aboutsummaryrefslogtreecommitdiff
path: root/docs/library/bluetooth.rst
diff options
context:
space:
mode:
authorJim Mussared <jim.mussared@gmail.com>2021-07-23 15:12:26 +1000
committerDamien George <damien@micropython.org>2021-08-14 22:21:55 +1000
commit1d9e489af3d00d737917b09c1f0d007705e970e9 (patch)
treeaccb081390ddda3bc2c9a36579480f0921934dbf /docs/library/bluetooth.rst
parent5733c49174a200b59196f44377a1418a6c38c877 (diff)
extmod/modbluetooth: Add send_update arg to gatts_write.
This allows the write to trigger a notification or indication, but only to subscribed clients. This is different to gatts_notify/gatts_indicate, which will unconditionally notify/indicate. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'docs/library/bluetooth.rst')
-rw-r--r--docs/library/bluetooth.rst19
1 files changed, 13 insertions, 6 deletions
diff --git a/docs/library/bluetooth.rst b/docs/library/bluetooth.rst
index f110bfb19..7ab4d6e88 100644
--- a/docs/library/bluetooth.rst
+++ b/docs/library/bluetooth.rst
@@ -485,10 +485,14 @@ writes from a client to a given characteristic, use
Reads the local value for this handle (which has either been written by
:meth:`gatts_write <BLE.gatts_write>` or by a remote client).
-.. method:: BLE.gatts_write(value_handle, data, /)
+.. method:: BLE.gatts_write(value_handle, data, send_update=False, /)
Writes the local value for this handle, which can be read by a client.
+ If *send_update* is ``True``, then any subscribed clients will be notified
+ (or indicated, depending on what they're subscribed to and which operations
+ the characteristic supports) about this write.
+
.. method:: BLE.gatts_notify(conn_handle, value_handle, data=None, /)
Sends a notification request to a connected client.
@@ -499,17 +503,20 @@ writes from a client to a given characteristic, use
Otherwise, if *data* is ``None``, then the current local value (as
set with :meth:`gatts_write <BLE.gatts_write>`) will be sent.
-.. method:: BLE.gatts_indicate(conn_handle, value_handle, /)
+ **Note:** The notification will be sent regardless of the subscription
+ status of the client to this characteristic.
- Sends an indication request to a connected client.
+.. method:: BLE.gatts_indicate(conn_handle, value_handle, /)
- **Note:** This does not currently support sending a custom value, it will
- always send the current local value (as set with :meth:`gatts_write
- <BLE.gatts_write>`).
+ Sends an indication request containing the characteristic's current value to
+ a connected client.
On acknowledgment (or failure, e.g. timeout), the
``_IRQ_GATTS_INDICATE_DONE`` event will be raised.
+ **Note:** The indication will be sent regardless of the subscription
+ status of the client to this characteristic.
+
.. method:: BLE.gatts_set_buffer(value_handle, len, append=False, /)
Sets the internal buffer size for a value in bytes. This will limit the