Skip to content

[windows] Scanning returns empty Services and LocalName #390

@dplcz

Description

@dplcz

Issue Description:

  • Environment

OS: Windows 11
Go Version: 1.23.2

Use a Windows machine with a working Bluetooth adapter.
Navigate to the examples/scanner directory within the tinygo.org/x/bluetooth project.

Expected Behavior
The scanner should discover nearby BLE devices. For many of these devices, it should correctly parse and display their LocalName and any Service UUIDs that are present in either their Advertising Packet or their Scan Response Packet.

Example of expected output:

`Device: MySensor (XX:XX:XX:XX:XX:XX), RSSI: -50, Services: [0000180f-0000-1000-8000-00805f9b34fb], LocalName: MySensor`

Example of actual output:

`Device: (XX:XX:XX:XX:XX:XX), RSSI: -50, Services: [], LocalName:`

Additional Context & Analysis
This issue seems to be a regression or an incomplete fix. I am aware of a previous issue (#132 ) which resulted in the Windows implementation being changed to use Active Scanning (#164 ). Based on that, the scanner should be able to retrieve data from Scan Response packets, but it appears it is not doing so.

To cross-verify, I tested with the same BLE peripherals using the Python bleak library on the same Windows machine. The results are very informative:

When using bleak in its default (active scan) mode, it correctly discovers both the LocalName and the Service UUIDs.
More importantly, when I explicitly configure bleak to perform passive scanning, it is still able to retrieve the Service UUIDs and LocalName for the same devices.

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