cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC™ 4

Anonymous
Not applicable

Hi,

   

Is there a way in the main application to detect when a characteristic read is occurring. 

   

In my application, I need to generate the characteristic data dynamically as it is requested. Ideally I would like a callback so that I can update the characteristic value before it is sent.

   

 

   

Thanks

0 Likes
1 Solution
Anonymous
Not applicable

Yes, there is a CYBLE_EVT_GATTS_READ_CHAR_VAL_ACCESS_REQ event. See this thread: http://www.cypress.com/forum/psoc-4-ble/gatt-server-event-when-long-read-completes

View solution in original post

0 Likes
4 Replies
Anonymous
Not applicable

Yes, there is a CYBLE_EVT_GATTS_READ_CHAR_VAL_ACCESS_REQ event. See this thread: http://www.cypress.com/forum/psoc-4-ble/gatt-server-event-when-long-read-completes

View solution in original post

0 Likes
Anonymous
Not applicable

Hi Speedycat,

   

That worked! I am getting that event.

   

There is still a small problem, I update the GATT database in the event handler, but the previous value is sent to the client. The next time the client reads the value, it reads the value that I had set so the read value is always delayed by one request.

   

Is this event triggered AFTER the response is sent to the client ?

   

and is there any way to update the data BEFORE it is sent to the client ?

   

 

   

Thanks

0 Likes
Anonymous
Not applicable

I think the BLE  component/code prohibits you from doing this. Maybe this is some constraint made by Cypress; maybe it is required by Bluetooth specification. I don't know.

   

You could create your own Characteristic with Write and Indicate properties. Use write to send your own "read command" to the server, and then let the server do an Indication back. 

0 Likes
Anonymous
Not applicable

Thanks for your help, I can work around this limitation.

0 Likes