class TTYStream

streamable tty serial I/O class. More...

Definition#include <serial.h>
InheritsSerial, streambuf, iostream
Inherited byttystream, TTYSession
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Members

Protected Members


Detailed Description

TTY streams are used to represent serial connections that are fully "streamable" objects using C++ stream classes and friends.

TTYStream ()
[protected]

This constructor is used to derive "ttystream", a more C++ style version of the TTYStream class.

void Allocate (void)
[protected]

Used to allocate the buffer space needed for iostream operations. This is based on MAX_INPUT.

void endStream (void)
[protected]

Used to terminate the buffer space and clean up the tty connection. This function is called by the destructor.

int underflow (void)
[protected]

This streambuf method is used to load the input buffer through the established tty serial port.

Returns: char from get buffer, EOF also possible.

int uflow (void)
[protected]

This streambuf method is used for doing unbuffered reads through the establish tty serial port when in interactive mode. Also this method will handle proper use of buffers if not in interative mode.

Returns: char from tty serial port, EOF also possible.

int overflow (int ch)
[protected]

This streambuf method is used to write the output buffer through the established tty port.

Parameters:
charto push through.

Returns: char pushed through.

TTYStream (const char *filename)

Create and ipen a tty serial port.

Parameters:
charname of device to open.

~TTYStream ()

End the tty stream and cleanup.

void Interactive (bool flag)

Set tty mode to buffered or "interactive". When interactive, all streamed I/O is directly sent to the serial port immediately.

Parameters:
boolset to true to make interactive.

int sync (void)

Flushes the stream input and out buffers, writes pending output.

Returns: 0 on success.

bool isPending (siopend_t pend, timeout_t timeout = TIMEOUT_INF)

Get the status of pending operations. This can be used to examine if input or output is waiting, or if an error has occured on the serial device. If read buffer contains data then input is ready and if write buffer contains data it is first flushed then checked.

Parameters:
readycheck to perform.
timeoutin milliseconds.

Returns: true if ready, false if timeout.

Reimplemented from Serial