Fix crash when clearing NRF52 BLE bonds (#6609)

* Fix crash before clearing BLE bonds

* Prevent clients re-pairing BLE during factory reset
Clients seem able to re-pair BLE after clearing bonds during factory reset, even after advertising disabled. This seems to primarily occur on Android devices, which seem to more actively maintain the BLE connection.
As a workaround, `NRF52Bluetooth::shutdown` swaps the BLE pairing callback to one which actively rejects new connections.

---------

Co-authored-by: Ben Meadors <benmmeadors@gmail.com>
This commit is contained in:
todd-herbert
2025-04-18 10:11:42 +12:00
committed by GitHub
parent e2f6600cb9
commit 74b3dc34e4
3 changed files with 32 additions and 12 deletions

View File

@@ -19,4 +19,7 @@ class NRF52Bluetooth : BluetoothApi
static void onConnectionSecured(uint16_t conn_handle);
static bool onPairingPasskey(uint16_t conn_handle, uint8_t const passkey[6], bool match_request);
static void onPairingCompleted(uint16_t conn_handle, uint8_t auth_status);
static bool onUnwantedPairing(uint16_t conn_handle, uint8_t const passkey[6], bool match_request);
static void disconnect();
};