nRF Connect SDK Bare Metal API 2.0.99
Loading...
Searching...
No Matches
ble_qwr.h
1
18#ifndef BLE_QWR_H__
19#define BLE_QWR_H__
20
21#ifdef __cplusplus
22extern "C" {
23#endif
24
25#include <stdint.h>
26#include <stdbool.h>
27#include <ble.h>
28#include <bm/softdevice_handler/nrf_sdh_ble.h>
29
36#define BLE_QWR_DEF(_name) \
37 static struct ble_qwr _name; \
38 NRF_SDH_BLE_OBSERVER(_name##_obs, ble_qwr_on_ble_evt, &_name, HIGH)
39
40/* Error code used by the module to reject prepare write requests on non-registered attributes. */
41#define BLE_QWR_REJ_REQUEST_ERR_CODE BLE_GATT_STATUS_ATTERR_APP_BEGIN + 0
42
56
61 union {
63 struct {
65 uint16_t attr_handle;
68 struct {
70 uint16_t attr_handle;
73 struct {
75 uint32_t reason;
77 };
78};
79
80/* Forward declaration of the struct ble_qwr. */
81struct ble_qwr;
82
90typedef uint16_t (*ble_qwr_evt_handler_t)(struct ble_qwr *qwr, const struct ble_qwr_evt *evt);
91
96struct ble_qwr {
98 uint32_t initialized;
104 uint16_t conn_handle;
109#if (CONFIG_BLE_QWR_MAX_ATTR > 0)
113 uint16_t attr_handles[CONFIG_BLE_QWR_MAX_ATTR];
119 uint16_t written_attr_handles[CONFIG_BLE_QWR_MAX_ATTR];
125 ble_user_mem_block_t mem_buffer;
126#endif
127};
128
139#if (CONFIG_BLE_QWR_MAX_ATTR > 0)
141 ble_user_mem_block_t mem_buffer;
142#endif
143};
144
161uint32_t ble_qwr_init(struct ble_qwr *qwr, const struct ble_qwr_config *qwr_config);
162
177uint32_t ble_qwr_conn_handle_assign(struct ble_qwr *qwr, uint16_t conn_handle);
178
192void ble_qwr_on_ble_evt(const ble_evt_t *ble_evt, void *ble_qwr);
193
194#if (CONFIG_BLE_QWR_MAX_ATTR > 0)
209uint32_t ble_qwr_attr_register(struct ble_qwr *qwr, uint16_t attr_handle);
210
227uint32_t ble_qwr_value_get(struct ble_qwr *qwr, uint16_t attr_handle, uint8_t *mem, uint16_t *len);
228#endif /* (CONFIG_BLE_QWR_MAX_ATTR > 0) */
229
230#ifdef __cplusplus
231}
232#endif
233
234#endif /* BLE_QWR_H__ */
235
uint16_t(* ble_qwr_evt_handler_t)(struct ble_qwr *qwr, const struct ble_qwr_evt *evt)
Queued Writes module event handler type.
Definition ble_qwr.h:90
uint32_t ble_qwr_attr_register(struct ble_qwr *qwr, uint16_t attr_handle)
Function for registering an attribute with the Queued Writes module.
uint32_t ble_qwr_conn_handle_assign(struct ble_qwr *qwr, uint16_t conn_handle)
Function for assigning a connection handle to an instance of the Queued Writes module.
uint32_t ble_qwr_init(struct ble_qwr *qwr, const struct ble_qwr_config *qwr_config)
Function for initializing the Queued Writes module.
ble_qwr_evt_type
Queued Writes module event types.
Definition ble_qwr.h:44
@ BLE_QWR_EVT_AUTH_REQUEST
Definition ble_qwr.h:52
@ BLE_QWR_EVT_ERROR
Definition ble_qwr.h:54
@ BLE_QWR_EVT_EXECUTE_WRITE
Definition ble_qwr.h:48
uint32_t ble_qwr_value_get(struct ble_qwr *qwr, uint16_t attr_handle, uint8_t *mem, uint16_t *len)
Function for retrieving the received data for a given attribute.
void ble_qwr_on_ble_evt(const ble_evt_t *ble_evt, void *ble_qwr)
Bluetooth LE event handler for the Queued Writes module.
ble_qwr_evt_handler_t evt_handler
Definition ble_qwr.h:138
ble_user_mem_block_t mem_buffer
Definition ble_qwr.h:141
Queued Writes init structure.
Definition ble_qwr.h:134
struct ble_qwr_evt::@18::@20 exec_write
struct ble_qwr_evt::@18::@22 error
uint32_t reason
Definition ble_qwr.h:75
enum ble_qwr_evt_type evt_type
Definition ble_qwr.h:60
struct ble_qwr_evt::@18::@21 auth_req
uint16_t attr_handle
Definition ble_qwr.h:65
Queued Writes module events.
Definition ble_qwr.h:58
uint16_t conn_handle
Definition ble_qwr.h:104
uint16_t attr_handles[1]
Definition ble_qwr.h:113
uint32_t initialized
Definition ble_qwr.h:98
bool is_user_mem_reply_pending
Definition ble_qwr.h:108
uint8_t nb_written_handles
Definition ble_qwr.h:123
uint8_t nb_registered_attr
Definition ble_qwr.h:115
uint16_t written_attr_handles[1]
Definition ble_qwr.h:119
ble_qwr_evt_handler_t evt_handler
Definition ble_qwr.h:102
ble_user_mem_block_t mem_buffer
Definition ble_qwr.h:125
Queued Writes structure.
Definition ble_qwr.h:96