diff options
author | Sven Gothel <[email protected]> | 2020-09-24 16:57:08 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2020-09-24 16:57:08 +0200 |
commit | 619fd2c85d03fb8ab3bbf6c84ac3fc935ab4c9f3 (patch) | |
tree | 25f7570c19a38073558dd3533b632f7061727adf /examples | |
parent | a173e5203ed7dcc183a84c7af888afec3656c267 (diff) |
dbt_scanner10/ScannerTinyB10: Fix '!KEEP_CONNECT' case, i.e. remove device and start discovery in process* function to disconnect right away.
Diffstat (limited to 'examples')
-rw-r--r-- | examples/direct_bt_scanner10/dbt_scanner10.cpp | 9 | ||||
-rw-r--r-- | examples/java/ScannerTinyB10.java | 11 |
2 files changed, 20 insertions, 0 deletions
diff --git a/examples/direct_bt_scanner10/dbt_scanner10.cpp b/examples/direct_bt_scanner10/dbt_scanner10.cpp index 370e712c..278cbdf0 100644 --- a/examples/direct_bt_scanner10/dbt_scanner10.cpp +++ b/examples/direct_bt_scanner10/dbt_scanner10.cpp @@ -435,6 +435,15 @@ exit: if( success ) { addToDevicesProcessed(device->getAddress()); } + + if( !KEEP_CONNECTED ) { + removeFromDevicesProcessing(device->getAddress()); + + device->remove(); + if( !USE_WHITELIST && 0 == devicesInProcessing.size() ) { + device->getAdapter().startDiscovery( true ); + } + } } static void removeDevice(std::shared_ptr<DBTDevice> device) { diff --git a/examples/java/ScannerTinyB10.java b/examples/java/ScannerTinyB10.java index 82d41a89..4b6591cb 100644 --- a/examples/java/ScannerTinyB10.java +++ b/examples/java/ScannerTinyB10.java @@ -472,6 +472,17 @@ public class ScannerTinyB10 { if( success ) { devicesProcessed.add(device.getAddress()); } + + if( !KEEP_CONNECTED ) { + devicesInProcessing.remove(device.getAddress()); + + device.remove(); + + if( !USE_WHITELIST && 0 == devicesInProcessing.size() ) { + final boolean r = device.getAdapter().startDiscovery( true ); + println("****** Processing Device: startDiscovery result "+r); + } + } } private void removeDevice(final BluetoothDevice device) { |