kopia lustrzana https://github.com/micropython/micropython-lib
micropython/bluetooth/aioble: subscribe must register the connection.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>pull/433/head
rodzic
2e91b92413
commit
32684886ee
|
@ -377,6 +377,9 @@ class ClientCharacteristic(BaseClientCharacteristic):
|
||||||
# Write to the Client Characteristic Configuration to subscribe to
|
# Write to the Client Characteristic Configuration to subscribe to
|
||||||
# notify/indications for this characteristic.
|
# notify/indications for this characteristic.
|
||||||
async def subscribe(self, notify=True, indicate=False):
|
async def subscribe(self, notify=True, indicate=False):
|
||||||
|
# Ensure that the generated notifications are dispatched in case the app
|
||||||
|
# hasn't awaited on notified/indicated yet.
|
||||||
|
self._register_with_connection()
|
||||||
if cccd := await self.descriptor(bluetooth.UUID(_CCCD_UUID)):
|
if cccd := await self.descriptor(bluetooth.UUID(_CCCD_UUID)):
|
||||||
await cccd.write(struct.pack("<H", _CCCD_NOTIFY * notify + _CCCD_INDICATE * indicate))
|
await cccd.write(struct.pack("<H", _CCCD_NOTIFY * notify + _CCCD_INDICATE * indicate))
|
||||||
else:
|
else:
|
||||||
|
|
Ładowanie…
Reference in New Issue