在 Windows Mobile 6 设备模拟器中映射虚拟串行端口时找不到端口
我正在开发一个使用条形码扫描仪的 Windows Mobile 6.5 应用程序。我正在尝试在我的开发环境中的 Windows Mobile 6 设备模拟器上模拟扫描仪的行为。
我使用 com0com 创建了一对虚拟串行端口(“COM2”和“COMA”)。我已经确认这两个虚拟串行端口都可以使用 HyperTerminal 和 Portmon 正常工作。我已将 COM2 映射到模拟器中的第一个串行端口(“串行端口 0”)。据我了解,该端口应该可以在设备上作为“COM1”进行访问。
在设备上调用 SerialPort.GetPortNames() 会报告三个串行端口:-“COM1”、“COM3”、“COM5”。尝试打开此端口时,会引发 IO 异常,表明串行端口不存在。
关于此问题的可能原因有什么建议吗?
根据要求,打开端口的代码:-
// Set up the serial port and open
serialPort.PortName = "COM1";
serialPort.BaudRate = 9600;
serialPort.DataBits = 8;
serialPort.Handshake = Handshake.None;
serialPort.Parity = Parity.None;
serialPort.StopBits = StopBits.One;
serialPort.ReadTimeout = 250;
serialPort.Open();
I'm working on a Windows Mobile 6.5 application that utilises a barcode scanner. I'm attempting to emulate the behaviour of the scanner on the Windows Mobile 6 Device Emulator in my development environment.
I've created a pair of virtual serial ports using com0com ('COM2' and 'COMA'). I've confirmed both of these virtual serial ports are working using HyperTerminal and Portmon. I've mapped COM2 to the first serial port ('Serial port 0') in the emulator. As I understand, this port should then be accessible as 'COM1' on the device.
Calling SerialPort.GetPortNames() on the device reports three serial ports:- 'COM1', 'COM3', 'COM5'. On attempting to open this port an IO exception is being thrown stating that the serial port does not exist.
Any suggestions as to possible causes for this problem?
As requested, the code that opens the port:-
// Set up the serial port and open
serialPort.PortName = "COM1";
serialPort.BaudRate = 9600;
serialPort.DataBits = 8;
serialPort.Handshake = Handshake.None;
serialPort.Parity = Parity.None;
serialPort.StopBits = StopBits.One;
serialPort.ReadTimeout = 250;
serialPort.Open();
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,这是 6.5 设备模拟器映像的问题。使用 Windows Mobile 6 映像可以正常工作。
This turned out to be an issue with the 6.5 device emulator images. Using a Windows Mobile 6 image instead works fine.