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

Problem connecting to BLE devices with Windows #70

Closed
corentinbettiol opened this issue Jun 5, 2019 · 5 comments
Closed

Problem connecting to BLE devices with Windows #70

corentinbettiol opened this issue Jun 5, 2019 · 5 comments
Assignees
Labels
Backend: pythonnet Issues or PRs relating to the .NET/pythonnet backend enhancement New feature or request

Comments

@corentinbettiol
Copy link

corentinbettiol commented Jun 5, 2019

  • bleak version: 0.4.2
  • Python version: 3.7.3
  • Operating System: Windows 10

Description

On linux (backends/bluezdbus/client.py), connect() function uses discover() with a timeout : await discover(timeout=0.1, loop=self.loop) (here).

On windows (backends/dotnet/client.py), connect() function uses discover() with a defined value: devices = await discover(2.0, loop=self.loop) (here), which leads to random errors due to the fact that Windows is unable to discover the device to connect to within 2 seconds.

Since discover() has a timeout var, it can be good to use timeout=2.0 instead of 2.0 in client.py, so developers can adapt the value without having to manually change Bleak.

@hbldh hbldh self-assigned this Jun 5, 2019
@hbldh hbldh added the enhancement New feature or request label Jun 5, 2019
@hbldh
Copy link
Owner

hbldh commented Jun 5, 2019

Thank you for your ideas. I agree, I have thought about this as well. My initial idea had been to not have any keyword argument at all for the connect method, but I think I might have to reconsider this.
I will probably make a temporary fix in version 0.4.3 to give users the configurability you ask for, but I have an idea for a more permanent solution which requires a lot more time to develop; time I do not have right now I am afraid. I will get back to you here when I have made some modifications and/or plans.

hbldh added a commit that referenced this issue Jun 5, 2019
@corentinbettiol
Copy link
Author

corentinbettiol commented Jun 6, 2019

Thank you for your quick answer, I will look at v0.4.3 when it will be available :)

@hbldh hbldh added the Backend: pythonnet Issues or PRs relating to the .NET/pythonnet backend label Jun 24, 2019
@hbldh hbldh closed this as completed in 9aebbb2 Jun 30, 2019
@hbldh
Copy link
Owner

hbldh commented Jul 1, 2019

Released 0.4.3 yesterday. Timeout keyword is now available in both BlueZ and .NET backend.

@pneumus
Copy link

pneumus commented Sep 7, 2019

I have a similar problem.
Windows 10 + Python 3.7 + bleak
I can not even import BleakClient from bleak
I also tried bleson with no result...
I can only discover / scan / list nearby devices but unable to connect.

Any idea?

@hbldh
Copy link
Owner

hbldh commented Sep 7, 2019

@sonus89 please create a new issue and add code and traceback of errors there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Backend: pythonnet Issues or PRs relating to the .NET/pythonnet backend enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants