HLR  0.0.1
Public Member Functions | List of all members
HLR::Kinematics::RV2AJ::Serial Class Reference

OO wrapper around POSIX serial devices. More...

#include <Serial.hpp>

Collaboration diagram for HLR::Kinematics::RV2AJ::Serial:

Public Member Functions

 Serial ()=default
 Constructor.
 
virtual ~Serial ()
 Destructor. More...
 
 Serial (const Serial &s)=delete
 Copy constructor, deleted. More...
 
 Serial (Serial &&s)=delete
 Move constructor, deleted. More...
 
Serialoperator= (const Serial &s)=delete
 Copy assignment operator, deleted. More...
 
Serialoperator= (Serial &&s)=delete
 Move assignment operator, deleted. More...
 
void open (const std::string &dev)
 Open specified serial device. More...
 
void close ()
 Closes active serial device. More...
 
bool opened () const
 Returns whether serial device is open. More...
 
void write (const std::string &msg)
 Writes message to open serial device. More...
 

Detailed Description

OO wrapper around POSIX serial devices.

Constructor & Destructor Documentation

virtual HLR::Kinematics::RV2AJ::Serial::~Serial ( )
virtual

Destructor.

Note
Closes the serial connection if it is open
HLR::Kinematics::RV2AJ::Serial::Serial ( const Serial s)
delete

Copy constructor, deleted.

Parameters
sSerial
HLR::Kinematics::RV2AJ::Serial::Serial ( Serial &&  s)
delete

Move constructor, deleted.

Parameters
sSerial

Member Function Documentation

void HLR::Kinematics::RV2AJ::Serial::close ( )

Closes active serial device.

Exceptions
std::runtime_errorif the device is not opened
void HLR::Kinematics::RV2AJ::Serial::open ( const std::string &  dev)

Open specified serial device.

Parameters
devdevice
Exceptions
std::invalid_argumentif the device name is invalid
std::runtime_errorif the device name is already open
std::runtime_errorif the device could not be opened
std::runtime_errorif it couldn't get device attributes
std::runtime_errorif it couldn't write device attributes
bool HLR::Kinematics::RV2AJ::Serial::opened ( ) const

Returns whether serial device is open.

Returns
true if open, false otherwise
Serial& HLR::Kinematics::RV2AJ::Serial::operator= ( const Serial s)
delete

Copy assignment operator, deleted.

Parameters
sSerial
Returns
Serial
Serial& HLR::Kinematics::RV2AJ::Serial::operator= ( Serial &&  s)
delete

Move assignment operator, deleted.

Parameters
sSerial
Returns
Serial
void HLR::Kinematics::RV2AJ::Serial::write ( const std::string &  msg)

Writes message to open serial device.

Parameters
msgmessage
Exceptions
std::invalid_argumentif the message is invalid
std::runtime_errorif the device is not open
std::runtime_errorif writing to the device fails

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