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 /src/direct_bt/GATTDescriptor.cpp | |
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 'src/direct_bt/GATTDescriptor.cpp')
-rw-r--r-- | src/direct_bt/GATTDescriptor.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/direct_bt/GATTDescriptor.cpp b/src/direct_bt/GATTDescriptor.cpp index 8b8e2df6..59bcc0e3 100644 --- a/src/direct_bt/GATTDescriptor.cpp +++ b/src/direct_bt/GATTDescriptor.cpp @@ -51,6 +51,10 @@ std::shared_ptr<GATTCharacteristic> GATTDescriptor::getCharacteristicChecked() c return ref; } +std::shared_ptr<GATTHandler> GATTDescriptor::getGATTHandlerChecked() const { + return getCharacteristicChecked()->getGATTHandlerChecked(); +} + std::shared_ptr<DBTDevice> GATTDescriptor::getDeviceChecked() const { return getCharacteristicChecked()->getDeviceChecked(); } |