To stay as close to your model as possible, you can do a couple of things:
1) Use a simple file descriptor (via open ()). You should also use read () and write () to communicate with the serial port.
2) Using 1 above allows you to use select to see if something is ready for writing or reading.
It will also allow you to move the connection to the modem to another thread if there are other things that your program should do ...
I recently did something very simulated with the HF Radio modem only and used the Boost ASIO library to communicate over the serial port.
This may help you if this is an option.
source share