Skip to content

Commit b9e7feb

Browse files
committed
aioble/server: Guard _indicate_done against non-indicate characteristics
Early-return with a warning if the BLE stack fires an indication-done callback for a characteristic that doesn't have the indicate flag set.
1 parent 916b9e1 commit b9e7feb

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

micropython/bluetooth/aioble/aioble/server.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,9 @@ async def indicate(self, connection, data=None, timeout_ms=1000):
279279

280280
def _indicate_done(conn_handle, value_handle, status):
281281
if characteristic := _registered_characteristics.get(value_handle, None):
282+
if not (characteristic.flags & _FLAG_INDICATE):
283+
log_warn("Received indication on unexpected characteristic:", value_handle)
284+
return
282285
if connection := DeviceConnection._connected.get(conn_handle, None):
283286
if not characteristic._indicate_connection:
284287
# Timeout.

0 commit comments

Comments
 (0)