Custom Profile Example - Write from Server to Client

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

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

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,

   

John
 

0 Likes
1 Solution
Anonymous
Not applicable

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.

View solution in original post

0 Likes
1 Reply
Anonymous
Not applicable

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.

0 Likes