diff options
author | Sven Gothel <[email protected]> | 2022-05-09 01:47:34 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2022-05-09 01:47:34 +0200 |
commit | 9c5f25ccd1637728d6e79592279e4b38ecd32f59 (patch) | |
tree | 265b733ff97873a822619f3bff904303072f3ff9 /api/direct_bt/BTDevice.hpp | |
parent | 6c1dbe6d7474283a343eca93c79549cda705bca4 (diff) |
JNI Lifecycle Fix: Have AdapterStatusListener derive from JavaUplink/DBTNativeDownlink, resolving BTAdapter::removeAllStatusListener() and use shared_ptr_ref<T>
- AdapterStatusListener's native instance is now created at java object construction, etc .. same pattern like BTDevice ..
- Java/Native object relation is inherently thread safe due to using use shared_ptr_ref<T>
Diffstat (limited to 'api/direct_bt/BTDevice.hpp')
-rw-r--r-- | api/direct_bt/BTDevice.hpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/api/direct_bt/BTDevice.hpp b/api/direct_bt/BTDevice.hpp index 270cb5ae..d9e1a2cf 100644 --- a/api/direct_bt/BTDevice.hpp +++ b/api/direct_bt/BTDevice.hpp @@ -53,6 +53,7 @@ namespace direct_bt { class BTAdapter; // forward class AdapterStatusListener; // forward + typedef std::shared_ptr<AdapterStatusListener> AdapterStatusListenerRef; // forward /** * BTDevice represents one remote Bluetooth device. @@ -383,7 +384,7 @@ namespace direct_bt { * @see BTAdapter::removeAllStatusListener() * @see removeStatusListener() */ - bool addStatusListener(std::shared_ptr<AdapterStatusListener> l); + bool addStatusListener(const AdapterStatusListenerRef& l); /** * Remove the given listener from the list. @@ -397,7 +398,7 @@ namespace direct_bt { * @see BTAdapter::removeAllStatusListener() * @see addStatusListener() */ - bool removeStatusListener(std::shared_ptr<AdapterStatusListener> l); + bool removeStatusListener(const AdapterStatusListenerRef& l); /** * Retrieves the current connection info for this device and returns the ConnectionInfo reference if successful, |