adafruit / Adafruit_CircuitPython_BLE

Bluetooth Low Energy (BLE) library for CircuitPython
MIT License
127 stars 58 forks source link

Hang when disconnecting quickly #24

Closed kattni closed 4 years ago

kattni commented 5 years ago

When one side of the connection disconnects abruptly, the code can hang with the following error:

Traceback (most recent call last):
  File "code.py", line 25, in <module>
  File "adafruit_ble/uart_server.py", line 142, in write
OSError: Failed to read CCCD value, err 0x3002

Requires soft reset to continue.

Mentioned to @dhalbert who suggested filing an issue here, though it is still unclear whether or not this should be handled within this library or within CircuitPython itself.

kattni commented 5 years ago

I walked away from the CPB with my mobile, and received a similar but slightly different error:

Traceback (most recent call last):
  File "code.py", line 28, in <module>
  File "adafruit_ble/uart_server.py", line 142, in write
OSError: Failed to notify or indicate attribute value, err 0x3002

Including here so we can cover all the bases necessary when including a fix for this.

dhalbert commented 4 years ago

Not seen with reworked code and API.