Public Types |
|
enum | BaudRateEnum {
BAUD_50 = B50,
BAUD_75 = B75,
BAUD_110 = B110,
BAUD_134 = B134,
BAUD_150 = B150,
BAUD_200 = B200,
BAUD_300 = B300,
BAUD_600 = B600,
BAUD_1200 = B1200,
BAUD_1800 = B1800,
BAUD_2400 = B2400,
BAUD_4800 = B4800,
BAUD_9600 = B9600,
BAUD_19200 = B19200,
BAUD_38400 = B38400,
BAUD_INVALID
} |
| The baud rates currently supported by the SUS-2 general terminal interface specification. More...
|
enum | CharSizeEnum {
CHAR_SIZE_5 = CS5,
CHAR_SIZE_6 = CS6,
CHAR_SIZE_7 = CS7,
CHAR_SIZE_8 = CS8,
CHAR_SIZE_INVALID
} |
| The allowed values of character sizes that can be used during the serial communication. More...
|
enum | ParityEnum {
PARITY_EVEN,
PARITY_ODD,
PARITY_NONE,
PARITY_INVALID
} |
| The allowed values of the parity associated with the serial port communications. More...
|
enum | FlowControlEnum {
FLOW_CONTROL_HARD,
FLOW_CONTROL_SOFT,
FLOW_CONTROL_INVALID
} |
| The values of the flow control settings for a serial port. More...
|
Public Methods |
|
| SerialStreamBuf () |
| The default constructor.
|
| ~SerialStreamBuf () |
| The destructor.
|
|
bool | is_open () const |
| Returns true if a previos call to open() succeeded (returned a non-null value) and there has been no intervening call to close.
|
SerialStreamBuf* | open ( const string filename, ios_base::openmode mode = ios_base::in | ios_base::out ) |
| If is_open() != false , returns a null pointer. More...
|
SerialStreamBuf* | close () |
| If is_open() == false, returns a null pointer. More...
|
int | SetParametersToDefault () |
| Initialize the serial communication parameters to their default values.
|
const BaudRateEnum | SetBaudRate (const BaudRateEnum baud_rate) |
| If is_open() != true, return -1. More...
|
const BaudRateEnum | BaudRate () const |
| Return the current baud rate of the serial port. More...
|
const CharSizeEnum | SetCharSize (const CharSizeEnum char_size) |
| Set the character size to be used during serial communication. More...
|
const CharSizeEnum | CharSize () const |
| Return the character size currently being used for serial communication.
|
short | SetNumOfStopBits (short stop_bits) |
| Set the number of stop bits used during serial communication. More...
|
short | NumOfStopBits () const |
| Get the number of stop bits being used during serial communication. More...
|
const ParityEnum | SetParity (const ParityEnum parity) |
| Set the parity for serial communication. More...
|
const ParityEnum | Parity () const |
| Get the current parity setting for the serial port. More...
|
const FlowControlEnum | SetFlowControl (const FlowControlEnum flow_c) |
| Use the specified flow control.
|
const FlowControlEnum | FlowControl () const |
| Return the current flow control setting.
|
Static Public Attributes |
|
const BaudRateEnum | DEFAULT_BAUD |
| The default value of the baud rate of the serial port.
|
const CharSizeEnum | DEFAULT_CHAR_SIZE |
| The default value of the character size used during the serial communication.
|
const short | DEFAULT_NO_OF_STOP_BITS |
| The default number of stop bits used.
|
const ParityEnum | DEFAULT_PARITY |
| The default parity setting.
|
const FlowControlEnum | DEFAULT_FLOW_CONTROL |
| The default flow control setting.
|
Protected Methods |
virtual streambuf* | setbuf (char_type *, streamsize) |
| Performs an operation that is defined separately for each class derived from streambuf. More...
|
virtual int | sync () |
| Synchronizes the controlled sequence with the arrays. More...
|
virtual int | showmanyc () |
| This method returns an estimate of the number of characters available in the sequence or -1 if no estimate is available. More...
|
virtual streamsize | xsgetn (char_type *s, streamsize n) |
| Reads upto n characters from the serial port and returns them through the character array located at s. More...
|
virtual int_type | underflow () |
| Reads and returns the next character from the associated serial port if one otherwise returns traits::eof(). More...
|
virtual int_type | uflow () |
| Reads and returns the next character from the associated serial port if one otherwise returns traits::eof(). More...
|
virtual int_type | pbackfail (int_type c = traits_type::eof()) |
| This function is called when a putback of a character fails. More...
|
virtual streamsize | xsputn (const char_type* s, streamsize n) |
| Writes upto n characters from tha character sequence at s to the serial port associated with the buffer. More...
|
virtual int_type | overflow (int_type c) |
| Writes the specified character to the associated serial port. More...
|
Private Methods |
int | InitializeSerialPort () |
| This routine is called by open() in order to initialize some parameters of the serial port and setting its parameters to default values. More...
|
Private Attributes |
char | mPutbackChar |
| We use unbuffered I/O for the serial port. More...
|
bool | mPutbackAvailable |
| True if a putback value is available in mPutbackChar.
|
int | mFileDescriptor |
| The file descriptor associated with the serial port.
|