Are client reads signaled to the peripheral application

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

cross mob
BrRe_4481111
Level 1
Level 1
5 replies posted First reply posted Welcome!

Before I go any further in studying the documentation and obtaining the tools and hardware I need to know if the BLE APIs will signal my peripheral application when the client attempts to read a characteristic. The peripheral application then needs to be able to set the value of the characteristic that the client will receive in the read response. I am surprised how many BLE chips do NOT support this when high level APIs like the Android do!

0 Likes
1 Solution
Yugandhar
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 5 likes given

Hello,

When the GATT Client sends a read request then CY_BLE_EVT_GATTS_READ_CHAR_VAL_ACCESS_REQ event is triggered on the GATT Server side . To update the value of a characteristic, PSoC 6 supports two functions: Cy_BLE_GATTS_WriteAttributeValuePeer and Cy_BLE_GATTS_WriteAttributeValueLocal which updates the Attribute value field in the GATT database of a GATT server. Please refer to this KBA link for more information Updating an Attribute’s Value in GATT DB of a BLE GATT Server in PSoC 6 BLE – KBA228425

Thanks,

P Yugandhar.

View solution in original post

0 Likes
3 Replies
Yugandhar
Moderator
Moderator
Moderator
500 solutions authored 1000 replies posted 5 likes given

Hello,

When the GATT Client sends a read request then CY_BLE_EVT_GATTS_READ_CHAR_VAL_ACCESS_REQ event is triggered on the GATT Server side . To update the value of a characteristic, PSoC 6 supports two functions: Cy_BLE_GATTS_WriteAttributeValuePeer and Cy_BLE_GATTS_WriteAttributeValueLocal which updates the Attribute value field in the GATT database of a GATT server. Please refer to this KBA link for more information Updating an Attribute’s Value in GATT DB of a BLE GATT Server in PSoC 6 BLE – KBA228425

Thanks,

P Yugandhar.

0 Likes

Thanks for the info. I already read the instructions about updating the database. However, what I needed to know what if I got signaled of a READ request (vs a WRITE) so I could use those two APIs as needed and control what the client receives in the read response at runtime. It looks like you are saying yes, there is an event that signals the server of a client read CY_BLE_EVT_GATTS_READ_CHAR_VAL_ACCESS_REQ and then I can use either of the two methods to control the response.

0 Likes

Hello,

I would recommend you to update the attribute values in GATT DB outside the event handler i.e., before the read request event(CY_BLE_EVT_GATTS_READ_CHAR_VAL_ACCESS_REQ) occurs because for a read request server has to send the read response within supervision timeout otherwise the connection will be lost.

Thanks,

P Yugandhar.

0 Likes