diff options
author | Sven Gothel <[email protected]> | 2021-10-28 11:48:25 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2021-10-28 11:48:25 +0200 |
commit | be27d9df9be1cd47b576d5dbd9bbb9a26c10ca4f (patch) | |
tree | 1ea4a319b70f3b06bf5596955d07dabfdd9ea10a /examples/java | |
parent | 1b9201736468339d3e512abe61df831517d88d15 (diff) |
Issue BTDevice::unpair() directly when device is discovered, disconnected and connected as peripheral
This enforces a consistent and stable security workflow.
- when a BTRole::Slave BTDevice is discovered, see AdapterStatusListener::deviceFound().
- when a BTRole::Slave BTDevice is disconnected, see AdapterStatusListener::deviceDisconnected().
- when a BTRole::Master BTDevice gets connected, see AdapterStatusListener::deviceConnected().
+++
Especially when connected as peripheral without unpair in SC mode,
the peripheral fails the DHKey Check.
TODO: Provide a persistent pre-pairing mechanism via SMPKeyBin for peripheral mode.
+++
Note: Our existing example code to connect to a remote slave/peripheral,
already performed the unpair on deviceFound(..) and deviceDisconnected().
These calls have now being removed, as they are performed directly by Direct-BT.
The example code uploads pre-existing keys for pre-pairing when device is found,
if existing.
Diffstat (limited to 'examples/java')
-rw-r--r-- | examples/java/DBTScanner10.java | 10 |
1 files changed, 0 insertions, 10 deletions
diff --git a/examples/java/DBTScanner10.java b/examples/java/DBTScanner10.java index 67b92df5..f6f31b43 100644 --- a/examples/java/DBTScanner10.java +++ b/examples/java/DBTScanner10.java @@ -348,11 +348,6 @@ public class DBTScanner10 { } }); { - final HCIStatusCode r = device.unpair(); - BTUtils.println(System.err, "****** Connecting Device: Unpair-Pre result: "+r); - } - - { final HCIStatusCode r = device.getAdapter().stopDiscovery(); BTUtils.println(System.err, "****** Connecting Device: stopDiscovery result "+r); } @@ -567,11 +562,6 @@ public class DBTScanner10 { if( !KEEP_CONNECTED ) { - { - final HCIStatusCode unpair_res = device.unpair(); - BTUtils.println(System.err, "****** Processing Ready Device: Unpair-Post result: "+unpair_res); - } - device.remove(); if( 0 < RESET_ADAPTER_EACH_CONN && 0 == deviceReadyCount.get() % RESET_ADAPTER_EACH_CONN ) { |