Closed leijdekkers closed 1 year ago
The descriptorUuid only returns “2902” and it should be “00002902-0000-1000-8000-00805f9b34fb”
yes there were changes related to this. we now return short names, aka 16-bit uuid, where possible.
2902 & 00002902-0000-1000-8000-00805f9b34fb are the same!
2909 is a "short name", part of the ble spec. they are equivalent. a 16 bit uuid can be converted to a 128 bit uuid by adding "-0000-1000-8000-00805f9b34fb" to the end.
if you want to compare the full name as a sting, use guid.uuid128
however it is more proper to compare Guid to Guid. this will do the conversions for you.
if (desc.uuid == Guid("2902"))
or
if (desc.uuid == Guid("00002902-0000-1000-8000-00805f9b34fb"))
^these are equivalent!
Requirements
Have you checked this problem on the example app?
No
FlutterBluePlus Version
1.28.10
Flutter Version
latest
What OS?
Android
OS Version
ios 16
Bluetooth Module
na
What is your problem?
It looks like the descriptor value is too short. So i have a specific bluetooth device with the following characteristic and descriptor values
Characteristic: 02a6c0d1-0451-4000-b000-fb3210111989 Descriptor: 00002902-0000-1000-8000-00805f9b34fb
I do the following to get the characteristic and descriptor
// Get the specific characteristic
BluetoothCharacteristic? characteristic = service?.characteristics.firstWhereOrNull((element) => element.characteristicUuid.toString() == "02a6c0d1-0451-4000-b000-fb3210111989");
// Get the descriptor
BluetoothDescriptor? descriptor = characteristic?.descriptors.firstWhereOrNull((d) => d.uuid.toString() == "00002902-0000-1000-8000-00805f9b34fb");
When I look at characteristic?.descriptors values, it shows me the following:
The descriptorUuid only returns “2902” and it should be “00002902-0000-1000-8000-00805f9b34fb”
In older FlutterBluePlus versions it was working correctly. So not sure what has been changed but it is not correct currently.
Thanks Peter
Logs