Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consider implementing... remove all bonded devices #5

Closed
mitchjs opened this issue May 19, 2020 · 3 comments
Closed

consider implementing... remove all bonded devices #5

mitchjs opened this issue May 19, 2020 · 3 comments

Comments

@mitchjs
Copy link

mitchjs commented May 19, 2020

not 100% sure where it should go...
i put it in BLEDevice class (old lib of course)

static void RemoveAllBondedDevices();

/* STATIC */ void BLEDevice::RemoveAllBondedDevices(void)
{
    int dev_num = esp_ble_get_bond_device_num();

	ESP_LOGI(LOG_TAG, "esp_ble_get_bond_device_num()=%d", dev_num);

    esp_ble_bond_dev_t *dev_list = (esp_ble_bond_dev_t *)malloc(sizeof(esp_ble_bond_dev_t) * dev_num);
    esp_ble_get_bond_device_list(&dev_num, dev_list);
    for (int i = 0; i < dev_num; i++) {
        esp_ble_remove_bond_device(dev_list[i].bd_addr);
    }

    free(dev_list);
}
@h2zero
Copy link
Owner

h2zero commented May 19, 2020

Hi @mitchjs, I haven't yet reached the point where I'll be implementing extra support for bond maintenance etc. I hope to get there soon though. If you need this functionality right away you can use ble_store_clear() to erase all bonds.

@mitchjs
Copy link
Author

mitchjs commented May 19, 2020

ah that nice and simple (thank you nimble)

@finger563
Copy link
Contributor

finger563 commented May 3, 2024

@h2zero i've noticed (on esp-idf v5.2.1) that the ble_store_clear() doesn't work as expected - I still get too many bonded device errors even though every time i enter pairing mode I call NimBLEDevice::deleteAllBonds().

With logs enabled:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants