3 Replies Latest reply on Dec 29, 2016 10:39 PM by anpm

    CySmart Write/Read to GATT DB not changing the data read

    grrasic_1882326

      Using CySmart 1.2 to change and write to a GATT attribute is verified to be correct by my firmware (EZ-BLE 4100) but reading back the attribute with the tool returns the original unchanged value. What is going on?

         

      ie: original value = 0x0A, write 0x0B with CySmart and verify with debugger in my f/w, but read a 0x0A with CySmart

        • 1. Re: CySmart Write/Read to GATT DB not changing the data read
          Gyan Chand

          Hi,

             

          If you are using custom characteristics then you have to manually store the value in Gatt_Server_database that is written by Gatt_Client to read back by the client.

             

          To accomplished this task you have to call -

             

                                   CyBle_GattsWriteAttributeValue() API 

             

          >  When CYBLE_EVT_GATTS_WRITE_REQ event is generated and after storing the value(written by client) in a variable ,you hav eto call above API .

             

          > See the below code snippet-------------

             

           """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""'

             

          /* Update RGB control handle with new values */
              rgbHandle.attrHandle = RGB_LED_CHAR_HANDLE;
              rgbHandle.value.val = RGBledData;
              rgbHandle.value.len = RGB_CHAR_DATA_LEN;
              rgbHandle.value.actualLen = RGB_CHAR_DATA_LEN;
              
              /* Send updated RGB control handle as attribute for read by central device */
              CyBle_GattsWriteAttributeValue(&rgbHandle, FALSE, &cyBle_connHandle, FALSE); 

             

          """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

             

           

             

          -Gyan

          • 2. Re: CySmart Write/Read to GATT DB not changing the data read
            anpm

            Hi,

               

            You can refer the attached example project of Read, Write properties.

               

            Thanks,

               

            Anjana

            • 3. Re: CySmart Write/Read to GATT DB not changing the data read
              grrasic_1882326

              Thank you, Gyan it all makes perfectly good sense now: If you want to read what you've written you must write what you read! I guess its a matter of verification protocol to prevent unwanted things written to your GATT DB.

                 

              Rick