You are here

CYBLE_EVT_GATTS_READ_REQ - Identify which characteristic was read | Cypress Semiconductor

CYBLE_EVT_GATTS_READ_REQ - Identify which characteristic was read

Summary: 3 Replies, Latest post by airbly on 14 Oct 2016 05:33 PM PDT
Verified Answers: 1
Last post
Log in to post new comments.
airbly's picture
User
16 posts

Hi,

Is it possible to determine which characteristic was read when the CYBLE_EVT_GATTS_READ_REQ event is triggered?

I would like to update the contents of a custom characteristic every time it is read to facilitate a memory dump process.  Currently it is a bit slow having to send a Write and then a Read for each block of data.  If each read caused the characteristic to be updated with the next block of data to allow the next read to get the next block, that would significantly improve performance for my application.

Any thoughts as to how I could accomplish this?

Thanks.

- Chris

jrow's picture
Cypress Employee
69 posts

Hi Chris,

The CYBLE_EVT_GATTS_READ_CHAR_VAL_ACCESS_REQ stack event generates an event with the parameter of a pointer of type CYBLE_GATTS_CHAR_VAL_READ_REQ_T. This has the attrHandle member, which you should be able to use to identify the characteristic in question.

airbly's picture
User
16 posts

Thanks jrow.  I will look into that and update this thread if everything works.

- Chris

airbly's picture
User
16 posts

This code appears to work well for this.

<code>

CYBLE_GATTS_CHAR_VAL_READ_REQ_T *rdReqParam;

....

case CYBLE_EVT_GATTS_READ_CHAR_VAL_ACCESS_REQ:

   rdReqParam = (CYBLE_GATTS_CHAR_VAL_READ_REQ_T *) eventParam;

   if (rdReqParam->attrHandle == CYBLE_SERVICE_CHARACTERISTIC_CHAR_HANDLE) {

      // Act on it

   }

   break;

</code> 

Log in to post new comments.