tinygo-org / bluetooth

Cross-platform Bluetooth API for Go and TinyGo. Supports Linux, macOS, Windows, and bare metal using Nordic SoftDevice or HCI
https://tinygo.org
Other
708 stars 134 forks source link

Device characteristics returned out of order on Linux #135

Closed SamWhited closed 1 year ago

SamWhited commented 1 year ago

The documentation for DiscoverCharacteristics says:

If there is no error, the characteristics slice has the same length as the UUID slice with characteristics in the same order in the slice as in the requested UUID list.

However, at least on Linux, the code appears to just iterate through characteristics appending them to the slice as they are found. The documentation either needs to be changed, or the code updated to reflect the expected behavior.

tomhut commented 1 year ago

This issue also seems to be present on macOS/Darwin.

aykevl commented 1 year ago

Here is a fix for macOS: https://github.com/tinygo-org/bluetooth/pull/161 @tomhut can you test this change?

aykevl commented 1 year ago

And here is a fix for Linux: https://github.com/tinygo-org/bluetooth/pull/162 @SamWhited can you take a look?

SamWhited commented 1 year ago

Sorry, I don't even remember what I was working on with this or how I was testing it so I don't have a good way to test it anymore :) Thanks for the fix though!