You are here

BLE_FindMe Example - adding custom service | Cypress Semiconductor

BLE_FindMe Example - adding custom service

Summary: 3 Replies, Latest post by Graeme Parker on 13 Jul 2016 06:35 AM PDT
Verified Answers: 1
Last post
Log in to post new comments.
Graeme Parker's picture
36 posts


So I am using he FindMe example code in Creator 3.3. Using CySmart I can interact with the target via the BLE PC dongle.

I have added a custom service with two characteristics. The first is a uint8[16] array which I can write to using the PSoC and these values are returned in CySmart (as expected). The second characteristic is a uint8 which has the property WriteWithoutResponse (as does the alertLevel of the included service).

Simply, how do I get the PSoC to take action when the 2nd characteristic is written to using CySmart?


cjoachim_1597296's picture
73 posts

By looking at the CYBLE_EVT_GATTS_WRITE_REQ event in your event handler and see if the Attribute to be written (param->attrHandle) is the one of your custom service Characteristic (you find your Attribute Handle in the generated file BLE_custom.h)?


Graeme Parker's picture
36 posts

Thanks for the speedy reply. Of course if I understood what you were saying I'd just be replying with a thank you. However...

I have:

            CyBle_WriteReqHandler((CYBLE_GATTS_WRITE_REQ_PARAM_T *)eventParam);

In BLE_eventHandler.c.

And my handles in BLE_custom.h:

#define CYBLE_SCDATA_SERVICE_HANDLE   (0x0011u) /* Handle of SCData service */
#define CYBLE_SCDATA_LOGDATA_DECL_HANDLE   (0x0012u) /* Handle of LogData characteristic declaration */
#define CYBLE_SCDATA_LOGDATA_CHAR_HANDLE   (0x0013u) /* Handle of LogData characteristic */
#define CYBLE_SCDATA_COMMAND_DECL_HANDLE   (0x0014u) /* Handle of Command characteristic declaration */
#define CYBLE_SCDATA_COMMAND_CHAR_HANDLE   (0x0015u) /* Handle of Command characteristic */

But I'm not sure what I should do next.

Graeme Parker's picture
36 posts

Been doing a bit of debugging to see what is happening. Quite tricky as you can't single step as it always ends up in an ISR. However, when CySmart does a write to either the alert characterstic or the custom one (both writewithoutresponse) then the BLE_eventHandler takes this case:

            if((cyBle_eventHandlerFlag & CYBLE_CALLBACK) != 0u)
                (void)CyBle_IassWriteCmdEventHandler((CYBLE_GATTS_WRITE_REQ_PARAM_T *)eventParam);

Which (I guess it's the CMD option because of the writenoresponse) then (in CyBle_IassWriteCmdEventHandler) currently does nothing if the event is a write to my custom characteristic.

I'll probably be back, but do have something to work on now.


Log in to post new comments.