src.nth.io/

summaryrefslogtreecommitdiff
path: root/main/state_client.h
diff options
context:
space:
mode:
Diffstat (limited to 'main/state_client.h')
-rw-r--r--main/state_client.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/main/state_client.h b/main/state_client.h
new file mode 100644
index 0000000..bf7e1c6
--- /dev/null
+++ b/main/state_client.h
@@ -0,0 +1,18 @@
+#pragma once
+
+#include "esp_err.h"
+#include "viewport_state.h"
+
+esp_err_t state_client_init(void);
+
+// Queue a state-change POST to <scrypted>/state.
+//
+// Concurrency model (per spec):
+// - At most one HTTP POST in flight; a dedicated worker task drives it.
+// - Depth-1 queue. If a POST is already queued, replace it with the newer
+// one — the in-flight POST is never cancelled.
+// - Fire-and-forget from the caller's perspective. Local state change
+// proceeds immediately regardless of POST outcome.
+//
+// Silently dropped if the device has no Scrypted URL configured.
+void state_client_post(viewport_run_state_t state);