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):
65 while (mStream.available() > 0) {
69 if (mIndex >= mBufSize - 1) {
70 input.status = InputLine::kStatusOverflow;
74 COROUTINE_CHANNEL_WRITE(mChannel, input);
75 }
else if (c ==
'\n' || c ==
'\r') {
77 mFlushLine ? InputLine::kStatusOverflow : InputLine::kStatusOk;
81 COROUTINE_CHANNEL_WRITE(mChannel, input);
108 bool mFlushLine =
false;
#define COROUTINE_AWAIT(condition)
Yield until condition is true, then execution continues.
int runCoroutine() override
The body of the coroutine.
#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.