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 Member Functions

virtual ~LOW_portSerial_Linux ()
 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)
 Configure the serial port.

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

virtual void tty_break ()
 Sends break signal.

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

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

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

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

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


Static Public Attributes

const unsigned int defaultTimeout = 5

Protected Member Functions

 LOW_portSerial_Linux (const LOW_portSerialFactory::portSpecifier_t inSerialPort)
 Constructor.


Private Attributes

const std::string serialPortPath
 Path to device file.

int serialFD
 File descriptor of serial port.


Friends

class LOW_portSerialFactory
 To allow construction.


Detailed Description

Platform specific portSerial for Linux platforms.

This class is thread-safe.

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

Definition at line 38 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 79 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 76 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 82 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 88 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 85 of file LOW_portSerial.h.


Constructor & Destructor Documentation

LOW_portSerial_Linux::~LOW_portSerial_Linux  )  [virtual]
 

Destructor.

Definition at line 56 of file LOW_portSerial_Linux.cpp.

References serialFD.

LOW_portSerial_Linux::LOW_portSerial_Linux const LOW_portSerialFactory::portSpecifier_t  inSerialPort  )  [protected]
 

Constructor.

Not publicly constructable. Use LOW_portSerialFactory.

Parameters:
inPortSpec Path to serial port device file.

Definition at line 46 of file LOW_portSerial_Linux.cpp.

References serialFD, and serialPortPath.


Member Function Documentation

LOW_portSerial::class_DERIVE_FROM_EXCEPTION portSerial_error  ,
LOW_exception 
[inherited]
 

Exception base class for all exceptions thrown by LOW_portSerial.

void LOW_portSerial_Linux::tty_break  )  [virtual]
 

Sends break signal.

Abstract method to be implemented by derived class.

Implements LOW_portSerial.

Definition at line 234 of file LOW_portSerial_Linux.cpp.

References __LOW_SYNCHRONIZE_METHOD_WRITE__, and 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
[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.

Implements LOW_portSerial.

Definition at line 68 of file LOW_portSerial_Linux.cpp.

References __LOW_SYNCHRONIZE_METHOD_WRITE__, 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
[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.

Implements LOW_portSerial.

Definition at line 218 of file LOW_portSerial_Linux.cpp.

References __LOW_SYNCHRONIZE_METHOD_WRITE__, and serialFD.

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

Implements LOW_portSerial.

Definition at line 295 of file LOW_portSerial_Linux.cpp.

References __LOW_SYNCHRONIZE_METHOD_WRITE__, and tty_readByte().

uint8_t LOW_portSerial_Linux::tty_readByte const bool  inTrashExtraReply = false,
const unsigned int  inSecTimeout = defaultTimeout
[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.

Implements LOW_portSerial.

Definition at line 242 of file LOW_portSerial_Linux.cpp.

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

Referenced by tty_read().

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

Implements LOW_portSerial.

Definition at line 322 of file LOW_portSerial_Linux.cpp.

References __LOW_SYNCHRONIZE_METHOD_WRITE__, and serialFD.

void LOW_portSerial_Linux::tty_write const uint8_t  inWriteByte  )  [virtual]
 

Writes one byte to serial port.

Abstract method to be implemented by derived class.

Parameters:
inWriteByte Byte to write.

Implements LOW_portSerial.

Definition at line 305 of file LOW_portSerial_Linux.cpp.

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


Friends And Related Function Documentation

friend class LOW_portSerialFactory [friend]
 

To allow construction.

Definition at line 78 of file LOW_portSerial_Linux.h.


Member Data Documentation

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

Definition at line 67 of file LOW_portSerial.h.

int LOW_portSerial_Linux::serialFD [private]
 

File descriptor of serial port.

Definition at line 113 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 std::string LOW_portSerial_Linux::serialPortPath [private]
 

Path to device file.

Definition at line 112 of file LOW_portSerial_Linux.h.

Referenced by LOW_portSerial_Linux().


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