win10 IoT开发 Serial?Device 返回 null

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了win10 IoT开发 Serial?Device 返回 null相关的知识,希望对你有一定的参考价值。

树莓派3,win10 Iot,串口开发,抄例子,串口获取返回老是null,例子却可以,代码一样,上网查询结果如下:

https://stackoverflow.com/questions/34160376/windows-universal-app-serial-ports-wont-open-serialdevice-fromidasync-always-n

 

So Microsoft do not mention that you need to add something to the app manifest for serial communication nor is there a tick box in the app manifest GUI for serial communication.

The following needs to be added to your app manifest (create the <Capabilities> section if it doesn‘t exist):

<Capabilities>
  <DeviceCapability Name="serialcommunication">
    <Device Id="any">
      <Function Type="name:serialPort" />
    </Device>
  </DeviceCapability>
</Capabilities>

UPDATE 10/2016

Microsoft have updated their documentation to reflect this requirement.

https://msdn.microsoft.com/en-us/library/windows/apps/windows.devices.serialcommunication.aspx

 

记录并转载

以上是关于win10 IoT开发 Serial?Device 返回 null的主要内容,如果未能解决你的问题,请参考以下文章

Win10 IoT C#开发 1 - Raspberry安装IoT系统及搭建开发环境

Win10 IoT C#开发 2 - GPIO Pin 控制发光二极管

Windows 10 IoT为Win10 IoT镜像添加默认应用(树莓派)

Win10 IoT C#开发 1.5 - 创建基于XAML的UI程序 及 应用的三种部署方法

Windows10 IoT开发系列API 移植工具

Win10 IoT系列 02Windows 10 IoT系统刻录和安装