Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
SerialInterface Class Reference

The SerialInterface class provides an interface to a connected serial device. More...

#include <serialinterface.h>

Public Member Functions

void connect ()
 try to open a connection to the serial device More...
 
void disconnect ()
 try to close the connection to the serial device More...
 
void read (std::string &message, std::string &delimiter)
 read a message from the serial input buffer More...
 
void send (std::string &message)
 try to send a message to the serial device More...
 
void setBaudRate (unsigned int baudRate)
 Setter for the baudrate, which defines the bandwith of the communication. More...
 
void setDeviceTag (const std::string &deviceTag)
 Setter for the device tag, which is an identifier a the connected serial device. More...
 
void setMaxLineLength (unsigned int maxLineLength)
 Setter for the maximum line length. More...
 
void setSerialDevicesFolder (const std::string &serialDevicesFolder)
 Setter for the path to the devices folder. More...
 
void setSerialTimeout (unsigned int serialTimeout)
 Setter for the serial timeout. More...
 
 ~SerialInterface ()
 SerialInterface default destructor. More...
 

Static Public Member Functions

static SerialInterfaceinstance ()
 Returns a singleton auf this class. More...
 

Private Member Functions

void findDeviceName (std::string &deviceName)
 
SerialInterfaceoperator= (const SerialInterface &)
 SerialInterface default assign operator. More...
 
 SerialInterface ()
 SerialInterface default constructor. More...
 
 SerialInterface (const SerialInterface &)
 SerialInterface default copy constructor. More...
 

Private Attributes

unsigned int baudRate
 
std::string deviceTag
 
unsigned int maxLineLength
 
serial::Serial serialConnection
 
std::string serialDevicesFolder
 
unsigned int serialTimeout
 

Detailed Description

The SerialInterface class provides an interface to a connected serial device.

This class follows the singleton pattern paradigm. For object instatiation call the instance methond, wich returns a singleton of this class.

Definition at line 24 of file serialinterface.h.

Constructor & Destructor Documentation

SerialInterface::~SerialInterface ( )
inline

SerialInterface default destructor.

Definition at line 39 of file serialinterface.h.

SerialInterface::SerialInterface ( )
private

SerialInterface default constructor.

<SerialConnection object.

Definition at line 10 of file serialinterface.cpp.

SerialInterface::SerialInterface ( const SerialInterface )
private

SerialInterface default copy constructor.

Member Function Documentation

void SerialInterface::connect ( )

try to open a connection to the serial device

Exceptions
std::exception

Definition at line 39 of file serialinterface.cpp.

void SerialInterface::disconnect ( )

try to close the connection to the serial device

Exceptions
std::exception

Definition at line 70 of file serialinterface.cpp.

void SerialInterface::findDeviceName ( std::string &  deviceName)
private

Definition at line 77 of file serialinterface.cpp.

static SerialInterface& SerialInterface::instance ( )
inlinestatic

Returns a singleton auf this class.

Returns
static object of SerialInterface class.

Definition at line 31 of file serialinterface.h.

SerialInterface& SerialInterface::operator= ( const SerialInterface )
private

SerialInterface default assign operator.

void SerialInterface::read ( std::string &  message,
std::string &  delimiter 
)

read a message from the serial input buffer

Parameters
[out]messagereceived message
[in]delimiterstop symbol for the input buffer parser
Exceptions
std::exception

Definition at line 62 of file serialinterface.cpp.

void SerialInterface::send ( std::string &  message)

try to send a message to the serial device

Parameters
[in]messagemessage to be transmitted
Exceptions
std::exception

Definition at line 52 of file serialinterface.cpp.

void SerialInterface::setBaudRate ( unsigned int  baudRate)

Setter for the baudrate, which defines the bandwith of the communication.

For a serial connection using the UART protocol baudrate equals bit/s.

Parameters
[in]baudRatein Baud per second

Definition at line 19 of file serialinterface.cpp.

void SerialInterface::setDeviceTag ( const std::string &  deviceTag)

Setter for the device tag, which is an identifier a the connected serial device.

Parameters
[in]deviceTagidentifier of the serial device

Definition at line 23 of file serialinterface.cpp.

void SerialInterface::setMaxLineLength ( unsigned int  maxLineLength)

Setter for the maximum line length.

What is the maximum amount of symbols that can be retrieved from the serial input buffer in one go.

Parameters
[in]maxLineLengthamount of symbols in a single frame

Definition at line 31 of file serialinterface.cpp.

void SerialInterface::setSerialDevicesFolder ( const std::string &  serialDevicesFolder)

Setter for the path to the devices folder.

Parameters
[in]serialDeviceFolgerpath where the serial devices are located in an OS

Definition at line 35 of file serialinterface.cpp.

void SerialInterface::setSerialTimeout ( unsigned int  serialTimeout)

Setter for the serial timeout.

How long should the interface wait for activity on the serial connection befor a retry is attempted?

Parameters
[in]serialTimeouttimeout in milliseconds

Definition at line 27 of file serialinterface.cpp.

Member Data Documentation

unsigned int SerialInterface::baudRate
private

Baudrate which defines the bandwith of the communication

Definition at line 99 of file serialinterface.h.

std::string SerialInterface::deviceTag
private

Device tag which is an identifier a the connected serial device

Definition at line 100 of file serialinterface.h.

unsigned int SerialInterface::maxLineLength
private

<Max interface wait time for activity.

Definition at line 102 of file serialinterface.h.

serial::Serial SerialInterface::serialConnection
private

<Path to the serial devices folder.

Definition at line 104 of file serialinterface.h.

std::string SerialInterface::serialDevicesFolder
private

<Max amount of symbols in a line.

Definition at line 103 of file serialinterface.h.

unsigned int SerialInterface::serialTimeout
private

Definition at line 101 of file serialinterface.h.


The documentation for this class was generated from the following files:


pses_ucbridge
Author(s): Sebastian Ehmes
autogenerated on Sat Oct 28 2017 19:16:13