aboutsummaryrefslogtreecommitdiffstats
path: root/examples/direct_bt_scanner00
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2020-07-28 02:00:55 +0200
committerSven Gothel <[email protected]>2020-07-28 02:00:55 +0200
commit1e77c24637204c0146e1e035d66b5e74d5f3d5ed (patch)
tree88279d4622cb2162016f658eecccad42cce0abc9 /examples/direct_bt_scanner00
parentf417fc491acd502fb5ed7ae2d3c6fc887bba8630 (diff)
Expose hciConnectionHandle: AdapterStatusListener connect/disconnect (C++/Java) and BluetoothDevice.java
To help tracking a device in user space and support more 'down to the metal' access, the HCI connection handle has been exposed to the Java DBTDevice and the AdapterStatusListener. For the latter, especially disconnectDevice(..) is of interest, since the disconnected handle is lost already when the callback gets invoked.
Diffstat (limited to 'examples/direct_bt_scanner00')
-rw-r--r--examples/direct_bt_scanner00/dbt_scanner00.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/examples/direct_bt_scanner00/dbt_scanner00.cpp b/examples/direct_bt_scanner00/dbt_scanner00.cpp
index 09ca4d9d..48939bdc 100644
--- a/examples/direct_bt_scanner00/dbt_scanner00.cpp
+++ b/examples/direct_bt_scanner00/dbt_scanner00.cpp
@@ -78,13 +78,14 @@ class MyAdapterStatusListener : public AdapterStatusListener {
fprintf(stderr, "****** UPDATED: %s of %s\n", getEIRDataMaskString(updateMask).c_str(), device->toString(true).c_str());
(void)timestamp;
}
- void deviceConnected(std::shared_ptr<DBTDevice> device, const uint64_t timestamp) override {
+ void deviceConnected(std::shared_ptr<DBTDevice> device, const uint16_t handle, const uint64_t timestamp) override {
fprintf(stderr, "****** CONNECTED: %s\n", device->toString(true).c_str());
(void)timestamp;
}
- void deviceDisconnected(std::shared_ptr<DBTDevice> device, const HCIStatusCode reason, const uint64_t timestamp) override {
- fprintf(stderr, "****** DISCONNECTED: Reason 0x%X (%s): %s\n",
- static_cast<uint8_t>(reason), getHCIStatusCodeString(reason).c_str(), device->toString(true).c_str());
+ void deviceDisconnected(std::shared_ptr<DBTDevice> device, const HCIStatusCode reason, const uint16_t handle, const uint64_t timestamp) override {
+ fprintf(stderr, "****** DISCONNECTED: Reason 0x%X (%s), old handle %s: %s\n",
+ static_cast<uint8_t>(reason), getHCIStatusCodeString(reason).c_str(),
+ uint16HexString(handle).c_str(), device->toString(true).c_str());
(void)timestamp;
}