|
oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
|
C++ wrappers around the oveRTOS embedded HTTP server API. More...
Classes | |
| struct | Config |
| HTTP server configuration. More... | |
| class | Request |
| Read-only view of an incoming HTTP request. More... | |
| class | Response |
| Helper for building and sending an HTTP response. More... | |
Typedefs | |
| using | Handler = ove_httpd_handler_t |
| Route handler callback type (same as the C typedef). | |
Functions | |
| Result< void > | start (const Config &cfg={}) noexcept |
| Starts the HTTP server. | |
| void | stop () |
| Stops the HTTP server and closes the listening socket. | |
| Result< void > | route (const char *method, const char *path, Handler handler) noexcept |
| Registers a route handler. | |
| void | register_builtin_routes () |
| Registers the built-in dashboard routes (/api/info, /api/leds, etc.). | |
| void | set_netif (ove_netif_t netif) |
| Associate a network interface with the dashboard routes. | |
| void | set_audio_graph (struct ove_audio_graph *g) |
| Set the audio graph for /api/audio/stats. | |
| void | set_model (ove_model_t model) |
| Set the ML model for /api/infer/stats. | |
C++ wrappers around the oveRTOS embedded HTTP server API.
Available when CONFIG_OVE_NET_HTTPD is enabled. Provides thin RAII wrappers around the request and response objects passed to route handlers, plus free functions for server lifecycle and route registration.
The server itself is a singleton managed by start() / stop().
Starts the HTTP server.
Spawns a background task that accepts connections on the configured port. Routes may be registered before or after starting.
| [in] | cfg | Server configuration (defaults: port 80, 1024-byte body). |
Result<void> on success; unexpected Error on failure.
|
inlinenoexcept |
Registers a route handler.
| [in] | method | HTTP method string ("GET" or "POST"). |
| [in] | path | URL path prefix (e.g. "/api/leds"). |
| [in] | handler | Callback function invoked when the route matches. |
Result<void> on success; unexpected Error::NoMemory if the route table is full.
|
inline |
Registers the built-in dashboard routes (/api/info, /api/leds, etc.).
Call after start() to add the standard device management API.
|
inline |
Associate a network interface with the dashboard routes.
When set, /api/info and /api/network report the real interface addresses instead of placeholders.