Hi,
I have quite a complex application already running on a custom board based on ESP32-WROOM-32D. I am using ESP-IDF 4.0 and managing Wi-Fi, Azure, etc... but now I need to add also BLE (Bluedroid) so my devices can work as clients connecting to one or several servers and consuming notifications from custom charactetistics.
As I said, the initial Wi-Fi application works just fine and the specific code I developed for BLE in an isolated project also returns good results. I have now integrated the BLE code with my existing project and one of the first issues I am experiencing is that when I start a BLE scan, the whole application gets blocked until the scan is finished. I do the BLE initialization from the main task and then I start the scan from a new task but the app still gets blocked. Is there any way to make somehow this scan process asyncrhonous? I mean, I have set the corresponding callbakcs so once I start the scan I only need the scan results notification on that callback. I saw something similar for Arduino coming from Neil Kolban but this feature does not seem to be consolidated into ESP-IDF, right?
Can anybody shed some light into this issue? Thanks!
Asynchronous/non-blocking BLE scan
Re: Asynchronous/non-blocking BLE scan
BLE in esp-idf is events driven so it should not block your code. You can also read BLEScan class to see how it is solved in there.
Re: Asynchronous/non-blocking BLE scan
Thank you for your reply. Yes, that is exactly what I was expecting, an event-driven behaviour but in my case the application gets blocked as long as the scan is in progress (30 seconds). I will have a look at the BLEScan class.
Re: Asynchronous/non-blocking BLE scan
After further inspection I confirmed that the application was not getting blocked. It was only the primary UART used for serial communication with another device that, for some reason, was not sending new messages during the scan process.
Who is online
Users browsing this forum: No registered users and 143 guests