“await RfcommDeviceService.FromIdAsync()"永远不会返回UWP应用程序 [英] "await RfcommDeviceService.FromIdAsync()" never returns in UWP app

查看:66
本文介绍了“await RfcommDeviceService.FromIdAsync()"永远不会返回UWP应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景故事:

我创建了一个面向Raspberry Pi 3的UWP应用程序,它将通过BT连接到Arduino Uno。开发速度非常慢(但是如果你忽略了BT LE对/ unpair错误就行了)所以我决定切换到使用我的电脑连接到Arduino。问题
是,我无法连接到设备。它是配对的,在另一个平台上测试,但这不起作用。

I created a UWP app geared for the Raspberry Pi 3 that will connect to an Arduino Uno via BT. Development is very slow (but worked if you ignore the BT LE pair/unpair bug) so i decided to switch over to using my computer to connect to the Arduino. Problem is, is that I cannot connect to the device. it is paired, tested on another platform, but this doesnt work.

有问题的代码:

                    var device = devices.Single(x => x.Name == configuredDeviceName);
                    _service = await RfcommDeviceService.FromIdAsync(device.Id);
                    _socket = new StreamSocket();
                    await _socket.ConnectAsync(_service.ConnectionHostName, _service.ConnectionServiceName, SocketProtectionLevel.BluetoothEncryptionAllowNullAuthentication);
                    _dataReader = new DataReader(_socket.InputStream);

第2行永远不会回来。只是坐在那里...我的主机PC正在运行Windows 10(周年纪念版),树莓派正在运行win 10内幕预览(10.14393.67)。我可以添加更多代码,如果你需要看到它,但我整天都被困住了。

line 2 never comes back. just sits there... My host PC is running Windows 10 (Anniversary Edition) and the raspberry pi is running the win 10 insider preview (10.14393.67). I can add more code if you need to see it, but Ive been stumped all day.

推荐答案

Hi Skaz, 

我试图让某人介入熟悉这个主题以进一步研究这个问题。可能会有一些时间延迟。感谢您的耐心等待。


这篇关于“await RfcommDeviceService.FromIdAsync()"永远不会返回UWP应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆