I have defined a private GATT Service with several cahractersitics. I have defined a 128bit UUID::
static struct bt_uuid_128 data_uuid = BT_UUID_INIT_128( BT_UUID_128_ENCODE(0xE700AA94, 0xB681, 0xFF0C, 0xAC74, 0x8C4A1EBDA6805));
Then I define the charactersitic:
BT_GATT_CHARACTERISTIC(&data_uuid.uuid, BT_GATT_CHRC_NOTIFY, BT_GATT_CHRC_NOTIFY, NULL, NULL, NULL), BT_GATT_CCC(data_ccc_cfg_changed, BT_GATT_PERM_READ | BT_GATT_PERM_WRITE),
In my NOTIFY callback:
static void data_ccc_cfg_changed(const struct bt_gatt_attr *attr, uint16_t value) { privateAttr = attr; data_notif_enabled = (value == BT_GATT_CCC_NOTIFY); LOG_INF("Log notifications %s", data_notif_enabled ? "enabled" : "disabled"); }
Then I've defined a notify function where i invoke:
bt_gatt_notify_uuid(NULL, &data_uuid.uuid, privateAttr, &myData, sizeof(myData));
But my NOTIFY characteristic isn't updating. I have followed the exact same pattern as a I did with a public GATT that works perfectly.
NOTE:
One thing I am not sure of is about how I'm getting the attr parameter from the function call i'm using to notify;
static inline int bt_gatt_notify_uuid(struct bt_conn *conn, const struct bt_uuid *uuid, const struct bt_gatt_attr *attr, const void *data, uint16_t len) { struct bt_gatt_notify_params params; memset(¶ms, 0, sizeof(params)); params.uuid = uuid; params.attr = attr; params.data = data; params.len = len; #if defined(CONFIG_BT_EATT) params.chan_opt = BT_ATT_CHAN_OPT_NONE; #endif /* CONFIG_BT_EATT */ return bt_gatt_notify_cb(conn, ¶ms); }
Can anyone please help me. This code has to go out to the custimer tomorrow.
Thanks, Drew