YARP
Yet Another Robot Platform
ISerialDevice.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006-2020 Istituto Italiano di Tecnologia (IIT)
3  * Copyright (C) 2006 Alexandre Bernardino
4  * Copyright (C) 2006 Carlos Beltran-Gonzalez
5  * All rights reserved.
6  *
7  * This software may be modified and distributed under the terms of the
8  * BSD-3-Clause license. See the accompanying LICENSE file for details.
9  */
10 
11 #ifndef YARP_DEV_ISERIALDEVICE_H
12 #define YARP_DEV_ISERIALDEVICE_H
13 
14 #include <yarp/os/Bottle.h>
15 #include <yarp/dev/api.h>
16 #include <yarp/sig/Vector.h>
17 
18 
19 namespace yarp {
20 namespace dev {
21 
28 {
29 public:
30  virtual ~ISerialDevice();
31 
37  virtual bool send(const yarp::os::Bottle& msg) = 0;
38  virtual bool send(char *msg, size_t size) = 0;
39 
40  //bool putMessage(Bottle& msg, bool waitreply, double replytimeout, Bottle& reply, char *replydelimiter, int replysize );
46  virtual bool receive(yarp::os::Bottle& msg) = 0;
47 
53  virtual int receiveChar(char& chr) = 0;
54 
61  virtual int receiveBytes(unsigned char* bytes, const int size) = 0;
62 
70  virtual int receiveLine(char* line, const int MaxLineLength) = 0;
76  virtual bool setDTR(bool enable) = 0;
81  virtual int flush() = 0;
82 };
83 
84 } // namespace dev
85 } // namespace yarp
86 
87 #endif // YARP_DEV_ISERIALDEVICE_H
yarp::os::Bottle
A simple collection of objects that can be described and transmitted in a portable way.
Definition: Bottle.h:73
Vector.h
contains the definition of a Vector type
yarp::dev::ISerialDevice::receive
virtual bool receive(yarp::os::Bottle &msg)=0
Gets the existing chars in the receive queue.
yarp::dev::ISerialDevice
A generic interface to serial port devices.
Definition: ISerialDevice.h:28
yarp::dev::ISerialDevice::receiveBytes
virtual int receiveBytes(unsigned char *bytes, const int size)=0
Gets an array of bytes (unsigned char) with size <= 'size' parameter.
yarp::dev::ISerialDevice::setDTR
virtual bool setDTR(bool enable)=0
Enable/Disable DTR protocol.
yarp::dev::ISerialDevice::receiveChar
virtual int receiveChar(char &chr)=0
Gets one single char from the receive queue.
yarp::dev::ISerialDevice::~ISerialDevice
virtual ~ISerialDevice()
yarp::dev::ISerialDevice::send
virtual bool send(char *msg, size_t size)=0
YARP_dev_API
#define YARP_dev_API
Definition: api.h:19
yarp
The main, catch-all namespace for YARP.
Definition: environment.h:18
yarp::dev::ISerialDevice::send
virtual bool send(const yarp::os::Bottle &msg)=0
Sends a string of chars to the serial communications channel.
yarp::dev::ISerialDevice::receiveLine
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.
api.h
yarp::dev::ISerialDevice::flush
virtual int flush()=0
Flushes the internal buffer.
Bottle.h