This project has moved. For the latest updates, please go here.
1
Vote

Win10: BluetoothWin32Authentication and PairRequest does not popup Windows pair dialog

description

Hi
The pairing part with a predefined pin "1234" (without UI or eventhandler) works perfect for my Legacy BT device on Windows 10.

When I try to force Windows to pop-up a pair dialog during pairing on Windows 10, the dialog does not show up. Also my own event handler does not get called (if I add one).
Does this functionality not work under Windows 10?

Best Regards,
Kristian
  private bool DoPairingWithInteraction2(InTheHand.Net.Sockets.BluetoothDeviceInfo deviceInfo)
    {
        EventHandler<BluetoothImpl.BluetoothWin32AuthenticationEventArgs> handler = new EventHandler<BluetoothImpl.BluetoothWin32AuthenticationEventArgs>(this.Win32AuthCallbackHandler);
        using (BluetoothImpl.BluetoothWin32Authentication pairer = new BluetoothImpl.BluetoothWin32Authentication(handler))
        //            using (BluetoothImpl.BluetoothWin32Authentication pairer = new BluetoothImpl.BluetoothWin32Authentication(this.Win32AuthCallbackHandler))
        {

            Console.WriteLine("[Pairer] DoPairingWithInteraction2 - before PairRequest");
            bool isPaired = BluetoothImpl.BluetoothSecurity.PairRequest(deviceInfo.DeviceAddress, null);
            Console.WriteLine("[Pairer] DoPairingWithInteraction2 - after PairRequest");
        }
        deviceInfo.Refresh();
        return deviceInfo.Authenticated;
    }

    private void Win32AuthCallbackHandler(Object sender, InTheHand.Net.Bluetooth.BluetoothWin32AuthenticationEventArgs e)
    {
        //Note we assume here that 'Legacy' pairing is being used, and thus we only set the Pin property!
        var address = e.Device.DeviceAddress.ToString();
        Console.WriteLine("[Pairer] Received an authentication request from address " + address);
        e.Pin = "1234";
    }

comments