192 {
193
197 auto idOpt = idJson.
as_int();
198 if (idOpt) {
199 int id = *idOpt;
202 }
203 }
204 }
205 }
206
207
209 Serial.println(
"ERROR Response:");
212 return;
213 }
214
215
218
219 if (
result.contains(
"ack")) {
220 auto ackOpt =
result[
"ack"].as_bool();
221 if (ackOpt && *ackOpt == true) {
222 Serial.println(
"Received ACK - request accepted");
223 return;
224 }
225 }
226
227
228 if (
result.contains(
"update")) {
229 auto updateOpt =
result[
"update"].as_int();
230 if (updateOpt) {
231 int update = *updateOpt;
233
234
238 }
239 return;
240 }
241
242
243 if (
result.contains(
"stop")) {
244 auto stopOpt =
result[
"stop"].as_bool();
245 if (stopOpt && *stopOpt == true) {
246 if (
result.contains(
"value")) {
247 Serial.print(
"Received FINAL result: ");
249 } else {
250 Serial.println(
"Received FINAL marker (no value)");
251 }
253 return;
254 }
255 }
256
257
258 Serial.print(
"Received result: ");
261 } else {
262 Serial.println(
"Received response without result:");
264 }
265}
FL_DISABLE_WARNING_PUSH FL_DISABLE_WARNING_GLOBAL_CONSTRUCTORS CFastLED FastLED
Global LED strip management instance.
fl::optional< i64 > as_int() const FL_NOEXCEPT
bool is_number() const FL_NOEXCEPT
void to_string(const fl::u16 *bit_data, fl::u32 bit_count, string *dst)
void printf(const char *format, const Args &... args) FL_NOEXCEPT
Printf-like formatting function that prints directly to the platform output.
expected< T, E > result
Alias for expected (Rust-style naming)
@ Blue
<div style='background:#0000FF;width:4em;height:4em;'></div>