Bluetooth: GATT: Fix using variable size storage for CCC
This removes the necessity of registering the storage for CCC and make it part of the declaration itself. Fixes #18547 Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This commit is contained in:
parent
cee271968e
commit
5f3595e47c
16 changed files with 36 additions and 66 deletions
|
@ -568,8 +568,7 @@ struct bt_gatt_ccc_cfg {
|
|||
|
||||
/* Internal representation of CCC value */
|
||||
struct _bt_gatt_ccc {
|
||||
struct bt_gatt_ccc_cfg *cfg;
|
||||
size_t cfg_len;
|
||||
struct bt_gatt_ccc_cfg cfg[BT_GATT_CCC_MAX];
|
||||
u16_t value;
|
||||
void (*cfg_changed)(const struct bt_gatt_attr *attr,
|
||||
u16_t value);
|
||||
|
@ -623,31 +622,29 @@ ssize_t bt_gatt_attr_write_ccc(struct bt_conn *conn,
|
|||
*
|
||||
* Helper macro to declare a Managed CCC attribute.
|
||||
*
|
||||
* @param _cfg Initial configuration.
|
||||
* @param _changed Configuration changed callback.
|
||||
* @param _write Configuration write callback.
|
||||
* @param _match Configuration match callback.
|
||||
*/
|
||||
#define BT_GATT_CCC_MANAGED(_cfg, _changed, _write, _match) \
|
||||
#define BT_GATT_CCC_MANAGED(_changed, _write, _match) \
|
||||
BT_GATT_ATTRIBUTE(BT_UUID_GATT_CCC, \
|
||||
BT_GATT_PERM_READ | BT_GATT_PERM_WRITE, \
|
||||
bt_gatt_attr_read_ccc, bt_gatt_attr_write_ccc, \
|
||||
(&(struct _bt_gatt_ccc) { .cfg = _cfg, \
|
||||
.cfg_len = ARRAY_SIZE(_cfg), \
|
||||
.cfg_changed = _changed, \
|
||||
.cfg_write = _write, \
|
||||
.cfg_match = _match }))
|
||||
(&(struct _bt_gatt_ccc) { \
|
||||
.cfg = {}, \
|
||||
.cfg_changed = _changed, \
|
||||
.cfg_write = _write, \
|
||||
.cfg_match = _match }))
|
||||
|
||||
/** @def BT_GATT_CCC
|
||||
* @brief Client Characteristic Configuration Declaration Macro.
|
||||
*
|
||||
* Helper macro to declare a CCC attribute.
|
||||
*
|
||||
* @param _cfg Initial configuration.
|
||||
* @param _cfg_changed Configuration changed callback.
|
||||
*/
|
||||
#define BT_GATT_CCC(_cfg, _cfg_changed) \
|
||||
BT_GATT_CCC_MANAGED(_cfg, _cfg_changed, NULL, NULL)
|
||||
#define BT_GATT_CCC(_cfg_changed) \
|
||||
BT_GATT_CCC_MANAGED(_cfg_changed, NULL, NULL)
|
||||
|
||||
/** @brief Read Characteristic Extended Properties Attribute helper
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue