Step 2.1: web server, embedded UI, /api/status, /api/reboot

- aes67_web: httpd (wildcard URI matching), serves web/index.html embedded
  via EMBED_TXTFILES, status registry (status_register) and route registry
  (web_register_uri), GET /api/status, POST /api/reboot (restarts 0.5 s
  after the response).
- Status fields come from each core component: aes67_net (ip, aes67_ip,
  mac, link), aes67_health (fw, uptime_s, heap_free, psram_free),
  aes67_tx stub (tx_packets, underruns = 0). No ptp object yet, so the UI
  shows "no data".
- Verified on board: / serves index.html byte-identical (27601 B),
  /api/status returns live values, reboot via API returns in ~12 s.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-09-24 22:56:06 +10:00
parent 69b4e18118
commit 35275b8ccf
12 changed files with 205 additions and 14 deletions
+14 -1
View File
@@ -2,6 +2,19 @@
// Core component: must not depend on main/ (project code).
#pragma once
#include "cJSON.h"
#include "esp_err.h"
#include "esp_http_server.h"
esp_err_t aes67_web_init(void);
// Adds fields to the /api/status object. Called on every GET /api/status.
typedef void (*status_cb_t)(cJSON *status);
// Registries: call before or after aes67_web_start(); routes registered early are added on start.
esp_err_t status_register(status_cb_t cb);
esp_err_t web_register_uri(const httpd_uri_t *uri);
// Start httpd on port 80 with the core routes (/, /api/status, /api/reboot).
esp_err_t aes67_web_start(void);
// Send a cJSON object as the response body (application/json).
esp_err_t web_send_json(httpd_req_t *req, const cJSON *json);