nimble BLE write notifications

kh13824
Posts: 10
Joined: Tue Oct 18, 2022 6:01 pm

nimble BLE write notifications

Postby kh13824 » Fri May 05, 2023 1:46 pm

Hello,

I am currently using Nimble BLE on an ESP32-S3 as a server and connecting to a virtual BLE client device which I have set with specific UUIDS. So far I have been successful in reading and writing to the client but I am having issues with notifications. Currently I subscribe to Read/Notify UUID's and set their CCCD field to 1, and have no issues with receiving a read notification on the ESP32-S3. I do the same for Write/Notify when subscribing and when I write to the client, I do not receive notifications on the ESP32-S3. Changing the value on the client side does not notify either. Is there something I am possibly missing to not receive notifications on the server? Is there a specific requirement to receive write notifications? I am using "ble_gattc_write_flat" as my write function.

MicroController
Posts: 1708
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: nimble BLE write notifications

Postby MicroController » Sat May 06, 2023 9:21 pm

Not sure if you're actually mixing up "client" and "server" here.
when I write to the client
The server does not write to the client. The client can issue reads or writes to the server; the server can only initiate indications or notifications.
receiving a read notification...
Again maybe a wording issue, but there is no such thing as a "read notification", or a "write notification" for that matter. As stated above, a server can send notifications to a client; generally at any time (after subscription) and with arbitrary content.
The conventional use case is that the server sends a notification when a characteristic's value changes from the server side. If the server is e.g. a temperature sensor, it would provide a "temperature" characteristic for clients to read; when the server detects that the measured temperature changed, it can send a notification to its client(s) to let them know that the value has changed. Usually, and if possible, it would include the new value in the notification message itself; if not, clients are at least made aware that they may want to read the updated characteristic's value from the server again.

That said,
when I write to the client, I do not receive notifications
sounds strange:
a) Why would one party (actually: the client) expect to be notified by the server about the fact that it just wrote a changed value to the server?
b) What should the content, or generally the semantics, of such a notification be, given that the corresponding characteristic's value cannot/may not be read by the client (you say it is write-only, correct)?

kh13824
Posts: 10
Joined: Tue Oct 18, 2022 6:01 pm

Re: nimble BLE write notifications

Postby kh13824 » Mon May 08, 2023 5:48 pm

Thank you for your reply. Apologies for you wording as I am new to using BLE. My ESP32 acts as a central role and initiates a connection to a peripheral. At the time of my post I was mainly working with an iOS device which had a BLE developer app acting as a peripheral. I had notifications set up for a characteristic which was set to read, notify. I had no issues with those notifications. With a write, notify characteristic set up on my BLE developer app, I was not receiving any notification when I subscribed and set the cccd for notifications. I switched to a different device which has the same services and characteristics and was then able to have notifications show on my ESP32 for the write, notify characteristic. I guess the limitation was due to the virtual app I was using which was "Lightblue".

gavalierm
Posts: 1
Joined: Mon Jan 22, 2024 8:19 am

Re: nimble BLE write notifications

Postby gavalierm » Mon Jan 22, 2024 8:30 am

Hello,

do you resolve the issue? How.. i m stuck on same scenario.

Thank you for help.

Who is online

Users browsing this forum: Majestic-12 [Bot] and 73 guests