小编jsp*_*sov的帖子

Windows phone 8.1 streamsocket.connectAsync生成"没有更多数据可用.(HRESULT异常:0x80070103)"

我正在开发必须在蓝牙打印机上打印的Windows Phone 8.1商店应用程序(XAML).

使用前两种方法成功找到该设备:

 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)
Run Code Online (Sandbox Code Playgroud)

并没有找到:

            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")))
Run Code Online (Sandbox Code Playgroud)

不幸的是,只有最后一个方法会给我"streamServiceName"才能在StreamSocket.ConnectAsync中使用

我尝试过StreamSocket.ConnectAsync的不同组合:

dim _soc = New StreamSocket()
Await _soc.ConnectAsync(dev.HostName, "1")
Run Code Online (Sandbox Code Playgroud)

"没有更多数据可用.(HRESULT异常:0x80070103)"

同样的

 dim _soc = New StreamSocket()
 Await _soc.ConnectAsync(dev.HostName, "{00001101-0000-1000-8000-00805F9B34FB}"
Run Code Online (Sandbox Code Playgroud)

正如你可以想象的那样

 dim _soc = New StreamSocket()
 Await _soc.ConnectAsync(btdv.HostName, "{00001101-0000-1000-8000-00805F9B34FB}"
Run Code Online (Sandbox Code Playgroud)

经过几天敲打我的头脑后,我真的没有想法.最让我烦恼的是,第一个代码组合适用于Windows Phone …

bluetooth windows-phone-8.1

5
推荐指数
1
解决办法
873
查看次数

标签 统计

bluetooth ×1

windows-phone-8.1 ×1