drivers/nble: Add initial implementation of bt_gatt_write_ccc
Change-Id: Iaf565c792fee6e2d39d199519199ee34f8f4ca57 Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
48802c2212
commit
a7462f82a8
1 changed files with 21 additions and 1 deletions
|
@ -301,7 +301,27 @@ int bt_gatt_attr_write_ccc(struct bt_conn *conn,
|
|||
const struct bt_gatt_attr *attr, const void *buf,
|
||||
uint16_t len, uint16_t offset)
|
||||
{
|
||||
return -ENOSYS;
|
||||
struct _bt_gatt_ccc *ccc = attr->user_data;
|
||||
const uint16_t *data = buf;
|
||||
|
||||
if (offset > sizeof(*data)) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
if (offset + len > sizeof(*data)) {
|
||||
return -EFBIG;
|
||||
}
|
||||
|
||||
/* We expect to receive this only when the has really changed */
|
||||
ccc->value = sys_le16_to_cpu(*data);
|
||||
|
||||
if (ccc->cfg_changed) {
|
||||
ccc->cfg_changed(ccc->value);
|
||||
}
|
||||
|
||||
BT_DBG("handle 0x%04x value %u", attr->handle, ccc->value);
|
||||
|
||||
return len;
|
||||
}
|
||||
|
||||
int bt_gatt_attr_read_cep(struct bt_conn *conn,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue