none
Windows 10 Stops Connecting to BLE Device after Connection is Interrupted RRS feed

  • Question

  • The BLE device is a custom BLE device using Bluetooth 4.0 and GATT.

    1. Pair BLE device to Windows 10 then my application can connect and disconnect from the device.
    2. Then I can restart the computer after disconnecting from the BLE device. Then the device be connected and disconnected to.
    3. When I remove power from the BLE device. (My applications poll the BLE device every few seconds.) Then I am unable to connect to the BLE device again even after restarting the computer.

    I am unable to connect back to the device until I un-pair the device from the computer and re-pair it.

    I don’t get this issue if the connection isn’t interrupted.

    I don't get this issue on Windows 8.1 only Windows 10.

    The errors displayed in visual studio

    Thursday, September 10, 2015 11:50 PM

All replies

  • I was also getting this behaviour using C++ and the Win32 APIs. My code was previously working in Windows 8.1, and given that disconnection and reconnection is 'normal' behaviour Windows needs to cope with this.

    When I looked in the Bluetooth settings panel after the Bluetooth device has been power cycled I see the device toggling between Connected and Paired. I have discovered that if I set my device to not allow bonding, that this behaviour goes away and it all works well. The issue comes down to the device forgetting the bonding information, whilst windows retains it and expects to use it. I was getting error 0x80070572, which led me to look at the difference between pairing and bonding.

    I hope this helps,

    Peter

    Wednesday, June 29, 2016 2:58 PM
  • Peter is absolutely right. The issue comes down to the device forgetting the bond information. The known workaround in code is to Pair the device using no security using the in app pairing APIs. The sample is up on GitHub here: https://github.com/Microsoft/Windows-universal-samples/blob/master/Samples/DeviceEnumerationAndPairing/cs/Scenario9_CustomPairDevice.xaml.cs

    The important pieces are here:

    // Get ceremony type and protection level selections
                DevicePairingKinds ceremoniesSelected = GetSelectedCeremonies();
                ProtectionLevelSelectorInfo protectionLevelInfo = (ProtectionLevelSelectorInfo)protectionLevelComboBox.SelectedItem;
                DevicePairingProtectionLevel protectionLevel = protectionLevelInfo.ProtectionLevel;
    
                DeviceInformationCustomPairing customPairing = deviceInfoDisp.DeviceInformation.Pairing.Custom;
    
                customPairing.PairingRequested += PairingRequestedHandler;
                DevicePairingResult result = await customPairing.PairAsync(ceremoniesSelected, protectionLevel);
                customPairing.PairingRequested -= PairingRequestedHandler;

    Run the sample, select a protectionLevel of "None" and see if you are able to maintain a connection (so don't pair the device through the UX). If that works, you should add this code to your app and pair it yourself.

    Best,

    Kiran

    Windows Bluetooth team

    Wednesday, June 29, 2016 6:07 PM