A generic interface to serial port devices.
More...
#include <yarp/dev/ISerialDevice.h>
|
virtual | ~ISerialDevice () |
|
virtual bool | send (const yarp::os::Bottle &msg)=0 |
| Sends a string of chars to the serial communications channel. More...
|
|
virtual bool | send (char *msg, size_t size)=0 |
|
virtual bool | receive (yarp::os::Bottle &msg)=0 |
| Gets the existing chars in the receive queue. More...
|
|
virtual int | receiveChar (char &chr)=0 |
| Gets one single char from the receive queue. More...
|
|
virtual int | receiveBytes (unsigned char *bytes, const int size)=0 |
| Gets an array of bytes (unsigned char) with size <= 'size' parameter. More...
|
|
virtual int | receiveLine (char *line, const int MaxLineLength)=0 |
| Gets one line (a sequence of chars with a ending '\n' or '\r') from the receive queue. More...
|
|
virtual bool | setDTR (bool enable)=0 |
| Enable/Disable DTR protocol. More...
|
|
virtual int | flush ()=0 |
| Flushes the internal buffer. More...
|
|
A generic interface to serial port devices.
Definition at line 27 of file ISerialDevice.h.
◆ ~ISerialDevice()
yarp::dev::ISerialDevice::~ISerialDevice |
( |
| ) |
|
|
virtualdefault |
◆ flush()
virtual int yarp::dev::ISerialDevice::flush |
( |
| ) |
|
|
pure virtual |
◆ receive()
Gets the existing chars in the receive queue.
- Parameters
-
- Returns
- true on success; false if no messages available
Implemented in ServerSerial, and SerialDeviceDriver.
◆ receiveBytes()
virtual int yarp::dev::ISerialDevice::receiveBytes |
( |
unsigned char * |
bytes, |
|
|
const int |
size |
|
) |
| |
|
pure virtual |
Gets an array of bytes (unsigned char) with size <= 'size' parameter.
The array is NOT null terminated.
- Parameters
-
bytes | a previously allocated buffer where the received data is stored. |
size | the size of the 'bytes' parameter. |
- Returns
- the number of received bytes. The function returns 0 if no bytes are received.
Implemented in ServerSerial, and SerialDeviceDriver.
◆ receiveChar()
virtual int yarp::dev::ISerialDevice::receiveChar |
( |
char & |
chr | ) |
|
|
pure virtual |
Gets one single char from the receive queue.
- Parameters
-
- Returns
- 0 if no chars are received; 1 if one char is received.
Implemented in SerialDeviceDriver, and ServerSerial.
◆ receiveLine()
virtual int yarp::dev::ISerialDevice::receiveLine |
( |
char * |
line, |
|
|
const int |
MaxLineLength |
|
) |
| |
|
pure virtual |
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
-
line | a previously allocated buffer where the received line is stored. |
MaxLineLength | the 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.
Implemented in ServerSerial, and SerialDeviceDriver.
◆ send() [1/2]
virtual bool yarp::dev::ISerialDevice::send |
( |
char * |
msg, |
|
|
size_t |
size |
|
) |
| |
|
pure virtual |
◆ send() [2/2]
◆ setDTR()
virtual bool yarp::dev::ISerialDevice::setDTR |
( |
bool |
enable | ) |
|
|
pure virtual |
The documentation for this class was generated from the following files: