Skip to content

Commit 3af2e32

Browse files
doc: nrf-bm: lib: bluetooth: add documentation for queued writes
Add documentation for BLE queued writes library. Signed-off-by: Eivind Jølsgard <[email protected]>
1 parent e2641ff commit 3af2e32

File tree

4 files changed

+74
-0
lines changed

4 files changed

+74
-0
lines changed

doc/nrf-bm/api/api.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,8 @@ Peer Manager library
123123
:inner:
124124
:members:
125125

126+
.. _api_queued_writes:
127+
126128
Queued Writes module
127129
====================
128130

doc/nrf-bm/doxygen/nrf-bm.doxyfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2401,6 +2401,7 @@ INCLUDE_FILE_PATTERNS =
24012401
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
24022402

24032403
PREDEFINED = __DOXYGEN__ \
2404+
CONFIG_BLE_QWR_MAX_ATTR=1 \
24042405

24052406
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
24062407
# tag can be used to specify a list of macro names that should be expanded. The
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
.. _lib_ble_queued_writes:
2+
3+
Bluetooth: Queued Writes
4+
########################
5+
6+
.. contents::
7+
:local:
8+
:depth: 2
9+
10+
The Bluetooth LE Queued Writes (QWR) library provides an implementation of the Queued Writes feature, allowing data to be written over multiple commands.
11+
This is particularly useful for writing attribute values that exceed the length of a single packet.
12+
13+
Overview
14+
********
15+
16+
Writing to a GATT characteristic can be done in a single write command or in a series of commands.
17+
Splitting the write operation into several commands allows for writing attribute values that are longer than a single packet.
18+
Such a series of write commands, called a Queued Write operation, involves multiple Prepare Write commands followed by a single Execute Write command.
19+
20+
The Queued Writes library provides an implementation of Queued Writes using the Generic Attribute Profile (GATT) Server interface of the SoftDevice.
21+
Add this module to your GATT server implementation to enable support for Queued Writes for some or all of the characteristics.
22+
A GATT client can then write to these characteristics using a series of commands.
23+
24+
Configuration
25+
*************
26+
27+
The library is enabled and configured using the Kconfig system.
28+
Set the :kconfig:option:`CONFIG_BLE_QWR` Kconfig option to enable the library.
29+
30+
The :kconfig:option:`CONFIG_BLE_QWR_MAX_ATTR` Kconfig option sets the maximum number of attributes that can be handled by the Queued Writes library.
31+
Setting this to zero disables all Queued Write operations.
32+
33+
Initialization
34+
==============
35+
36+
To initialize an instance of the module, call the :c:func:`ble_qwr_init` function.
37+
38+
You must provide a configuration structure that includes an event handler and a data buffer.
39+
Without a buffer, the library cannot store received data and will reject Queued Writes requests.
40+
41+
After initialization, call the :c:func:`ble_qwr_attr_register` function repeatedly to register each characteristic attribute for which you want to enable Queued Writes.
42+
Attributes are identified by their handles.
43+
44+
Usage
45+
*****
46+
47+
The library uses a callback function to handle write authorization.
48+
When it receives an Execute Write request, it calls the callback function with a :c:enum:`BLE_QWR_EVT_AUTH_REQUEST` event to determine whether the request should be accepted:
49+
50+
* To authorize the request, the callback function must return :c:macro:`BLE_GATT_STATUS_SUCCESS`.
51+
The module then writes all received data and notifies the GATT server that the data is ready to use by calling the callback function again, this time with a :c:enum:`BLE_QWR_EVT_EXECUTE_WRITE` event.
52+
* To reject the request (for example, because the received data is not valid or the application is busy), the callback function must return a BLE GATT status code other than :c:macro:`BLE_GATT_STATUS_SUCCESS`.
53+
The module then deletes the received data.
54+
55+
Dependencies
56+
************
57+
58+
This library uses the following |BMshort| libraries:
59+
60+
* SoftDevice - :kconfig:option:`CONFIG_SOFTDEVICE`
61+
* SoftDevice handler - :kconfig:option:`CONFIG_NRF_SDH`
62+
63+
API documentation
64+
*****************
65+
66+
| Header file: :file:`include/bm/bluetooth/ble_qwr.h`
67+
| Source files: :file:`lib/bluetooth/ble_qwr/`
68+
69+
:ref:`Bluetooth LE Queued Writes library API reference <api_queued_writes>`

doc/nrf-bm/release_notes/release_notes_changelog.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,5 +139,7 @@ Documentation
139139
* Added documentation for the :ref:`lib_bm_buttons` library.
140140
* Added documentation for the :ref:`lib_bm_timer` library.
141141
* Added documentation for the :ref:`lib_ble_adv` library.
142+
* Added documentation for the :ref:`lib_ble_queued_writes` library.
142143
* Added documentation for the :ref:`lib_event_scheduler` library.
143144
* Added documentation for the :ref:`lib_sensorsim` library.
145+
* Added documentation for the :ref:`lib_ble_queued_writes` library.

0 commit comments

Comments
 (0)