YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
FakeSerialPort.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2023-2023 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef FAKESERIALPORT_H
7#define FAKESERIALPORT_H
8
11#include <yarp/os/Bottle.h>
12
13#include <stdio.h>
14
16
17using namespace yarp::os;
18
32{
33private:
35
36 bool verbose = true;
37
38public:
40
41 virtual ~FakeSerialPort();
42
43 bool open(yarp::os::Searchable& config) override;
44 bool close() override;
45
46 bool send(const Bottle& msg) override;
47 bool send(const char *msg, size_t size) override;
48 bool receive(Bottle& msg) override;
49 int receiveChar(char& chr) override;
50 int receiveBytes(unsigned char* bytes, const int size) override;
51 int receiveLine(char* line, const int MaxLineLength) override;
52 bool setDTR(bool value) override;
53 int flush() override;
54};
55
56#endif
This class is the parameters parser for class FakeSerialPort.
fakeSerialPort: A fake basic Serial Communications Link (RS232, USB).
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
int receiveBytes(unsigned char *bytes, const int size) override
Gets an array of bytes (unsigned char) with size <= 'size' parameter.
virtual ~FakeSerialPort()
int flush() override
Flushes the internal buffer.
bool receive(Bottle &msg) override
Gets the existing chars in the receive queue.
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.
bool send(const Bottle &msg) override
Sends a string of chars to the serial communications channel.
bool close() override
Close the DeviceDriver.
bool setDTR(bool value) override
Enable/Disable DTR protocol.
int receiveChar(char &chr) override
Gets one single char from the receive queue.
Interface implemented by all device drivers.
A generic interface to serial port devices.
A simple collection of objects that can be described and transmitted in a portable way.
Definition Bottle.h:64
A mini-server for performing network communication in the background.
A base class for nested structures that can be searched.
Definition Searchable.h:31
An interface to the operating system, including Port based communication.