2
我正在开发Windows 8.1的通用应用程序。我的应用程序使用的蓝牙设备,手机完美的作品,但在平板电脑上我有错误,同时连接到设备:Winrt蓝牙错误
请求的地址不在其上下文(0x80072741)
这里我的代码有效:
await
streamSocket.ConnectAsync(
new HostName(info.Id),
"{00001101-0000-1000-8000-00805F9B34FB}");
dataReader = new DataReader(streamSocket.InputStream);
dataWriter = new DataWriter(streamSocket.OutputStream);
能力:
<DeviceCapability Name="proximity" />
<m2:DeviceCapability Name="bluetooth.rfcomm">
<m2:Device Id="any">
<m2:Function Type="name:serialPort" />
</m2:Device>
</m2:DeviceCapability>
如果我理解正确,建议使用RfcommDeviceService。但是在这个服务中有一些错误。这就是我使用StreamSockets的原因。在我使用它之后,WIndowsPhone上的所有错误都已修复。 – Vitaliy
如果它对您有用,此代码在Windows 10上完美运行。这就是为什么我们决定停止支持Windows 8.1平板电脑 – Vitaliy