2016-10-11 28 views
0

我需要支持多种设备,包括串行和BLE。当我将以下代码添加到Package.appxmanifest文件时,出现错误如何在Windows 8.1中将rfcomm和genericAttributeProfile设备功能添加到Package.appxmanifest。

无法激活Windows应用商店应用'blah.blah_blah!App'。激活请求失败,错误为'E_INVALIDARG'。

<m2:DeviceCapability Name="bluetooth.genericAttributeProfile"> 
    <m2:Device Id="any"> 
    <m2:Function Type="name:heartRate"/> 
    </m2:Device> 
</m2:DeviceCapability> 

<m2:DeviceCapability Name="bluetooth.rfcomm"> 
    <m2:Device Id="any"> 
    <m2:Function Type="name:serialPort"/> 
    </m2:Device> 
</m2:DeviceCapability> 

回答

1

我再次出现您的项目的错误。如果你只是添加Bluetooth.genericAttributeProfile或Bluetooth.rfcom,那没关系。所以我认为引用可重复性造成的错误,您可以按照以下步骤添加蓝牙并添加所有蓝牙服务。 enter image description here

在后面的代码

,你可以通过添加var rfcommDeviceService = Windows.Devices.Bluetooth.Rfcomm.RfcommDeviceService; 和RfcommDeviceService通过var gattDeviceService = Windows.Devices.Bluetooth.GenericAttributeProfile.GattDeviceService;添加gattDeviceService。

相关问题