You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm unable to close a connection to a client without a timeout.
What I Did
I Connect to a ESP32 with a BLE Server running the "standard" UART Characteristic. Even just connecting and then trying to disconnect causes this behavior.
I tried several methods, all end in a timeout error.
Traceback (most recent call last):
File "XXX/BLEHelp.py", line 475, in <module>
asyncio.run(main(address))
File "C:\Users\XXX\AppData\Local\Programs\Python\Python38\lib\asyncio\runners.py", line 43, in run
return loop.run_until_complete(main)
File "C:\Users\XXX\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete
return future.result()
File "XXX/BLEHelp.py", line 473, in main
await client.disconnect()
File "C:\Users\XXX\AppData\Local\Programs\Python\Python38\lib\site-packages\bleak\backends\winrt\client.py", line 313, in disconnect
await asyncio.wait_for(event.wait(), timeout=10)
File "C:\Users\XXX\AppData\Local\Programs\Python\Python38\lib\asyncio\tasks.py", line 490, in wait_for
raise exceptions.TimeoutError()
asyncio.exceptions.TimeoutError
Update
it seems to work more or less reliably when connecting after being connected for longer periods of time.
it never works if I connect and then disconnect only a few seconds later
The text was updated successfully, but these errors were encountered:
I've noticed this recently too. I think we just need to extend the default timeout value to 30 seconds or so.
For background, Windows doesn't actually let us tell the device to disconnect. We can only say that we aren't using it any more and it is up to the OS to decide when to actually disconnect.
This changes the disconnect timeout on the WinRT backend to 120s.
Sometimes it can take up to a minute for Windows to actually close
the GATT session/disconnect the device. This behavior is also seen
in other apps, like WebBluetooth in Chrome. Furthermore, the device
remains connected even after the app is closed, so clearly this is
an issue with the Windows Bluetooth stack and not something that
can be fixed in userspace code.
Fixes#807.
Description
I'm unable to close a connection to a client without a timeout.
What I Did
I Connect to a ESP32 with a BLE Server running the "standard" UART Characteristic. Even just connecting and then trying to disconnect causes this behavior.
I tried several methods, all end in a timeout error.
I've used the example code from this documentation: https://buildmedia.readthedocs.org/media/pdf/bleak/stable/bleak.pdf Page 10
causes this
Update
it seems to work more or less reliably when connecting after being connected for longer periods of time.
it never works if I connect and then disconnect only a few seconds later
The text was updated successfully, but these errors were encountered: