Move the web assets and templates under v2/web, drop the old src/, lib/ and scripts, and update firmware, tools, docs and db files. Add the audio page, LED test scripts and VPN autoconnect script. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
31 lines
1.1 KiB
C
31 lines
1.1 KiB
C
#pragma once
|
|
|
|
#include <stdbool.h>
|
|
#include "cJSON.h"
|
|
#include "esp_err.h"
|
|
|
|
// JSON "database": one file per collection under /db, each an object of
|
|
// id -> record, mirroring the Pi's db/*.json. Collections stay in memory and
|
|
// are written back (via a temp file and rename) whenever they change.
|
|
|
|
// Mount the db partition and load every collection
|
|
esp_err_t store_init(void);
|
|
|
|
// Borrowed pointer to the collection object (id -> record); never NULL for a known name
|
|
cJSON *store_coll(const char *name);
|
|
bool store_known(const char *name);
|
|
|
|
// Replace a whole collection with a parsed object (takes ownership) and persist it
|
|
esp_err_t store_replace(const char *name, cJSON *obj);
|
|
esp_err_t store_save(const char *name);
|
|
|
|
// Next numeric string id for a collection ("1" when empty); writes into buf
|
|
void store_next_id(const char *name, char *buf, size_t len);
|
|
|
|
// Settings are one flat object (the "settings" collection itself)
|
|
cJSON *store_settings(void);
|
|
|
|
// Recursive lock around every read or write of the collections (HTTP handlers and the sequencer)
|
|
void store_lock(void);
|
|
void store_unlock(void);
|