25 #ifndef ACE_ROUTINE_STREAM_LINE_READER_H 26 #define ACE_ROUTINE_STREAM_LINE_READER_H 29 #include <AceRoutine.h> 30 #include "InputLine.h" 53 char* buffer,
int bufferSize):
64 while (mStream.available() > 0) {
65 char c = mStream.read();
68 if (mIndex >= mBufSize - 1) {
69 input.status = InputLine::kStatusOverflow;
73 COROUTINE_CHANNEL_WRITE(mChannel, input);
74 }
else if (c ==
'\n' || c ==
'\r') {
76 mFlushLine ? InputLine::kStatusOverflow : InputLine::kStatusOk;
80 COROUTINE_CHANNEL_WRITE(mChannel, input);
107 bool mFlushLine =
false;
virtual int runCoroutine() override
The body of the coroutine.
#define COROUTINE_AWAIT(condition)
Yield until condition is true, then execution continues.
#define COROUTINE_LOOP()
Mark the beginning of a coroutine loop.
An AceRoutine coroutine that reads lines (terminated by '\n' or '\r' from the Stream device...
An unbuffered synchronized channel.
StreamLineReader(ace_routine::Channel< InputLine > &channel, Stream &stream, char *buffer, int bufferSize)
Constructor.
Base class of all coroutines.