- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
in BLE component is Custom characteristics "MESSAGE" and in Properties are two parameters: Read and Write.
These parameters I can change by "tick" button in configure window. It's clear.
But how I can enable/disable for example Write parameter directly in C file?
I would like to have something as:
if ( i == 1) "Write is enable"
else "Write is disable"
Thanks in advance, Libor
Solved! Go to Solution.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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;
CyBle_GattcWriteCharacteristicDescriptors(cyBle_connHandle, &serviceChangedCccdPacket);
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_App...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please post your code so we can check it.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello bobgoar, I used the example from here:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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;
CyBle_GattcWriteCharacteristicDescriptors(cyBle_connHandle, &serviceChangedCccdPacket);
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_App...