- espnow_link, ctrl_msg and beat_sync: the reliable link, envelopes and beat-synced timing. - ctrl_msg: accept an envelope with the trailing save byte. - patterns_frame() and espnow_link_poll() split out of their tasks, so the WebAssembly simulator can drive one frame and one link pass from a timer. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
1013 B
C
35 lines
1013 B
C
/*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
#pragma once
|
|
|
|
#include "esp_err.h"
|
|
#include "esp_http_server.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define WEB_API_MSG_MAX 2048 // a request message: {"method","path","body","host"}
|
|
#define WEB_API_REPLY_MAX 16384 // a reply envelope: {"status","body"}
|
|
|
|
/** @brief Start the HTTP server on port 80 (UI and JSON API). */
|
|
esp_err_t web_start(void);
|
|
|
|
/**
|
|
* @brief Add Access-Control-Allow-Origin for a LAN or localhost page that asked (the Origin header).
|
|
* Call before the response is sent. Other origins get no header, so the browser blocks them.
|
|
*/
|
|
void web_allow_lan_origin(httpd_req_t *req);
|
|
|
|
/**
|
|
* @brief Run one API request without HTTP, as the WebSocket does: msg is
|
|
* {"method": "GET" or "POST", "path": "/api/...", "body": ..., "host": optional relay target}.
|
|
* out gets the envelope {"status": n, "body": "<JSON text>"}. Used by the USB config port.
|
|
*/
|
|
void web_api_call(const char *msg, char *out, size_t cap);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|