BLE notifications

ndjurov
Posts: 65
Joined: Wed Mar 25, 2020 11:34 pm

BLE notifications

Postby ndjurov » Thu Sep 16, 2021 11:34 pm

If a service has two or more characteristics that server uses to indicate/notify a client and this is done from different tasks, is it necessary to create some kind of transmission control - mutex, semaphore etc., or the Bluedroid stack will take care of this and serialize the transmission? In other words, are functions like esp_ble_gattc_write_char_descr() or esp_ble_gatts_send_indicate() thread safe?
Thanks.

chegewara
Posts: 2371
Joined: Wed Jun 14, 2017 9:00 pm

Re: BLE notifications

Postby chegewara » Sun Sep 26, 2021 6:27 pm

You dont have to worry as long as 2 tasks wont try to notify from the same characteristic, i am 95% sure about that.

ndjurov
Posts: 65
Joined: Wed Mar 25, 2020 11:34 pm

Re: BLE notifications

Postby ndjurov » Mon Sep 27, 2021 11:22 pm

Thanks you very much.
There is only one task doing the notification - sending just a keep-alive signal to the client every 2-3 seconds. That's all.

chegewara
Posts: 2371
Joined: Wed Jun 14, 2017 9:00 pm

Re: BLE notifications

Postby chegewara » Mon Sep 27, 2021 11:27 pm

Maybe thats stupid question, but why are you sending keep alive notifications? This is all done by BLE low level driver and you even can control the timeout after which client will be disconnected.

ndjurov
Posts: 65
Joined: Wed Mar 25, 2020 11:34 pm

Re: BLE notifications

Postby ndjurov » Wed Oct 20, 2021 4:58 pm

Thank you very much, and my apologies for not seeing your post earlier.

The answer is simple - I didn't know about this BLE feature. I knew that BLE keep-alive exists at same level as it is able to recognize if a peer got disconnected, but I didn't know that it could be used by the application. I have to read more about it to understand how to use it.
Thank you very much for this useful info.

Who is online

Users browsing this forum: axellin, Bing [Bot] and 119 guests