0
我试图连接到蓝牙设备连接到蓝牙设备/如何设置RFCOMM能力
我已经配对它,当我搜索了它,我发现它:
private async void Grid_DoubleTapped(object sender, DoubleTappedRoutedEventArgs e)
{
ListBox1.Items.Clear();
var devices = await DeviceInformation.FindAllAsync(RfcommDeviceService.GetDeviceSelector(RfcommServiceId.SerialPort));
var device = devices.FirstOrDefault(c => c.Name.Contains("BMMTCA32"));
foreach (var element in device.Properties)
{
var strMessage = element.Key + (element.Value == null ? "" : " = " + element.Value.ToString());
ListBox1.Items.Add(strMessage);
}
}
这里是我的列表框中的输出:
System.ItemNameDisplay = BMMTCA32-01
System.Devices.DeviceInstanceId = BTHENUM\{00001101-0000-1000-8000-00805f9b34fb}_LOCALMFG&0048\8&f358302&0&0012F31DECF3_C00000000
System.Devices.Icon = C:\Windows\System32\DDORes.dll,-2001
{51236583-0C4A-4FE8-B81F-166AEC13F510} 123 = C:\Windows\SYSTEM32\DDORes.dll,-3001
System.Devices.InterfaceEnabled = True
System.Devices.IsDefault = False
System.Devices.PhysicalDeviceLocation
但我的问题是如何连接到它?
当我尝试使用Googeling时,我得到的答案是否设置了rfcomm功能?有关详细信息,请参见http://msdn.microsoft.com/en-us/library/windows/apps/dn263090.aspx。
但是当我看着那个页面时,我迷失了,因为我没有在清单文件中写什么。
简而言之:如何连接到设备?
PS:这是一个Windows平板电脑程序。
不,我得到一个未知的服务异常。 – 2014-11-25 15:20:59
注意device.id = \\?\ BTHENUM#{00001101-0000-1000-8000-00805f9b34fb} _LOCALMFG&0048#8&f358302&0&0012F31DECF3_C00000000#{b142fc3e-fa4e-460b-8abc-072b628b3c70} – 2014-11-25 15:23:17
它有以下例外吗?如果是这样,你遇到了一些麻烦,这是一些其他开发人员在Windows.Bluetooth开发中遇到问题,而没有解决方案。 “没有这样的服务是已知的,在指定的命名空间中找不到该服务” – ggg 2014-11-25 15:32:22