-
Notifications
You must be signed in to change notification settings - Fork 308
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
BleakError: "service already present" with duplicate UUID when enumerating services #139
Comments
This is problematic. I can make the error go away by not throwing the exepction, but currently Bleak cannot handle two characteristics with the same uuid, since it looks for characteristics by the uuid value, not the handle value. I have no solution for this right now. I will have to think about this for a while. |
@hbldh per Bluetooth BLUETOOTH CORE SPECIFICATION Version 5.2 | Vol 3, Part G: |
…cteristic UUID. Fix ssue hbldh#139.
This is indeed a problematic situation; I finally see why all the libraries and backends have their own object representing a charactersitic, and not just the UUID... This was a fundamental difference in Bleak, that I would only use UUIDs and not anything else, to simplify things and only have to deal with All |
I had the same problem, described in #56. Look under 3rd bullet point under What I Did. I have such cases almost all the time and I was also bothered that I always re-query characteristic instance via UUID instead of just saving the reference, so I modified I will also take a look into this and try to contribute. I was working with BlueZ for the last half year (in C not Python, modifying Linux core BT drivers) but now I return back to this great project to use it for Python testing. |
Oh, yes, I'm also seeing this problem for my usecase as well. Is the current temporary/recommended solution for connecting to devices with this behavior to use @pliniofpa's PR? |
Just to add a little more to this, the UUID is a type and multiple instances of nearly everything can occur:
Some possible fixes:
|
This issue needs a resolution. It will not be identical to @pliniofpa's solution, but somewhere similar. It might lead to a backwards incompatible solution, but I aim to be as not-interruptive as possible and issue My goal is to have this ready to release by the end of June. |
@hbldh, I do a lot of work with Bluetooth on all three platforms; more than happy to help if wanted and needed. Even if it's just testing solutions. And thanks again for bleak! Best "pointless project" ever. :) |
Merges #167 by means of new branch. Changed some details of #167 to handle characteristics a bit differently. read_gatt_char, write_gatt_char, start_notify and stop_notify now accepts: - BleakGATTCharacteristics objects - integer handle for the characteristic to use - string uuid - uuid.UUID objects The efficiency of using the different solutions are in that descending order as well. It is now less effective than before to use string representations of the UUIDs of a characteristic, this is an effect of keeping track of characteristics is done by integer handles instead of string uuids. This will hopefully fixes #139 and #159.
bluetoothctl -v
) in case of Linux: 5.50Description
First off, thanks for the library! It's been fun to tinker with so far. As a warning, I am new to Bluetooth generally.
I'm trying to connect to an esoteric BLE device, and so far Bleak has been throwing an exception during characteristics enumeration. It appears to be due to two characteristics having the same UUID. I saw #101, but this appears to be due to a device actually reporting a duplicate UUID rather than a missed initialization.
I can confirm this is the case with this device with
gatttool
. Notice how the UUID00002a06-0000-1000-8000-00805f9b34fb
is duplicated for handles0x0024
and0x0027
:I expect to still be able to send commands to the device, as
gatttool
has no problems doing so. However, Bleak can't handle it.What I Did
Running a simple Bleak connection script with debug logging provides:
The text was updated successfully, but these errors were encountered: