Bluetooth LE - Prevent Windows from automatically discovering & reading from all characteristics after PairAsync

EricP-8687 60 Reputation points
2024-03-18T20:13:28.65+00:00

This method to pair and exchange bond keys results in the Windows BLE stack automatically enumerating and reading a bunch of characteristic values. We want to prevent this behavior and only have the application read from characteristics we ask it to or Windows may need to read for OS functionality.

https://learn.microsoft.com/en-us/uwp/api/windows.devices.enumeration.deviceinformationpairing.pairasync?view=winrt-22000#windows-devices-enumeration-deviceinformationpairing-pairasync(windows-devices-enumeration-devicepairingprotectionlevel)

For example - after PairAsync, here is Windows discovering and reading characteristics that the application did not ask it to discover/read, aren't standard characteristics in the Device Information Service or the database hash, and couldn't possibly contribute to any Windows features.

User's image

This is not desired behavior for our devices or application, and at a minimum is a waste of time and power/increases the surface area for bugs. If there is a problem reading one of these characteristics, Windows gets stuck disconnecting, connecting, waiting 30 seconds for a response, over and over.

Is there a way to disable this behavior, so Windows does not start re-enumerating the entire GATT database and reading characteristic values?

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
10,619 questions
Universal Windows Platform (UWP)
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
8,168 questions
{count} votes

Accepted answer
  1. Junjie Zhu - MSFT 14,831 Reputation points Microsoft Vendor
    2024-03-20T01:59:37.1466667+00:00

    Hi @EricP-8687

    Welcome to Microsoft Q&A!

    This method to pair and exchange bond keys results in the Windows BLE stack automatically enumerating and reading a bunch of characteristic values.

    This behavior has been in the Windows pairing APIs for a long time and is retained for compatibility reasons.

    Currently, there is no plan to update this behavior. If you own the remote device, it is recommended to verify/change the characteristic that is causing the issue.

    Thank you.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful