Workflow suggestions for clearing bonded devices and advertising

mps360
Posts: 7
Joined: Mon Oct 16, 2023 8:32 pm

Workflow suggestions for clearing bonded devices and advertising

Postby mps360 » Mon Oct 16, 2023 9:43 pm

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.

MicroController
Posts: 1605
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: Workflow suggestions for clearing bonded devices and advertising

Postby MicroController » Tue Oct 17, 2023 1:28 pm

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;
?

mps360
Posts: 7
Joined: Mon Oct 16, 2023 8:32 pm

Re: Workflow suggestions for clearing bonded devices and advertising

Postby mps360 » Tue Oct 17, 2023 2:33 pm

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.

Who is online

Users browsing this forum: No registered users and 120 guests