I have a question for my student project about serial ports. I develop a simulator and I try to connect two serial ports on the same computer like /dev/ser1 and /dev/ser2. Is there a command line or a C/C++ function for that?
I have a question for my student project about serial ports. I develop a simulator and I try to connect
two serial ports on the same computer like /dev/ser1 and /dev/ser2. Is there a command line or a C/C++ >function for that?
You can use qtalk to connect two serial ports. If that does not answer your question, then you need to be a little more clear about what you are asking.
Thank you Mario and Maschoen for your answers. Sorry for my English. I hope this will be more clear.
So, on one computer, I have one program which use /dev/ser1 and another program which use /dev/ser2. It is possible to connect the two serial ports without using a cable but by typing a command ? The aim is to establish a serial communication between the two programs. Thanks
I develop a program on QNX which controls 4 trains running on a railroad model. This program uses a serial port (/dev/ser1) to communicate with the railroad model. But before using this program in real, I have to simulate this one in order to verify that any train will collide with another one.
So, I develop a simulator which runs on the same computer as the program (I only have one computer). This sumulator uses the second serial port (/dev/ser2).
So, in order to establish the communication between the simulator and the program, I have to create a kind of virtual link between /dev/ser1 and /dev/ser2.
I have found nullmodem (src) by Rinas which creates a virtual network of pseudo-terminals. I think it could help me. For the portability, I just have to replace the â€œgetopt_longâ€
This is very easy to do under QNX. Here are two ways.
Make the simulator a resource manager and have it attach to /dev/ser1.
When your program opens /dev/ser1 it will be communicating with the simulator.
This is the harder way as you have to learn about resource managers
Create an API in your program that hides the serial access.
Create two versions of the implementation of the API.
One of these implementations is the real one, it just passes the calls on to
real I/O calls.
The 2nd implementation uses message passing to communicate with
a simulator. This is easiest if your communications are client-server
oriented. If not, you might need to use a 2nd thread in your simulator.
Of course one wonders if you’ve already done what you say, why don’t you
just connect the two serial ports with a null modem cable?