diff --git a/doc/releases/release-notes-4.0.rst b/doc/releases/release-notes-4.0.rst index 77a092000bede3..bb08b4bd05b117 100644 --- a/doc/releases/release-notes-4.0.rst +++ b/doc/releases/release-notes-4.0.rst @@ -140,6 +140,9 @@ Bluetooth :c:func:`bt_conn_le_create` and :c:func:`bt_conn_le_create_synced` return an error if the connection pointer passed as an argument is not NULL. + * :c:member:`_bt_gatt_ccc.value` is now a bitwise OR-reduction of the + individual CCC values of connected clients instead of the maximum. + * Controller * Added Periodic Advertising Sync Transfer (PAST) support with support for both sending and receiving roles. diff --git a/include/zephyr/bluetooth/gatt.h b/include/zephyr/bluetooth/gatt.h index c72cb821a726ad..51dcb48b7afc10 100644 --- a/include/zephyr/bluetooth/gatt.h +++ b/include/zephyr/bluetooth/gatt.h @@ -936,7 +936,7 @@ struct _bt_gatt_ccc { /** Configuration for each connection */ struct bt_gatt_ccc_cfg cfg[BT_GATT_CCC_MAX]; - /** Highest value of all connected peer's subscriptions */ + /** Bitwise OR of all connected peers' CCC values */ uint16_t value; /** @brief CCC attribute changed callback diff --git a/subsys/bluetooth/host/gatt.c b/subsys/bluetooth/host/gatt.c index 118af2097afe08..2e66ab057c069a 100644 --- a/subsys/bluetooth/host/gatt.c +++ b/subsys/bluetooth/host/gatt.c @@ -2201,9 +2201,7 @@ static void gatt_ccc_changed(const struct bt_gatt_attr *attr, struct bt_conn *conn = bt_conn_lookup_addr_le(ccc->cfg[i].id, &ccc->cfg[i].peer); if (conn) { - if (ccc->cfg[i].value > value) { - value = ccc->cfg[i].value; - } + value |= ccc->cfg[i].value; bt_conn_unref(conn); }