How to add custom data to Scan Response in UWP application?

Windy-Cao 1 Reputation point
2022-08-03T14:39:31.257+00:00

I am developing a BLE peripheral with GATT servers on the windows platform, but I found there is no windows API to set custom data to Scan Response(or Scannable, I am not quite sure about the difference between Scannable and Scan Response). Can you please provide the API to implement this, It would be helpful to provide some code examples, thanks

Universal Windows Platform (UWP)
{count} votes

1 answer

Sort by: Most helpful
  1. Nico Zhu (Shanghai Wicresoft Co,.Ltd.) 12,856 Reputation points
    2022-08-04T04:05:48.24+00:00

    Hello,
    Welcome to Microsoft Q&A!

    but I found there is no windows API to set custom data to Scan Response

    Scan response data are not directly controllable from the App. I have to say it has no such method for writing scan response data directly, you need refer ADVERTISING AND SCAN RESPONSE DATA FORMAT to make scan response data manually. If the App wants more space, they can consider enabled extended advertisement (only available on systems that have radios that support this on both sending and receiving sides). They can use BluetoothLEAdvertisementPublisher.UseExtendedAdvertisement Property (Windows.Devices.Bluetooth.Advertisement) - Windows UWP applications | Microsoft Learn

    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.