What else can be done during a BLE Scan callback
Posted: Fri Oct 25, 2019 2:05 am
I am writing an app that needs to scan multiple BLE devices that will be advertising intermittently (they are battery driven and so are inactive much of the time, waking briefly to advertise and see if there is a quick response before going back to a deep sleep).
This means that the ESP-IDF based code needs to respond as fast as possible when it picks up an advertising device.
I set up a scan and I can detect the advertising device via the callback. I could then remember the device's ID, wait for the scan to complete and then try to access the device, but the device will probably be back to sleep by the time.
What I would *like* to do in the scan callback code is to connect to the device immediately, read the data and then break the connection before returning from the scan callback.
My question: can I do this? Are there limitations on what other BLE API functions can be called inside a callback function? (I've looked but I can't see this documented anywhere.)
Susan
This means that the ESP-IDF based code needs to respond as fast as possible when it picks up an advertising device.
I set up a scan and I can detect the advertising device via the callback. I could then remember the device's ID, wait for the scan to complete and then try to access the device, but the device will probably be back to sleep by the time.
What I would *like* to do in the scan callback code is to connect to the device immediately, read the data and then break the connection before returning from the scan callback.
My question: can I do this? Are there limitations on what other BLE API functions can be called inside a callback function? (I've looked but I can't see this documented anywhere.)
Susan