OO wrapper around POSIX serial devices.
More...
#include <Serial.hpp>
OO wrapper around POSIX serial devices.
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
-
HLR::Kinematics::RV2AJ::Serial::Serial |
( |
Serial && |
s | ) |
|
|
delete |
Move constructor, deleted.
- Parameters
-
void HLR::Kinematics::RV2AJ::Serial::close |
( |
| ) |
|
Closes active serial device.
- Exceptions
-
std::runtime_error | if the device is not opened |
void HLR::Kinematics::RV2AJ::Serial::open |
( |
const std::string & |
dev, |
|
|
char |
delim |
|
) |
| |
Open specified serial device.
- Parameters
-
- Exceptions
-
std::invalid_argument | if the device name is invalid |
std::runtime_error | if the device name is already open |
std::runtime_error | if the device could not be opened |
std::runtime_error | if it couldn't get device attributes |
std::runtime_error | if 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
-
- Returns
- Serial
Serial& HLR::Kinematics::RV2AJ::Serial::operator= |
( |
Serial && |
s | ) |
|
|
delete |
Move assignment operator, deleted.
- Parameters
-
- Returns
- Serial
std::string HLR::Kinematics::RV2AJ::Serial::read |
( |
| ) |
|
Reads message from open serial device up to (including) delimiter.
- Exceptions
-
std::runtime_error | if the device is not open |
std::runtime_error | if reading from the device fails |
- Returns
- message
void HLR::Kinematics::RV2AJ::Serial::write |
( |
const std::string & |
msg | ) |
|
Writes message to open serial device.
- Parameters
-
- Exceptions
-
std::invalid_argument | if the message is invalid |
std::runtime_error | if the device is not open |
std::runtime_error | if writing to the device fails |
The documentation for this class was generated from the following file: