Bluetooth Windows phone 8.1 streamsocket.connectAsync生成;没有更多的数据可用。(HRESULT的例外情况:0x80070103)“;
我正在开发必须在蓝牙打印机上打印的Windows Phone 8.1应用商店应用程序(XAML) 使用前两种方法成功找到设备:Bluetooth Windows phone 8.1 streamsocket.connectAsync生成;没有更多的数据可用。(HRESULT的例外情况:0x80070103)“;,bluetooth,windows-phone-8.1,Bluetooth,Windows Phone 8.1,我正在开发必须在蓝牙打印机上打印的Windows Phone 8.1应用商店应用程序(XAML) 使用前两种方法成功找到设备: PeerFinder.AllowBluetooth = True PeerFinder.Role = PeerRole.Client PeerFinder.AlternateIdentities.Item("Bluetooth:SDP") = "{00001101-0000-1000-8000-00805F9B34FB}
PeerFinder.AllowBluetooth = True
PeerFinder.Role = PeerRole.Client
PeerFinder.AlternateIdentities.Item("Bluetooth:SDP") = "{00001101-0000-1000-8000-00805F9B34FB}"
'PeerFinder.AlternateIdentities.Item("Bluetooth:Paired") = ""
Dim devs = Await PeerFinder.FindAllPeersAsync()
Dim dev As PeerInformation = devs(0)
Dim btdevs = Await DeviceInformation.FindAllAsync(BluetoothDevice.GetDeviceSelector())
Dim btdv = btdevs(0)
并且在以下内容中未找到:
Dim dfdevs1 = Await DeviceInformation.FindAllAsync(RfcommDeviceService.GetDeviceSelector(RfcommServiceId.SerialPort))
' same result with Await DeviceInformation.FindAllAsync(RfcommDeviceService.GetDeviceSelector(RfcommServiceId.FromUuid(New Guid("00001101-0000-1000-8000-00805F9B34FB")))
不幸的是,只有最后一个方法将为我提供“remoteServiceName”,以便在StreamSocket.ConnectAsync中使用
我尝试了StreamSocket.ConnectAsync的不同组合:
dim _soc = New StreamSocket()
Await _soc.ConnectAsync(dev.HostName, "1")
“没有更多可用数据。(HRESULT异常:0x80070103)”
同样适用于
dim _soc = New StreamSocket()
Await _soc.ConnectAsync(dev.HostName, "{00001101-0000-1000-8000-00805F9B34FB}"
正如你可以想象的那样
dim _soc = New StreamSocket()
Await _soc.ConnectAsync(btdv.HostName, "{00001101-0000-1000-8000-00805F9B34FB}"
经过几天的磕头之后,我真的失去了主意。最让我恼火的是,第一组代码在Windows Phone 8.0上运行得非常完美
是的,在AppManifest中,所有内容都已设置:
<DeviceCapability Name="proximity" />
<m2:DeviceCapability Name="bluetooth.rfcomm">
<m2:Device Id="any">
<!--<m2:Function Type="name:serialPort" />-->
<m2:Function Type="serviceId:00001101-0000-1000-8000-00805F9B34FB" />
</m2:Device>
</m2:DeviceCapability>
任何想法都将受到高度赞赏 在我们谈话时,我也在研究这个问题,我已经取得了很好的进展。对我来说,这个问题是在我从WP8升级到WP8.1(silverlight)之后出现的 确保您的appxmanifest设置了以下权限:
<m2:DeviceCapability Name="bluetooth.rfcomm">
<m2:Device Id="any">
<m2:Function Type="serviceId:00001101-0000-1000-8000-00805f9b34fb" />
<m2:Function Type="name:serialPort" />
</m2:Device>
</m2:DeviceCapability>
我仍然需要检查这是否在其他设备上工作,但请让我知道你是如何工作的
PeerFinder.AlternateIdentities["Bluetooth:SDP"] = "{00001101-0000-1000-8000-00805f9b34fb}";
//find the device from the device list we are trying to connect to
var selector = RfcommDeviceService.GetDeviceSelector(RfcommServiceId.SerialPort);
var dev = await DeviceInformation.FindAllAsync(selector, null);
var devA = dev.Where(f => f.Name.Equals(_item.Device.DisplayName)).FirstOrDefault();
//get the service
RfcommDeviceService service = await RfcommDeviceService.FromIdAsync(devA.Id);
//create the connection
await Common.Instance.Socket.ConnectAsync(service.ConnectionHostName, service.ConnectionServiceName);
MetaData.Instance.BlueBoxRef = _item.Device.DisplayName.Substring(8);
NavigationService.Navigate(new Uri("/OpenDevice.xaml", UriKind.RelativeOrAbsolute));