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
Hi, I have observed that sometimes I have some invocations of read_gatt_char/write_gatt_char that never return. So, my application freezes. Is it the expected behavior? Is there a best practice for adding a timeout to them (so, if they don't return then something like an exception is raised and the control returns to the caller)?
Thank you very much!
The text was updated successfully, but these errors were encountered:
There is no timeout capability in the dbus-next library that Bleak uses, but one could possibly use a await asyncio.wait_for(self._bus.call(...), timeout=5.0) (See Python docs) to stop waiting for a reply. I have no idea if this messes up the MessageBus that represents Bleak's connection to the DBus system which in turn communicates with BlueZ which in turn communicates with your device...
You can try it yourself by modifying in read_gatt_char and You can try it yourself by modifying in write_gatt_char. You should raise a BleakError if timeout happens and catch that in you application, instead of just returning None, though.
Try it and see if it works. Feel free to make a PR if you get it into a state that you are satified with, and we will review it!
Description
Hi, I have observed that sometimes I have some invocations of read_gatt_char/write_gatt_char that never return. So, my application freezes. Is it the expected behavior? Is there a best practice for adding a timeout to them (so, if they don't return then something like an exception is raised and the control returns to the caller)?
Thank you very much!
The text was updated successfully, but these errors were encountered: