Skip to content

Commit 9169ca6

Browse files
committed
aioble: Add support for write-with-update.
This allows a server to write a characteristic and automatically notify/indicate all subscribed clients. Signed-off-by: Jim Mussared <[email protected]>
1 parent dc03b4a commit 9169ca6

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

micropython/bluetooth/aioble/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ aioble
33

44
This library provides an object-oriented, asyncio-based wrapper for MicroPython's [ubluetooth](https://docs.micropython.org/en/latest/library/ubluetooth.html) API.
55

6-
**Note**: aioble requires MicroPython v1.15 or higher.
6+
**Note**: aioble requires MicroPython v1.17 or higher.
77

88
Features
99
--------

micropython/bluetooth/aioble/aioble/server.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,12 @@ def read(self):
8888
else:
8989
return ble.gatts_read(self._value_handle)
9090

91-
# Write value to local db.
92-
def write(self, data):
91+
# Write value to local db, and optionally notify/indicate subscribers.
92+
def write(self, data, send_update=False):
9393
if self._value_handle is None:
9494
self._initial = data
9595
else:
96-
ble.gatts_write(self._value_handle, data)
96+
ble.gatts_write(self._value_handle, data, send_update)
9797

9898
# Wait for a write on this characteristic. Returns the connection that did
9999
# the write, or a tuple of (connection, value) if capture is enabled for

0 commit comments

Comments
 (0)