oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
Loading...
Searching...
No Matches
Classes | Typedefs | Functions
ove::httpd Namespace Reference

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.
 

Detailed Description

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().

Function Documentation

◆ start()

Result< void > ove::httpd::start ( const Config cfg = {})
inlinenoexcept

Starts the HTTP server.

Spawns a background task that accepts connections on the configured port. Routes may be registered before or after starting.

Parameters
[in]cfgServer configuration (defaults: port 80, 1024-byte body).
Returns
Empty Result<void> on success; unexpected Error on failure.

◆ route()

Result< void > ove::httpd::route ( const char *  method,
const char *  path,
Handler  handler 
)
inlinenoexcept

Registers a route handler.

Parameters
[in]methodHTTP method string ("GET" or "POST").
[in]pathURL path prefix (e.g. "/api/leds").
[in]handlerCallback function invoked when the route matches.
Returns
Empty Result<void> on success; unexpected Error::NoMemory if the route table is full.

◆ register_builtin_routes()

void ove::httpd::register_builtin_routes ( )
inline

Registers the built-in dashboard routes (/api/info, /api/leds, etc.).

Call after start() to add the standard device management API.

◆ set_netif()

void ove::httpd::set_netif ( ove_netif_t  netif)
inline

Associate a network interface with the dashboard routes.

When set, /api/info and /api/network report the real interface addresses instead of placeholders.