36#include <libserial/SerialPortConstants.h>
37#include <libserial/SerialStreamBuf.h>
102 const BaudRate& baudRate = BaudRate::BAUD_DEFAULT,
103 const CharacterSize& characterSize = CharacterSize::CHAR_SIZE_DEFAULT,
104 const FlowControl& flowControlType = FlowControl::FLOW_CONTROL_DEFAULT,
105 const Parity& parityType = Parity::PARITY_DEFAULT,
106 const StopBits& stopBits = StopBits::STOP_BITS_DEFAULT,
107 bool exclusive =
true) ;
148 void Open(
const std::string& fileName,
149 const std::ios_base::openmode& openMode = std::ios_base::in | std::ios_base::out,
150 bool exclusive =
true) ;
230 void SetParity(
const Parity& parityType) ;
255 void SetVMin(
const short vmin) ;
283 void SetDTR(
const bool dtrState =
true) ;
296 void SetRTS(
const bool rtsState =
true) ;
345 std::unique_ptr<SerialStreamBuf> mIOBuffer {
nullptr} ;
SerialStream is a stream class for accessing serial ports on POSIX operating systems....
void FlushIOBuffers()
Flushes the serial port input and output buffers.
void DrainWriteBuffer()
Waits until the write buffer is drained and then returns.
short GetVMin()
Gets the VMIN value for the device, which represents the minimum number of characters for non-canonic...
SerialStream & operator=(const SerialStream &otherSerialStream)=delete
Prevents copying of objects of this class by declaring the assignment operator private....
BaudRate GetBaudRate()
Gets the current baud rate for the serial port.
bool GetDSR()
Get the status of the DSR line.
void SetCharacterSize(const CharacterSize &characterSize)
Sets the character size for the serial port.
SerialStream(const SerialStream &otherSerialStream)=delete
Prevents copying of objects of this class by declaring the copy constructor private....
bool GetCTS()
Get the status of the CTS line.
void SetBaudRate(const BaudRate &baudRate)
Sets the baud rate for the serial port to the specified value.
int GetNumberOfBytesAvailable()
Gets the number of bytes available in the read buffer.
bool IsDataAvailable()
Checks if data is available at the input of the serial port.
void FlushInputBuffer()
Flushes the serial port input buffer.
short GetVTime()
Gets the current timeout value for non-canonical reads in deciseconds.
SerialStream & operator=(const SerialStream &&otherSerialStream)=delete
Move assignment is not allowed.
void Close()
Closes the serial port. All settings of the serial port will be lost and no more I/O can be performed...
virtual ~SerialStream()
Default Destructor for a SerialStream object Closes the stream associated with mFileDescriptor,...
StopBits GetStopBits()
Gets the number of stop bits currently being used by the serial.
void SetDTR(const bool dtrState=true)
Sets the DTR line to the specified value.
void SetFlowControl(const FlowControl &flowControlType)
Sets flow control for the serial port.
int GetFileDescriptor()
Gets the serial port file descriptor.
SerialStream()
Default Contructor. Creates a new SerialStream object but does not open it. The Open() method will ne...
FlowControl GetFlowControl()
Gets the current flow control setting.
void SetVMin(const short vmin)
Sets the minimum number of characters for non-canonical reads.
void SetStopBits(const StopBits &stopBits)
Sets the number of stop bits to be used with the serial port.
void SetVTime(const short vtime)
Sets character buffer timeout for non-canonical reads in deciseconds.
bool IsOpen()
Determines if the serial port is open for I/O.
void Open(const std::string &fileName, const std::ios_base::openmode &openMode=std::ios_base::in|std::ios_base::out, bool exclusive=true)
Opens the serial port associated with the specified file name and the specified mode.
bool GetDTR()
Gets the status of the DTR line.
CharacterSize GetCharacterSize()
Gets the character size being used for serial communication.
void SetRTS(const bool rtsState=true)
Set the RTS line to the specified value.
std::vector< std::string > GetAvailableSerialPorts()
Gets a list of available serial ports.
void FlushOutputBuffer()
Flushes the serial port output buffer.
Parity GetParity()
Gets the parity type for the serial port.
SerialStream(const SerialStream &&otherSerialStream)=delete
Move construction is disallowed.
bool GetRTS()
Get the status of the RTS line.
void SetParity(const Parity &parityType)
Sets the parity type for the serial port.