Page 1 of 1

NimBLE - where is code that manages persistent bonding

Posted: Mon Jun 29, 2020 12:55 am
by bfriedkin
Hello -

This is a follow-up on this topic that covers persistent storage of the keys required to maintain device bonds across ESP32 reboots:

viewtopic.php?t=13049

Simple question: Where is the code that reads and writes the persistent data? Looking at the ble_hs_cfg store callbacks and reading through the ESP-IDF NimBLE port, I wasn't able to find the code. Presumably there are functions that read/write NVS to store the keys and associated data. The sample apps only set the store_status_cb to ble_store_util_status_rr, which I believe is called when there is insufficient storage.

Thanks,
Brian

Re: NimBLE - where is code that manages persistent bonding

Posted: Mon Jun 29, 2020 2:48 pm
by ESP_ulipe
Hi Brian, you can find this code section in: components/bt/host/nimble/nimble/nimble/host/store.

In this directory, there are different implementations of storing configuration, including the NVS way that the ESP32 implements, you can find specifically this implementation in: store/config/src/ble_store_nvs.c, the configuration of the read and write memory callbacks are implemented locally in this file.

Please let me know if this information was useful to you :D

Felipe

Re: NimBLE - where is code that manages persistent bonding

Posted: Mon Jun 29, 2020 10:48 pm
by bfriedkin
Felipe -

Thank you for the helpful answer. That is what I was looking for.

Regards,
Brian

Re: NimBLE - where is code that manages persistent bonding

Posted: Thu Jul 02, 2020 6:47 pm
by ESP_ulipe
Glad that I could help.

Cheers.