Bluetooth: host: Fix CCC store on write for multiple connections
Fix CCC store on write feature for multiple connections. CCCs are only enqueued for storing when going from no connections subscribed to any connection subscribed. The CCC should be stored when its value is changed for the specific connection. Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
This commit is contained in:
parent
366a64cb1e
commit
4dd49ac746
1 changed files with 5 additions and 0 deletions
|
@ -1691,6 +1691,7 @@ ssize_t bt_gatt_attr_write_ccc(struct bt_conn *conn,
|
|||
{
|
||||
struct _bt_gatt_ccc *ccc = attr->user_data;
|
||||
struct bt_gatt_ccc_cfg *cfg;
|
||||
bool value_changed;
|
||||
uint16_t value;
|
||||
|
||||
if (offset) {
|
||||
|
@ -1741,6 +1742,7 @@ ssize_t bt_gatt_attr_write_ccc(struct bt_conn *conn,
|
|||
}
|
||||
}
|
||||
|
||||
value_changed = cfg->value != value;
|
||||
cfg->value = value;
|
||||
|
||||
BT_DBG("handle 0x%04x value %u", attr->handle, cfg->value);
|
||||
|
@ -1748,8 +1750,11 @@ ssize_t bt_gatt_attr_write_ccc(struct bt_conn *conn,
|
|||
/* Update cfg if don't match */
|
||||
if (cfg->value != ccc->value) {
|
||||
gatt_ccc_changed(attr, ccc);
|
||||
}
|
||||
|
||||
if (value_changed) {
|
||||
#if defined(CONFIG_BT_SETTINGS_CCC_STORE_ON_WRITE)
|
||||
/* Enqueue CCC store if value has changed for the connection */
|
||||
gatt_ccc_conn_enqueue(conn);
|
||||
#endif
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue