Is it safe to block wait inside NimBLE event?

Just Me
Posts: 4
Joined: Mon Dec 30, 2024 9:19 pm

Is it safe to block wait inside NimBLE event?

Postby Just Me » Mon Dec 30, 2024 9:49 pm

Hi,

what is the design practice if I want to wait for an outside event when NimBLE is connected to a peer?

The idea is to perform BLE scan, connect to a peer, find the service characteristic I'm interested in and then wait until an (user input) interrupt occurs to write a value to that characteristic.

What can I do? Can I for example create a queue and wait for an item with xQueueReceive with portMAX_DELAY in the place like this:

https://github.com/espressif/esp-idf/bl ... ain.c#L424

That particular line of code starts performing operations on characteristics after service discovery finishes when the peer is connected.

I would like to know if the NimBLE controller and host will not get out of sync e.g. if the server disconnects whilst waiting there. Or in other words, if it's safe to block wait there. Or what would be the proper design practice to achieve my goal?

Thank you

Who is online

Users browsing this forum: Ivaledev and 70 guests