8 #ifndef _SerialStreamBuf_h_
9 #define _SerialStreamBuf_h_
82 BAUD_460800 = SerialPort::BAUD_460800,
283 std::ios_base::openmode mode =
284 std::ios_base::in | std::ios_base::out ) ;
385 const short SetVMin(
short vtime ) ;
391 const short VMin()
const;
397 const short SetVTime(
short vtime ) ;
403 const short VTime()
const;
450 virtual std::streambuf*
setbuf( char_type*,
459 virtual std::streamsize
xsgetn( char_type* s,
460 std::streamsize n ) ;
490 virtual int_type
uflow() ;
498 virtual int_type
pbackfail(int_type c = traits_type::eof()) ;
506 virtual std::streamsize
xsputn(
const char_type* s,
507 std::streamsize n ) ;
514 virtual int_type
overflow(int_type c) ;
564 mPutbackAvailable(false),
592 return std::streambuf::setbuf(0, 0) ;
602 if( this->
is_open() ==
false ) {
627 std::streambuf::int_type
637 #endif // #ifndef _SerialStreamBuf_h_
int InitializeSerialPort()
This routine is called by open() in order to initialize some parameters of the serial port and settin...
FlowControlEnum
The values of the flow control settings for a serial port.
static const short DEFAULT_VTIME
The default character buffer timing.
const short VTime() const
Get the current timeout value for non-canonical reads in deciseconds.
int mFileDescriptor
The file descriptor associated with the serial port.
static const ParityEnum DEFAULT_PARITY
The default parity setting.
const BaudRateEnum BaudRate() const
Return the current baud rate of the serial port.
const ParityEnum Parity() const
Get the current parity setting for the serial port.
static const short DEFAULT_VMIN
The default character buffer size.
CharSizeEnum
The allowed values of character sizes that can be used during the serial communication.
virtual std::streamsize xsputn(const char_type *s, std::streamsize n)
Writes upto n characters from the character sequence at s to the serial port associated with the buff...
~SerialStreamBuf()
The destructor.
virtual int_type uflow()
Reads and returns the next character from the associated serial port if one otherwise returns traits:...
const short VMin() const
Get the VMIN value for the device.
short SetNumOfStopBits(short numOfStopBits)
Set the number of stop bits used during serial communication.
virtual std::streamsize showmanyc()
Check, wether input is available on the port.
static const CharSizeEnum DEFAULT_CHAR_SIZE
The default value of the character size used during the serial communication.
const short SetVTime(short vtime)
Set character buffer timeout in 10ths of a second.
static const FlowControlEnum DEFAULT_FLOW_CONTROL
The default flow control setting.
static const char CTRL_Q
Character used to signal that I/O can start while using software flow control with the serial port...
bool mPutbackAvailable
True if a putback value is available in mPutbackChar.
const BaudRateEnum SetBaudRate(const BaudRateEnum baudRate)
If is_open() != true, return -1.
SerialStreamBuf * open(const std::string filename, std::ios_base::openmode mode=std::ios_base::in|std::ios_base::out)
If is_open() != false, returns a null pointer.
BaudRateEnum
The baud rates currently supported by the SUS-2 general terminal interface specification.
const ParityEnum SetParity(const ParityEnum parityType)
Set the parity for serial communication.
const CharSizeEnum SetCharSize(const CharSizeEnum charSize)
Set the character size to be used during serial communication.
bool is_open() const
Returns true if a previous call to open() succeeded (returned a non-null value) and there has been no...
ParityEnum
The allowed values of the parity associated with the serial port communications.
int SetParametersToDefault()
Initialize the serial communication parameters to their default values.
No parity i.e. parity checking disabled.
const short SetVMin(short vtime)
Set the minimum number of characters for non-canonical reads.
This is the streambuf subclass used by SerialStream.
char mPutbackChar
We use unbuffered I/O for the serial port.
const FlowControlEnum FlowControl() const
Return the current flow control setting.
virtual std::streamsize xsgetn(char_type *s, std::streamsize n)
Reads upto n characters from the serial port and returns them through the character array located at ...
Invalid flow control setting.
SerialStreamBuf & operator=(const SerialStreamBuf &)
SerialStreamBuf * close()
If is_open() == false, returns a null pointer.
virtual int_type underflow()
Reads and returns the next character from the associated serial port if one otherwise returns traits:...
short NumOfStopBits() const
Get the number of stop bits being used during serial communication.
static const short DEFAULT_NO_OF_STOP_BITS
The default number of stop bits used.
static const BaudRateEnum DEFAULT_BAUD
The default value of the baud rate of the serial port.
const CharSizeEnum CharSize() const
Return the character size currently being used for serial communication.
virtual std::streambuf * setbuf(char_type *, std::streamsize)
Performs an operation that is defined separately for each class derived from streambuf.
virtual int_type pbackfail(int_type c=traits_type::eof())
This function is called when a putback of a character fails.
static const char CTRL_S
Character used to signal that I/O should stop while using software flow control with the serial port...
const FlowControlEnum SetFlowControl(const FlowControlEnum flowControlType)
Use the specified flow control.
virtual int_type overflow(int_type c)
Writes the specified character to the associated serial port.
SerialStreamBuf()
The default constructor.