23 lines
878 B
C
23 lines
878 B
C
// commands.h — the WebUI -> device channel (SPEC C1).
|
|
//
|
|
// The device is never contacted directly. The WebUI writes a row into
|
|
// `device_commands`; the endpoint attaches pending rows to the next
|
|
// ingest/heartbeat response; this module executes them and acks.
|
|
//
|
|
// Deferred execution: some commands must not run inside the HTTP response
|
|
// callback (OTA reboots, streaming blocks for a minute). Those are queued and
|
|
// run from the main loop, which is also where sleep decisions are made.
|
|
#pragma once
|
|
|
|
#include <Arduino.h>
|
|
#include <ArduinoJson.h>
|
|
|
|
// Pass this to apiIngest/apiHeartbeat. Parses and either executes immediately
|
|
// or defers. Cheap commands ack from here; deferred ones ack on completion.
|
|
void commandOnReceived(JsonObjectConst cmd);
|
|
|
|
// Run anything that was deferred. Call once per main-loop tick.
|
|
void commandRunDeferred();
|
|
|
|
bool commandHasPending();
|