aboutsummaryrefslogtreecommitdiffstats
path: root/api/direct_bt/BTDevice.hpp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2022-11-27 14:04:40 +0100
committerSven Gothel <[email protected]>2022-11-27 14:04:40 +0100
commit5998a10ae6d20704569a4c4f4de35dd78d4ca163 (patch)
tree33626c0bc0f2468d5fbb960486d53f0467352463 /api/direct_bt/BTDevice.hpp
parentcc49c8bf94b5b9b557cb2caf7b379df0660604af (diff)
clang-tidy fixes part-1
Details - Use 'size_type' instead of 'int', propagate same 'size_type' into 'darray' etc. - Use 'std::make_shared', 'std::make_unique' - Use range-based for loops - Remove redundant 'virtual', use 'override' in derived classes - Use 'nullptr' - Use default impl for dtor, ctor (incomplete) - Use copy and std::move (incomplete) - Explcitly catch std::bad_alloc in 'new' in 'noexcept' -> 'abort' - 'abort' was issued implicitly in noexcept methods - L2CAPServer, L2CAPClient, NopGattServerHandler, DBGattServerHandler, FwdGattServerHandler - Use local close_impl(), usable in virtual destructor - L2CAPClient::read, HCIComm::read - preset 'poll' result 'n', avoid garbage comparison - BTAdapter::enableListening - loop through addMgmtEventCallback() result - JNI code - explicit size_type is cast to jsize or jint w/o check - unchanged semantics
Diffstat (limited to 'api/direct_bt/BTDevice.hpp')
-rw-r--r--api/direct_bt/BTDevice.hpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/api/direct_bt/BTDevice.hpp b/api/direct_bt/BTDevice.hpp
index eeb421fc..d4c7ba7e 100644
--- a/api/direct_bt/BTDevice.hpp
+++ b/api/direct_bt/BTDevice.hpp
@@ -249,6 +249,9 @@ namespace direct_bt {
void sendMgmtEvDeviceDisconnected(std::unique_ptr<MgmtEvent> evt) noexcept;
public:
+ typedef jau::nsize_t size_type;
+ typedef jau::snsize_t ssize_type;
+
const uint64_t ts_creation;
/** Device's unique mac address and type tuple. */
const BDAddressAndType addressAndType; // FIXME: Mutable for resolvable -> identity during pairing?
@@ -1038,6 +1041,8 @@ namespace direct_bt {
*/
std::shared_ptr<BTGattHandler> getGattHandler() noexcept;
+ typedef jau::darray<BTGattServiceRef, size_type> GattServiceList_t;
+
/**
* Returns a complete list of shared BTGattService available on this device,
* initially retrieved via GATT discovery.
@@ -1059,7 +1064,7 @@ namespace direct_bt {
* A GATT connection will be created via connectGATT() if not established yet.
* @see getGattGenericAccess()
*/
- jau::darray<BTGattServiceRef> getGattServices() noexcept;
+ GattServiceList_t getGattServices() noexcept;
/**
* Returns the shared GenericAccess instance, retrieved by getGattServices() or nullptr if not available.
@@ -1199,15 +1204,15 @@ namespace direct_bt {
* @param associatedCharacteristic the match criteria to remove any BTGattCharListener from the list
* @return number of removed listener.
*/
- int removeAllAssociatedCharListener(const BTGattCharRef& associatedCharacteristic) noexcept;
+ size_type removeAllAssociatedCharListener(const BTGattCharRef& associatedCharacteristic) noexcept;
- int removeAllAssociatedCharListener(const BTGattChar * associatedCharacteristic) noexcept;
+ size_type removeAllAssociatedCharListener(const BTGattChar * associatedCharacteristic) noexcept;
/**
* Remove all {@link BTGattCharListener} from the list.
* @return number of removed listener.
*/
- int removeAllCharListener() noexcept;
+ size_type removeAllCharListener() noexcept;
};
inline bool operator==(const BTDevice& lhs, const BTDevice& rhs) noexcept