From 32684886ee2911cbeee94daec7a86df06f2a0c58 Mon Sep 17 00:00:00 2001 From: Jim Mussared Date: Thu, 8 Jul 2021 15:12:20 +1000 Subject: [PATCH] micropython/bluetooth/aioble: subscribe must register the connection. Signed-off-by: Jim Mussared --- micropython/bluetooth/aioble/aioble/client.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/micropython/bluetooth/aioble/aioble/client.py b/micropython/bluetooth/aioble/aioble/client.py index 7e22bd7e..4f575f52 100644 --- a/micropython/bluetooth/aioble/aioble/client.py +++ b/micropython/bluetooth/aioble/aioble/client.py @@ -377,6 +377,9 @@ class ClientCharacteristic(BaseClientCharacteristic): # Write to the Client Characteristic Configuration to subscribe to # notify/indications for this characteristic. 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)): await cccd.write(struct.pack("