Page 1 of 1

Workflow suggestions for clearing bonded devices and advertising

Posted: Mon Oct 16, 2023 9:43 pm
by mps360
Hi, I'm using esp-idf and bluedroid.

I would like to implement a feature that allows the user to press and hold a button, which triggers the following sequence
- Disconnect device from host
- Clear all bonding information
- Start advertising

The purpose of this is ease of portability between host machines, as it will be used on multiple devices frequently, rather than tracking credentials, a clean slate would be better.

The issue I'm having is that
- the host (macbook in this case) tries to reconnect automatically
- then the device is missing the key
- the connection attempt fails
- the device stops advertising until I manually start via button press.

When I increased the advertisement interval, the host connection attempt times out, and I see the advertisement, but then the problem becomes latency.

Is there a better workflow to accomplish this?
do I need to add another SW timer to kick off the start of advertising?

Any advice is welcome, thank you.

Re: Workflow suggestions for clearing bonded devices and advertising

Posted: Tue Oct 17, 2023 1:28 pm
by MicroController
Do you have code in place to restart advertising like https://github.com/espressif/esp-idf/bl ... C1-L489C15

Code: Select all

    case ESP_GATTS_DISCONNECT_EVT:
        ESP_LOGI(GATTS_TAG, "ESP_GATTS_DISCONNECT_EVT, disconnect reason 0x%x", param->disconnect.reason);
        esp_ble_gap_start_advertising(&adv_params);
        break;
?

Re: Workflow suggestions for clearing bonded devices and advertising

Posted: Tue Oct 17, 2023 2:33 pm
by mps360
I did, but I took it out when I wanted the button to trigger advertising.
That sounds like it'll sort me out. Thank you.