蓝牙客户端扫描c#

时间:2015-05-28 10:13:39

标签: c# bluetooth

我正在尝试使用 c#创建一个简短的桌面应用,以便我扫描蓝牙设备。我使用了这段代码(在这个网站上找到):

BluetoothClient client = new BluetoothClient();
BluetoothDeviceInfo[] devices = client.DiscoverDevicesInRange();
Console.WriteLine("There are:"+devices.Length+" devices");
foreach (BluetoothDeviceInfo dev in devices)
{
    Console.WriteLine("Found : "+dev.DeviceName);
}

显然我导入了32feet.NET dll。即使我打开某些BT设备,这段代码也没有找到任何设备。 我该如何解决这个问题?

[新]  写作:



            var radios =  BluetoothRadio.AllRadios;
            foreach (BluetoothRadio radio in radios) Console.WriteLine(radio.Name);
            Console.WriteLine(BluetoothRadio.PrimaryRadio.Name);
            if (BluetoothRadio.IsSupported) Console.WriteLine("BT radio is supported");




我的结果是" MY-PC"和"支持BT广播"

0 个答案:

没有答案