boskokg / flutter_blue_plus

Flutter plugin for connecting and communicationg with Bluetooth Low Energy devices, on Android and iOS
Other
661 stars 417 forks source link

[Feature]: Support multiple characteristics with same uuid (HID Service) #795

Open chipweinberger opened 4 months ago

chipweinberger commented 4 months ago

FlutterBluePlus Version

1.31.14

Flutter Version

3.18.1

What is your feature request?

Relevant Issue: https://github.com/boskokg/flutter_blue_plus/issues/789

FlutterBluePlus does not yet support multiple characteristics with the same uuid in the same service, which is needed for the 0x1812 HID Service.

We need to add a new class member to BluetoothCharacteristic: final int characteristicIndex

For most characteristics, index will be 0. But If there are multiple characteristics with the same uuid, index represents first, second, third, etc. Android & iOS always keep characteristics in the same order, so we can use an index to find the right one.


in the BLE 0x1812 service is it possible to have multiple 0x2a4d characteristics?

Yes, in the Bluetooth Low Energy (BLE) specification, the Human Interface Device (HID) service, identified by the UUID 0x1812, can indeed have multiple instances of the Report characteristic, which is identified by the UUID 0x2A4D. This design allows a single HID service to support multiple reports, such as keyboard input, mouse input, and other control or data reports, each of which can be defined by its own instance of the Report characteristic.

This capability is crucial for devices that serve multiple functions or support complex interactions, allowing them to report different types of data to a host device under a single HID service. Each 0x2A4D characteristic instance can be configured with different properties (like Read, Write, Notify) and permissions, and it can be associated with different Report Reference descriptors that define the type and ID of the report, enabling the host to distinguish between them.

Logs

No Logs
vishal788 commented 4 months ago

All data is coming properly but after some time have some error and freez application.

i need some help for this error given below :-

D/FBP-Android: [FBP] onCharacteristicChanged: D/FBP-Android: [FBP] chr: ffe1

MrCsabaToth commented 3 months ago

Same UUID? That sounds wild, almost defeats the "unique" part of UUID. I didn't know that such a scenario is even possible and valid: I thought that the service UUID + characteristic UUID is unique tuple.