25#include "api/HardwareSerial.h"
36 SerialImpl(
const char* device =
"/dev/ttyACM0") { this->device = device; }
49 virtual int available(
void) {
return serial.
available(); };
51 virtual int peek(
void) {
52 if (peek_char == -1) {
58 virtual int read(
void) {
60 if (peek_char != -1) {
70 virtual void flush(
void) {};
74 virtual operator bool() {
return is_open; }
77 void setTimeout(
unsigned long timeout) {
78 this->timeout = timeout;
79 HardwareSerial::setTimeout(timeout);
89 virtual void open(
unsigned long baudrate) {
91 Logger.error(
"SerialImpl",
"could not open", device);
Definition HardwareSerial.h:89
This class is used for communication over a serial device.
Definition serialib.h:50
int available()
Return the number of bytes in the received buffer (UNIX only)
Definition serialib.cpp:600
char openDevice(const char *Device, const unsigned int Bauds)
Open the serial port.
Definition serialib.cpp:92
char readChar(char *pByte, const unsigned int timeOut_ms=0)
Wait for a byte from the serial device and return the data read.
Definition serialib.cpp:339
void closeDevice()
Close the connection with the current device.
Definition serialib.cpp:217
char writeChar(char)
Write a char on the current serial port.
Definition serialib.cpp:241
We provide the WiFi class to simulate the Arduino WIFI. In in Linux we can expect that networking is ...
Definition CanMsg.cpp:31
Header file of the class serialib. This class is used for communication over a serial device.