Windows - irregular connection timing #459
Unanswered
Nilsandren
asked this question in
Q&A
Replies: 1 comment 6 replies
-
There are multiple reports of this, and I haven't been able to discern why or remedy it. Could you please add some more logging in the
This is an example from my usage of Bleak in Windows:
My TI SensorTag is discovered quickly, connected to quickly and services are resolved quickly (I think they were cached in Windows here though). Though I think the Sensortag is programmed to be "an active BLE peripheral"... FWIW, Bleak is not the only one that feels the effects of this: https://docs.microsoft.com/en-us/answers/questions/39802/windows-ble-scanning-interval-issue.html |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi!
I am using bleak (latest stable) for windows and nordic devices as peripherals. The peripheral has a 3 second advertising interval. I have a problem with connection timeouts (sometimes I managed to connect to the peripheral, but sometimes it got a timeout for a few tries in a row). In my code, I will try to connect multiple times.
I found this reported issue #350, and tried to play around with the timeout mentioned there in the file bleak/bleak/backends/dotnet/client.py :
await asyncio.wait_for(event.wait(), timeout=10)
Using the default of 10 seconds, I would say that the success rate of connecting to the peripheral is about 1 out of 4-5 times. When Increasing this value to around 30 seconds the success rate is about 4 out of 5 times. However, I can't seem to find any pattern in the time it takes to connect to the device (it could be anything between 2 seconds to 30 seconds).
Do anyone have any advise on how to further investigate why time to connect is varying this much? Is the backend perhaps retrying multiple times? I have debug log activated but nothing is logged between connection attempt until success:
2021-02-22 13:48:16,610 DEBUG Connecting to BLE device @ DF:DB:08:20:5D:F7
2021-02-22 13:48:39,346 DEBUG _ConnectionStatusChanged_Handler: 1
I wasn't sure if this should be reported as an issue or not, but I thought it could be more fitting here. When using an iphone or android the connection time is much quicker and more consistent.
bleak version: 0.10.0
Python version: 3.7.8
Operating System: Win10
Beta Was this translation helpful? Give feedback.
All reactions