Skip to content

Commit 3268488

Browse files
committed
micropython/bluetooth/aioble: subscribe must register the connection.
Signed-off-by: Jim Mussared <[email protected]>
1 parent 2e91b92 commit 3268488

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

micropython/bluetooth/aioble/aioble/client.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,9 @@ def _on_indicate(conn_handle, value_handle, indicate_data):
377377
# Write to the Client Characteristic Configuration to subscribe to
378378
# notify/indications for this characteristic.
379379
async def subscribe(self, notify=True, indicate=False):
380+
# Ensure that the generated notifications are dispatched in case the app
381+
# hasn't awaited on notified/indicated yet.
382+
self._register_with_connection()
380383
if cccd := await self.descriptor(bluetooth.UUID(_CCCD_UUID)):
381384
await cccd.write(struct.pack("<H", _CCCD_NOTIFY * notify + _CCCD_INDICATE * indicate))
382385
else:

0 commit comments

Comments
 (0)