1

I am writting console Application using C# and 32feet library. I want connect via bluetooth to phone device. I was following this code : link I came across a problem while pairing two devices. I am using this line to request connection:

bool isPaired = BluetoothSecurity.PairRequest(device.DeviceAddress, DEVICE_PIN);

Now auth request shows up on my phone, but there is a problem, becouse auth-code on phone is slighlty different than DEVICE_PIN. Computer trying to connect with phone, but after few minutes I get "Connection failed" info. This is my method to pair

public void  pair(int index)
        {
      BluetoothClient client = new BluetoothClient();
            devices = client.DiscoverDevices();

            BluetoothDeviceInfo device = devices[index];
            bool isPaired = BluetoothSecurity.PairRequest(device.DeviceAddress, "8080");
            if (isPaired)
            {
                Console.WriteLine("Paired: ");
            }
            else
            {
                Console.WriteLine("Not paired: ");
            }
        }
Community
  • 1
  • 1
rpieniazek
  • 2,160
  • 2
  • 12
  • 16

1 Answers1

0

Try stopping the Bluetooth Windows services on your computer one by one and test. After you stop a Windows Service, make sure to disable/enable the Bluetooth radio on your computer to take effect.