作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想创建一个 UWP 应用程序来接收 Waspmote 板发送的信息。
在 WindowsForms 中,使用 System.IO.Ports;
它可以工作
如何解决这个问题,并且能够从串口接收到消息
最佳答案
您正在尝试使用 UWP 应用无法访问的旧 API。
使用Windows.Devices.SerialCommunication中的类可以实现串口通信.
您将使用的类是 SerialDevice这将允许您枚举、打开设备并执行 I/O 操作。
为了使用 API,您需要在您的应用程序 list 中添加串行端口功能。 UWP 应用程序只能访问声明的硬件资源。
<DeviceCapability Name="serialcommunication">
<Device Id="vidpid:045E 0610">
<Function Type="name:serialPort"/>
</Device>
</DeviceCapability>
或者如果您想访问任何硬件:
<DeviceCapability Name="serialcommunication">
<Device Id="any">
<Function Type="name:serialPort"/>
</Device>
</DeviceCapability>
您会找到完整的 serial port sample作为 UWP 示例集合的一部分。
关于UWP 链接到串口,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47791149/
我正在开发一个 voip 调用应用程序。我需要做的是在接到来电时将 Activity 带到前台。我在应用程序中使用 Twilio,并在收到推送消息时开始调用。 问题是我试图在接到任何电话时显示 Act
我是一名优秀的程序员,十分优秀!