21#include <zephyr/bluetooth/gatt.h>
22#include <zephyr/bluetooth/uuid.h>
31#define BT_GATT_POOL_INIT(_attr_array_size) \
35 .attrs = (struct bt_gatt_attr[_attr_array_size]) \
38 .attr_array_size = _attr_array_size \
48#define BT_GATT_POOL_DEF(_name, _attr_array_size) \
49 const static struct bt_gatt_pool _name = \
50 BT_GATT_POOL_INIT(_attr_array_size)
57#define BT_GATT_POOL_SVC(_gp, _svc_uuid_init) \
60 const struct bt_uuid *_svc_uuid = _svc_uuid_init; \
61 _ret = bt_gatt_pool_svc_alloc(_gp, _svc_uuid); \
62 __ASSERT_NO_MSG(!_ret); \
76#define BT_GATT_POOL_CHRC(_gp, _uuid, _props, _perm, _read, _write, _value) \
79 const struct bt_gatt_attr _attr = BT_GATT_ATTRIBUTE( \
80 _uuid, _perm, _read, _write, _value); \
81 _ret = bt_gatt_pool_chrc_alloc(_gp, _props, &_attr); \
82 __ASSERT_NO_MSG(!_ret); \
95#define BT_GATT_POOL_DESC(_gp, _uuid, _perm, _read, _write, _value) \
98 const struct bt_gatt_attr _descriptor = BT_GATT_DESCRIPTOR( \
99 _uuid, _perm, _read, _write, _value); \
100 _ret = bt_gatt_pool_desc_alloc(_gp, &_descriptor); \
101 __ASSERT_NO_MSG(!_ret); \
112#define BT_GATT_POOL_CCC(_gp, _ccc, _ccc_changed, _perm) \
115 _ccc = (struct _bt_gatt_ccc)BT_GATT_CCC_INITIALIZER(\
116 _ccc_changed, NULL, NULL); \
117 _ret = bt_gatt_pool_ccc_alloc(_gp, &_ccc, _perm); \
118 __ASSERT_NO_MSG(!_ret); \
130 struct bt_gatt_service
svc;
146 struct bt_uuid
const *svc_uuid);
157 struct bt_gatt_attr
const *attr);
167 struct bt_gatt_attr
const *descriptor);
179 struct _bt_gatt_ccc *ccc,
188#if CONFIG_BT_GATT_POOL_STATS != 0
191void bt_gatt_pool_stats_print(
void);
int bt_gatt_pool_chrc_alloc(struct bt_gatt_pool *gp, uint8_t props, struct bt_gatt_attr const *attr)
Take a characteristic descriptor from the pool.
int bt_gatt_pool_svc_alloc(struct bt_gatt_pool *gp, struct bt_uuid const *svc_uuid)
Take a primary service descriptor from the pool.
void bt_gatt_pool_free(struct bt_gatt_pool *gp)
Free the whole dynamically created GATT service.
int bt_gatt_pool_ccc_alloc(struct bt_gatt_pool *gp, struct _bt_gatt_ccc *ccc, uint8_t perm)
Take a CCC descriptor from the pool.
int bt_gatt_pool_desc_alloc(struct bt_gatt_pool *gp, struct bt_gatt_attr const *descriptor)
Take an attribute descriptor from the pool.
size_t attr_array_size
Definition: gatt_pool.h:132
struct bt_gatt_service svc
Definition: gatt_pool.h:130
The GATT service object that uses dynamic attribute allocation.
Definition: gatt_pool.h:128