Skip to content

Darwin: DiscoverServices does not preserve requested UUID order #416

@acouvreur

Description

@acouvreur

Problem

Just like #409 for characteristics and #414 for services.

On Darwin, DeviceService.DiscoverServices returns services in the native enumeration order, not the order of the requested UUID list.

The public contract says: when a UUID filter is provided, the returned slice must have the same length and order as the requested UUID list. This is honored on linux but not on darwin.

Impact

Callers relying on index order receive swapped results.

Expected behavior

If filter UUIDs are provided:

  • result slice length == len(uuids)
  • order matches uuids
  • error if any requested characteristic is missing

Actual behavior

Order matches enumeration order from CoreBluetooth.

Proposed fix

Build an ordered slice matching filter UUIDs (same logic as darwin/linux), including handling duplicate UUIDs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions