嘿我正在尝试扫描所有蓝牙设备的通用Windows应用程序。所以我从这行代码开始扫描:
var devices = await DeviceInformation.FindAllAsync(RfcommDeviceService.GetDeviceSelector(RfcommServiceId.SerialPort));
foreach (var device in devices)
{
listBox.Items.Add(device);
}
但这不起作用,所以我想将DeviceCapability添加到我的表单中。
<Capabilities>
<Capability Name="internetClient" />
<m2:DeviceCapability Name="bluetooth.rfcomm">
<m2:Device Id="any">
<m2:Function Type="name.serialPort"/>
</m2:Device>
</m2:DeviceCapability>
但是Visual Studio说的是命名空间前缀&#39; m2&#39;没有定义。
答案 0 :(得分:1)
我试图删除M2并且它停止给我错误。具体来说,我的代码现在看起来像:
<Capabilities>
<Capability Name="internetClientServer" />
<DeviceCapability Name="proximity" />
<DeviceCapability Name="bluetooth.rfcomm">
<Device Id="any">
<!-- Used by the Microsoft Band SDK -->
<Function Type="serviceId:A502CA9A-2BA5-413C-A4E0-13804E47B38F" />
<!-- Used by the Microsoft Band SDK -->
<Function Type="serviceId:C742E1A2-6320-5ABC-9643-D206C677E580" />
</Device>
</DeviceCapability>
</Capabilities>