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

LOW_portSerial_Linux Class Reference

Platform specific portSerial for Linux platforms. More...

#include <LOW_portSerial_Linux.h>

Inheritance diagram for LOW_portSerial_Linux:

Inheritance graph
[legend]
Collaboration diagram for LOW_portSerial_Linux:

Collaboration 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 Methods

 LOW_portSerial_Linux (const string inSerialPort)
 Constructor. More...

virtual ~LOW_portSerial_Linux ()
 Destructor. More...


Protected Methods

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

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

void tty_break () const
 Sends break signal. More...

uint8_t tty_readByte (const bool inTrashExtraReply=false) const
 Reads on byte from serial port. More...

void tty_read (byteVec_t &outReadBytes, const bool inTrashExtraReply=false) const
 Reads multiple bytes from serial port. More...

void tty_write (const uint8_t inWriteByte) const
 Writes one byte to serial port. More...

void tty_write (const byteVec_t &inWriteBytes) const
 Writes multiple bytes to serial port. More...


Private Attributes

const string serialPortPath
 Path to device file. More...

int serialFD
 File descriptor of serial port. More...


Static Private Attributes

const int serialTimeout = 5
 Timeout of serial operations in seconds. More...


Detailed Description

Platform specific portSerial for Linux platforms.

Todo:
Add OS-level locking of serial port (e.g. uucp style).

Author:
Harald Roelle, Helmut Reiser

Definition at line 34 of file LOW_portSerial_Linux.h.


Member Enumeration Documentation

enum LOW_portSerial::dataBitsSite_t [inherited]
 

Number of data bits type.

Enumeration values:
bit5_size 
bit6_size 
bit7_size 
bit8_size 

Definition at line 69 of file LOW_portSerial.h.

enum LOW_portSerial::flowControl_t [inherited]
 

Serial flow control type.

Enumeration values:
none_flowControl 
xonxoff_flowControl 
rtscts_flowControl 

Definition at line 66 of file LOW_portSerial.h.

enum LOW_portSerial::parity_t [inherited]
 

Parity control type.

Enumeration values:
no_parity 
odd_parity 
even_parity 

Definition at line 72 of file LOW_portSerial.h.

enum LOW_portSerial::speed_t [inherited]
 

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 78 of file LOW_portSerial.h.

enum LOW_portSerial::stopBits_t [inherited]
 

Number of stop bits type.

Enumeration values:
bit1_stopBit 
bit2_stopBit 

Definition at line 75 of file LOW_portSerial.h.


Constructor & Destructor Documentation

LOW_portSerial_Linux::LOW_portSerial_Linux const string    inSerialPort
 

Constructor.

Parameters:
inPortSpec  Path to serial port device file.

Definition at line 43 of file LOW_portSerial_Linux.cpp.

References serialFD, and serialPortPath.

LOW_portSerial_Linux::~LOW_portSerial_Linux   [virtual]
 

Destructor.

Definition at line 53 of file LOW_portSerial_Linux.cpp.

References serialFD.


Member Function Documentation

void LOW_portSerial_Linux::tty_break   const [protected, virtual]
 

Sends break signal.

Abstract method to be implemented by derived class.

Reimplemented from LOW_portSerial.

Definition at line 296 of file LOW_portSerial_Linux.cpp.

References serialFD.

void LOW_portSerial_Linux::tty_configure const flowControl_t    inFlowCtl,
const dataBitsSite_t    inDataBits,
const parity_t    inParity,
const stopBits_t    inStopBits,
const speed_t    inSpeed
const [protected, 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.

Reimplemented from LOW_portSerial.

Definition at line 65 of file LOW_portSerial_Linux.cpp.

References LOW_portSerial::B10472_speed, LOW_portSerial::B110_speed, LOW_portSerial::B115200_speed, LOW_portSerial::B1200_speed, LOW_portSerial::B134_speed, LOW_portSerial::B150_speed, LOW_portSerial::B1800_speed, LOW_portSerial::B19200_speed, LOW_portSerial::B200_speed, LOW_portSerial::B2400_speed, LOW_portSerial::B300_speed, LOW_portSerial::B38400_speed, LOW_portSerial::B4800_speed, LOW_portSerial::B50_speed, LOW_portSerial::B57600_speed, LOW_portSerial::B600_speed, LOW_portSerial::B75_speed, LOW_portSerial::B9600_speed, LOW_portSerial::bit1_stopBit, LOW_portSerial::bit2_stopBit, LOW_portSerial::bit5_size, LOW_portSerial::bit6_size, LOW_portSerial::bit7_size, LOW_portSerial::bit8_size, LOW_portSerial::even_parity, LOW_portSerial::no_parity, LOW_portSerial::none_flowControl, LOW_portSerial::odd_parity, LOW_portSerial::rtscts_flowControl, serialFD, and LOW_portSerial::xonxoff_flowControl.

void LOW_portSerial_Linux::tty_flush const bool    inFlushIn = true,
const bool    inFlushOut = true
const [protected, 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.

Reimplemented from LOW_portSerial.

Definition at line 282 of file LOW_portSerial_Linux.cpp.

References serialFD.

void LOW_portSerial_Linux::tty_read byteVec_t   outReadBytes,
const bool    inTrashExtraReply = false
const [protected, 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.

Reimplemented from LOW_portSerial.

Definition at line 353 of file LOW_portSerial_Linux.cpp.

References byteVec_t, and tty_readByte().

uint8_t LOW_portSerial_Linux::tty_readByte const bool    inTrashExtraReply = false const [protected, 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.
Returns:
Byte read from serial port.

Reimplemented from LOW_portSerial.

Definition at line 302 of file LOW_portSerial_Linux.cpp.

References LOW_helper_msglog::portSerial_dl, LOW_helper_msglog::printDebug(), serialFD, and serialTimeout.

Referenced by tty_read().

void LOW_portSerial_Linux::tty_write const byteVec_t   inWriteBytes const [protected, 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.

Reimplemented from LOW_portSerial.

Definition at line 376 of file LOW_portSerial_Linux.cpp.

References byteVec_t, LOW_helper_msglog::portSerial_dl, LOW_helper_msglog::printDebug(), and serialFD.

void LOW_portSerial_Linux::tty_write const uint8_t    inWriteByte const [protected, virtual]
 

Writes one byte to serial port.

Abstract method to be implemented by derived class.

Parameters:
inWriteByte  Byte to write.

Reimplemented from LOW_portSerial.

Definition at line 361 of file LOW_portSerial_Linux.cpp.

References LOW_helper_msglog::portSerial_dl, LOW_helper_msglog::printDebug(), and serialFD.


Member Data Documentation

int LOW_portSerial_Linux::serialFD [private]
 

File descriptor of serial port.

Definition at line 98 of file LOW_portSerial_Linux.h.

Referenced by LOW_portSerial_Linux(), tty_break(), tty_configure(), tty_flush(), tty_readByte(), tty_write(), and ~LOW_portSerial_Linux().

const string LOW_portSerial_Linux::serialPortPath [private]
 

Path to device file.

Definition at line 97 of file LOW_portSerial_Linux.h.

Referenced by LOW_portSerial_Linux().

const int LOW_portSerial_Linux::serialTimeout = 5 [static, private]
 

Timeout of serial operations in seconds.

Definition at line 89 of file LOW_portSerial_Linux.h.

Referenced by tty_readByte().


The documentation for this class was generated from the following files:
Generated on Sun Jan 12 21:07:58 2003 by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001