I C# verwenden Bluetooth Low Enegergy Geräte unter Windows 10 zu finden, wenn ich die folgenden Codes ausführen, traf ich einen solchen Fehler:C# Scan Bluetooth LE Geräte
"An exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll but was not handled in user code".
Die Linie des Fehlers ist Debug.WriteLine("Found device: " + devices[0].Id);
Ich weiß nicht, warum es außerhalb der Reichweite ist. Vielen Dank!
namespace BluetoothLE
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private async void LookForPairedDevices()
{
// Get BLE devices paired with Windows
DeviceInformationCollection devices = await DeviceInformation.FindAllAsync(BluetoothLEDevice.GetDeviceSelector());
Debug.WriteLine("Found device: " + devices[0].Id);
}
}
}
'DeviceInformation.FindAllAsync (BluetoothLEDevice.GetDeviceSelector()' ergab keine Geräte, so versuchen, Index für den Zugriff auf 0 ((erstes Element) hat eine Ausnahme ausgelöst –