Quantcast
Channel: Recent Discussions — Mixed Reality Developer Forum
Viewing all articles
Browse latest Browse all 10543

Pair a BLE Device with Hololens

$
0
0

Hi all,

I'm developing an App that receives Data from a BLE-Device.

For Tests i created a Win10 app to scan, pair and connect with my BLE-Device. It works great!

Well now I use nearly the same Code for my Hololens App. The Scanning works great but I can't pair via my App (but I can pair it via the Hololens Settings -> Devices).

Here is my code for Pairing ( I used this to get my app working ):

    public async void pair(int index)
    {
    // Do not allow a new Pair operation to start if an existing one is in progress.
    if (isBusy)
    {
        return;
    }

    isBusy = true;

    // BT_Code: Pair the currently selected device.
    DeviceInformation devInfo = listDeviceInformation[index];
    DevicePairingResult result = await devInfo.Pairing.PairAsync();

    var myRes = result;

    if (result.Status == DevicePairingResultStatus.Paired || result.Status == DevicePairingResultStatus.AlreadyPaired)
    {
        paired = true;
        Audio.say("Paired with " + devInfo.Name);
    }
    else
    {
        paired = false;
        Audio.say("Could not pair with" + devInfo.Name + "error is " + result.Status.ToString());
    }

    isBusy = false;
}

It seems the Problem is here: DevicePairingResult result = await devInfo.Pairing.PairAsync();

I always get the result "failed" except when I Pair my BLE-Device via Hololens Settings bevor and start the App after successful pairing.

Does anyone have a hint for me?

Best regards
Marc


Viewing all articles
Browse latest Browse all 10543

Trending Articles