The serial port is an internal class which is attached to and then serviced by a specified SerialService thread.
More...
|
| void | setTimer (timeout_t timeout=0) |
| | Derived setTimer to notify the service thread pool of changes in expected timeout.
|
| |
| void | incTimer (timeout_t timeout) |
| | Derived incTimer to notify the service thread pool of a change in expected timeout.
|
| |
| virtual | ~Serial () |
| | The serial base class may be "thrown" as a result on an error, and the "catcher" may then choose to destory the object.
|
| |
| Serial & | operator= (const Serial &from) |
| | Serial ports may also be duplecated by the assignment operator.
|
| |
| Error | setSpeed (unsigned long speed) |
| | Set serial port speed for both input and output.
|
| |
| Error | setCharBits (int bits) |
| | Set character size.
|
| |
| Error | setParity (Parity parity) |
| | Set parity mode.
|
| |
| Error | setStopBits (int bits) |
| | Set number of stop bits.
|
| |
| Error | setFlowControl (Flow flow) |
| | Set flow control.
|
| |
| void | toggleDTR (timeout_t millisec) |
| | Set the DTR mode off momentarily.
|
| |
| void | sendBreak (void) |
| | Send the "break" signal.
|
| |
| Error | getErrorNumber (void) |
| | Often used by a "catch" to fetch the last error of a thrown serial.
|
| |
| char * | getErrorString (void) |
| | Often used by a "catch" to fetch the user set error string of a thrown serial.
|
| |
| int | getBufferSize (void) |
| | Get the "buffer" size for buffered operations.
|
| |
| virtual bool | isPending (Pending pend, timeout_t timeout=TIMEOUT_INF) |
| | Get the status of pending operations.
|
| |
| | TimerPort () |
| | Create a timer, mark it as inactive, and set the initial "start" time to the creation time of the timer object.
|
| |
| void | setTimer (timeout_t timeout=0) |
| | Set a new start time for the object based on when this call is made and optionally activate the timer for a specified number of milliseconds.
|
| |
| void | incTimer (timeout_t timeout) |
| | Set a timeout based on the current time reference value either from object creation or the last setTimer().
|
| |
| void | decTimer (timeout_t timeout) |
| | Adjust a timeout based on the current time reference value either from object creation or the last setTimer().
|
| |
| void | sleepTimer (void) |
| | Sleep until the current timer expires.
|
| |
| void | endTimer (void) |
| | This is used to "disable" the service thread from expiring the timer object.
|
| |
| timeout_t | getTimer (void) const |
| | This is used by service threads to determine how much time remains before the timer expires based on a timeout specified in setTimer() or incTimer().
|
| |
| timeout_t | getElapsed (void) const |
| | This is used to determine how much time has elapsed since a timer port setTimer benchmark time was initially set.
|
| |
|
| | SerialPort (SerialService *svc, const char *name) |
| | Construct a tty serial port for a named serial device.
|
| |
| virtual | ~SerialPort () |
| | Disconnect the Serial Port from the service pool thread and shutdown the port.
|
| |
| void | setDetectPending (bool) |
| | Used to indicate if the service thread should monitor pending data for us.
|
| |
| bool | getDetectPending (void) const |
| | Get the current state of the DetectPending flag.
|
| |
| void | setDetectOutput (bool) |
| | Used to indicate if output ready monitoring should be performed by the service thread.
|
| |
| bool | getDetectOutput (void) const |
| | Get the current state of the DetectOutput flag.
|
| |
| virtual void | expired (void) |
| | Called by the service thread when the objects timer has expired.
|
| |
| 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 occured such as a hangup.
|
| |
| int | output (void *buf, int len) |
| | Transmit "send" data to the serial port.
|
| |
| virtual void | output (void) |
| | Perform when output is available for sending data.
|
| |
| int | input (void *buf, int len) |
| | Receive "input" for pending data from the serial port.
|
| |
| void | open (const char *fname) |
| | Opens the serial device.
|
| |
| void | close (void) |
| | Closes the serial device.
|
| |
| virtual int | aRead (char *Data, const int Length) |
| | Reads from serial device.
|
| |
| virtual int | aWrite (const char *Data, const int Length) |
| | Writes to serial device.
|
| |
| Error | error (Error error, char *errstr=NULL) |
| | This service is used to throw all serial errors which usually occur during the serial constructor.
|
| |
| void | error (char *err) |
| | This service is used to thow application defined serial errors where the application specific error code is a string.
|
| |
| void | setError (bool enable) |
| | This method is used to turn the error handler on or off for "throwing" execptions by manipulating the thrown flag.
|
| |
| int | setPacketInput (int size, unsigned char btimer=0) |
| | Set packet read mode and "size" of packet read buffer.
|
| |
| int | setLineInput (char newline=13, char nl1=0) |
| | Set "line buffering" read mode and specifies the newline character to be used in seperating line records.
|
| |
| void | restore (void) |
| | Restore serial device to the original settings at time of open.
|
| |
| void | flushInput (void) |
| | Used to flush the input waiting queue.
|
| |
| void | flushOutput (void) |
| | Used to flush any pending output data.
|
| |
| void | waitOutput (void) |
| | Used to wait until all output has been sent.
|
| |
| void | endSerial (void) |
| | Used as the default destructor for ending serial I/O services.
|
| |
| void | initConfig (void) |
| | Used to initialize a newly opened serial file handle.
|
| |
| | Serial () |
| | This allows later ttystream class to open and close a serial device.
|
| |
| | Serial (const char *name) |
| | A serial object may be constructed from a named file on the file system.
|
| |
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.
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 TTYPort timer, pending input data waiting to be read, and "sighup" connection breaks.
- Author
- David Sugar dyfet.nosp@m.@ost.nosp@m.el.co.nosp@m.m
base class for thread pool serviced serial I/O.