- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm at a loss on how to set CYBLE_GATT_DB_ATTR_CHAR_VAL_RD_EVENT for my custom service.
Per the BLE API document:
BLE_EVT_GATTS_READ_CHAR_VAL_ACCESS_REQ
Event parameters for characteristic read value access event generated by BLE Stack upon an access of Characteristic value read for the characteristic definition which has CYBLE_GATT_DB_ATTR_CHAR_VAL_RD_EVENT property set.
Thanks,
Jesse
Solved! Go to Solution.
- Labels:
-
BLE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jesse - May be it's too late, but here's how you can set the permission field to enable read request access event:
1. Gatt DB for your server is stored in BLE_gatt.c file (cyBle_gattDB)
2. Third entry in the gatt db is the permission field (as per the structure that you just showed above).
3. Set the 17th bit of the permission for your desired characteristic in the gatt DB to enable read access event
Here's an example:
{ 0x0003u, 0x2A00u /* Device Name */, 0x00010201u /* rd */, 0x0003u, {{0x0013u, (void *)&cyBle_attValuesLen[0]}} },
There are no APIs currently that I know of to set the permission field explicitly. You can export the gattdb and make changes to it before calling the CyBle_Start API.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok. I have no responses so maybe I'll need to explain what I want to do. I just want to know when the client has read a characteristic from the server. It sounds like that it possible from the documentation by setting the CYBLE_GATT_DB_ATTR_CHAR_VAL_RD_EVENT bit. I'm assuming that is a specific bit per characteristic? or is it a global setting? Anyone have any idea where that bit is stored in the Gatt DB?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok in the BLE_StackGattDb.h I see this...
typedef struct
{
/* Start Handle: Act as an index for querying BLE GATT database */
uint16 attHandle;
/* UUID: 16 bit UUID type for an attribute entry, for 32 bit and
128 bit UUIDs the last 16 bits should be stored in this entry
GATT DB access layer shall retrieve complete 128 bit UUID from
CYBLE_GATTS_ATT_GENERIC_VAL_T structure. */
uint16 attType;
/* The permission bits are clubbed in to a 32-bit field. These
32-bits can be grouped in to 4 bytes. The lowest significant byte
is byte 0 (B0) and the most significant byte is byte 3 (B3). The
bytes where the permissions have been grouped is as given below.
* Attribute permissions (B0)
* Characteristic permissions (B1)
* Implementation specific permission (B3, B2)
*/
uint32 permission;
/* Attribute end handle, indicating logical boundary of given attribute. */
uint16 attEndHandle;
/* Attribute value format, it can be one of following:
* uint16 16bit - UUID for 16bit service & characteristic declaration
* CYBLE_GATTS_ATT_GENERIC_VAL_T attFormatValue - Buffer containing 32 bit
or 128 bit UUID values for service & charactertistic declaration
* CYBLE_GATTS_ATT_GENERIC_VAL_T attFormatValue - Buffer contraining generic
char definition value, or generic descriptor values
*/
CYBLE_GATTS_ATT_VALUE_T attValue;
} CYBLE_GATTS_DB_T;
There is also this:
/* Implementation permissions <B2>: Implementation specific
defines to access runtime characteristics. */
/* Bit: */
#define CYBLE_GATT_DB_ATTR_CHAR_VAL_RD_EVENT 0x010000u
I can't modify the permissions directly because they are read-only. But I don't see any functions available to modify the permissions. I would expect there is some function similar to CyBle_GattsWriteAttributeValue().
Anyone? Anyone?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jesse - May be it's too late, but here's how you can set the permission field to enable read request access event:
1. Gatt DB for your server is stored in BLE_gatt.c file (cyBle_gattDB)
2. Third entry in the gatt db is the permission field (as per the structure that you just showed above).
3. Set the 17th bit of the permission for your desired characteristic in the gatt DB to enable read access event
Here's an example:
{ 0x0003u, 0x2A00u /* Device Name */, 0x00010201u /* rd */, 0x0003u, {{0x0013u, (void *)&cyBle_attValuesLen[0]}} },
There are no APIs currently that I know of to set the permission field explicitly. You can export the gattdb and make changes to it before calling the CyBle_Start API.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Undesh,
It looks like this is very similar to something I am trying to accomplish. Could you expand on how what you mean by export the gattdb? I tried making a copy of the CYBLE_GATTS_DB_T modifying the bits and then calling CyBle_GattsDbRegister() with the copy. However this didn't seem to have any affect
Thanks for any help!