2403a6b64b
- aes67_ota: GET /api/ota (version, project, build_date, idf, running, previous, previous_version, pending_verify, can_rollback), POST /api/ota streamed into the inactive slot (4 KiB chunks), POST /api/ota/confirm and /api/ota/rollback. - Rejected before any flash write: bad magic, wrong chip, wrong project_name, chip revision outside the image's min/max range. esp_ota_end verifies the whole image. - Self-test on a pending image: IP address plus HTTP 200 from our own /api/status within 60 s marks it valid; otherwise mark invalid and reboot into the previous slot. A crash before that is rolled back by the bootloader. - CONFIG_AES67_OTA_SELFTEST_FORCE_FAIL (test builds only) forces a failed self-test. - aes67_web: web_reboot_later() shared by /api/reboot and OTA. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
24 lines
889 B
C
24 lines
889 B
C
// aes67_web: httpd, embedded index.html, config store (cJSON in NVS), core routes.
|
|
// Core component: must not depend on main/ (project code).
|
|
#pragma once
|
|
|
|
#include "cJSON.h"
|
|
#include "esp_err.h"
|
|
#include "esp_http_server.h"
|
|
|
|
// 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/config, /api/reboot).
|
|
esp_err_t aes67_web_start(void);
|
|
|
|
// Restart after ms (lets an HTTP response go out first).
|
|
void web_reboot_later(uint32_t ms);
|
|
|
|
// Send a cJSON object as the response body (application/json).
|
|
esp_err_t web_send_json(httpd_req_t *req, const cJSON *json);
|