ost::TTYStream(3)

πŸ“¦ version 1.8.1, in ubuntu jammy

πŸ¦‹ ost::TTYStream(3) πŸ¦‹

okay bestie, this is a page from the GNU CommonC++ Library Functions Manual, and it's literally the moment serial connections become fully-fledged C++ stream girlies. strap in. πŸ’–


✨ NAME ✨

ost::TTYStream β€” TTY streams are used to represent serial connections that are fully 'streamable' objects using C++ stream classes and friends. no cap. πŸ’…


✨ SYNOPSIS ✨

#include <serial.h>

Inherits streambuf, ost::Serial, and iostream.

Inherited by ost::TTYSession, and ost::ttystream.

🫢 Public Member Functions

  • TTYStream(const char *filename, timeout_t to=0) β€” create and open a tty serial port. main character entrance energy.
  • virtual ~TTYStream() β€” end the tty stream and cleanup. she's leaving, but she's cleaning up after herself first. queen behavior.
  • void setTimeout(timeout_t to) β€” set the timeout control.
  • void interactive(bool flag) β€” set tty mode to buffered or 'interactive'.
  • int sync(void) β€” flushes the stream input and out buffers, writes pending output.
  • bool isPending(Pending pend, timeout_t timeout=TIMEOUT_INF) β€” get the status of pending operations.

πŸ”’ Protected Member Functions

  • TTYStream() β€” this constructor is used to derive ttystream, a more C++ style version of the TTYStream class.
  • void allocate(void) β€” used to allocate the buffer space needed for iostream operations.
  • void endStream(void) β€” used to terminate the buffer space and clean up the tty connection.
  • int underflow(void) β€” this streambuf method is used to load the input buffer through the established tty serial port.
  • int uflow(void) β€” this streambuf method is used for doing unbuffered reads through the establish tty serial port when in interactive mode.
  • int overflow(int ch) β€” this streambuf method is used to write the output buffer through the established tty port.

πŸŽ€ Protected Attributes

  • char * gbuf
  • char * pbuf
  • timeout_t timeout

πŸ’ž Friends

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

🧚 Additional Inherited Members

(yes bestie, there's more stuff inherited from up the family tree β€” it's just filed under "additional inherited members" so we don't list every single one here.)


🌈 Detailed Description 🌈

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 TTYStream class. TTYStream 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. πŸ”₯

The TTYSession aggregates a TTYStream and a Common C++ Thread which is assumed to be the execution context that will be used to perform actual I/O operations. This class is very analogous to TCPSession.

πŸ‘‘ Author

David Sugar dyfet@ostel.com

streamable tty serial I/O class. ✨ (that's the tagline, and honestly? she ate.)

πŸ› οΈ Constructor & Destructor Documentation πŸ› οΈ

ost::TTYStream::TTYStream() [protected]

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

ost::TTYStream::TTYStream(const char * filename, timeout_t to = 0)

Create and open a tty serial port.

Parameters

  • filename β€” char name of device to open.
  • to β€” default timeout.

virtual ost::TTYStream::~TTYStream() [virtual]

End the tty stream and cleanup.


πŸ’« Member Function Documentation πŸ’«

void ost::TTYStream::allocate(void) [protected]

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

void ost::TTYStream::endStream(void) [protected]

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

void ost::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

  • flag β€” bool set to true to make interactive.

bool ost::TTYStream::isPending(Pending 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

  • pend β€” ready check to perform.
  • timeout β€” in milliseconds.

Reimplemented from ost::Serial.

int ost::TTYStream::overflow(int ch) [protected]

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

Parameters

  • ch β€” char to push through.

Returns

char pushed through.

void ost::TTYStream::setTimeout(timeout_t to) [inline]

Set the timeout control.

Parameters

  • to β€” timeout to use.

int ost::TTYStream::sync(void)

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

Returns

0 on success.

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


TTYStream& crlf(TTYStream &) [friend]

TTYStream& lfcr(TTYStream &) [friend]

(no extra notes on these two, bestie β€” they're just out here being friends. 🫢)


πŸ“ Member Data Documentation πŸ“

char* ost::TTYStream::gbuf [protected]

char * ost::TTYStream::pbuf [protected]

timeout_t ost::TTYStream::timeout [protected]


🌸 Author 🌸

Generated automatically by Doxygen for GNU CommonC++ from the source code.


and that's the whole page, bestie!! πŸ’œ this was written for GNU CommonC++, dated Sun Dec 27 2020, and it's the ost::TTYStream(3) manual page β€” go forth and stream your serial connections like the icon you are. πŸ’…βœ¨

πŸ“¦ where this page comes from