.TH "ost::TTYStream" 3 "Sun Dec 27 2020" "GNU CommonC++" \" -*- nroff -*- .ad l .nh .SH NAME ost::TTYStream \- TTY streams are used to represent serial connections that are fully 'streamable' objects using C++ stream classes and friends\&. .SH SYNOPSIS .br .PP .PP \fC#include \fP .PP Inherits streambuf, \fBost::Serial\fP, and iostream\&. .PP Inherited by \fBost::TTYSession\fP, and \fBost::ttystream\fP\&. .SS "Public Member Functions" .in +1c .ti -1c .RI "\fBTTYStream\fP (const char *filename, \fBtimeout_t\fP to=0)" .br .RI "Create and open a tty serial port\&. " .ti -1c .RI "virtual \fB~TTYStream\fP ()" .br .RI "End the tty stream and cleanup\&. " .ti -1c .RI "void \fBsetTimeout\fP (\fBtimeout_t\fP to)" .br .RI "Set the timeout control\&. " .ti -1c .RI "void \fBinteractive\fP (bool flag)" .br .RI "Set tty mode to buffered or 'interactive'\&. " .ti -1c .RI "int \fBsync\fP (void)" .br .RI "Flushes the stream input and out buffers, writes pending output\&. " .ti -1c .RI "bool \fBisPending\fP (\fBPending\fP pend, \fBtimeout_t\fP \fBtimeout\fP=\fBTIMEOUT_INF\fP)" .br .RI "Get the status of pending operations\&. " .in -1c .SS "Protected Member Functions" .in +1c .ti -1c .RI "\fBTTYStream\fP ()" .br .RI "This constructor is used to derive 'ttystream', a more C++ style version of the \fBTTYStream\fP class\&. " .ti -1c .RI "void \fBallocate\fP (void)" .br .RI "Used to allocate the buffer space needed for iostream operations\&. " .ti -1c .RI "void \fBendStream\fP (void)" .br .RI "Used to terminate the buffer space and clean up the tty connection\&. " .ti -1c .RI "int \fBunderflow\fP (void)" .br .RI "This streambuf method is used to load the input buffer through the established tty serial port\&. " .ti -1c .RI "int \fBuflow\fP (void)" .br .RI "This streambuf method is used for doing unbuffered reads through the establish tty serial port when in interactive mode\&. " .ti -1c .RI "int \fBoverflow\fP (int ch)" .br .RI "This streambuf method is used to write the output buffer through the established tty port\&. " .in -1c .SS "Protected Attributes" .in +1c .ti -1c .RI "char * \fBgbuf\fP" .br .ti -1c .RI "char * \fBpbuf\fP" .br .ti -1c .RI "\fBtimeout_t\fP \fBtimeout\fP" .br .in -1c .SS "Friends" .in +1c .ti -1c .RI "\fBTTYStream\fP & \fBcrlf\fP (\fBTTYStream\fP &)" .br .ti -1c .RI "\fBTTYStream\fP & \fBlfcr\fP (\fBTTYStream\fP &)" .br .in -1c .SS "Additional Inherited Members" .SH "Detailed Description" .PP TTY streams are used to represent serial connections that are fully 'streamable' objects using C++ stream classes and friends\&. The first application relevant serial I/O class is the \fBTTYStream\fP class\&. \fBTTYStream\fP offers a linearly buffered 'streaming' I/O session with the serial device\&. Furthermore, traditional C++ 'stream' operators (<< and >>) may be used with the serial device\&. A more 'true' to ANSI C++ library format 'ttystream' is also available, and this supports an 'open' method in which one can pass initial serial device parameters immediately following the device name in a single string, as in '/dev/tty3a:9600,7,e,1', as an example\&. .PP The \fBTTYSession\fP aggragates a \fBTTYStream\fP and a Common C++ \fBThread\fP which is assumed to be the execution context that will be used to perform actual I/O operations\&. This class is very anagolous to \fBTCPSession\fP\&. .PP \fBAuthor\fP .RS 4 David Sugar dyfet@ostel.com .RE .PP streamable tty serial I/O class\&. .SH "Constructor & Destructor Documentation" .PP .SS "ost::TTYStream::TTYStream ()\fC [protected]\fP" .PP This constructor is used to derive 'ttystream', a more C++ style version of the \fBTTYStream\fP class\&. .SS "ost::TTYStream::TTYStream (const char * filename, \fBtimeout_t\fP to = \fC0\fP)" .PP Create and open a tty serial port\&. .PP \fBParameters\fP .RS 4 \fIfilename\fP char name of device to open\&. .br \fIto\fP default timeout\&. .RE .PP .SS "virtual ost::TTYStream::~TTYStream ()\fC [virtual]\fP" .PP End the tty stream and cleanup\&. .SH "Member Function Documentation" .PP .SS "void ost::TTYStream::allocate (void)\fC [protected]\fP" .PP Used to allocate the buffer space needed for iostream operations\&. This is based on MAX_INPUT\&. .SS "void ost::TTYStream::endStream (void)\fC [protected]\fP" .PP Used to terminate the buffer space and clean up the tty connection\&. This function is called by the destructor\&. .SS "void ost::TTYStream::interactive (bool flag)" .PP Set tty mode to buffered or 'interactive'\&. When interactive, all streamed I/O is directly sent to the serial port immediately\&. .PP \fBParameters\fP .RS 4 \fIflag\fP bool set to true to make interactive\&. .RE .PP .SS "bool ost::TTYStream::isPending (\fBPending\fP pend, \fBtimeout_t\fP timeout = \fC\fBTIMEOUT_INF\fP\fP)\fC [virtual]\fP" .PP 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\&. .PP \fBReturns\fP .RS 4 true if ready, false if timeout\&. .RE .PP \fBParameters\fP .RS 4 \fIpend\fP ready check to perform\&. .br \fItimeout\fP in milliseconds\&. .RE .PP .PP Reimplemented from \fBost::Serial\fP\&. .SS "int ost::TTYStream::overflow (int ch)\fC [protected]\fP" .PP This streambuf method is used to write the output buffer through the established tty port\&. .PP \fBParameters\fP .RS 4 \fIch\fP char to push through\&. .RE .PP \fBReturns\fP .RS 4 char pushed through\&. .RE .PP .SS "void ost::TTYStream::setTimeout (\fBtimeout_t\fP to)\fC [inline]\fP" .PP Set the timeout control\&. .PP \fBParameters\fP .RS 4 \fIto\fP timeout to use\&. .RE .PP .SS "int ost::TTYStream::sync (void)" .PP Flushes the stream input and out buffers, writes pending output\&. .PP \fBReturns\fP .RS 4 0 on success\&. .RE .PP .SS "int ost::TTYStream::uflow (void)\fC [protected]\fP" .PP 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\&. .PP \fBReturns\fP .RS 4 char from tty serial port, EOF also possible\&. .RE .PP .SS "int ost::TTYStream::underflow (void)\fC [protected]\fP" .PP This streambuf method is used to load the input buffer through the established tty serial port\&. .PP \fBReturns\fP .RS 4 char from get buffer, EOF also possible\&. .RE .PP .SH "Friends And Related Function Documentation" .PP .SS "\fBTTYStream\fP& crlf (\fBTTYStream\fP &)\fC [friend]\fP" .SS "\fBTTYStream\fP& lfcr (\fBTTYStream\fP &)\fC [friend]\fP" .SH "Member Data Documentation" .PP .SS "char* ost::TTYStream::gbuf\fC [protected]\fP" .SS "char * ost::TTYStream::pbuf\fC [protected]\fP" .SS "\fBtimeout_t\fP ost::TTYStream::timeout\fC [protected]\fP" .SH "Author" .PP Generated automatically by Doxygen for GNU CommonC++ from the source code\&.