1 Reply Latest reply on Jan 25, 2017 12:25 PM by epr_1639216

    Custom Profile Example - Write from Server to Client

      Hi colleagues,


      In the Custom Profile Example (RGB LED Control), I would like to write in the red field (see attached in yellow highlighted) a desired value and not the done from the color map. I tried with the following but it is not working: 


      - BLE Component with write, read and notify parameters


      - wrReqParam->handleValPair.value.val[RED_INDEX] = (uint8) MyValue; 
      Option 1) CyBle_GattsWriteEventHandler (wrReqParam); 


      Option 2) CyBle_GattcWriteCharacteristicValue(wrReqParam->connHandle,&wrReqParam->handleValPair);


      Is there any possibility to write that value from the server to client and display it in that field or is it directly done from color map to that field by the Android App? 


      Thanks in advance,



        • 1. Re: Custom Profile Example - Write from Server to Client

          I don't know how the Android App works/runs under the hood, but from the server-side of the situation:


          There are three options for writing data involving the BLE radio that I have found:


          CyBle_GattsWriteAttributeValue(&tempHandle,false,&cyBle_connHandle, false)


          CyBle_GattsNotification(cyBle_connHandle, &tempHandle)


          CyBle_GattsIndicate(cyBle_connHandle, &tempHandle) //Not sure of the function name is correct here


          The first function will only update the "local" copy on the BLE radio (server);


          The second and third will write the value to the Android App-side of the connection (client), with the indication requiring an ACK handshake step.




          Personally, I've been working with the notification, and it seems to work pretty well. Most likely I will switch to the Indicate function to ensure reliable data delivery, but for testing purposes it adds an extra step of complexity that I'm not worried about atm.


          You could try the notification or indication functions to see if those push the data to the App.