ESP-IDF BLE No Disconnect Event
Posted: Wed Feb 07, 2018 10:09 pm
Hello all,
Writing some BLE code today, mostly following from the excellent example here: https://github.com/espressif/esp-idf/tr ... att_server. However I've hit a bit of a snag while trying to deal with disconnect events.
Simply, I don't seem to get them.
Right now I can connect to my ESP32, Read, Write, etc... But I can't ever reconnect to it as it never begins advertising again following a disconnect. Tracing the issue, I find that my "ESP_GATTS_DISCONNECT_EVT" case never gets called. Odd... So I dig some more, I find out that oftentimes the ESP_GATTS_CLOSE_EVT event is a better candidate for this, so I make sure I work with that as well... Still no luck.
Finally, I put a debug statement in my event handler before my switch statement going over the event, and I start logging out every event that comes my way. It turns out that following a disconnect... Simply nothing happens.
I've tried connecting with my computer as well as my phone using different test apps, and it all seems to be the same. No disconnect or close events get sent my way.
Anybody have any ideas as to where to start diagnosing this issue? I can provide my [very messy] code if needed.
Writing some BLE code today, mostly following from the excellent example here: https://github.com/espressif/esp-idf/tr ... att_server. However I've hit a bit of a snag while trying to deal with disconnect events.
Simply, I don't seem to get them.
Right now I can connect to my ESP32, Read, Write, etc... But I can't ever reconnect to it as it never begins advertising again following a disconnect. Tracing the issue, I find that my "ESP_GATTS_DISCONNECT_EVT" case never gets called. Odd... So I dig some more, I find out that oftentimes the ESP_GATTS_CLOSE_EVT event is a better candidate for this, so I make sure I work with that as well... Still no luck.
Finally, I put a debug statement in my event handler before my switch statement going over the event, and I start logging out every event that comes my way. It turns out that following a disconnect... Simply nothing happens.
I've tried connecting with my computer as well as my phone using different test apps, and it all seems to be the same. No disconnect or close events get sent my way.
Anybody have any ideas as to where to start diagnosing this issue? I can provide my [very messy] code if needed.