diff options
author | Sven Gothel <[email protected]> | 2021-10-28 04:36:43 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2021-10-28 04:36:43 +0200 |
commit | 77c984eb8645d4ffb151efa6f1c296fd20f8dc83 (patch) | |
tree | 9279022094ff1be31851595562dc8981c0e4cf48 /examples | |
parent | e1672b58c407024e7c2b67ad8d6afbc0794f91d7 (diff) |
dbt_peripheral00: Peripheral in SC mode needs unpair(), i.e. erase all keys ..
Diffstat (limited to 'examples')
-rw-r--r-- | examples/dbt_peripheral00.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/dbt_peripheral00.cpp b/examples/dbt_peripheral00.cpp index fc990e59..cc92e669 100644 --- a/examples/dbt_peripheral00.cpp +++ b/examples/dbt_peripheral00.cpp @@ -493,14 +493,16 @@ static void processDisconnectedDevice(std::shared_ptr<BTDevice> device) { fprintf_td(stderr, "****** Disconnected Device: Start %s\n", device->toString().c_str()); stopAdvertising(&device->getAdapter(), "device-disconnected"); -#if 0 - // Unpair'ing is not natural, since a reconnect would try to use pre-paired keys + // Unpair'ing doesn't seem to be natural, since a reconnect would try to use pre-paired keys // and we only upload keys from disk when adapter gets initialized. + // + // However, w/o unpairing the peripheral in SC mode fails the DHKey Check. + // Hence we need to keep it for now and perhaps use a more fancy SMPKeyBin management + // to provide a more persistance pre-pairing mechanism. { const HCIStatusCode r = device->unpair(); fprintf_td(stderr, "****** Disconnect Device: Unpair-Post result: %s\n", to_string(r).c_str()); } -#endif BTDeviceRegistry::removeFromProcessingDevices(device->getAddressAndType()); std::this_thread::sleep_for(std::chrono::milliseconds(100)); // wait a little |