UUID compare in CCC function (Zephyr)

Hello,

I have created different characteristics with the CCC macro (BT_GATT_CCC) that share the same "Configuration changed callback" function.

Inside the function below, i want to compare and find which uuid has enabled notification from client.

static void cccCfgChanged(const struct bt_gatt_attr *attr, uint16_t value)
{
    char str[BT_UUID_STR_LEN];
    bt_uuid_to_str(attr->uuid, str, sizeof(str));
}
The function bt_uuid_to_str just give junk in the char array, does attr-uuid not contain the uuid of the characteristic which has enabled notifications?
I have also tried  bt_uuid_cmp without any luck.
Parents
  • Hi,

    Sorry, not to familiar with zephyr yet, but trying to answer anyway. When the peer enables notification it writes to the attribute handle for the cccd. This means some where in the stack this must be linked to the rest of the bt_gatt_attr struct. I would guess that is happening in the application layer, so you will likely have to linke this in the application yourself. As a check, what information does this struct contain if you halt the code and check?

     

Reply
  • Hi,

    Sorry, not to familiar with zephyr yet, but trying to answer anyway. When the peer enables notification it writes to the attribute handle for the cccd. This means some where in the stack this must be linked to the rest of the bt_gatt_attr struct. I would guess that is happening in the application layer, so you will likely have to linke this in the application yourself. As a check, what information does this struct contain if you halt the code and check?

     

Children
No Data
Related