nRF Connect SDK Bare Metal API 2.0.99
Loading...
Searching...
No Matches

◆ BLE_GQ_CUSTOM_DEF

#define BLE_GQ_CUSTOM_DEF ( _name,
_max_conns,
_heap_size,
_max_req_blocks )

#include <ble_gq.h>

Value:
static uint16_t CONCAT(_name, _conn_handles_arr)[] = { \
LISTIFY(_max_conns, BLE_GQ_CONN_HANDLE_INIT, (,)), \
}; \
BUILD_ASSERT(ARRAY_SIZE(CONCAT(_name, _conn_handles_arr)) == (_max_conns)); \
static uint16_t CONCAT(_name, _purge_arr)[] = { \
LISTIFY(_max_conns, BLE_GQ_PURGE_ARRAY_INIT, (,), (_max_conns)), \
}; \
BUILD_ASSERT(ARRAY_SIZE(CONCAT(_name, _purge_arr)) == (_max_conns)); \
static sys_slist_t CONCAT(_name, _req_queues)[] = { \
LISTIFY(_max_conns, BLE_GQ_REQ_QUEUE_INIT, (,), _name), \
}; \
BUILD_ASSERT(ARRAY_SIZE(CONCAT(_name, _req_queues)) == (_max_conns)); \
K_MEM_SLAB_DEFINE_STATIC(_name##_req_blocks, sizeof(struct ble_gq_req), (_max_req_blocks), \
sizeof(void *)); \
static K_HEAP_DEFINE(_name##_heap, (_heap_size)); \
static const struct ble_gq _name = { \
.max_conns = (_max_conns), \
.conn_handles = CONCAT(_name, _conn_handles_arr), \
.purge_list = CONCAT(_name, _purge_arr), \
.req_queue = (sys_slist_t *)&CONCAT(_name, _req_queues), \
.req_blocks = &CONCAT(_name, _req_blocks), \
.data_pool = &CONCAT(_name, _heap), \
}; \
NRF_SDH_BLE_OBSERVER(CONCAT(_name, _obs), ble_gq_on_ble_evt, (void *)&_name, HIGH)
void ble_gq_on_ble_evt(const ble_evt_t *ble_evt, void *ble_gq)
Bluetooth LE event handler for the GATT Queue library.
#define BLE_GQ_PURGE_ARRAY_INIT(i, _max_conns)
Helper macro for initializing purge array. Used in BLE_GQ_CUSTOM_DEF.
Definition ble_gq.h:88
#define BLE_GQ_CONN_HANDLE_INIT(i, _)
Helper macro for initializing connection handle array. Used in BLE_GQ_CUSTOM_DEF.
Definition ble_gq.h:83
#define BLE_GQ_REQ_QUEUE_INIT(i, _name)
Helper macro for initializing request queues. Used in BLE_GQ_CUSTOM_DEF.
Definition ble_gq.h:93
Structure to hold a Bluetooth LE GATT request.
Definition ble_gq.h:169
uint16_t *const conn_handles
Pointer to array with registered connection handles.
Definition ble_gq.h:246
Bluetooth LE GATT Queue.
Definition ble_gq.h:238

Macro for defining a Bluetooth LE GATT queue instance.

Parameters
_nameName of the instance.
_max_connsMaximum number of connection handles that can be registered.
_heap_sizeSize of heap used for storing additional data for write, notify and indicate operations.
_max_req_blocksMaximum number of requests that can be held at any point in time.