Getting a different BLE event depending on the size of the write request

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

cross mob
Anonymous
Not applicable

Hello,

   

 

   

i'm using CySmart along a software I wrote for the PSoC 4 and I have the following problem:

   

 

   

In my StackEventHandler function, when the message I'm trying to write to a certain custom characteristic has a certain number of bytes or less, I get a CYBLE_EVT_GATTS_WRITE_REQ event.

   

 

   

When the message has a lot of bytes (around 20+) I get CYBLE_EVT_GATTS_EXEC_WRITE_REQ. 

   

 

   

In other words, I can proccess the data prior to writing only if it is less than a certain number of bytes, if the number of bytes is bigger than this threshold, it gets written directly to the characteristic. Why is that?

0 Likes
1 Solution
Anonymous
Not applicable

Hi,

   

You are correct. When the client uses write value, the CYBLE_EVT_GATTS_WRITE_REQ event is triggered on the server, whereas CYBLE_EVT_GATTS_EXEC_WRITE_REQ is triggered when the client writes using Write Long Characterisitc Value.

   

The stack is designed in such a way that the the "long value" is written automatically to the GATT DB on the server when it gets CYBLE_EVT_GATTS_EXEC_WRITE_REQ event. On the other hand, when the CYBLE_EVT_GATTS_WRITE_REQ event is triggered, the designer can choose to update the GATT DB.

   

To answer your in short, it behaves so because it is designed so.

   

If you wish to update the GATT DB when you get CYBLE_EVT_GATTS_EXEC_WRITE_REQ, you should read the value and then re-write it.

View solution in original post

0 Likes
1 Reply
Anonymous
Not applicable

Hi,

   

You are correct. When the client uses write value, the CYBLE_EVT_GATTS_WRITE_REQ event is triggered on the server, whereas CYBLE_EVT_GATTS_EXEC_WRITE_REQ is triggered when the client writes using Write Long Characterisitc Value.

   

The stack is designed in such a way that the the "long value" is written automatically to the GATT DB on the server when it gets CYBLE_EVT_GATTS_EXEC_WRITE_REQ event. On the other hand, when the CYBLE_EVT_GATTS_WRITE_REQ event is triggered, the designer can choose to update the GATT DB.

   

To answer your in short, it behaves so because it is designed so.

   

If you wish to update the GATT DB when you get CYBLE_EVT_GATTS_EXEC_WRITE_REQ, you should read the value and then re-write it.

0 Likes