We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3c4ec51 commit 045344eCopy full SHA for 045344e
1 file changed
src/NimBLEDevice.cpp
@@ -632,10 +632,13 @@ int NimBLEDevice::getNumBonds() {
632
* @returns True on success.
633
*/
634
bool NimBLEDevice::deleteAllBonds() {
635
- int rc = ble_store_clear();
636
- if (rc != 0) {
637
- NIMBLE_LOGE(LOG_TAG, "Failed to delete all bonds; rc=%d", rc);
638
- return false;
+ int numBonds = NimBLEDevice::getNumBonds();
+ for (int i = numBonds - 1; i >= 0; i--) {
+ auto addr = NimBLEDevice::getBondedAddress(i);
+ if (!NimBLEDevice::deleteBond(addr)) {
639
+ NIMBLE_LOGE(LOG_TAG, "Failed to delete bond for address: %s", addr.toString().c_str());
640
+ return false;
641
+ }
642
}
643
return true;
644
0 commit comments