-
Notifications
You must be signed in to change notification settings - Fork 21
doc: nrf-bm: lib: bluetooth: add documentation for queued writes #416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
eivindj-nordic
wants to merge
1
commit into
nrfconnect:main
Choose a base branch
from
eivindj-nordic:doc_qwr
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| .. _lib_ble_queued_writes: | ||
|
|
||
| Bluetooth: Queued Writes | ||
| ######################## | ||
|
|
||
| .. contents:: | ||
| :local: | ||
| :depth: 2 | ||
|
|
||
| The Bluetooth Low Energy® Queued Writes (QWR) library provides an implementation of Queued Writes. | ||
|
|
||
| Overview | ||
| ******** | ||
|
|
||
| Writing to a GATT characteristic can be done in a single write command or in a series of commands. | ||
| Splitting the write operation into several commands makes it possible to write attribute values that are longer than a single packet. | ||
| Such a series of write commands, called a Queued Write operation, consists of multiple Prepare Write commands followed by one Execute Write command. | ||
|
|
||
| The Queued Writes module provides an implementation of Queued Writes, using the Generic Attribute Profile (GATT) Server interface of the SoftDevice. | ||
| Add this module to your GATT server implementation to enable support for Queued Writes for some or all of the characteristics. | ||
| A GATT client can then write to these characteristics using a series of commands. | ||
|
|
||
| Configuration | ||
| ************* | ||
|
|
||
| The library is enabled and configured using the Kconfig system. | ||
| Set the :kconfig:option:`CONFIG_BLE_QWR` Kconfig option to enable the library. | ||
|
|
||
| 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. | ||
| If the :kconfig:option:`CONFIG_BLE_QWR_MAX_ATTR` Kconfig option is set to zero, all Queued Write operation requests will be rejected by the library. | ||
|
|
||
| Initialization | ||
| ============== | ||
|
|
||
| To initialize an instance of the module, call the :c:func:`ble_qwr_init` function. | ||
| You must provide a configuration structure that minimum contains an event handler. | ||
| For supporting Queued Writes operations, a buffer for storing the received data must be provided as part of the configuration. | ||
| If the buffer is not provided, the library will reject all Queued Writes requests. | ||
| Next, call the :c:func:`ble_qwr_attr_register` function repeatedly to register each characteristic attribute for which you want to enable Queued Writes. | ||
| Attributes are identified by their handles. | ||
|
|
||
| Usage | ||
| ***** | ||
|
|
||
| The callback function is used to authorize the write requests. | ||
| When the module 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: | ||
|
|
||
| * To authorize the request, the callback function must return :c:macro:`BLE_GATT_STATUS_SUCCESS`. | ||
| 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. | ||
| * 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`. | ||
| The module then deletes the received data. | ||
|
|
||
| Dependencies | ||
| ************ | ||
|
|
||
| This library uses the following |BMshort| libraries: | ||
|
|
||
| * SoftDevice - :kconfig:option:`CONFIG_SOFTDEVICE` | ||
| * SoftDevice handler - :kconfig:option:`CONFIG_NRF_SDH` | ||
|
|
||
| API documentation | ||
| ***************** | ||
|
|
||
| | Header file: :file:`include/bm/bluetooth/ble_qwr.h` | ||
| | Source files: :file:`lib/bluetooth/ble_qwr/` | ||
|
|
||
| :ref:`Bluetooth LE Queued Writes library API reference <api_queued_writes>` | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.