11 #ifndef INCLUDED_LIBCYBERRADIO_SERIALPORT_H_ 12 #define INCLUDED_LIBCYBERRADIO_SERIALPORT_H_ 14 #include "LibCyberRadio/Common/Debuggable.h" 46 const std::string& device,
47 int baudrate = 115200,
91 bool write(
const std::string& data);
207 std::string _lastError;
213 struct termios _settings;
int getDataBits() const
Gets the current number of data bits.
int getStopBits() const
Gets the current number of stop bits.
bool setBaudRate(int baudrate)
Sets the current baud rate.
~SerialPort()
Destroys a SerialPort object.
bool setDataBits(int databits)
Sets the current number of data bits.
SerialPort(const std::string &device, int baudrate=115200, char parity='N', int databits=8, int stopbits=1, bool xonxoff=false, bool rtscts=false, bool debug=false)
Constructs a SerialPort object.
Class that manages communications with a serial port.
bool write(const std::string &data)
Writes data to the serial port.
char getParity() const
Gets the current parity setting.
Class that supports debug output.
bool setStopBits(int stopbits)
Sets the current number of stop bits.
bool open()
Open the serial port.
std::string getLastError() const
Gets the last error message.
bool enableXonXoffFlowControl(bool enabled)
Enables XON/XOFF (software) flow control on the serial port.
SerialPort & operator=(const SerialPort &other)
Assignment operator for SerialPort objects.
virtual int debug(const char *format,...)
Outputs debug information.
Defines functionality for LibCyberRadio applications.
bool usesRtsCtsFlowControl() const
Gets whether the serial port currently uses RTS/CTS (hardware) flow control.
bool setParity(char parity)
Sets the current parity setting.
bool close()
Close the serial port.
bool usesXonXoffFlowControl() const
Gets whether the serial port currently uses XON/XOFF (software) flow control.
bool enableRtsCtsFlowControl(bool enabled)
Enables RTS/CTS (hardware) flow control on the serial port.
std::string read()
Reads data from the serial port.
int getBaudRate() const
Gets the current baud rate.