JSON-Based Configuration Manager Requirements¶
This document specifies component-level requirements for the JSON-Schema-Driven Configuration Management System. These requirements refine the high-level system requirement Non-volatile Configuration ... (REQ_SYS_CFG_1) (Non-volatile Configuration Storage).
Document Version: 2.0 Last Updated: 2025-11-12
Component Overview¶
The JSON-based configuration manager component provides centralized configuration management through a single JSON schema source of truth. Configuration is stored persistently in NVS and accessed via type-safe C API. The web interface generates forms dynamically from the schema.
Configuration Schema Definition¶
Description: The configuration manager SHALL define all configuration parameters in a single JSON schema file (config_schema.json) that serves as the authoritative source of truth for parameter definitions, default values, and UI metadata. Rationale: Single source of truth prevents duplication across C code, web forms, and documentation. Schema-driven approach enables code generation for factory defaults and dynamic UI generation. Acceptance Criteria:
|
Description: The configuration schema SHALL support logical grouping of parameters into sections for organization in the web interface. Rationale: Logical organization improves usability for configuration with many parameters. Acceptance Criteria:
|
Description: The configuration system SHALL support basic parameter types: string, password, integer, boolean, and hidden. Rationale: Covers typical IoT configuration needs while remaining simple. Separate types enable appropriate UI widgets and validation. Acceptance Criteria:
|
Configuration Generation and Defaults¶
Description: The build system SHALL automatically generate C code to initialize factory default configuration from the JSON schema during build time. Rationale: Eliminates manual default value maintenance in C code. Generated code is compiled into firmware, ensuring defaults match schema without runtime JSON parsing. Acceptance Criteria:
|
Description: The ESP32 application code SHALL NOT parse JSON at runtime. JSON parsing SHALL occur only at build time (code generation) or in browser (UI). Rationale: Eliminates runtime overhead and memory overhead of JSON parser on resource-constrained ESP32. Simplifies C code and improves performance. Acceptance Criteria:
|
NVS Storage and Access¶
Description: Configuration parameters SHALL be stored in NVS using the schema “key” field directly as the NVS key. Rationale: Direct key usage simplifies storage format and eliminates need for separate UUID system. Keys are human-readable for debugging. Acceptance Criteria:
|
Description: The configuration manager SHALL provide type-specific getter and setter functions for configuration access. Rationale: Type-specific functions enforce compile-time type checking via function signature. Different functions for different types prevent accidental type mismatches at call site. Acceptance Criteria:
|
Description: Configuration changes SHALL be immediately persisted to NVS on each config_set_xxx() call. Rationale: Ensures configuration survives power loss and system resets. Acceptance Criteria:
|
Description: The system SHALL provide config_factory_reset() function to reset all configuration to schema-defined defaults. Rationale: Users need ability to recover from misconfiguration without firmware rebuild. Acceptance Criteria:
|
Web Interface Integration¶
Description: The configuration system SHOULD provide integration points for web-based configuration interfaces. Rationale: Web servers need access to configuration schema and runtime values to provide user interfaces. Config Manager provides the data layer; Web Server provides the HTTP/UI layer. Acceptance Criteria:
Note: Detailed web interface requirements (HTML forms, REST API endpoints, validation) are specified in Web Server Requirements (Configuration REST API (REQ_WEB_CONF_1)). This requirement ensures Config Manager provides necessary integration points without knowing HTTP details. |
Error Handling¶
Description: The configuration system SHALL gracefully handle NVS errors and continue operating with default values. Rationale: NVS corruption or wear should not prevent system operation. Acceptance Criteria:
|
Description: On first boot, config_init() SHALL initialize NVS with factory defaults from schema if NVS “config” namespace is empty or uninitialized. Rationale: New devices need sensible defaults on first boot. Acceptance Criteria:
|
Development Guide¶
Description: Adding new configuration parameters SHALL require modification of only config_schema.json, with C code and web UI auto-updating. Rationale: Low friction for extending configuration reduces development time. Acceptance Criteria:
|
Description: The build system SHOULD provide optional pre-build validation script that detects type mismatches between schema and C code. Rationale: Catches developer errors early without requiring code generation. Optional to keep build simple. Acceptance Criteria:
|
Future Enhancements¶
Description: The configuration system MAY support schema versioning and automatic migration of configuration data across firmware updates. Rationale: As firmware evolves, configuration structure may change (new fields, renamed keys, changed types). Schema versioning enables detection and migration of old configurations. However, embedded devices are typically “programmed out” thoroughly before production deployment, minimizing schema changes after deployment. Acceptance Criteria (if implemented):
Note: This requirement is marked “open” as schema changes are rare in production embedded systems. Hardware constraints typically stabilize configuration structure early in development. For most deployments, factory reset on major firmware updates is acceptable alternative to complex migration logic. |
Traceability¶
All traceability is automatically generated by Sphinx-Needs based on the :links: attributes in each requirement.
ID |
Title |
Status |
Tags |
|---|---|---|---|
Certificate Handler |
implemented |
||
Config Manager |
implemented |
||
Display Logic |
implemented |
||
Distance Sensor |
implemented |
||
LED Controller |
implemented |
||
Network Tunnel |
implemented |
||
Startup Tests |
implemented |
||
Web Server |
implemented |
||
WiFi Manager |
implemented |
||
cert_handler_get_ca_cert |
implemented |
||
cert_handler_get_info |
implemented |
||
cert_handler_get_server_cert |
implemented |
||
cert_handler_get_server_key |
implemented |
||
cert_handler_init |
implemented |
||
config_commit |
implemented |
||
config_factory_reset |
implemented |
||
config_get_all_as_json |
implemented |
||
config_get_bool |
implemented |
||
config_get_int16 |
implemented |
||
config_get_int32 |
implemented |
||
config_get_schema_json |
implemented |
||
config_get_string |
implemented |
||
config_init |
implemented |
||
config_set_all_from_json |
implemented |
||
config_set_bool |
implemented |
||
config_set_bool_no_commit |
implemented |
||
config_set_int16 |
implemented |
||
config_set_int16_no_commit |
implemented |
||
config_set_int32 |
implemented |
||
config_set_string |
implemented |
||
config_set_string_no_commit |
implemented |
||
config_write_factory_defaults |
implemented |
||
display_logic_start |
implemented |
||
distance_sensor_get_latest |
implemented |
||
distance_sensor_get_queue_overflows |
implemented |
||
distance_sensor_has_new_measurement |
implemented |
||
distance_sensor_init |
implemented |
||
distance_sensor_is_running |
implemented |
||
distance_sensor_monitor |
implemented |
||
distance_sensor_start |
implemented |
||
distance_sensor_stop |
implemented |
||
led_clear_all |
implemented |
||
led_clear_pixel |
implemented |
||
led_color_brightness |
implemented |
||
led_color_rgb |
implemented |
||
led_controller_deinit |
implemented |
||
led_controller_init |
implemented |
||
led_get_all_colors |
implemented |
||
led_get_count |
implemented |
||
led_get_pixel |
implemented |
||
led_is_initialized |
implemented |
||
led_set_pixel |
implemented |
||
led_show |
implemented |
||
netif_uart_tunnel_deinit |
implemented |
||
netif_uart_tunnel_get_handle |
implemented |
||
netif_uart_tunnel_init |
implemented |
||
led_running_test_multiple_cycles |
implemented |
||
led_running_test_rainbow |
implemented |
||
led_running_test_single_cycle |
implemented |
||
web_server_get_port |
implemented |
||
web_server_init |
implemented |
||
web_server_is_running |
implemented |
||
web_server_start |
implemented |
||
static_file_handler |
implemented |
||
web_server_stop |
implemented |
||
wifi_manager_clear_credentials |
implemented |
||
wifi_manager_get_ip_address |
implemented |
||
wifi_manager_get_status |
implemented |
||
wifi_manager_init |
implemented |
||
wifi_manager_monitor |
implemented |
||
wifi_manager_set_credentials |
implemented |
||
wifi_manager_start |
implemented |
||
wifi_manager_stop |
implemented |
||
wifi_manager_switch_to_ap |
implemented |
||
distance_sensor_error_t |
implemented |
||
distance_measurement_t |
implemented |
||
distance_raw_measurement_t |
implemented |
||
led_color_t |
implemented |
||
netif_uart_tunnel_config_t |
implemented |
||
web_server_config_t |
implemented |
||
wifi_credentials_t |
implemented |
||
wifi_manager_mode_t |
implemented |
||
wifi_status_t |
implemented |
||
JSON Schema as Configuration Source of Truth |
implemented |
config; schema; architecture |
|
Web Interface Integration Support |
approved |
config; integration |
|
NVS Error Graceful Handling |
implemented |
config; error-handling; reliability |
|
Configuration Initialization on Boot |
implemented |
config; boot |
|
Simple Process to Add Configuration Fields |
implemented |
config; extensibility; developer-experience |
|
Type Safety via Optional Static Validation |
implemented |
config; validation; developer-experience |
|
Configuration Schema Versioning and Migration |
open |
config; versioning; migration; future |
|
Parameter Grouping for UI Organization |
implemented |
config; ui; schema |
|
Parameter Type System |
implemented |
config; types |
|
Build-Time Factory Defaults Generation |
implemented |
config; build; code-generation |
|
No Runtime JSON Parsing in C Code |
implemented |
config; performance; memory |
|
Key-Based NVS Storage |
implemented |
config; storage; nvs |
|
Type-Safe Configuration API |
implemented |
config; api; type-safety |
|
Persistent Configuration Storage |
implemented |
config; storage; nvs |
|
Factory Reset Capability |
implemented |
config; reset |
|
Supporting Documentation Traceability |
implemented |
developer; documentation; traceability |
|
Supported Development Environments |
implemented |
developer; devcontainer; codespaces |
|
Debugging Guide Content |
implemented |
developer; documentation; debugging |
|
Web Flasher Guide Content |
implemented |
developer; documentation; flasher |
|
Switching Dev Modes Guide Content |
implemented |
developer; documentation; devmodes |
|
QEMU Emulator Guide Content |
implemented |
developer; documentation; qemu |
|
Known Limitations Documentation |
implemented |
developer; limitations; known-issues |
|
Hardware Specifications Content |
implemented |
developer; documentation; hardware |
|
Overview Index Content |
implemented |
developer; documentation; overview |
|
Quick Start Content |
implemented |
developer; documentation; quickstart |
|
README Content Scope |
implemented |
developer; documentation; readme |
|
Hardware Platform |
approved |
display; hardware; integration |
|
Configuration Integration |
approved |
display; configuration; integration |
|
Core Visualization Concept |
approved |
display; ux; visualization |
|
Below Minimum Distance Warning |
approved |
display; ux; safety |
|
Out of Range Display |
approved |
display; ux; error-handling |
|
WS2812 LED Strip Support |
approved |
led; hardware; ws2812 |
|
Individual Pixel Control |
approved |
led; control; api |
|
Configurable LED Count |
approved |
led; configuration; flexibility |
|
Accurate Color Display |
approved |
led; quality; color-accuracy |
|
LED State Read API |
approved |
led; api; monitoring; web-interface |
|
QEMU UART Network Bridge |
approved |
emulation; network; qemu; uart |
|
Packet Encapsulation |
approved |
emulation; protocol |
|
Host-Side Bridge Script |
approved |
emulation; tooling; host |
|
DHCP Client Support |
approved |
emulation; network; dhcp |
|
Conditional Compilation |
approved |
emulation; build |
|
Emulation Setup Documentation |
approved |
emulation; documentation |
|
Tunnel Throughput |
approved |
emulation; performance |
|
Packet Loss Handling |
approved |
emulation; reliability |
|
Component Initialization |
approved |
sensor; initialization; gpio |
|
Timing and Performance |
approved |
sensor; performance; timing |
|
Accuracy and Calibration |
approved |
sensor; accuracy; calibration |
|
Timeout Error Handling |
approved |
sensor; error-handling; timeout |
|
Range Validation |
approved |
sensor; error-handling; validation |
|
Queue Overflow Management |
approved |
sensor; error-handling; queue |
|
Trigger Pulse Generation |
approved |
sensor; trigger; timing |
|
Real-Time Timestamp Capture |
approved |
sensor; isr; timing; real-time |
|
Measurement Processing |
approved |
sensor; processing; filtering |
|
Blocking API Access |
approved |
sensor; api; synchronization |
|
Task Lifecycle Management |
approved |
sensor; lifecycle; freertos |
|
Health Monitoring |
approved |
sensor; monitoring; diagnostics |
|
Real-Time ISR Constraints |
approved |
sensor; performance; real-time; isr |
|
Memory Resource Limits |
approved |
sensor; memory; resource |
|
LED Controller Initialization |
approved |
startup; initialization; led |
|
Visual Boot Sequence |
approved |
startup; ux; validation |
|
Timing Performance |
approved |
startup; performance; timing |
|
Garage Parking Assistance System |
approved |
system; parking; garage |
|
Component-based Architecture |
approved |
architecture; modularity |
|
Non-volatile Configuration Storage |
approved |
storage; nvs; configuration |
|
ESP32 Hardware Platform |
approved |
hardware; platform |
|
WiFi Connectivity |
approved |
network; wifi |
|
Memory Management |
approved |
performance; memory |
|
Error Handling and Recovery |
approved |
reliability; error-handling |
|
HTTPS Support |
open |
security; https; future |
|
Emulator Support |
approved |
emulator; qemu; testing |
|
Emulator Network Connectivity |
approved |
emulator; qemu; network; development |
|
System Time and NTP Support |
open |
time; ntp; future |
|
Web-based Configuration |
approved |
web; configuration |
|
Real-time Status Display |
approved |
web; ui; monitoring |
|
Configuration Interface |
approved |
web; ui; configuration |
|
WiFi Setup Interface |
approved |
web; wifi; network |
|
Web Interface Navigation |
approved |
web; ui; navigation |
|
HTTP Server Concurrency |
approved |
web; performance |
|
Configuration REST API |
approved |
web; api; config |
|
LED State API Endpoint |
approved |
web; api; led; visualization |
|
Web UI Responsiveness |
approved |
web; performance; ux |
|
Mobile-First Design |
approved |
web; ui; mobile |
|
Schema-Driven Configuration Form |
approved |
web; ui; config |
|
ESP-IDF CMake Integration |
approved |
build; cmake |
|
Certificate Handler Component Design |
draft |
component; security |
|
GitHub Codespaces Integration |
approved |
development; devcontainer |
|
Component Communication Pattern |
approved |
dataflow; communication |
|
Configuration Manager Component Design |
approved |
component; config |
|
Configuration Data Flow |
approved |
dataflow; config |
|
Error Recovery and Reset Strategy |
approved |
error-handling; reliability; reset |
|
Flash Memory Configuration |
approved |
flash; memory |
|
HTTP Server Architecture Details |
approved |
network; http; web |
|
ESP32 Distance Sensor Layered Architecture |
approved |
architecture; layering |
|
Logging and Diagnostics Strategy |
approved |
logging; diagnostics; debugging |
|
Memory Management Strategy |
approved |
memory; performance |
|
Network Tunnel Component Design |
approved |
component; qemu; network |
|
System Performance Requirements |
approved |
performance; requirements |
|
QEMU Hardware Abstraction |
approved |
qemu; emulation |
|
QEMU Component Selection |
approved |
qemu; build |
|
FreeRTOS Task Organization |
approved |
threading; rtos |
|
Web Server Component Design |
approved |
component; web; network |
|
WiFi Manager Design Details |
approved |
network; wifi |
|
Type-Safe Configuration API |
approved |
api; interface; c-api |
|
JSON Schema-Driven Architecture |
draft |
architecture; config; json-schema |
|
Bulk JSON Configuration API |
approved |
api; json; bulk-operations |
|
Factory Reset via Bulk JSON Update |
approved |
build-process; code-generation; factory-reset |
|
Adding New Configuration Fields |
approved |
development; guide; extensibility |
|
Configuration Schema Structure |
approved |
data-structure; schema |
|
JSON Schema as Single Source of Truth |
approved |
architecture; schema; design-pattern |
|
NVS Storage Format |
approved |
storage; nvs |
|
Type Safety Without Code Generation |
approved |
type-safety; best-practices |
|
JSON Schema for UI Generation |
approved |
web; ui; javascript |
|
Configuration Webpage Architecture |
implemented |
frontend; javascript; ui |
|
Device Reset Countdown Interface |
implemented |
ui; countdown; reset |
|
Error Handling and User Feedback |
implemented |
error-handling; feedback |
|
Configuration Data Flow |
implemented |
data-flow; json; api |
|
Dynamic Form Generation from Schema |
implemented |
form-generation; schema; javascript |
|
Complete Page Initialization Flow |
implemented |
initialization; lifecycle |
|
JSON Array to Form Field Mapping |
implemented |
data-mapping; json; form |
|
UI State Management |
implemented |
ui-state; javascript |
|
Supported Development Environments — Options |
implemented |
developer; devcontainer; codespaces |
|
Supported Development Environments — Setup Steps |
implemented |
developer; devcontainer; codespaces |
|
Debugging Guide — Debugging Features |
implemented |
developer; documentation; debugging |
|
Debugging Guide — Quick Start in QEMU |
implemented |
developer; documentation; debugging |
|
Web Flasher Guide — Overview and Browser Requirements |
implemented |
developer; documentation; flasher |
|
Web Flasher Guide — Flash Procedure |
implemented |
developer; documentation; flasher |
|
Dev Modes Guide — What Changes Between Modes |
implemented |
developer; documentation; devmodes |
|
Dev Modes Guide — How to Switch |
implemented |
developer; documentation; devmodes |
|
QEMU Guide — Starting QEMU |
implemented |
developer; documentation; qemu |
|
QEMU Guide — Stopping QEMU |
implemented |
developer; documentation; qemu |
|
QEMU Guide — Accessing the Web Interface |
implemented |
developer; documentation; qemu |
|
Known Limitations File Structure and Process |
implemented |
developer; limitations; known-issues |
|
Hardware Components Listing |
implemented |
developer; documentation; hardware |
|
Hardware Pin Assignment Table |
implemented |
developer; documentation; hardware |
|
Overview Index — Navigation Section |
implemented |
developer; documentation; overview |
|
Overview Index — Project Description |
implemented |
developer; documentation; overview |
|
Overview Index — Audience Section |
implemented |
developer; documentation; overview |
|
Quick Start — Hardware Path |
implemented |
developer; documentation; quickstart; hardware |
|
Quick Start — QEMU Path |
implemented |
developer; documentation; quickstart; qemu |
|
README Introduction and Project Link |
implemented |
developer; documentation; readme |
|
README Metadata Section |
implemented |
developer; documentation; readme |
|
Distance-to-Visual Mapping Algorithm |
approved |
display; algorithm; mapping |
|
Embedded Arithmetic Architecture |
approved |
display; performance; arithmetic |
|
Public Display API |
approved |
display; api; interface |
|
Task-Based Architecture |
approved |
display; freertos; task |
|
Configuration Integration |
approved |
display; configuration |
|
WS2812 Hardware Integration |
approved |
display; hardware; integration |
|
Pixel-Level Control API |
approved |
led; api; control |
|
Batch Operations API |
approved |
led; api; batch |
|
LED State Read API |
approved |
led; api; monitoring; thread-safety |
|
RMT Peripheral Hardware Abstraction |
approved |
led; rmt; hardware |
|
RAM Buffer Architecture |
approved |
led; memory; buffer |
|
Color Representation and Conversion |
approved |
led; color; conversion |
|
Error Handling and Validation |
approved |
led; error-handling; validation |
|
Dynamic Memory Management |
approved |
led; memory; resource |
|
LED Controller Simulator |
approved |
led; simulator; qemu |
|
WS2812 Timing Specification |
approved |
led; timing; ws2812 |
|
UART Tunnel Component Architecture |
implemented |
netif; qemu; uart; architecture |
|
Host-Side Serial-TUN Bridge Script |
implemented |
netif; qemu; python; bridge; tooling |
|
Conditional Compilation — QEMU-Only Build Guard |
implemented |
netif; qemu; build; kconfig |
|
IP Configuration and DHCP Client Integration |
implemented |
netif; qemu; dhcp; ip |
|
Emulation Setup Documentation |
implemented |
netif; qemu; documentation |
|
Performance Characteristics and Known Limitations |
implemented |
netif; qemu; performance; limitations |
|
UART Wire Protocol — Length-Prefix Framing |
implemented |
netif; qemu; protocol; framing |
|
Distance Calculation Algorithm |
approved |
sensor; algorithm; calibration |
|
EMA Smoothing Filter Design |
approved |
sensor; algorithm; filtering |
|
Public API Design |
approved |
sensor; api; interface |
|
Dual-Queue Real-Time Architecture |
approved |
sensor; architecture; real-time |
|
GPIO Interface Design |
approved |
sensor; gpio; hardware |
|
Error Handling Design |
approved |
sensor; error-handling; robustness |
|
Interrupt Service Routine Design |
approved |
sensor; isr; real-time |
|
Distance Sensor Simulator Design |
approved |
sensor; simulator; qemu |
|
Sensor Task Design |
approved |
sensor; freertos; task |
|
LED Controller Dependency Design |
approved |
startup; initialization; dependency |
|
Sequential LED Pattern Algorithm |
approved |
startup; algorithm; visual |
|
Startup Integration and Cleanup |
approved |
startup; integration; cleanup |
|
Component Architecture |
approved |
startup; architecture; component |
|
Web Server Architecture |
approved |
web; architecture |
|
Captive Portal Design |
approved |
web; captive-portal; wifi |
|
HTTP Server Configuration |
approved |
web; config; performance |
|
Extension Guide for Web Pages |
approved |
web; extensibility; guide |
|
Config Manager Integration Pattern |
approved |
web; integration; config |
|
WiFi Manager Integration Pattern |
approved |
web; integration; wifi |
|
Mobile-First Responsive Design |
approved |
web; ui; mobile; responsive |
|
Configuration API Endpoints |
approved |
web; api; config; schema |
|
System Health API Endpoint |
approved |
web; api; diagnostics |
|
LED State API Endpoint |
approved |
web; api; led; visualization |
|
WiFi Management REST API Endpoints |
approved |
web; api; wifi |
|
URI Routing Table |
approved |
web; routing |
|
CORS Configuration |
approved |
web; security; cors |
|
Static File Embedding Strategy |
approved |
web; build; embedding |
|
Web Server Testing Strategy |
approved |
web; testing |
|
Modular Firmware Extensibility |
implemented |
developer; firmware; extensibility |
|
Traceable Supporting Documentation |
implemented |
developer; documentation; traceability |
|
Visual Distance Feedback for Parking |
approved |
display; sensor; garage-user |
|
Appliance Reliability - Just Works on Power |
approved |
reliability; startup; garage-user |
|
Device Setup via Web Interface |
approved |
setup; wifi; web; maker |

REQ_CFG_JSON_1¶