YARP
Yet Another Robot Platform
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 
16 namespace yarp {
17 namespace dev {
18 
25 {
26 public:
27  virtual ~ISerialDevice();
28 
34  virtual bool send(const yarp::os::Bottle& msg) = 0;
35  virtual bool send(char *msg, size_t size) = 0;
36 
37  //bool putMessage(Bottle& msg, bool waitreply, double replytimeout, Bottle& reply, char *replydelimiter, int replysize );
43  virtual bool receive(yarp::os::Bottle& msg) = 0;
44 
50  virtual int receiveChar(char& chr) = 0;
51 
58  virtual int receiveBytes(unsigned char* bytes, const int size) = 0;
59 
67  virtual int receiveLine(char* line, const int MaxLineLength) = 0;
73  virtual bool setDTR(bool enable) = 0;
78  virtual int flush() = 0;
79 };
80 
81 } // namespace dev
82 } // namespace yarp
83 
84 #endif // YARP_DEV_ISERIALDEVICE_H
contains the definition of a Vector type
A generic interface to serial port devices.
Definition: ISerialDevice.h:25
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 send(char *msg, size_t size)=0
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:74
The main, catch-all namespace for YARP.
Definition: dirs.h:16
#define YARP_dev_API
Definition: api.h:18