diff options
author | Sven Gothel <[email protected]> | 2022-05-06 10:54:01 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2022-05-06 10:54:01 +0200 |
commit | 7b1b83bfa1041c4c93cb6eac0c4994c2bd44f6b8 (patch) | |
tree | 33c627e75ca4d65c17836c8d49a5684f0a3489ed /trial/direct_bt | |
parent | b3d62d2336744481bc83377d780d9ac79f534207 (diff) |
API Change: AdapterStatusListener::deviceConnected(): `const uint16_t handle` -> `const bool discovered`
Motivation:
- the connection handle is known to the device already and can be retrieved, redundant information
- the flag discovered gives information whether BTAdapter has sent out a deviceFound message, i.e. the user actually issued the connection (default).
We like to detect issues where devices are automatically connected by the underlying host implementation,
i.e. BlueZ/kernel's whitelist mechanism or otherwise - an unsusal and undesired situation.
In such case, no `DEVICE FOUND` advertising is promoted and the underlying BlueZ/kernel
issues the connection itself.
Here `discovered` will be `false`.
Diffstat (limited to 'trial/direct_bt')
-rw-r--r-- | trial/direct_bt/dbt_client00.hpp | 6 | ||||
-rw-r--r-- | trial/direct_bt/dbt_client01.hpp | 6 | ||||
-rw-r--r-- | trial/direct_bt/dbt_server00.hpp | 6 | ||||
-rw-r--r-- | trial/direct_bt/dbt_server01.hpp | 6 |
4 files changed, 12 insertions, 12 deletions
diff --git a/trial/direct_bt/dbt_client00.hpp b/trial/direct_bt/dbt_client00.hpp index 047a8f3b..e0fe8145 100644 --- a/trial/direct_bt/dbt_client00.hpp +++ b/trial/direct_bt/dbt_client00.hpp @@ -121,9 +121,9 @@ class DBTClient00 : public DBTClientTest { (void)timestamp; } - void deviceConnected(BTDeviceRef device, const uint16_t handle, const uint64_t timestamp) override { - fprintf_td(stderr, "****** Client CONNECTED: %s\n", device->toString(true).c_str()); - (void)handle; + void deviceConnected(BTDeviceRef device, const bool discovered, const uint64_t timestamp) override { + fprintf_td(stderr, "****** Client CONNECTED (discovered %d): %s\n", discovered, device->toString(true).c_str()); + (void)discovered; (void)timestamp; } diff --git a/trial/direct_bt/dbt_client01.hpp b/trial/direct_bt/dbt_client01.hpp index ce05e392..8d8c78db 100644 --- a/trial/direct_bt/dbt_client01.hpp +++ b/trial/direct_bt/dbt_client01.hpp @@ -131,9 +131,9 @@ class DBTClient01 : public DBTClientTest { (void)timestamp; } - void deviceConnected(BTDeviceRef device, const uint16_t handle, const uint64_t timestamp) override { - fprintf_td(stderr, "****** Client CONNECTED: %s\n", device->toString(true).c_str()); - (void)handle; + void deviceConnected(BTDeviceRef device, const bool discovered, const uint64_t timestamp) override { + fprintf_td(stderr, "****** Client CONNECTED (discovered %d): %s\n", discovered, device->toString(true).c_str()); + (void)discovered; (void)timestamp; } diff --git a/trial/direct_bt/dbt_server00.hpp b/trial/direct_bt/dbt_server00.hpp index 9565e0b1..67ce53f2 100644 --- a/trial/direct_bt/dbt_server00.hpp +++ b/trial/direct_bt/dbt_server00.hpp @@ -210,14 +210,14 @@ class DBTServer00 : public DBTServerTest { (void)timestamp; } - void deviceConnected(BTDeviceRef device, const uint16_t handle, const uint64_t timestamp) override { - fprintf_td(stderr, "****** Server CONNECTED: %s\n", device->toString(true).c_str()); + void deviceConnected(BTDeviceRef device, const bool discovered, const uint64_t timestamp) override { + fprintf_td(stderr, "****** Server CONNECTED (discovered %d): %s\n", discovered, device->toString(true).c_str()); const bool available = nullptr == parent.getDevice(); if( available ) { parent.setDevice(device); BTDeviceRegistry::addToProcessingDevices(device->getAddressAndType(), device->getName()); } - (void)handle; + (void)discovered; (void)timestamp; } diff --git a/trial/direct_bt/dbt_server01.hpp b/trial/direct_bt/dbt_server01.hpp index 911aaf4d..9bcbe984 100644 --- a/trial/direct_bt/dbt_server01.hpp +++ b/trial/direct_bt/dbt_server01.hpp @@ -210,14 +210,14 @@ class DBTServer01 : public DBTServerTest { (void)timestamp; } - void deviceConnected(BTDeviceRef device, const uint16_t handle, const uint64_t timestamp) override { - fprintf_td(stderr, "****** Server CONNECTED: %s\n", device->toString(true).c_str()); + void deviceConnected(BTDeviceRef device, const bool discovered, const uint64_t timestamp) override { + fprintf_td(stderr, "****** Server CONNECTED (discovered %d): %s\n", discovered, device->toString(true).c_str()); const bool available = nullptr == parent.getDevice(); if( available ) { parent.setDevice(device); BTDeviceRegistry::addToProcessingDevices(device->getAddressAndType(), device->getName()); } - (void)handle; + (void)discovered; (void)timestamp; } |