Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using threads to connect to mutliple devices at the same time. #325

Open
mat-moten opened this issue May 26, 2021 · 0 comments
Open

Using threads to connect to mutliple devices at the same time. #325

mat-moten opened this issue May 26, 2021 · 0 comments

Comments

@mat-moten
Copy link

Hi. I'm building an application on windows using PyQt5 which needs to connect to multiple BLE devices

Right now i'm using a basic "for loop" to both connect and send commands to my devices. it's works as intented but it could be optimized by using threads to connect to all the devices asynchronously.

but when i try to connect to my devices using threads both with pure python and the QThread class), i get this timeout error starting at the second device.

pygatt.backends.bgapi.exceptions.ExpectedResponseTimeout: Timed out after 1.000000s waiting for [<ResponsePacketType.sm_set_bondable_mode: 51>]

i'm wondering if this is even possible to do. My understanding is that my instance of the BGAPIBLEDevice could be "busy" connecting to the first device, thus locking the instance until it's finished.

when i put more than 1 second of sleep between my threads start, i don't get this error. it's useless but it serves my point.

Maybe i'm doing something wrong. what is your knowledge on this subject?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant