 |
Arduino Core for STM32
1.0
|
Go to the documentation of this file.
43 #define NO_SKIP_CHAR 1 // a magic char not found in a valid ASCII numeric field
99 virtual int read() = 0;
106 virtual int peek() = 0;
173 virtual void width(
size_t width_);
180 bool find(
const char *target);
188 return find((
char *) target);
197 bool find(
const char *target,
size_t length);
205 bool find(
const uint8_t *target,
size_t length) {
206 return find((
char *) target, length);
214 bool find(
char target) {
return find (&target, 1); }
222 bool findUntil(
const char *target,
const char *terminator);
230 bool findUntil(
const uint8_t *target,
const char *terminator) {
231 return findUntil((
char *) target, terminator);
242 bool findUntil(
const char *target,
size_t targetLen,
const char *terminate,
size_t termLen);
252 bool findUntil(
const uint8_t *target,
size_t targetLen,
const char *terminate,
size_t termLen) {
253 return findUntil((
char *) target, targetLen, terminate, termLen);
305 virtual size_t readBytes(
char *buffer,
size_t length);
314 virtual size_t readBytes(uint8_t *buffer,
size_t length) {
315 return readBytes((
char *) buffer, length);
328 size_t readBytesUntil(
char terminator,
char *buffer,
size_t length);
344 #ifdef String_class_h
349 virtual String readString();
358 String readStringUntil(
char terminator);
370 return parseNum<long>(skipChar);
382 bool isNegative =
false;
396 else if(c >=
'0' && c <=
'9')
397 value = value * 10 + c -
'0';
400 }
while((c >=
'0' && c <=
'9') || c == skipChar);
427 bool isNegative =
false;
428 bool isFraction =
false;
445 else if(c >=
'0' && c <=
'9') {
446 value = value * 10 + c -
'0';
452 }
while((c >=
'0' && c <=
'9') || c ==
'.' || c == skipChar);
457 return value * fraction;
int timedRead()
Private method to read stream with timeout.
Definition: Stream.cpp:15
__INTEGER_ONLY__(T, Stream &) operator>>(T &val)
This operator (>>) applied to an input stream is known as extraction operator, it can be used same as...
Definition: Stream.h:144
bool find(const char *target)
Reads and removes data from the stream until the target string is found.
Definition: Stream.cpp:153
virtual size_t readBytes(char *buffer, size_t length)
Reads characters from the stream into a buffer.
Definition: Stream.cpp:303
virtual void width(size_t width_)
Sets receiving width, that is applied when using operators >> (same as cin.width() method).
Definition: Stream.cpp:132
bool findUntil(const char *target, const char *terminator)
Reads data from the stream until a target string or terminator string is found.
Definition: Stream.cpp:164
virtual size_t readBytes(uint8_t *buffer, size_t length)
Reads characters from the stream into a buffer.
Definition: Stream.h:314
bool find(uint8_t *target)
Reads and removes data from the stream until the target string is found.
Definition: Stream.h:187
size_t readBytesUntil(char terminator, uint8_t *buffer, size_t length)
Reads characters from the stream into a buffer.
Definition: Stream.h:340
int timedPeek()
Private method to peek stream with timeout.
Definition: Stream.cpp:30
__FLOATING_ONLY__(T, T) inline parseNum()
Parses the first valid floating point number from the stream.
Definition: Stream.h:294
#define NO_SKIP_CHAR
Definition: Stream.h:43
__INTEGER_ONLY__(T, T) inline parseNum()
Parses the first valid integer number from the stream.
Definition: Stream.h:273
float parseFloat(char skipChar)
Parses the first valid floating point number from the stream.
Definition: Stream.h:414
virtual size_t widthCheck(size_t width_)
Checks if the correct width in width() method was set.
Definition: Stream.cpp:142
long parseInt()
Parses the first valid (long) integer number from the stream.
Definition: Stream.h:262
virtual int peek()=0
Reads one byte from receiving buffer and without removing it from buffer.
virtual int read()=0
Reads one byte from receiving buffer and removes it from buffer.
long parseInt(char skipChar)
Parses the first valid (long) integer number from the stream.
Definition: Stream.h:369
float parseFloat()
Parses the first valid floating point number from the stream.
Definition: Stream.h:283
size_t readBytesUntil(char terminator, char *buffer, size_t length)
Reads characters from the stream into a buffer.
Definition: Stream.cpp:319
Stream & operator>>(char &c)
This operator (>>) applied to an input stream is known as extraction operator, it can be used same as...
Definition: Stream.cpp:64
bool find(const uint8_t *target, size_t length)
Reads and removes data from the stream until the target string is found.
Definition: Stream.h:205
unsigned long _startMillis
Used for timeout measurement.
Definition: Stream.h:66
This class is for receiving and transmitting data.
Definition: Stream.h:56
Stream()
Constructor.
Definition: Stream.h:111
__FLOATING_ONLY__(T, Stream &) operator>>(T &val)
This operator (>>) applied to an input stream is known as extraction operator, it can be used same as...
Definition: Stream.h:155
This file contains class with methods, that are used for to print formatted output.
int peekNextDigit()
Gets the next numeric digit in the stream or -1 if timeout.
Definition: Stream.cpp:46
The stream class is derived from this class. This class contains methods, that are used for to print ...
Definition: Print.h:130
void setTimeout(unsigned long timeout)
Sets the maximum milliseconds to wait for data transmitting or receiving.
Definition: Stream.cpp:127
virtual int available()=0
Checks how many bytes are available in receiving buffer.
__INTEGER_ONLY__(T, T) parseNum(char skipChar)
Parses the first valid integer number from the stream.
Definition: Stream.h:381
bool find(char target)
Reads and removes data from the stream until the target character is found.
Definition: Stream.h:214
__FLOATING_ONLY__(T, T) parseNum(char skipChar)
Parses the first valid floating point number from the stream.
Definition: Stream.h:426
bool findUntil(const uint8_t *target, size_t targetLen, const char *terminate, size_t termLen)
Reads data from the stream until a target string or terminator string is found.
Definition: Stream.h:252
unsigned long _timeout
Number of milliseconds to wait for the next char before aborting timed read.
Definition: Stream.h:61
size_t _width
Maximum operator >> read width.
Definition: Stream.h:472
bool findUntil(const uint8_t *target, const char *terminator)
Reads data from the stream until a target string or terminator string is found.
Definition: Stream.h:230