Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

TTYStream Class Reference

#include <serial.h>

Inheritance diagram for TTYStream::

std::streambuf std::iostream Serial TTYSession ttystream List of all members.

Public Methods

 TTYStream (const char *filename)
 Create and ipen a tty serial port. More...

 ~TTYStream ()
 End the tty stream and cleanup. More...

void setTimeout (timeout_t to)
 Set the timeout control. More...

void Interactive (bool flag)
 Set tty mode to buffered or "interactive". More...

int sync (void)
 Flushes the stream input and out buffers, writes pending output. More...

bool isPending (siopend_t pend, timeout_t timeout=TIMEOUT_INF)
 Get the status of pending operations. More...


Protected Methods

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

void Allocate (void)
 Used to allocate the buffer space needed for iostream operations. More...

void endStream (void)
 Used to terminate the buffer space and clean up the tty connection. More...

int underflow (void)
 This streambuf method is used to load the input buffer through the established tty serial port. More...

int uflow (void)
 This streambuf method is used for doing unbuffered reads through the establish tty serial port when in interactive mode. More...

int overflow (int ch)
 This streambuf method is used to write the output buffer through the established tty port. More...


Protected Attributes

char * gbuf
char * pbuf
timeout_t timeout

Friends

TTYStream & crlf (TTYStream &)
TTYStream & lfcr (TTYStream &)

Constructor & Destructor Documentation

TTYStream::TTYStream   [protected]
 

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

TTYStream::TTYStream const char *   filename
 

Create and ipen a tty serial port.

Parameters:
char   name of device to open.

TTYStream::~TTYStream  
 

End the tty stream and cleanup.


Member Function Documentation

void TTYStream::Allocate void   [protected]
 

Used to allocate the buffer space needed for iostream operations.

This is based on MAX_INPUT.

void TTYStream::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:
bool   set to true to make interactive.

void TTYStream::endStream void   [protected]
 

Used to terminate the buffer space and clean up the tty connection.

This function is called by the destructor.

bool TTYStream::isPending siopend_t   pend,
timeout_t   timeout = TIMEOUT_INF
[virtual]
 

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.

Returns:
true if ready, false if timeout.
Parameters:
ready   check to perform.
timeout   in milliseconds.

Reimplemented from Serial.

int TTYStream::overflow int   ch [protected]
 

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

Parameters:
char   to push through.
Returns:
char pushed through.

void TTYStream::setTimeout timeout_t   to [inline]
 

Set the timeout control.

Parameters:
timeout   to use.

int TTYStream::sync void  
 

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

Returns:
0 on success.

int TTYStream::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 TTYStream::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.


Friends And Related Function Documentation

TTYStream& crlf TTYStream &   [friend]
 

TTYStream& lfcr TTYStream &   [friend]
 


Member Data Documentation

char* TTYStream::gbuf [protected]
 

char * TTYStream::pbuf [protected]
 

timeout_t TTYStream::timeout [protected]
 


The documentation for this class was generated from the following file:
Generated at Tue Oct 16 11:17:19 2001 for CommonC++ by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001