- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Solved! Go to Solution.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That might be possible for custom services. I also need this for predefined services, such as "Device Information". I couldn't understand why Cypress doesn't give the possibility to do this. I'm sure not the only one who might need this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As jrow said "This is not currently possible in the latest official BLE stack component." The BLE stack is given by the Bluetooth association and so ensures that all "official" versions can interact with each other on all iso layers.
Bob