brics_oodl::SerialIO Class Reference

#include <SerialIO.hpp>

List of all members.

Public Types

enum  HandshakeFlags { HS_NONE, HS_HARDWARE, HS_XONXOFF }
 

Constants for defining the handshake.

More...
enum  ParityFlags {
  PA_NONE, PA_EVEN, PA_ODD, PA_MARK,
  PA_SPACE
}
 

Constants for defining the parity bits.

More...
enum  StopBits { SB_ONE, SB_ONE_5, SB_TWO }
 

Constants for defining the stop bits.

More...

Public Member Functions

void changeBaudRate (int BaudRate)
void close ()
void flushTx ()
int getSizeRXQueue ()
int open ()
void purge ()
void purgeRx ()
void purgeTx ()
int readBlocking (char *Buffer, int Length)
int readNonBlocking (char *Buffer, int Length)
 SerialIO ()
 Default constructor.
void setBaudRate (int BaudRate)
void setBufferSize (int ReadBufSize, int WriteBufSize)
void setBytePeriod (double Period)
void setDeviceName (const char *Name)
void SetFormat (int ByteSize, ParityFlags Parity, int StopBits)
void setHandshake (HandshakeFlags Handshake)
void setMultiplier (double Multiplier=1)
void setTimeout (double Timeout)
int write (const char *Buffer, int Length)
virtual ~SerialIO ()
 Destructor.

Protected Attributes

int m_BaudRate
::timeval m_BytePeriod
int m_ByteSize
int m_Device
std::string m_DeviceName
HandshakeFlags m_Handshake
double m_Multiplier
ParityFlags m_Parity
int m_ReadBufSize
bool m_ShortBytePeriod
int m_StopBits
double m_Timeout
::termios m_tio
int m_WriteBufSize

Detailed Description

Wrapper class for serial communication.

Definition at line 67 of file SerialIO.hpp.


Member Enumeration Documentation

Constants for defining the handshake.

Enumerator:
HS_NONE 
HS_HARDWARE 
HS_XONXOFF 

Definition at line 72 of file SerialIO.hpp.

Constants for defining the parity bits.

Enumerator:
PA_NONE 
PA_EVEN 
PA_ODD 
PA_MARK 
PA_SPACE 

Definition at line 80 of file SerialIO.hpp.

Constants for defining the stop bits.

Enumerator:
SB_ONE 
SB_ONE_5 
SB_TWO 

Definition at line 91 of file SerialIO.hpp.


Constructor & Destructor Documentation

brics_oodl::SerialIO::SerialIO (  ) 

Default constructor.

virtual brics_oodl::SerialIO::~SerialIO (  )  [virtual]

Destructor.


Member Function Documentation

void brics_oodl::SerialIO::changeBaudRate ( int  BaudRate  ) 

Changes the baudrate. The serial port is allready open.

Parameters:
BaudRate new baudrate.
void brics_oodl::SerialIO::close (  ) 

Closes the serial port.

void brics_oodl::SerialIO::flushTx (  )  [inline]

Sends the transmit buffer. All bytes of the transmit buffer will be sent.

Definition at line 230 of file SerialIO.hpp.

int brics_oodl::SerialIO::getSizeRXQueue (  ) 

Returns the number of bytes available in the read buffer.

int brics_oodl::SerialIO::open (  ) 

Opens serial port. The port has to be configured before.

void brics_oodl::SerialIO::purge (  )  [inline]

Clears the read and transmit buffer.

Definition at line 207 of file SerialIO.hpp.

void brics_oodl::SerialIO::purgeRx (  )  [inline]

Clears the read buffer.

Definition at line 214 of file SerialIO.hpp.

void brics_oodl::SerialIO::purgeTx (  )  [inline]

Clears the transmit buffer. The content of the buffer will not be transmitted.

Definition at line 222 of file SerialIO.hpp.

int brics_oodl::SerialIO::readBlocking ( char *  Buffer,
int  Length 
)

Reads the serial port blocking. The function blocks until the requested number of bytes have been read or the timeout occurs.

Parameters:
Buffer pointer to the buffer.
Length number of bytes to read
int brics_oodl::SerialIO::readNonBlocking ( char *  Buffer,
int  Length 
)

Reads the serial port non blocking. The function returns all avaiable bytes but not more than requested.

Parameters:
Buffer pointer to the buffer.
Length number of bytes to read
void brics_oodl::SerialIO::setBaudRate ( int  BaudRate  )  [inline]

Sets the baudrate.

Parameters:
BaudRate baudrate.

Definition at line 114 of file SerialIO.hpp.

void brics_oodl::SerialIO::setBufferSize ( int  ReadBufSize,
int  WriteBufSize 
) [inline]

Sets the buffer sizes.

Parameters:
ReadBufSize number of bytes of the read buffer.
WriteBufSize number of bytes of the write buffer.

Definition at line 146 of file SerialIO.hpp.

void brics_oodl::SerialIO::setBytePeriod ( double  Period  ) 

Sets the byte period for transmitting bytes. If the period is not equal to 0, the transmit will be repeated with the given period until all bytes are transmitted.

Parameters:
default is 0.
void brics_oodl::SerialIO::setDeviceName ( const char *  Name  )  [inline]

Sets the device name

Parameters:
Name 'COM1', 'COM2', ...

Definition at line 108 of file SerialIO.hpp.

void brics_oodl::SerialIO::SetFormat ( int  ByteSize,
ParityFlags  Parity,
int  StopBits 
) [inline]

Sets the message format.

Definition at line 133 of file SerialIO.hpp.

void brics_oodl::SerialIO::setHandshake ( HandshakeFlags  Handshake  )  [inline]

Defines the handshake type.

Definition at line 139 of file SerialIO.hpp.

void brics_oodl::SerialIO::setMultiplier ( double  Multiplier = 1  )  [inline]

Sets a multiplier for the baudrate. Some serial cards need a specific multiplier for the baudrate.

Parameters:
Multiplier default is one.

Definition at line 128 of file SerialIO.hpp.

void brics_oodl::SerialIO::setTimeout ( double  Timeout  ) 

Sets the timeout.

Parameters:
Timeout in seconds
int brics_oodl::SerialIO::write ( const char *  Buffer,
int  Length 
)

Writes bytes to the serial port.

Parameters:
Buffer buffer of the message
Length number of bytes to send

Member Data Documentation

Definition at line 238 of file SerialIO.hpp.

::timeval brics_oodl::SerialIO::m_BytePeriod [protected]

Definition at line 245 of file SerialIO.hpp.

Definition at line 240 of file SerialIO.hpp.

Definition at line 237 of file SerialIO.hpp.

std::string brics_oodl::SerialIO::m_DeviceName [protected]

Definition at line 236 of file SerialIO.hpp.

Definition at line 242 of file SerialIO.hpp.

Definition at line 239 of file SerialIO.hpp.

Definition at line 241 of file SerialIO.hpp.

Definition at line 243 of file SerialIO.hpp.

Definition at line 246 of file SerialIO.hpp.

Definition at line 240 of file SerialIO.hpp.

double brics_oodl::SerialIO::m_Timeout [protected]

Definition at line 244 of file SerialIO.hpp.

::termios brics_oodl::SerialIO::m_tio [protected]

Definition at line 235 of file SerialIO.hpp.

Definition at line 243 of file SerialIO.hpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines


brics_oodl_scanner_libs
Author(s): Alexander Bubeck
autogenerated on Fri Jan 11 09:51:20 2013