How to trigger event for incoming BLE connection/pairing request in UWP application?

sathish reddy 1 Reputation point
2022-02-08T11:27:39.89+00:00

I have implemented a console application which uses UWP C++/Winrt APIs to advertise and scan for BLE devices. Advertisement is being done using GATT service provider with custom UUID and Scanning is performed with help of Device Watcher. Pairing mechanism is implemented with help of Custom Pairing(PairAsync()) with few device pairing kinds(such as Display Pin, Provide Pin etc...).

Now, I am running the same application on 2 different laptops. From one Laptop, I initiated connection request and expecting custom UI(which is implemented by me) to popup at other laptop. But it did not happen, only at initiator end Custom UI(which is implemented by me) popped up to Provide Pin and other end default Windows UI popped to Display Pin . From this, I understood that incoming pairing/connection request is being handled by Windows stack. I have searched a lot but could not find the way to get event in UWP application.

I found that in Wi-Fi direct, there is dedicated class available for WiFiDirectConnectionListener to handle incoming connection request. Is there similar APIs available for BLE? Any suggestion/workaround is appreciated.

Thanks

Universal Windows Platform (UWP)
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Roy Li - MSFT 32,731 Reputation points Microsoft Vendor
    2022-02-09T06:53:17.677+00:00

    Hello,

    Welcome to Microsoft Q&A!

    How to trigger event for incoming BLE connection/pairing request in UWP application?

    I have to say that there is no such API that could detect the incoming connection from BLE devices. That is handled by the system. You could submit a feature request about this in the Feedback Hub. You could find the Feedback Hub in the Start Menu.

    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 comments No comments