120 {
122
124 if (avail <= 0) {
126 }
127
128
129
130
131
133 if (!line.has_value() || line->empty()) {
135 }
136
137
138 fl::string_view view = *line;
139
140
141 if (prefix && prefix[0] != '\0') {
144 }
145 }
146
147
150 }
151
152
155 }
156
157
158 if (view.
empty() || view[0] !=
'{') {
159
160
161
162
163
164
165
166
167
168
169
170
171
173 FL_WARN(
"[RPC] discarded a " << (
static_cast<unsigned>(line->size())) <<
" byte line that does not begin with '{'; a request that arrived truncated looks exactly like this");
174 }
176 }
177
178
179 fl::string input(view);
181 };
182}
static json parse(const fl::string &txt) FL_NO_EXCEPT
void remove_suffix(fl::size n) FL_NO_EXCEPT
constexpr const char & back() const FL_NO_EXCEPT
constexpr bool empty() const FL_NO_EXCEPT
void remove_prefix(fl::size n) FL_NO_EXCEPT
bool starts_with(string_view sv) const FL_NO_EXCEPT
constexpr const char & front() const FL_NO_EXCEPT
fl::optional< fl::string > readLine(char delimiter, char skipChar, fl::optional< u32 > timeoutMs) FL_NO_EXCEPT
bool isspace(char c) FL_NO_EXCEPT
Check if character is whitespace (space, tab, newline, carriage return)
constexpr nullopt_t nullopt
constexpr fl::size kDroppedRequestWarnBytes
Create a JSON-RPC RequestSource that reads from fl:: serial input.
int available() FL_NO_EXCEPT
FASTLED_FORCE_INLINE size_t strlen(const char *s) FL_NO_EXCEPT