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.
nimble BLE write notifications
-
- Posts: 1708
- Joined: Mon Oct 17, 2022 7:38 pm
- Location: Europe, Germany
Re: nimble BLE write notifications
Not sure if you're actually mixing up "client" and "server" here.
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,
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)?
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.when I write to the client
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.receiving a read notification...
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,
sounds strange:when I write to the client, I do not receive notifications
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)?
Re: nimble BLE write notifications
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".
Re: nimble BLE write notifications
Hello,
do you resolve the issue? How.. i m stuck on same scenario.
Thank you for help.
do you resolve the issue? How.. i m stuck on same scenario.
Thank you for help.
Who is online
Users browsing this forum: No registered users and 92 guests