Match characteristics based on their flags (read/write/notify/...) - #308
Conversation
|
Matching on properties isn’t right either. HID devices can have multiple input and output endpoints which will have the same uuid and properties. The builder API is recommended over the macro for these more advanced use cases. |
|
I'm not saying this is going to fix all possible issues with characteristic discovery, but isn't this still better than the current approach? Are there any possible ramifications? |
|
The current approach is easy to understand. If we add complexity it will make it more confusing when it fails. Also, specifically for the HID service, you're going to need more control over other aspects like descriptors than the macro allows. I strongly recommend using the builder API instead of the macro for complex services like HID. Also, this crate is pretty much in maintenance mode. Future development is happening with the |
Some BLE devices expose multiple characteristics with the same UUID but different properties. For example, HID over BLE devices have two characteristics with UUID 0x2A4D:
Currently the discovery loop matches UUID only, not only that but it re-assigns the characteristic on each match, so only the last discovered characteristic is made available to the user. This makes it impossible to access both endpoints.
After the change, something like this is possible:
The idea is that if user requests a certain operation flag, it must be presented in props of the matching characteristic.
Also added a small guard to not re-assign chars that already have a handle.