diff options
author | Sven Gothel <[email protected]> | 2022-05-16 06:38:59 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2022-05-16 06:38:59 +0200 |
commit | ffde85abc843f0c59e75ea47046274642fd088dd (patch) | |
tree | 90e75eb2fba63571ee6a680d3a29a0095aed3261 /src/direct_bt/BTGattHandler.cpp | |
parent | 35b5da1c71bfecae0203045daaa1247e61de0d40 (diff) |
noexcept: BTGattHandler::send*(): Fix BTGattHandler's discover*(): Return true == no_ioerror, initClientGatt() checks content.
Fix in commit 82ecfd8e19c88e3e4d0ddb04796874834292a05e contains bugs in its BTGattHandler discovery:
- discoverDescriptors() shall just return true == no_ioerror, its OK to have no descriptors
- discoverCharacteristics() shall just return true == no_ioerror, we may tolerate to have no characteristics
- discoverPrimaryServices() shall just return true == no_ioerror, we check services later on
- discoverCompletePrimaryServices() shall only return false if above signaled an ioerror, we check services later on
- initClientGatt() bails out on ioerror or failed services content - here we perform the services checks.
Fixed
Diffstat (limited to 'src/direct_bt/BTGattHandler.cpp')
-rw-r--r-- | src/direct_bt/BTGattHandler.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/direct_bt/BTGattHandler.cpp b/src/direct_bt/BTGattHandler.cpp index 34a8f776..0ed46416 100644 --- a/src/direct_bt/BTGattHandler.cpp +++ b/src/direct_bt/BTGattHandler.cpp @@ -970,8 +970,10 @@ bool BTGattHandler::discoverCompletePrimaryServices(std::shared_ptr<BTGattHandle if( !discoverCharacteristics(primSrv) ) { return false; } - if( !discoverDescriptors(primSrv) ) { - return false; + if( primSrv->characteristicList.size() > 0 ) { + if( !discoverDescriptors(primSrv) ) { + return false; + } } } return true; @@ -1041,8 +1043,7 @@ bool BTGattHandler::discoverPrimaryServices(std::shared_ptr<BTGattHandler> share } } PERF_TS_TD("GATT discoverPrimaryServices"); - - return result.size() > 0; + return true; } bool BTGattHandler::discoverCharacteristics(BTGattServiceRef & service) noexcept { @@ -1109,8 +1110,7 @@ bool BTGattHandler::discoverCharacteristics(BTGattServiceRef & service) noexcept } PERF_TS_TD("GATT discoverCharacteristics"); - - return service->characteristicList.size() > 0; + return true; } bool BTGattHandler::discoverDescriptors(BTGattServiceRef & service) noexcept { @@ -1201,8 +1201,7 @@ bool BTGattHandler::discoverDescriptors(BTGattServiceRef & service) noexcept { } } PERF_TS_TD("GATT discoverDescriptors"); - - return service->characteristicList.size() > 0; + return true; } bool BTGattHandler::readDescriptorValue(BTGattDesc & desc, int expectedLength) noexcept { |