Please post your code so we can check it.
You need to change the associated CCCD value of the custom characteristic that you want to disable and enable.
(I believe it is set to 1 to enable and 0 to disable on a bitwise level, but you should look it up in the documentation on the BLE component to be sure).
Some of the example projects contain examples of what you want to do as well in the 100 projects in 100 days.
I found in file BLE_gatt.c const CYBLE_GATTS_DB_T cyBle_gattDB[0x12u] and inside is characteristic for "MESSAGE".
When I change value from 0x000A0001u to 0x00020001u, parametr Write is disable. It's what I need.
But it's a const and isn't possible to change it in program. Or I'm wrong?
Untitled_10.png 94.0 K
Nope. That's the constant declared for Cypress' API usage. What you are looking for is more like this:
extern CYBLE_GATTC_WRITE_REQ_T serviceChangedCccdPacket;
serviceChangedCccdPacket.value = cccdIndFlagSetStruct;
serviceChangedCccdPacket.attrHandle = cyBle_gattc.cccdHandle;
Note: The example updates the descriptor value within the BLE callback stack, and thus it might have some call requirements to work properly.
I got this from the ANCS Example project on github: https://github.com/cypresssemiconductorco/PSoC-4-BLE/tree/master/100_Projects_in_100_Days/Day022_Apple_Notification_Center_Service