Serial port library written in C++
Library for communicating with COM ports on a Linux system.
Uses fstream to the file I/O.
- Clone the git repo onto your local storage.
- Run make all to compile and run unit tests. Do not worry about error messages being printed when unit tests are run, the unit tests are designed to specifically cause errors to test the response.
- To include serial-port-cpp into your embedded (or otherwise) firmware/software project, copy the repo into your project folder (or other suitable place), include the file "/api/SerialPortApi.hpp" from your C++ code, and make sure to compile all the files within "/src/".
The following table lists all of the libraries dependencies.
|C++14||C++14 used for strongly typed enums, std::chrono and literals.|
|stty||Used in unit tests to verify the serial port is configured correctly.|
See GitHub Issues.
Nothing here yet...
- My code stalls when calling functions like
SerialPort::Read(). This is probably because the library is set up to do a blocking read, and not enough characters have been received to allow
SerialPort::Read()to return. Use
SerialPort::SetNumCharsToWait()to determine how many characters to wait for before returning (set to 0 for non-blocking mode).