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
764 stars 138 forks source link

Device.DiscoverServices should allow for multiple service definitions with the same UUID #279

Open ScottDuckworth opened 4 months ago

ScottDuckworth commented 4 months ago

Per the GATT reference, part G, section 3.1:

A device or higher level specification may have multiple service definitions and may have multiple service definitions with the same service UUID.

However, this is not supported by this library, at least not for the implementations of Device.DiscoverServices found in gattc_linux.go, gattc_darwin.go, and gattc_hci.go. Each of these implementations store the services in a map keyed by UUID, which prevents multiple definitions with the same UUID.

It looks like the implementation in gattc_windows.go might work in this case, though I haven't tested it.