ost::SerialPort(3)
π ost::SerialPort(3) β the manual page, bestie edition π
okay so real talk, this page lives in the Library Functions Manual and it's all about ost::SerialPort, a GNU CommonC++ thing. pull up a chair, grab a strawberry π, and let's get into it.
β¨ NAME β¨
ost::SerialPort β so like, the serial port is an internal class which is attached to and then serviced by a specified SerialService thread. that's the whole vibe. it doesn't go out alone, it's got a service thread holding its hand π«Ά
π SYNOPSIS π
#include <serial.h>
Inherits ost::Serial, and ost::TimerPort. yes bestie, it's got two parents and both of them ate π
π Public Member Functions
void setTimer (timeout_t timeout=0)β a derivedsetTimerthat goes and tells the service thread pool "hey, the expected timeout changed!!" so it can reschedule everything.void incTimer (timeout_t timeout)β a derivedincTimerthat also notifies the service thread pool that the expected timeout changed. same energy, different function, periodt.
π Protected Member Functions
SerialPort (SerialService *svc, const char *name)β constructs a tty serial port for a named serial device. iconic.virtual ~SerialPort ()β disconnects the Serial Port from the service pool thread and shuts the port down. say bye bye πvoid setDetectPending (bool)β tells the service thread whether it should be monitoring pending data for us.bool getDetectPending (void) constβ returns the current state of theDetectPendingflag. vibe check on that flag.void setDetectOutput (bool)β tells whether output-ready monitoring should be done by the service thread.bool getDetectOutput (void) constβ returns the current state of theDetectOutputflag.virtual void expired (void)β called by the service thread when the object's timer has expired. ding, time's up β°virtual void pending (void)β called by the service thread when input data is pending for this tty port.virtual void disconnect (void)β called by the service thread when an exception has occurred, such as a hangup.int output (void *buf, int len)β transmits "send" data to the serial port.virtual void output (void)β performed when output is available for sending data.int input (void *buf, int len)β receives "input" for pending data from the serial port.
π¦ Friends
class SerialService
Additional Inherited Members
(yes there are more, they're inherited, go look at the parent classes, iykyk π)
πΈ DETAILED DESCRIPTION πΈ
The serial port is an internal class which is attached to and then serviced by a specified SerialService thread.
Derived versions of this class offer specific functionality such as serial integration protocols. so if you want custom behaviour, you make a baby class that inherits from this one πΌ
The TTYPort and TTYService classes are used to form thread-pool serviced serial I/O protocol sets. These can be used when one has a large number of serial devices to manage, and a single (or limited number of) thread(s) can then be used to service the tty port objects present. Each tty port supports a timer control and several virtual methods that the service thread can call when events occur. This model provides for 'callback' event management, whereby the service thread performs a 'callback' into the port object when events occur. Specific events supported include:
- the expiration of a
TTYPorttimer β° - pending input data waiting to be read π₯
'sighup'connection breaks π
ngl this is genuinely elegant. one thread, many ports, callbacks doing the absolute most. main character energy fr fr.
Author
David Sugar dyfet@ostel.com
base class for thread pool serviced serial I/O.
π§ CONSTRUCTOR & DESTRUCTOR DOCUMENTATION π§
ost::SerialPort::SerialPort (SerialService * svc, const char * name)
[protected]
Construct a tty serial port for a named serial device.
Parameters
- svc β pool thread object.
- name β of tty port.
virtual ost::SerialPort::~SerialPort () [protected], [virtual]
Disconnect the Serial Port from the service pool thread and shutdown the port. it's giving "we're done here" π
β MEMBER FUNCTION DOCUMENTATION β
virtual void ost::SerialPort::disconnect (void) [protected], [virtual]
Called by the service thread when an exception has occured such as a hangup.
virtual void ost::SerialPort::expired (void) [protected], [virtual]
Called by the service thread when the objects timer has expired.
bool ost::SerialPort::getDetectOutput (void) const [inline], [protected]
Get the current state of the DetectOutput flag.
bool ost::SerialPort::getDetectPending (void) const [inline], [protected]
Get the current state of the DetectPending flag.
void ost::SerialPort::incTimer (timeout_t timeout)
Derived incTimer to notify the service thread pool of a change in expected timeout. This allows SerialService to reschedule all timers.
int ost::SerialPort::input (void * buf, int len) [inline], [protected]
Receive 'input' for pending data from the serial port. This is not a public member since it's meant to support internal protocols rather than direct external access to the device. so don't go poking it from outside, bestie π
Returns
- number of bytes received.
Parameters
- buf β address of buffer to input.
- len β of input buffer used.
int ost::SerialPort::output (void * buf, int len) [inline], [protected]
Transmit 'send' data to the serial port. This is not public since it's meant to support internal protocols rather than direct public access to the device.
Returns
- number of bytes send.
Parameters
- buf β address of buffer to send.
- len β of bytes to send.
virtual void ost::SerialPort::output (void) [protected], [virtual]
Perform when output is available for sending data.
virtual void ost::SerialPort::pending (void) [protected], [virtual]
Called by the service thread when input data is pending for this tty port. Effected by setPacketInput and by setLineInput.
void ost::SerialPort::setDetectOutput (bool) [protected]
Used to indicate if output ready monitoring should be performed by the service thread.
void ost::SerialPort::setDetectPending (bool) [protected]
Used to indicate if the service thread should monitor pending data for us.
void ost::SerialPort::setTimer (timeout_t timeout = 0)
Derived setTimer to notify the service thread pool of changes in expected timeout. This allows SerialService to reschedule all timers.
Parameters
- timeout β in milliseconds.
π FRIENDS AND RELATED FUNCTION DOCUMENTATION π
friend class SerialService [friend]
your fave is friends with SerialService, we love a supportive relationship π«Ά
π AUTHOR π
Generated automatically by Doxygen for GNU CommonC++ from the source code.
so yeah. that's the whole page, every flag, every signature, every parameter, nothing skipped, no cap. if you needed the tl;dr: it's a base class for thread pool serviced serial I/O and it's honestly kind of iconic β¨
and that's a wrap, bestie β this lil manual page came out of GNU CommonC++ and got its glow-up dated Sun Dec 27 2020, which is literally when this version of ost::SerialPort(3) was born. slay πππ¦
π¦ where this page comes from
- ubuntu jammy: libcommoncpp2-doc 1.8.1-10
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms