YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
ISerialDevice.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2006-2021 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-FileCopyrightText: 2006 Alexandre Bernardino
4 * SPDX-FileCopyrightText: 2006 Carlos Beltran-Gonzalez
5 * SPDX-License-Identifier: BSD-3-Clause
6 */
7
8#ifndef YARP_DEV_ISERIALDEVICE_H
9#define YARP_DEV_ISERIALDEVICE_H
10
11#include <yarp/os/Bottle.h>
12#include <yarp/dev/api.h>
13#include <yarp/sig/Vector.h>
14
15
16namespace yarp::dev {
17
24{
25public:
26 virtual ~ISerialDevice();
27
33 virtual bool send(const yarp::os::Bottle& msg) = 0;
34 virtual bool send(const char *msg, size_t size) = 0;
35
36 //bool putMessage(Bottle& msg, bool waitreply, double replytimeout, Bottle& reply, char *replydelimiter, int replysize );
42 virtual bool receive(yarp::os::Bottle& msg) = 0;
43
49 virtual int receiveChar(char& chr) = 0;
50
57 virtual int receiveBytes(unsigned char* bytes, const int size) = 0;
58
66 virtual int receiveLine(char* line, const int MaxLineLength) = 0;
72 virtual bool setDTR(bool enable) = 0;
77 virtual int flush() = 0;
78};
79
80} // namespace yarp::dev
81
82#endif // YARP_DEV_ISERIALDEVICE_H
contains the definition of a Vector type
A generic interface to serial port devices.
virtual bool send(const char *msg, size_t size)=0
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.
virtual bool setDTR(bool enable)=0
Enable/Disable DTR protocol.
virtual int flush()=0
Flushes the internal buffer.
virtual bool send(const yarp::os::Bottle &msg)=0
Sends a string of chars to the serial communications channel.
virtual int receiveChar(char &chr)=0
Gets one single char from the receive queue.
virtual bool receive(yarp::os::Bottle &msg)=0
Gets the existing chars in the receive queue.
virtual int receiveBytes(unsigned char *bytes, const int size)=0
Gets an array of bytes (unsigned char) with size <= 'size' parameter.
A simple collection of objects that can be described and transmitted in a portable way.
Definition Bottle.h:64
For streams capable of holding different kinds of content, check what they actually have.
#define YARP_dev_API
Definition api.h:18