Missing manual? - GAP Central connecting to multiple peripherals.
BLE at the wrong end of a learning curve and trying to piece things together.
Perhaps I could just give a rough outline of the project. I want a Linux device to listen for advertisements from a particular BLE sensor and connect to those sensors, as and when they appear. Once connected, the Linux device can send commands to the sensor, to turn on/off an LED or request sensor data from each of the connected sensors.
The Linux kernel is 4.15 is an Ubuntu 16.04 based system.
I was looking at the latest bluez-5.50 doc directory but didn't see a file for gap.txt, but adapter-api.txt looks like the API I'm looking for.
I'm trying to do this from Python, so currently thinking of using DBus interface, another learning curve to address.
So after all that a specific bluex questions. I'm missing things, and possibly incorrectly assuming that I need a certain kernel specified for bluez5.50, but can't see any mention of versions of bluez relating to versions of kernel.
Secondly bluez-5.50 appears to be building an applicaiton, so I assume that application has to be running to interface to Linux Kernel bluetooth stack and handle the DBus API. So bluez should be a system service just started on powerup?
Thanks for any help, I get the impression that this list is predominately for guts of the Linux Kernel's bluetooth stack, but user side list is hard to find.
Thanks again
John
Hello John,
There are various Python examples available in the tree under the test directory:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test
There are a number of Python libraries that have been implemented to help with what you are looking to do.
There is a list of some of them at:
https://github.com/ukBaz/python-bluezero/wiki
I hope that helps.
Regards,
Barry
Quoted 33 lines · John Whitmore
BLE at the wrong end of a learning curve and trying to piece things together.
Perhaps I could just give a rough outline of the project. I want a Linux device to listen for advertisements from a particular BLE sensor and connect to those sensors, as and when they appear. Once connected, the Linux device can send commands to the sensor, to turn on/off an LED or request sensor data from each of the connected sensors.
The Linux kernel is 4.15 is an Ubuntu 16.04 based system.
I was looking at the latest bluez-5.50 doc directory but didn't see a file for gap.txt, but adapter-api.txt looks like the API I'm looking for.
I'm trying to do this from Python, so currently thinking of using DBus interface, another learning curve to address.
So after all that a specific bluex questions. I'm missing things, and possibly incorrectly assuming that I need a certain kernel specified for bluez5.50, but can't see any mention of versions of bluez relating to versions of kernel.
Secondly bluez-5.50 appears to be building an applicaiton, so I assume that application has to be running to interface to Linux Kernel bluetooth stack and handle the DBus API. So bluez should be a system service just started on powerup?
Thanks for any help, I get the impression that this list is predominately for guts of the Linux Kernel's bluetooth stack, but user side list is hard to find.
Thanks again
John
Quoted 11 lines · Barry Byford
Hello John,
There are various Python examples available in the tree under the test directory:
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/testThere are a number of Python libraries that have been implemented to help with what you are looking to do.
There is a list of some of them at:
https://github.com/ukBaz/python-bluezero/wiki
Quoted 5 lines
I hope that helps.
Regards,
Barry
Thanks a million Barry, yes a great help.
I have used bluepy library to interface to the BTLE Devices but that has proved unreliable at best. I'm not sure where the problems lie but basically sometimes to connect I have to disconnect the USB BT Dongle and re-insert it to get BlurTooth to work. I can scan and find the devices I'm looking for but as soon as a connection is attempted I just get a null return from the connection function. At present that means that bluetooth is not ready for production on the linux device we're using. I'll try get the device into that state and try connect with command line tools, just in case it gives some indicaiton of what the problem actually is. At present there's no indication.
I'm sort of hoping that this is an issue with bluepy and I'll move to another interface and see if that makes this any more reliable. It's for an LE sensor for IoT in a production line, so unreliable is worst then useless.
Thanks again for your help
John