1 Reply Latest reply on Feb 3, 2017 12:22 AM by yssu

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

    pd7vendpago_2250931

      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?

        • 1. Re: Getting a different BLE event depending on the size of the write request
          yssu

          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.