Closed aleksmarcelo closed 4 years ago
The BlueZ DBus API does things a bit differently from e.g. gatttool
and previous BlueZ API solutions. The Battery Service (0x180F) is instead served under the Battery DBus interface, making that service not available in get_services
calls. That service has, I believe, been relocated to the Device interface and is available on the device object instead. See here: https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/device-api.txt
The device you have connected to is available in object you get when doing discovery. Check the details
attribute of the BLEDevice
object.
Bleak tries its hardest to be identical over all OS:es, but some things are not possible to do, and I think this is one of them. The BlueZ DBus API is not comparable to gatttool
. Are the handles you use giving you the wrong data? Verify that first. If they differ it might be due to BlueZ readressing this internally, I cannot be certain. Bleak merely uses what handles that are presented by the BlueZ DBus API.
There has been some changes regarding handles in version 0.8.0. It might solve this, if it even was an issue to start with. I get correct results using the handles that Bleak provides, at least for my devices. They are the handles provided by the BlueZ DBus API and I cannot use anything else than them.
Will close this issue. Feel free to reopen if new data is dicovered.
bleak version: 0.7.1
Python version: 3.6.9
Operating System: LINUX ( 5.4.0-40-generic #44~18.04.1-Ubuntu SMP Wed Jun 24 23:13:08 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux)
BlueZ version (
bluetoothctl -v
) in case of Linux: 5.54Description
When you simply list services and characteristics ( I used a Mi Band Fit)
What I Did
Bleak version and results
Results Bleak:
Using gatttol to list services:
Using gatttol to list all characteristics:
bluepy sample:
bluepy results:
You can observe that the service 0x1800 is not returned by bleak and the handle id is not the right one pointing to the characteristic. Anyway, correcting some issues Bleak will be the most one!