BLE index for cy_ble_customCServ

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

cross mob
JeHu_3414236
Level 5
Level 5
10 likes received First like received

I have one custom service defined in my GATT client.  PSoC creator defines this value:

#define CY_BLE_CUSTOMC_CUSTOM_SERVICE_SERVICE_INDEX   (0x01u) /* Index of Custom Service service in the cy_ble_customCServ array */

The cy_ble_customCServ array is defined as:

cy_stc_ble_customc_t cy_ble_customCServ[CY_BLE_CUSTOMC_SERVICE_COUNT]

and CY_BLE_CUSTOMC_SERVICE_COUNT = 1

How am I supposed to use CY_BLE_CUSTOMC_CUSTOM_SERVICE_SERVICE_INDEX?  It would be cy_ble_customCServ[1] when the size is only 1.  Should CY_BLE_CUSTOMC_CUSTOM_SERVICE_SERVICE_INDEX be defined as 0?

0 Likes
1 Solution
ShipingW_81
Moderator
Moderator
Moderator
500 replies posted 250 solutions authored 250 replies posted

CY_BLE_CUSTOMC_CUSTOM_SERVICE_SERVICE_INDEX means the current number of custom service supported in GATT client. It cannot be defined as 0 if there is custom service existing.

CY_BLE_CUSTOMC_SERVICE_COUNT means the number of element in the cy_ble_customCServ array. It should be identical with CY_BLE_CUSTOMC_CUSTOM_SERVICE_SERVICE_INDEX.

View solution in original post

0 Likes
3 Replies
ShipingW_81
Moderator
Moderator
Moderator
500 replies posted 250 solutions authored 250 replies posted

CY_BLE_CUSTOMC_CUSTOM_SERVICE_SERVICE_INDEX means the current number of custom service supported in GATT client. It cannot be defined as 0 if there is custom service existing.

CY_BLE_CUSTOMC_SERVICE_COUNT means the number of element in the cy_ble_customCServ array. It should be identical with CY_BLE_CUSTOMC_CUSTOM_SERVICE_SERVICE_INDEX.

0 Likes

Do you have an example project on how to use CY_BLE_CUSTOMC_CUSTOM_SERVICE_SERVICE_INDEX?  From this other thread Democode for PSoC6 BLE central reading value from custom service , it is being used the same way I interpreted it, which is apparently wrong:

myVal.attrHandle = cy_ble_customCServ[CY_BLE_CUSTOMC_HEAT_COST_ALLOCATOR_SERVICE_SERVICE_INDEX].customServChar[CY_BLE_CUSTOMC_HEAT_COST_ALLOCATOR_SERVICE_SENSORDATA_CHAR_INDEX].customServCharHandle[0];

0 Likes

Seems no such code example for GATT server handles its custom service.

Can you please clarify more about the specific issue encountered?

0 Likes