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

Bluetooth connection requirements #5

Closed
agricolab opened this issue Jul 17, 2019 · 3 comments
Closed

Bluetooth connection requirements #5

agricolab opened this issue Jul 17, 2019 · 3 comments

Comments

@agricolab
Copy link

I am currently streaming various vernier godirect devices over USB. I noticed that i am able to connect and receive data also via Bluetooth using "Graphical Analysis", but fail to do so over the python library. The documentation clearly says:

For wireless Bluetooth® connection, the Python code requires a Bluegiga BLED112 Bluetooth® Low Energy Dongle

https://www.vernier.com/support/sensor-requirements/?sensor=gdx-hd&platform=Python

Point is, i am facing some deliverability issues with the BLED112 dongles. Is my assumption correct that the hardware dependency is because godirect-py depends on vernierpygatt which in turn depends on gatttool, which has limited support and so we can only use the Bluegiga BLED112 Bluetooth® Low Energy Dongle? If so, can you support me with any hints for possible workarounds?
Thanks.

@stocktonkincade
Copy link
Contributor

Our implementation relies on vernierpygatt, which is just our own version of the pygatt module. That module only works with the Bluegiga BLED112 Bluetooth® Low Energy Dongle on Windows and Mac. That dongle is also supported on Linux. The BGAPI is the default backend used by pygatt.

However, on Linux only, the pygatt module also provides an alternative backend for GATTTOOL. This requires a system which supports BlueZ. So, it is possible to use a system stack radio with pygatt on Linux. However, for simplicity, the godirect-py module is currently hard-coded to use the BGAPI backend, rather than the GATTTOOL backend. While we would like to change that, we have not yet done that for any Lunux distros. You might be able to beat us to it.

We are also interested in delivering a solution that would allow the use of system BLE stacks on Mac and Windows platforms, but have not yet been able to devote the resources.

@agricolab
Copy link
Author

agricolab commented Jul 29, 2019

Great, thanks for the feedback. I was researching the current infrastructure, and found Bleak at https://github.com/hbldh/bleak

As it stands, i am able to connect with a GDX-RB over bluetooth using bleak and a non-BLED112 dongle, and receive some information about the device on Python 3 / Win10. Will look further in the course of the next days about how to interface for data access.

@stocktonkincade
Copy link
Contributor

As of godirect-py v1.0.5, we have implemented the bleak backend. This allows BLE connectivity through the native BLE stack/radio on Windows only. To enable:

  • install bleak:

pip3 install bleak

  • upgrade to the 1.0.5 version of godirect-py:

pip3 install --upgrade godirect

How it works

This init detects that the bleak module, it will attempt to use the bleak backend. Otherwise, it will continue to fall through to the Bluegiga radio. So, the following will default to the native BLE stack, if bleak is installed:
godirect.__init__(use_ble=True, use_usb=False)

You can override the native BLE stack and always use the Bluegiga backend by calling:
godirect.__init__(use_ble=True, use_ble_bg=True, use_usb=False)

We hope to deliver future releases that also support Linux and Mac platforms. See issue #9 and #10.

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

2 participants