Hello, I have a custom service implemented that provides characteristics to view and update settings on our device. The service will optionally be enabled when the device comes out of deep sleep. I would like to shut down the bluetooth stack and deallocate any resources being used after a successful configuration is received, but I have had trouble getting the esp_bluedroid_disable() function to work.
I am currently doing the following things after a successful configuration has been received:
- Call esp_ble_gatts_stop_service() with the service handle
- Respond to ESP_GATTS_STOP_EVT, calling esp_ble_gatts_delete_service() with the service handle
- Respond to ESP_GATTS_DELETE_EVT, calling esp_ble_gatts_app_unregister() with the gatts interface
- Respond to ESP_GATTS_UNREG_EVT, calling esp_bluedroid_disable()
esp_bluedroid_disable() never returns or errors. I set the trace on the gatt library to 6 as suggested in a few other posts but didn't get any additional debugging output. I haven't seen in any examples the process of disabling bluetooth, so I am not sure if I am missing a step. I did find that calling esp_bluedroid_disable() immediately after esp_bluedroid_enable() did succeed. I took a look at the SDK code but it doesn't seem like an unimplemented function or such. Any help is appreciated!