kopia lustrzana https://github.com/micropython/micropython-lib
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 <jim.mussared@gmail.com>pull/459/head
rodzic
dc03b4af4d
commit
9169ca6543
|
@ -3,7 +3,7 @@ aioble
|
|||
|
||||
This library provides an object-oriented, asyncio-based wrapper for MicroPython's [ubluetooth](https://docs.micropython.org/en/latest/library/ubluetooth.html) API.
|
||||
|
||||
**Note**: aioble requires MicroPython v1.15 or higher.
|
||||
**Note**: aioble requires MicroPython v1.17 or higher.
|
||||
|
||||
Features
|
||||
--------
|
||||
|
|
|
@ -88,12 +88,12 @@ class BaseCharacteristic:
|
|||
else:
|
||||
return ble.gatts_read(self._value_handle)
|
||||
|
||||
# Write value to local db.
|
||||
def write(self, data):
|
||||
# Write value to local db, and optionally notify/indicate subscribers.
|
||||
def write(self, data, send_update=False):
|
||||
if self._value_handle is None:
|
||||
self._initial = data
|
||||
else:
|
||||
ble.gatts_write(self._value_handle, data)
|
||||
ble.gatts_write(self._value_handle, data, send_update)
|
||||
|
||||
# Wait for a write on this characteristic. Returns the connection that did
|
||||
# the write, or a tuple of (connection, value) if capture is enabled for
|
||||
|
|
Ładowanie…
Reference in New Issue