BusBricks: /Users/felixschulke/Developement/Arduino/Modbus_RTU/Modbus_RTU/Modbus-RTU/lib/mockSoftwareSerial/mockSoftwareSerial.h Source File
BusBricks  0.1
Customize bus-communication
Loading...
Searching...
No Matches
mockSoftwareSerial.h
Go to the documentation of this file.
1
24#ifndef MOCKSOFTWARESERIAL_H
25#define MOCKSOFTWARESERIAL_H
26
27#ifdef ARDUINO
28 #include <Arduino.h>
29#else
30 #include <mockArduino.h>
31 using namespace arduinoMocking;
32 #include <Content_stack.h>
33
38 namespace arduinoMocking {
39
66 public:
73 SoftwareSerial(int rx, int tx);
74
82 void begin(long baud);
83
91 void println(const String &message);
92
100 void print(const String &message);
101
110 void write(const char* data, size_t size);
111
117 void flush();
118
124 int available();
125
131 int read();
132
138 int peek();
139
145 void simulateInput();
146
152 void simulateInput(std::string input);
153
154 private:
155 int rxPin;
156 int txPin;
157 Content_stack<char, 512> dataQueue;
158 };
159
160 } // namespace arduinoMocking
161
162#endif // ARDUINO
163#endif // MOCKSOFTWARESERIAL_H
Content-Stack-Template the content-stack stores the added items (call-by-value / copy) on internal ar...
Definition Content_stack.h:45
Mock class to simulate the SoftwareSerial library for native builds.
Definition mockSoftwareSerial.h:65
int available()
Returns the number of available bytes in the internal queue.
Definition mockSoftwareSerial.cpp:80
void flush()
Empties the internal queue and prints the flushed data to the console.
Definition mockSoftwareSerial.cpp:50
void println(const String &message)
Prints a message followed by a newline.
Definition mockSoftwareSerial.cpp:35
int read()
Reads a character from the internal queue.
Definition mockSoftwareSerial.cpp:62
void write(const char *data, size_t size)
Writes data to the internal queue.
Definition mockSoftwareSerial.cpp:44
void begin(long baud)
Initializes the serial communication with the specified baud rate.
Definition mockSoftwareSerial.cpp:31
void print(const String &message)
Prints a message without a newline.
Definition mockSoftwareSerial.cpp:39
int peek()
Returns the next character in the queue without removing it.
Definition mockSoftwareSerial.cpp:72
void simulateInput()
Simulates user input by adding characters to the internal queue.
Definition mockSoftwareSerial.cpp:85
Provides mock implementations of Arduino framework functions and classes for native builds.
Definition mockArduino.cpp:28
std::string String
Alias for std::string to simulate Arduino's String type.
Definition mockArduino.h:51