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;
virtual int debug(const char *format,...)
Outputs debug information.
Debuggable(bool debug=false, const std::string &debug_name="", FILE *debug_fp=DEBUG_FP, const std::string &debug_timefmt=DEBUG_TIME_FMT)
Constructs a Debuggable object.
std::string read()
Reads data from the serial port.
SerialPort & operator=(const SerialPort &other)
Assignment operator for SerialPort objects.
~SerialPort()
Destroys a SerialPort object.
bool usesXonXoffFlowControl() const
Gets whether the serial port currently uses XON/XOFF (software) flow control.
std::string getLastError() const
Gets the last error message.
bool close()
Close the serial port.
int getStopBits() const
Gets the current number of stop bits.
bool write(const std::string &data)
Writes data to the serial port.
bool setStopBits(int stopbits)
Sets the current number of stop bits.
bool setDataBits(int databits)
Sets the current number of data bits.
bool enableRtsCtsFlowControl(bool enabled)
Enables RTS/CTS (hardware) flow control on the serial port.
int getBaudRate() const
Gets the current baud rate.
bool enableXonXoffFlowControl(bool enabled)
Enables XON/XOFF (software) flow control on the serial port.
char getParity() const
Gets the current parity setting.
int getDataBits() const
Gets the current number of data bits.
bool setBaudRate(int baudrate)
Sets the current baud rate.
bool setParity(char parity)
Sets the current parity setting.
bool open()
Open the serial port.
bool usesRtsCtsFlowControl() const
Gets whether the serial port currently uses RTS/CTS (hardware) flow control.
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.
Defines functionality for LibCyberRadio applications.