fakeSerialPort
: A fake basic Serial Communications Link (RS232, USB).
More...
#include <fake/fakeSerialPort/FakeSerialPort.h>
Public Member Functions | |
FakeSerialPort () | |
virtual | ~FakeSerialPort () |
bool | open (yarp::os::Searchable &config) override |
Open the DeviceDriver. | |
bool | close () override |
Close the DeviceDriver. | |
bool | send (const Bottle &msg) override |
Sends a string of chars to the serial communications channel. | |
bool | send (const char *msg, size_t size) override |
bool | receive (Bottle &msg) override |
Gets the existing chars in the receive queue. | |
int | receiveChar (char &chr) override |
Gets one single char from the receive queue. | |
int | receiveBytes (unsigned char *bytes, const int size) override |
Gets an array of bytes (unsigned char) with size <= 'size' parameter. | |
int | receiveLine (char *line, const int MaxLineLength) override |
Gets one line (a sequence of chars with a ending '\n' or '\r') from the receive queue. | |
bool | setDTR (bool value) override |
Enable/Disable DTR protocol. | |
int | flush () override |
Flushes the internal buffer. | |
![]() | |
DeviceDriver () | |
DeviceDriver (const DeviceDriver &other)=delete | |
DeviceDriver (DeviceDriver &&other) noexcept=delete | |
DeviceDriver & | operator= (const DeviceDriver &other)=delete |
DeviceDriver & | operator= (DeviceDriver &&other) noexcept=delete |
virtual | ~DeviceDriver () |
virtual std::string | id () const |
Return the id assigned to the PolyDriver. | |
virtual void | setId (const std::string &id) |
Set the id for this device. | |
template<class T > | |
bool | view (T *&x) |
Get an interface to the device driver. | |
virtual DeviceDriver * | getImplementation () |
Some drivers are bureaucrats, pointing at others. | |
![]() | |
virtual | ~ISerialDevice () |
![]() | |
FakeSerialPort_ParamsParser () | |
~FakeSerialPort_ParamsParser () override=default | |
bool | parseParams (const yarp::os::Searchable &config) override |
Parse the DeviceDriver parameters. | |
std::string | getDeviceClassName () const override |
Get the name of the DeviceDriver class. | |
std::string | getDeviceName () const override |
Get the name of the device (i.e. | |
std::string | getDocumentationOfDeviceParams () const override |
Get the documentation of the DeviceDriver's parameters. | |
std::vector< std::string > | getListOfParams () const override |
Return a list of all params used by the device. | |
bool | getParamValue (const std::string ¶mName, std::string ¶mValue) const override |
Return the value (represented as a string) of the requested parameter. | |
std::string | getConfiguration () const override |
Return the configuration of the device. | |
![]() | |
virtual | ~IDeviceDriverParams () |
Additional Inherited Members | |
![]() | |
const std::string | m_device_classname = {"FakeSerialPort"} |
const std::string | m_device_name = {"fakeSerialPort"} |
bool | m_parser_is_strict = false |
const parser_version_type | m_parser_version = {} |
std::string | m_provided_configuration |
const std::string | m_comport_defaultValue = {"COM3"} |
const std::string | m_verbose_defaultValue = {"1"} |
const std::string | m_baudrate_defaultValue = {"9600"} |
const std::string | m_xonlim_defaultValue = {"0"} |
const std::string | m_xofflim_defaultValue = {"0"} |
const std::string | m_readmincharacters_defaultValue = {"1"} |
const std::string | m_readtimeoutmsec_defaultValue = {"100"} |
const std::string | m_paritymode_defaultValue = {"EVEN"} |
const std::string | m_ctsenb_defaultValue = {"0"} |
const std::string | m_rtsenb_defaultValue = {"0"} |
const std::string | m_xinenb_defaultValue = {"0"} |
const std::string | m_xoutenb_defaultValue = {"0"} |
const std::string | m_modem_defaultValue = {"0"} |
const std::string | m_rcvenb_defaultValue = {"0"} |
const std::string | m_dsrenb_defaultValue = {"0"} |
const std::string | m_dtrdisable_defaultValue = {"0"} |
const std::string | m_databits_defaultValue = {"7"} |
const std::string | m_stopbits_defaultValue = {"1"} |
const std::string | m_line_terminator_char1_defaultValue = {"'\r'"} |
const std::string | m_line_terminator_char2_defaultValue = {"'\n'"} |
std::string | m_comport = {"COM3"} |
int | m_verbose = {1} |
int | m_baudrate = {9600} |
int | m_xonlim = {0} |
int | m_xofflim = {0} |
int | m_readmincharacters = {1} |
int | m_readtimeoutmsec = {100} |
std::string | m_paritymode = {"EVEN"} |
int | m_ctsenb = {0} |
int | m_rtsenb = {0} |
int | m_xinenb = {0} |
int | m_xoutenb = {0} |
int | m_modem = {0} |
int | m_rcvenb = {0} |
int | m_dsrenb = {0} |
int | m_dtrdisable = {0} |
int | m_databits = {7} |
int | m_stopbits = {1} |
char | m_line_terminator_char1 = {'\r'} |
char | m_line_terminator_char2 = {'\n'} |
fakeSerialPort
: A fake basic Serial Communications Link (RS232, USB).
Parameters required by this device are shown in class: FakeSerialPort_ParamsParser Beware: all parameters parsed by fakeSerialPort are actually ignored because it is a fake device which does not connect to any real hardware.
Definition at line 28 of file FakeSerialPort.h.
FakeSerialPort::FakeSerialPort | ( | ) |
Definition at line 21 of file FakeSerialPort.cpp.
|
virtual |
Definition at line 24 of file FakeSerialPort.cpp.
|
overridevirtual |
Close the DeviceDriver.
Reimplemented from yarp::dev::DeviceDriver.
Definition at line 36 of file FakeSerialPort.cpp.
|
overridevirtual |
Flushes the internal buffer.
Implements yarp::dev::ISerialDevice.
Definition at line 131 of file FakeSerialPort.cpp.
|
overridevirtual |
Open the DeviceDriver.
config | is a list of parameters for the device. Which parameters are effective for your device can vary. See device invocation examples. If there is no example for your device, you can run the "yarpdev" program with the verbose flag set to probe what parameters the device is checking. If that fails too, you'll need to read the source code (please nag one of the yarp developers to add documentation for your device). |
Reimplemented from yarp::dev::DeviceDriver.
Definition at line 29 of file FakeSerialPort.cpp.
Gets the existing chars in the receive queue.
msg | the received string |
Implements yarp::dev::ISerialDevice.
Definition at line 171 of file FakeSerialPort.cpp.
Gets an array of bytes (unsigned char) with size <= 'size' parameter.
The array is NOT null terminated.
bytes | a previously allocated buffer where the received data is stored. |
size | the size of the 'bytes' parameter. |
Implements yarp::dev::ISerialDevice.
Definition at line 136 of file FakeSerialPort.cpp.
Gets one single char from the receive queue.
chr | the received char. |
Implements yarp::dev::ISerialDevice.
Definition at line 110 of file FakeSerialPort.cpp.
Gets one line (a sequence of chars with a ending '\n' or '\r') from the receive queue.
The ending '\n''\r' chars are not removed in the returned line.
line | a previously allocated buffer where the received line is stored. |
MaxLineLength | the size of the 'line' parameter. |
Implements yarp::dev::ISerialDevice.
Definition at line 143 of file FakeSerialPort.cpp.
Sends a string of chars to the serial communications channel.
msg | the string to send |
Implements yarp::dev::ISerialDevice.
Definition at line 46 of file FakeSerialPort.cpp.
Implements yarp::dev::ISerialDevice.
Definition at line 80 of file FakeSerialPort.cpp.
Enable/Disable DTR protocol.
enable | Enable/Disable DTR protocol |
Implements yarp::dev::ISerialDevice.
Definition at line 41 of file FakeSerialPort.cpp.