Serial Port Simulation
-
Shucks, this is a bit difficult to explain, but hopefully someone will understand. I am developing an application that reads data from a serial port. The device that connects to the port is not available yet - fortunately I know the data stream format. I want to develop the application using a "virtual" COM port, meaning I'll have another application producing a data stream to the COM port in use by the application in development. To perhaps explain it better, I want to develop two apps, one that produces a data stream to "COM1" and the real application to read from this COM1 port. After testing with various values from the "COM" port, I want to distribute this app without further development and must be able to read from a real COM port. Please point me in the right direction. Thanks
the confused are confused beyond confusion
-
Shucks, this is a bit difficult to explain, but hopefully someone will understand. I am developing an application that reads data from a serial port. The device that connects to the port is not available yet - fortunately I know the data stream format. I want to develop the application using a "virtual" COM port, meaning I'll have another application producing a data stream to the COM port in use by the application in development. To perhaps explain it better, I want to develop two apps, one that produces a data stream to "COM1" and the real application to read from this COM1 port. After testing with various values from the "COM" port, I want to distribute this app without further development and must be able to read from a real COM port. Please point me in the right direction. Thanks
the confused are confused beyond confusion
A little off topic to begin with, but this board is designated to contain questions about COM where the abbreviation stands for the "Component Object Model" and not the serial communications port. Just in case you had them mixed up. ;) Now to a suggestion for your question: Develop a simulator for your device, but instead of a serial port you can use named pipes. Create the named pipe in your simulator with
::CreateNamedPipe()
and then open it with::CreateFile()
in your application that is supposed to communicate with your future device. You will be able to use the same API as when using a real serial port, but calls to::SetCommState()
and such will returnFALSE
. You will, however, be able to build the complete communication logic and the protocol and leave it unchanged when you open the real serial port instead of a named pipe. I've used this technique several times in situations very similar to yours, which made it possible for me to develop client applications without the hardware."It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown