diff options
author | Sven Gothel <[email protected]> | 2020-09-19 19:30:18 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-09-19 19:30:18 +0200 |
commit | 4b19b488bdbbeb3302e04d80ba1d4002fc12b54f (patch) | |
tree | b123b1d6ca422502f49383450bd0121a0260fa0b /examples | |
parent | 19a54ffc89bbac2ca72abeece6689ee27d25d1a2 (diff) |
Fix GATT* Object relationship incl weak back-reference (GATTHandler was skipped >= GATTService); GATTHandler owned by DBTDevice, always.
GATTService and childs might need access to their GATTHandler, not just DBTDevice.
This relationship always existed, but was skipped.
Also emphasize that GATTHandler is always owned by DBTDevice, hence has a weak back-reference to the same.
Fixed in ATTPDUTypes C++ Direct-BT API doc overview.
Further impact:
- GATTService has a weak back-reference to GATTHandler instead of DBTDevice,
DBTDevice reference will then be picked up from GATTHandler, the usual.
- GATTHandler::discoverPrimaryServices(..), discoverCompletePrimaryServices(..)
needs to receive GATTHandler's shared_ptr from owner and caller to build the back-reference in GATTService
Diffstat (limited to 'examples')
-rw-r--r-- | examples/direct_bt_scanner01/dbt_scanner01.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/examples/direct_bt_scanner01/dbt_scanner01.cpp b/examples/direct_bt_scanner01/dbt_scanner01.cpp index 3ea5541c..b3ffb78f 100644 --- a/examples/direct_bt_scanner01/dbt_scanner01.cpp +++ b/examples/direct_bt_scanner01/dbt_scanner01.cpp @@ -261,7 +261,7 @@ int main(int argc, char *argv[]) gatt->addCharacteristicListener( std::shared_ptr<GATTCharacteristicListener>( new MyGATTEventListener() ) ); - std::vector<GATTServiceRef> & primServices = gatt->discoverCompletePrimaryServices(); + std::vector<GATTServiceRef> & primServices = gatt->discoverCompletePrimaryServices(gatt); const uint64_t t5 = getCurrentMilliseconds(); { const uint64_t td45 = t5 - t4; // connect -> gatt complete |