【发布时间】:2017-11-21 07:44:45
【问题描述】:
我正在使用 UWP 创建串行通信程序..
串行通信未连接。 未捕获“设备”。返回 null。
代码在这里。
// Get a device selector from the given port name
string selector = SerialDevice.GetDeviceSelector(portName);
// Get a list of devices that match the given name
DeviceInformationCollection devices = await DeviceInformation.FindAllAsync(selector, null);
// If any device found...
if (devices.Any())
然后,我在 UWP 项目的 Package.appxmanifest 中添加了该代码。
<DeviceCapability Name="serialcommunication">
<Device Id="any">
<Function Type="name:serialPort" />
</Device>
</DeviceCapability>
但它不起作用..
但是,我正在类库中创建串行通信模块。
【问题讨论】:
标签: c# uwp serial-port