i used the example Project AN91162 to make my own Custom BLE Service. I made the all the settings on the BLE-Block. All i want is to transmit a varibale uint8 over Bluetooth to my CY8CKIT-042-BLE. But now to my problem: I can't find the datatyp of the CYBLE_GATTS_WRITE_REQ_PARAM_T or the wrReqParam. Down below you see the Code i made. How to fill in the wrReqParam to my variable command, i made a Green comment, where i try to make this happen in the Programm. All that i try makes Errorors and doesn't work. 😕 Ideas how to make this?
Thanks for Help!
void GeneralEventHandler(uint32 event, void * eventParam) //eventParam contains Data written
if(CyBle_GetState() == CYBLE_STATE_DISCONNECTED)
wrReqParam =(CYBLE_GATTS_WRITE_REQ_PARAM_T *) eventParam;
//Here i want to set the Value of wrReqParam to the variable "command" but how?
/* Place your initialization/startup code here (e.g. MyInst_Start()) */
/* CyGlobalIntEnable; */ /* Uncomment this line to enable global interrupts. */
/* Place your application code here. */
Are you writing from the client to the server?
I assume that you set the properties of the of the characteristic as write (not write without response).
Declare the variables
write the following code sniffet in the switch case
wReqparam=*(CYBLE_GATTS_WRITE_REQ_PARAM_T *) eventParam;
With this code i fill in the value to my local variable:
command = *wrReqParam->handleValPair.value.val;
But I had to reconnect after every value written.
Thanks for this line, with this code, i don't have to reconnect after i wrote something to my variable:
As the property supported by the characteristic is Write request and not Write without response, the GATT server should send back a response to the request sent.That is why, for each 'CYBLE_EVT_GATTS_WRITE_REQ' event, you need to call 'CyBle_GattsWriteRsp(cyBle_connHandle);' to send back response.
If this response is not sent within a time limit, then the GATT Client will consider the link broken and disconnect.