Reputation: 357
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();
Upvotes: 0
Views: 1321
Reputation: 357
This turned out to be an issue with the 6.5 device emulator images. Using a Windows Mobile 6 image instead works fine.
Upvotes: 1