public static void AutoPairDevices() { // get a list of all paired devices var paired = LocalClient.DiscoverDevices(255, false, true, false, false); // check every discovered device if it is already paired foreach (var device in DeviceList) { var isPaired = paired.Any(t => device.Equals(t)); // if the device is not paired, try to pair it if (!isPaired) { // loop through common PIN numbers to see if they pair foreach (var devicePin in CommonDevicePins) { isPaired = BluetoothSecurity.PairRequest(device.DeviceAddress, devicePin); if (isPaired) { break; } } } } }
public static void PrintAllDevices() { DeviceList.AddRange(LocalClient.DiscoverDevices(65536, true, true, true, true)); PrintDevices(); }
public static void PrintPairedDevices() { DeviceList.AddRange(LocalClient.DiscoverDevices(255, true, true, false, false)); PrintDevices(); }