Stream | |
---|---|
Quick Look | |
Hardware | (External hardware) |
Core | Stream.h |
Stream is a base class for character-based streams.
findUntil(const char *target, size_t targetLen, const char *terminate, size_t termLen)
findUntil(const uint8_t *target, size_t targetLen, const char *terminate, size_t termLen)
readBytesUntil( char terminator, char *buffer, size_t length)
readBytesUntil( char terminator, uint8_t *buffer, size_t length))
The Stream class is a base class which provides functions to handle data streams and assist in parsing streams. It is not called directly, but it is used from within other libraries.
virtual int available() = 0;
virtual int read() = 0;
virtual int flush() = 0;
virtual void flush() = 0;
void setTimeout(unsigned long timeout);
Sets the maximum milliseconds to wait for stream data, default is 1 second.
bool find(const char *target);
Reads data from the stream until the target string is found.
bool find(const uint8_t *target);
Returns true if target string is found, false if timed out (see setTimeout)
bool find(const char *target, size_t length);
Reads data from the stream until the target string of given length is found
bool find(const uint8_t *target, size_t length);
Returns true if target string is found, false if timed out
bool findUntil(const char *target, const char *terminator);
Same as find but the search ends if the terminator string is found.
findUntil(const uint8_t *target, const char *terminator);
Same as find but the search ends if the terminator string is found.
findUntil(const char *target, size_t targetLen, const char *terminate, size_t termLen);
Reads data from the stream until the target string of the given length is found. Search is terminated if the terminator string is found. Returns true if target string is found, false if terminated or timed out.
findUntil(const uint8_t *target, size_t targetLen, const char *terminate, size_t termLen);
Reads data from the stream until the target string of the given length is found. Search is terminated if the terminator string is found. Returns true if target string is found, false if terminated or timed out.
long parseInt();
Returns the first valid (long) integer value from the current position. Initial characters that are not digits (or the minus sign) are skipped. Integer is terminated by the first character that is not a digit.
float parseFloat();
Returns the first valid floating point value from the current position. Initial characters that are not digits (or the minus sign) are skipped. Integer is terminated by the first character that is not a digit.
size_t readBytes( char *buffer, size_t length);
Read chars from stream into buffer.
size_t readBytes( uint8_t *buffer, size_t length);
Read chars from stream into buffer. Terminates if length characters have been read or timeout (see setTimeout). Returns the number of characters placed in the buffer (0 means no valid data found).
size_t readBytesUntil( char terminator, char *buffer, size_t length);
Read chars from stream into buffer with a terminator character.
size_t readBytesUntil( char terminator, uint8_t *buffer, size_t length);
Terminates if length characters have been read, timeout, or if the terminator character detected. Returns the number of characters placed in the buffer (0 means no valid data found)
String readString();
Arduino String function.
String readStringUntil(char terminator);
Arduino String function.