understanding WriteWithoutResponse handling in BLE stack

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

cross mob
GeIo_1586191
Level 4
Level 4
50 replies posted 25 replies posted 10 replies posted

As you know when creating a custom BLE characteristic you can assign which property applies as shown below

pastedImage_0.png

I've noticed all BLE examples provided use the "Write" property and this is typically handled here within the stackeventhandler routine:

        /* This event is received when Central device sends a Write command

           on an Attribute */

        case CY_BLE_EVT_GATTS_WRITE_REQ:

           

            /* Read the write request parameter */

            writeReqParameter = (cy_stc_ble_gatts_write_cmd_req_param_t *)

                                eventParameter;

            /* When this event is triggered, the peripheral has received a

               write command on the custom  characteristic. Check if command

               fits any of the custom attributes and update the flag for

               sending notifications by the respective service */

            if (SLIDER_CCCD_HANDLE

                == writeReqParameter->handleValPair.attrHandle)

            {

                HandleWriteRequestforSlider(writeReqParameter);

            }

            if (BUTTON_CCCD_HANDLE

                == writeReqParameter->handleValPair.attrHandle)

            {

                HandleWriteRequestforButtons(writeReqParameter);

            }

            if (RGB_CCCD_HANDLE

                == writeReqParameter->handleValPair.attrHandle ||

                CY_BLE_RGB_LED_RGB_LED_CONTROL_CHAR_HANDLE

                == writeReqParameter->handleValPair.attrHandle)

            {

                HandleWriteRequestforRgb(writeReqParameter);

            }

           

            /* Send the response to the write request received. */

            Cy_BLE_GATTS_WriteRsp(connectionHandle);

            break;

With the response sent back using Cy_BLE_GATTS_WriteRsp(connectionHandle);

Now I cannot figure out what happens with a WriteWithNoResponse option. I tried this by swapping out Write with a WriteWithNoResponse with GATT characteristic but I could not get this to work.

Is there a different event handler for this, for example, or what do I need to do.

All help appreciated.

Thanks

1 Solution
GyanC_36
Employee
Employee
250 replies posted 100 replies posted 50 replies posted

Hello ,

Performing 'WriteWithoutResponse' generates CY_BLE_EVT_GATTS_WRITE_CMD_REQ event instead of CY_BLE_EVT_GATTS_WRITE_REQ at the Server side when a Central (Client) device sends a 'WriteWithoutResponse' command on an Attribute.

-Gyan

   

View solution in original post

1 Reply
GyanC_36
Employee
Employee
250 replies posted 100 replies posted 50 replies posted

Hello ,

Performing 'WriteWithoutResponse' generates CY_BLE_EVT_GATTS_WRITE_CMD_REQ event instead of CY_BLE_EVT_GATTS_WRITE_REQ at the Server side when a Central (Client) device sends a 'WriteWithoutResponse' command on an Attribute.

-Gyan