YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
SerialPort_nwc_yarp Class Reference

serialPort_nwc_yarp: a client for a serialPort_nws_yarp device More...

#include <networkWrappers/serialPort_nwc_yarp/SerialPort_nwc_yarp.h>

+ Inheritance diagram for SerialPort_nwc_yarp:

Public Member Functions

 SerialPort_nwc_yarp ()=default
 
 SerialPort_nwc_yarp (const SerialPort_nwc_yarp &)=delete
 
 SerialPort_nwc_yarp (SerialPort_nwc_yarp &&)=delete
 
SerialPort_nwc_yarpoperator= (const SerialPort_nwc_yarp &)=delete
 
SerialPort_nwc_yarpoperator= (SerialPort_nwc_yarp &&)=delete
 
 ~SerialPort_nwc_yarp () override
 
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 &c) override
 Gets one single char from the receive queue.
 
int flush () override
 Flushes the internal buffer.
 
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.
 
int receiveBytes (unsigned char *bytes, const int size) override
 Gets an array of bytes (unsigned char) with size <= 'size' parameter.
 
bool setDTR (bool enable) override
 Enable/Disable DTR protocol.
 
bool close () override
 Close the DeviceDriver.
 
bool open (Searchable &prop) override
 Open the DeviceDriver.
 
- Public Member Functions inherited from yarp::dev::DeviceDriver
 DeviceDriver ()
 
 DeviceDriver (const DeviceDriver &other)=delete
 
 DeviceDriver (DeviceDriver &&other) noexcept=delete
 
DeviceDriveroperator= (const DeviceDriver &other)=delete
 
DeviceDriveroperator= (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 DeviceDrivergetImplementation ()
 Some drivers are bureaucrats, pointing at others.
 
- Public Member Functions inherited from yarp::dev::ISerialDevice
virtual ~ISerialDevice ()
 
- Public Member Functions inherited from SerialPort_nwc_yarp_ParamsParser
 SerialPort_nwc_yarp_ParamsParser ()
 
 ~SerialPort_nwc_yarp_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.
 
- Public Member Functions inherited from yarp::dev::IDeviceDriverParams
virtual ~IDeviceDriverParams ()
 

Additional Inherited Members

- Public Attributes inherited from SerialPort_nwc_yarp_ParamsParser
const std::string m_device_classname = {"SerialPort_nwc_yarp"}
 
const std::string m_device_name = {"serialPort_nwc_yarp"}
 
bool m_parser_is_strict = false
 
const parser_version_type m_parser_version = {}
 
const std::string m_local_defaultValue = {""}
 
const std::string m_remote_defaultValue = {""}
 
std::string m_local = {}
 
std::string m_remote = {}
 

Detailed Description

serialPort_nwc_yarp: a client for a serialPort_nws_yarp device

Parameters required by this device are shown in class: SerialPort_nwc_yarp_ParamsParser

Definition at line 35 of file SerialPort_nwc_yarp.h.

Constructor & Destructor Documentation

◆ SerialPort_nwc_yarp() [1/3]

SerialPort_nwc_yarp::SerialPort_nwc_yarp ( )
default

◆ SerialPort_nwc_yarp() [2/3]

SerialPort_nwc_yarp::SerialPort_nwc_yarp ( const SerialPort_nwc_yarp )
delete

◆ SerialPort_nwc_yarp() [3/3]

SerialPort_nwc_yarp::SerialPort_nwc_yarp ( SerialPort_nwc_yarp &&  )
delete

◆ ~SerialPort_nwc_yarp()

SerialPort_nwc_yarp::~SerialPort_nwc_yarp ( )
override

Definition at line 15 of file SerialPort_nwc_yarp.cpp.

Member Function Documentation

◆ close()

bool SerialPort_nwc_yarp::close ( )
overridevirtual

Close the DeviceDriver.

Returns
true/false on success/failure.

Reimplemented from yarp::dev::DeviceDriver.

Definition at line 65 of file SerialPort_nwc_yarp.cpp.

◆ flush()

int SerialPort_nwc_yarp::flush ( )
overridevirtual

Flushes the internal buffer.

Returns
the number of flushed characters.

Implements yarp::dev::ISerialDevice.

Definition at line 44 of file SerialPort_nwc_yarp.cpp.

◆ open()

bool SerialPort_nwc_yarp::open ( Searchable config)
overridevirtual

Open the DeviceDriver.

Parameters
configis 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).
Returns
true/false upon success/failure

Reimplemented from yarp::dev::DeviceDriver.

Definition at line 70 of file SerialPort_nwc_yarp.cpp.

◆ operator=() [1/2]

SerialPort_nwc_yarp & SerialPort_nwc_yarp::operator= ( const SerialPort_nwc_yarp )
delete

◆ operator=() [2/2]

SerialPort_nwc_yarp & SerialPort_nwc_yarp::operator= ( SerialPort_nwc_yarp &&  )
delete

◆ receive()

bool SerialPort_nwc_yarp::receive ( Bottle msg)
overridevirtual

Gets the existing chars in the receive queue.

Parameters
msgthe received string
Returns
true on success; false if no messages available

Implements yarp::dev::ISerialDevice.

Definition at line 34 of file SerialPort_nwc_yarp.cpp.

◆ receiveBytes()

int SerialPort_nwc_yarp::receiveBytes ( unsigned char bytes,
const int  size 
)
overridevirtual

Gets an array of bytes (unsigned char) with size <= 'size' parameter.

The array is NOT null terminated.

Parameters
bytesa previously allocated buffer where the received data is stored.
sizethe size of the 'bytes' parameter.
Returns
the number of received bytes. The function returns 0 if no bytes are received.

Implements yarp::dev::ISerialDevice.

Definition at line 55 of file SerialPort_nwc_yarp.cpp.

◆ receiveChar()

int SerialPort_nwc_yarp::receiveChar ( char chr)
overridevirtual

Gets one single char from the receive queue.

Parameters
chrthe received char.
Returns
0 if no chars are received; 1 if one char is received.

Implements yarp::dev::ISerialDevice.

Definition at line 39 of file SerialPort_nwc_yarp.cpp.

◆ receiveLine()

int SerialPort_nwc_yarp::receiveLine ( char line,
const int  MaxLineLength 
)
overridevirtual

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.

Parameters
linea previously allocated buffer where the received line is stored.
MaxLineLengththe size of the 'line' parameter.
Returns
the number of received characters (including the '
''\r' chars, plus the buffer terminator '\0'). The function returns 0 if no chars are received.

Implements yarp::dev::ISerialDevice.

Definition at line 50 of file SerialPort_nwc_yarp.cpp.

◆ send() [1/2]

bool SerialPort_nwc_yarp::send ( const Bottle msg)
overridevirtual

Sends a string of chars to the serial communications channel.

Parameters
msgthe string to send
Returns
true on success

Implements yarp::dev::ISerialDevice.

Definition at line 20 of file SerialPort_nwc_yarp.cpp.

◆ send() [2/2]

bool SerialPort_nwc_yarp::send ( const char msg,
size_t  size 
)
overridevirtual

Implements yarp::dev::ISerialDevice.

Definition at line 26 of file SerialPort_nwc_yarp.cpp.

◆ setDTR()

bool SerialPort_nwc_yarp::setDTR ( bool  enable)
overridevirtual

Enable/Disable DTR protocol.

Parameters
enableEnable/Disable DTR protocol
Returns
true on success

Implements yarp::dev::ISerialDevice.

Definition at line 60 of file SerialPort_nwc_yarp.cpp.


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