Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members | File Members | Related Pages

LOW_portSerial Class Reference

Abstract base class for serial ports. More...

#include <LOW_portSerial.h>

Inheritance diagram for LOW_portSerial:

Inheritance graph
[legend]
List of all members.

Public Types

enum  flowControl_t { none_flowControl, xonxoff_flowControl, rtscts_flowControl }
 Serial flow control type. More...

enum  dataBitsSite_t { bit5_size, bit6_size, bit7_size, bit8_size }
 Number of data bits type. More...

enum  parity_t { no_parity, odd_parity, even_parity }
 Parity control type. More...

enum  stopBits_t { bit1_stopBit, bit2_stopBit }
 Number of stop bits type. More...

enum  speed_t {
  B50_speed, B75_speed, B110_speed, B134_speed,
  B150_speed, B200_speed, B300_speed, B600_speed,
  B1200_speed, B1800_speed, B2400_speed, B4800_speed,
  B9600_speed, B19200_speed, B38400_speed, B57600_speed,
  B115200_speed, B10472_speed
}
 Serial speed control type. More...


Public Member Functions

 class_DERIVE_FROM_EXCEPTION (portSerial_error, LOW_exception)
 Exception base class for all exceptions thrown by LOW_portSerial.

virtual ~LOW_portSerial ()
 Destructor.

virtual void tty_configure (const flowControl_t inFlowCtl, const dataBitsSite_t inDataBits, const parity_t inParity, const stopBits_t inStopBits, const speed_t inSpeed)=0
 Configure the serial port.

virtual void tty_flush (const bool inFlushIn=true, const bool inFlushOut=true)=0
 Flushs serial input and/or output buffers.

virtual void tty_break ()=0
 Sends break signal.

virtual uint8_t tty_readByte (const bool inTrashExtraReply=false, const unsigned int inSecTimeout=defaultTimeout)=0
 Reads on byte from serial port.

virtual void tty_read (byteVec_t &outReadBytes, const bool inTrashExtraReply=false, const unsigned int inSecTimeout=defaultTimeout)=0
 Reads multiple bytes from serial port.

virtual void tty_write (const uint8_t inWriteByte)=0
 Writes one byte to serial port.

virtual void tty_write (const byteVec_t &inWriteBytes)=0
 Writes multiple bytes to serial port.


Static Public Attributes

const unsigned int defaultTimeout = 5

Detailed Description

Abstract base class for serial ports.

Each instance represents one serial port.

Specific platforms dereive their implementation classes from this class.

The instances are created by LOW_portSerialFactory, following the factory design pattern.

Note: There is no prescribed constructor. A class deriving from this one should have a constructor which only requires to specify the port, but no extra setup parameters for it.
This enables parts of your software to specify a serial port by creating an object, but without knowing the specific setup for it. This setup might be known then by other parts, which receive the object as port specification.

This class is thread-safe.

See also:
LOW_portSerialFactory
Author:
Harald Roelle

Definition at line 48 of file LOW_portSerial.h.


Member Enumeration Documentation

enum LOW_portSerial::dataBitsSite_t
 

Number of data bits type.

Enumeration values:
bit5_size 
bit6_size 
bit7_size 
bit8_size 

Definition at line 79 of file LOW_portSerial.h.

enum LOW_portSerial::flowControl_t
 

Serial flow control type.

Enumeration values:
none_flowControl 
xonxoff_flowControl 
rtscts_flowControl 

Definition at line 76 of file LOW_portSerial.h.

enum LOW_portSerial::parity_t
 

Parity control type.

Enumeration values:
no_parity 
odd_parity 
even_parity 

Definition at line 82 of file LOW_portSerial.h.

enum LOW_portSerial::speed_t
 

Serial speed control type.

Enumeration values:
B50_speed 
B75_speed 
B110_speed 
B134_speed 
B150_speed 
B200_speed 
B300_speed 
B600_speed 
B1200_speed 
B1800_speed 
B2400_speed 
B4800_speed 
B9600_speed 
B19200_speed 
B38400_speed 
B57600_speed 
B115200_speed 
B10472_speed 

Definition at line 88 of file LOW_portSerial.h.

enum LOW_portSerial::stopBits_t
 

Number of stop bits type.

Enumeration values:
bit1_stopBit 
bit2_stopBit 

Definition at line 85 of file LOW_portSerial.h.


Constructor & Destructor Documentation

LOW_portSerial::~LOW_portSerial  )  [virtual]
 

Destructor.

Definition at line 27 of file LOW_portSerial.cpp.


Member Function Documentation

LOW_portSerial::class_DERIVE_FROM_EXCEPTION portSerial_error  ,
LOW_exception 
 

Exception base class for all exceptions thrown by LOW_portSerial.

virtual void LOW_portSerial::tty_break  )  [pure virtual]
 

Sends break signal.

Abstract method to be implemented by derived class.

Implemented in LOW_portSerial_Linux.

Referenced by LOW_linkDS2480B::resetLinkAdapter().

virtual void LOW_portSerial::tty_configure const flowControl_t  inFlowCtl,
const dataBitsSite_t  inDataBits,
const parity_t  inParity,
const stopBits_t  inStopBits,
const speed_t  inSpeed
[pure virtual]
 

Configure the serial port.

Abstract method to be implemented by derived class.

Parameters:
inFlowCtl Flow control.
inDataBits Number of data bits.
inParity Parity control.
inStopBits Number of stop bits.
inSpeed Port speed.

Implemented in LOW_portSerial_Linux.

Referenced by LOW_linkPassiveSerial::resetBus(), LOW_linkPassiveSerial::resetLinkAdapter(), and LOW_linkDS2480B::resetLinkAdapter().

virtual void LOW_portSerial::tty_flush const bool  inFlushIn = true,
const bool  inFlushOut = true
[pure virtual]
 

Flushs serial input and/or output buffers.

Abstract method to be implemented by derived class.

Parameters:
inFlushIn If set to true input buffer is flushed.
inFlushOut If set to true output buffer is flushed.

Implemented in LOW_portSerial_Linux.

Referenced by LOW_linkDS2480B::reset_cmd(), LOW_linkPassiveSerial::resetBus(), LOW_linkPassiveSerial::resetLinkAdapter(), LOW_linkDS2480B::resetLinkAdapter(), LOW_linkPassiveSerial::touchBit(), LOW_linkDS2480B::~LOW_linkDS2480B(), and LOW_linkPassiveSerial::~LOW_linkPassiveSerial().

virtual void LOW_portSerial::tty_read byteVec_t outReadBytes,
const bool  inTrashExtraReply = false,
const unsigned int  inSecTimeout = defaultTimeout
[pure virtual]
 

Reads multiple bytes from serial port.

The desired number of bytes to read is specified by the preset length of the vector parameter.

Abstract method to be implemented by derived class.

Parameters:
outReadBytes Reference to byte vector, where read bytes are stored in.
inTrashExtraReply If true one extra byte is read from serial port at the end and trashed.
inSecTimeout Timeout in seconds.

Implemented in LOW_portSerial_Linux.

Referenced by LOW_linkDS2480B::touchBlock().

virtual uint8_t LOW_portSerial::tty_readByte const bool  inTrashExtraReply = false,
const unsigned int  inSecTimeout = defaultTimeout
[pure virtual]
 

Reads on byte from serial port.

Abstract method to be implemented by derived class.

Parameters:
inTrashExtraReply If true one extra byte is read from serial port and trashed.
inSecTimeout Timeout in seconds.
Returns:
Byte read from serial port.

Implemented in LOW_portSerial_Linux.

Referenced by LOW_linkDS2480B::pulse_cmd(), LOW_linkDS2480B::pulse_cmd_manual(), LOW_linkDS2480B::readConfigValue(), LOW_linkDS2480B::reset_cmd(), LOW_linkPassiveSerial::resetBus(), LOW_linkDS2480B::singleBit_cmd(), LOW_linkPassiveSerial::touchBit(), LOW_linkDS2480B::touchByte(), and LOW_linkDS2480B::writeConfigValue().

virtual void LOW_portSerial::tty_write const byteVec_t inWriteBytes  )  [pure virtual]
 

Writes multiple bytes to serial port.

The desired number of bytes to write is specified by the preset length of the vector parameter.

Abstract method to be implemented by derived class.

Parameters:
inWriteBytes Reference to byte vector which contains bytes to write.

Implemented in LOW_portSerial_Linux.

virtual void LOW_portSerial::tty_write const uint8_t  inWriteByte  )  [pure virtual]
 

Writes one byte to serial port.

Abstract method to be implemented by derived class.

Parameters:
inWriteByte Byte to write.

Implemented in LOW_portSerial_Linux.

Referenced by LOW_linkDS2480B::pulse_cmd(), LOW_linkDS2480B::pulse_cmd_manual(), LOW_linkDS2480B::readConfigValue(), LOW_linkDS2480B::reset_cmd(), LOW_linkPassiveSerial::resetBus(), LOW_linkDS2480B::resetLinkAdapter(), LOW_linkDS2480B::searchAccelCtrl_cmd(), LOW_linkDS2480B::setMode(), LOW_linkDS2480B::singleBit_cmd(), LOW_linkPassiveSerial::touchBit(), LOW_linkDS2480B::touchBlock(), LOW_linkDS2480B::touchByte(), and LOW_linkDS2480B::writeConfigValue().


Member Data Documentation

const unsigned int LOW_portSerial::defaultTimeout = 5 [static]
 

Definition at line 67 of file LOW_portSerial.h.


The documentation for this class was generated from the following files:
Generated on Tue Feb 3 11:31:06 2004 for OneWireLibrary++ by doxygen 1.3.2