remove_all_bonded_devices() but client still bonded

marclee
Posts: 51
Joined: Fri Apr 09, 2021 1:09 pm

remove_all_bonded_devices() but client still bonded

Postby marclee » Fri Jan 28, 2022 10:05 pm

Device: ESP32-C3-DevKitC-02

Hello,

I'm using a mix of gatt_security_server / gatt_security_client and ble_spp_server / ble_spp_client.

If bonded clients get deleted in gatt_security_server, using the command remove_all_bonded_devices(), clients may still have the bonds stored in their bond list.

If such a client connects to gatt_security_server, the server still seems to be able to receive WRITE events "ESP_GATTS_WRITE_EVT" (see "Hello world!!!" in the log below), even they are not paired. After a while the server sends log messages "BT_BTM: BTM_GetSecurityFlags false".

Code: Select all

D (6263) main.c: ESP_GAP_BLE_REMOVE_BOND_DEV_COMPLETE_EVT status = 0
I (6273) main.c: ESP_GAP_BLE_REMOVE_BOND_DEV
I (6273) main.c: -----ESP_GAP_BLE_REMOVE_BOND_DEV----
I (6283) main.c: 60 15 a3 65 57 3a 
I (6283) main.c: ------------------------------------
V (6293) main.c: GAP_EVT, event 6
I (6293) main.c: advertising start success
V (14933) main.c: GATTS_EVT, event = 0x0E
I (14933) main.c: ESP_GATTS_CONNECT_EVT
V (14933) a2c_ble.c: Connected to: 0x61F11791F3BA
V (15823) main.c: GATTS_EVT, event = 0x04
V (15923) main.c: GATTS_EVT, event = 0x02
I (15933) main.c: ESP_GATTS_WRITE_EVT, write value:
I (15933) main.c: ESP_GATTS_WRITE_EVT: handle = 5
V (15973) main.c: GATTS_EVT, event = 0x02
I (15983) main.c: ESP_GATTS_WRITE_EVT, write value:
I (15983) main.c: ESP_GATTS_WRITE_EVT: handle = 5
V (16073) main.c: GATTS_EVT, event = 0x02
I (16083) main.c: ESP_GATTS_WRITE_EVT, write value:
I (16083) main.c: ESP_GATTS_WRITE_EVT: handle = 10
V (16573) main.c: GATTS_EVT, event = 0x02
I (16583) main.c: ESP_GATTS_WRITE_EVT, write value:
I (16583) main.c: ESP_GATTS_WRITE_EVT: handle = 2
I (16583) main.c: Hello world!!!

...

V (108583) main.c: GATTS_EVT, event = 0x02
I (108583) main.c: ESP_GATTS_WRITE_EVT, write value:
I (108583) main.c: ESP_GATTS_WRITE_EVT: handle = 2
I (108583) main.c: Hello world!!!
V (108913) main.c: GATTS_EVT, event = 0x05
E (109573) BT_BTM: BTM_GetSecurityFlags false

V (109583) main.c: GATTS_EVT, event = 0x02
I (109583) main.c: ESP_GATTS_WRITE_EVT, write value:
I (109583) main.c: ESP_GATTS_WRITE_EVT: handle = 2
I (109583) main.c: Hello world!!!
V (109913) main.c: GATTS_EVT, event = 0x05
E (110573) BT_BTM: BTM_GetSecurityFlags false
If client reconnects a second time, a new pairing process is started and client is bonded correctly.

How can the server be forced to rebond correctly at first time?

Who is online

Users browsing this forum: Google [Bot] and 134 guests