aboutsummaryrefslogtreecommitdiffstats
path: root/api/direct_bt/DBTAdapter.hpp
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-05-24 19:57:07 +0200
committerSven Gothel <[email protected]>2020-05-24 19:57:07 +0200
commit461c54a3212f003cbb5f9a0afaeef5fb80a9f57e (patch)
tree97e7da5d77bf57dd41fd295d98fdce8aa379a015 /api/direct_bt/DBTAdapter.hpp
parenteb67f2d4e0100193822df670e17ed659b1debfd4 (diff)
AdapterStatusListener (C++/Java): Add discoveringChanged(..), converge deviceConnected/deviceDisconnected
Add discoveringChanged(..), as it is of high interest to the user to adjust connect/disconnect and GATT operations. Hence add it to this central adapter listener, also being used to synthesize the old fashion TinyB 'discovering' callback. We also expose the 'keepAlive' flag in this callback to the user. Converge deviceConnected(..)/deviceDisconnected(..) -> deviceConnectionChanged(..) to be a bit more efficient. +++ DBTAdapter: keepAlive in startDiscovery defaults to false, aligned w/ TinyB. A new startDiscovery(..) method has been added to the Java API, also adding keepAlive. +++ Java TODO: Add the whitelist add/remove functionality
Diffstat (limited to 'api/direct_bt/DBTAdapter.hpp')
-rw-r--r--api/direct_bt/DBTAdapter.hpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/api/direct_bt/DBTAdapter.hpp b/api/direct_bt/DBTAdapter.hpp
index 7cff8f62..67f9a174 100644
--- a/api/direct_bt/DBTAdapter.hpp
+++ b/api/direct_bt/DBTAdapter.hpp
@@ -78,13 +78,13 @@ namespace direct_bt {
virtual void adapterSettingsChanged(DBTAdapter const &a, const AdapterSetting oldmask, const AdapterSetting newmask,
const AdapterSetting changedmask, const uint64_t timestamp) = 0;
+ virtual void discoveringChanged(DBTAdapter const &a, const bool enabled, const bool keepAlive, const uint64_t timestamp) = 0;
+
virtual void deviceFound(std::shared_ptr<DBTDevice> device, const uint64_t timestamp) = 0;
virtual void deviceUpdated(std::shared_ptr<DBTDevice> device, const uint64_t timestamp, const EIRDataType updateMask) = 0;
- virtual void deviceConnected(std::shared_ptr<DBTDevice> device, const uint64_t timestamp) = 0;
-
- virtual void deviceDisconnected(std::shared_ptr<DBTDevice> device, const uint64_t timestamp) = 0;
+ virtual void deviceConnectionChanged(std::shared_ptr<DBTDevice> device, const bool connected, const uint64_t timestamp) = 0;
virtual ~AdapterStatusListener() {}
@@ -325,6 +325,11 @@ namespace direct_bt {
* Returns true if successful, otherwise false;
* </p>
* <p>
+ * if {@code keepAlive} is {@code true}, discovery state will be re-enabled
+ * in case the underlying Bluetooth implementation (BlueZ, ..) disabled it.
+ * Default is {@code false}.
+ * </p>
+ * <p>
* Default parameter values are chosen for using public address resolution
* and usual discovery intervals etc.
* </p>
@@ -335,7 +340,7 @@ namespace direct_bt {
* Also clears previous discovered devices via removeDiscoveredDevices().
* </p>
*/
- bool startDiscovery(bool keepAlive=true, HCIAddressType own_mac_type=HCIAddressType::HCIADDR_LE_PUBLIC,
+ bool startDiscovery(bool keepAlive=false, HCIAddressType own_mac_type=HCIAddressType::HCIADDR_LE_PUBLIC,
uint16_t interval=0x0004, uint16_t window=0x0004);
/**