我有一个使用32feet库的WinForms项目。以下代码段应该用于检测BLE设备(蓝牙低能耗设备),但是,它仅返回正常的蓝牙设备。
有什么主意吗?
private void blescan()
{
{
lsb_device.Items.Clear();
BluetoothRadio.PrimaryRadio.Mode = RadioMode.Connectable;
BluetoothClient client = new BluetoothClient();
BluetoothDeviceInfo[] devices = client.DiscoverDevices();
BluetoothClient bluetoothClient = new BluetoothClient();
String authenticated;
String classOfDevice;
String connected;
String deviceAddress;
String deviceName;
String installedServices;
String lastSeen;
String lastUsed;
String remembered;
String rssi;
foreach (BluetoothDeviceInfo device in devices)
{
lbl_status.Visible = true;
authenticated = device.Authenticated.ToString();
classOfDevice = device.ClassOfDevice.ToString();
connected = device.Connected.ToString();
deviceAddress = device.DeviceAddress.ToString();
deviceName = device.DeviceName.ToString();
installedServices = device.InstalledServices.ToString();
lastSeen = device.LastSeen.ToString();
lastUsed = device.LastUsed.ToString();
remembered = device.Remembered.ToString();
rssi = device.Rssi.ToString();
string[] row = new string[] { authenticated, classOfDevice, connected, deviceAddress, deviceName, installedServices, lastSeen, lastUsed, remembered, rssi };
lsb_device.Items.Add("Device Name:" + row[4] + " || MAC Address:" + row[3]);
}
lbl_status.Text = "Scan completed.";
}
}
以下是扫描Form
的屏幕截图: