Module for handling Queued Write operations.
More...
Module for handling Queued Write operations.
This module handles prepare write, execute write, and cancel write commands. It also manages memory requests related to these operations.
- Note
- The application must propagate BLE stack events to this module by calling nrf_ble_qwr_on_ble_evt().
#define NRF_BLE_QWR_DEF |
( |
|
_name | ) |
|
Macro for defining a nrf_ble_qwr instance.
- Parameters
-
_name | Name of the instance. |
#define NRF_BLE_QWRS_DEF |
( |
|
_name, |
|
|
|
_cnt |
|
) |
| |
Macro for defining an array of nrf_ble_qwr instance.
- Parameters
-
_name | Name of the array. |
_cnt | Size of the array. |
Queued Writes structure.
This structure contains status information for the Queued Writes module.
Queued Writes module event types.
Enumerator |
---|
NRF_BLE_QWR_EVT_EXECUTE_WRITE |
Event that indicates that an execute write command was received for a registered handle and that the received data was actually written and is now ready.
|
NRF_BLE_QWR_EVT_AUTH_REQUEST |
Event that indicates that an execute write command was received for a registered handle and that the write request must now be accepted or rejected.
|
Function for registering an attribute with the Queued Writes module.
Call this function for each attribute that you want to enable for Queued Writes (thus a series of prepare write and execute write operations).
- Parameters
-
[in] | p_qwr | Queued Writes structure. |
[in] | attr_handle | Handle of the attribute to register. |
- Return values
-
NRF_SUCCESS | If the registration was successful. |
NRF_ERROR_NO_MEM | If no more memory is available to add this registration. |
NRF_ERROR_NULL | If any of the given pointers is NULL. |
NRF_ERROR_INVALID_STATE | If the given context has not been initialized. |
Function for assigning a connection handle to a given instance of the Queued Writes module.
Call this function when a link with a peer has been established to associate this link to the instance of the module. This makes it possible to handle several links and associate each link to a particular instance of this module.
- Parameters
-
[in] | p_qwr | Queued Writes structure. |
[in] | conn_handle | Connection handle to be associated with the given Queued Writes instance. |
- Return values
-
NRF_SUCCESS | If the assignment was successful. |
NRF_ERROR_NULL | If any of the given pointers is NULL. |
NRF_ERROR_INVALID_STATE | If the given context has not been initialized. |
Function for initializing the Queued Writes module.
Call this function in the main entry of your application to initialize the Queued Writes module. It must be called only once with a given Queued Writes structure.
- Parameters
-
[out] | p_qwr | Queued Writes structure. This structure must be supplied by the application. It is initialized by this function and is later used to identify the particular Queued Writes instance. |
[in] | p_qwr_init | Initialization structure. |
- Return values
-
NRF_SUCCESS | If the Queued Writes module was initialized successfully. |
NRF_ERROR_NULL | If any of the given pointers is NULL. |
NRF_ERROR_INVALID_STATE | If the given context has already been initialized. |
void nrf_ble_qwr_on_ble_evt |
( |
ble_evt_t const * |
p_ble_evt, |
|
|
void * |
p_context |
|
) |
| |
Function for handling BLE stack events.
Handles all events from the BLE stack that are of interest to the Queued Writes module.
- Parameters
-
[in] | p_ble_evt | Event received from the BLE stack. |
[in] | p_context | Queued Writes structure. |
ret_code_t nrf_ble_qwr_value_get |
( |
nrf_ble_qwr_t * |
p_qwr, |
|
|
uint16_t |
attr_handle, |
|
|
uint8_t * |
p_mem, |
|
|
uint16_t * |
p_len |
|
) |
| |
Function for retrieving the received data for a given attribute.
Call this function after receiving an NRF_BLE_QWR_EVT_AUTH_REQUEST event to retrieve a linear copy of the data that was received for the given attribute.
- Parameters
-
[in] | p_qwr | Queued Writes structure. |
[in] | attr_handle | Handle of the attribute. |
[out] | p_mem | Pointer to the application buffer where the received data will be copied. |
[in,out] | p_len | Input: length of the input buffer. Output: length of the received data. |
- Return values
-
NRF_SUCCESS | If the data was retrieved and stored successfully. |
NRF_ERROR_NO_MEM | If the provided buffer was smaller than the received data. |
NRF_ERROR_NULL | If any of the given pointers is NULL. |
NRF_ERROR_INVALID_STATE | If the given context has not been initialized. |