Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
Anonymous
Not applicable

Hi,

is there any way to update the data of a Characteristic during a read request?

I want to update the data by writing a new value to the Characteristic when I receive a read request. The client should read the updated data then.

Hope you can help.

0 Likes
1 Solution
Anonymous
Not applicable

This is not currently possible in the latest official BLE stack component. There is a CYBLE_EVT_GATTS_READ_CHAR_VAL_ACCESS_REQ event which can be enabled on a per-attribute basis that tells the application code that a read has been requested, but the data is pre-loaded for transfer to the client before this event is triggered, and so it is not possible to actually modify the value before it is delivered back to the client. I am unsure whether this is going to change in the near future.

   

As an alternative (though perhaps not as clean as the modify-on-read scenario), you could make the characteristic support both write and notify or indicate, then have the server notify/indicate the immediate new value to the client after the client writes a simple value to the same characteristic. At a protocol level, this is not all that different from what actually happens with a read request.

View solution in original post

0 Likes
3 Replies