oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
Loading...
Searching...
No Matches
Classes | Namespaces | Typedefs | Functions
net_httpd.hpp File Reference

C++ wrappers for the oveRTOS embedded HTTP server API. More...

#include <ove/net_httpd.h>
#include <ove/types.hpp>
#include <ove/error.hpp>
#include <string_view>
Include dependency graph for net_httpd.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  ove::httpd::Request
 Read-only view of an incoming HTTP request. More...
 
class  ove::httpd::Response
 Helper for building and sending an HTTP response. More...
 
struct  ove::httpd::Config
 HTTP server configuration. More...
 
class  ove::ws::Connection
 Non-owning handle to an active WebSocket connection. More...
 

Namespaces

namespace  ove
 Top-level namespace for all oveRTOS C++ abstractions.
 
namespace  ove::httpd
 C++ wrappers around the oveRTOS embedded HTTP server API.
 
namespace  ove::ws
 C++ wrappers around the oveRTOS WebSocket API.
 

Typedefs

using ove::httpd::Handler = ove_httpd_handler_t
 Route handler callback type (same as the C typedef).
 
using ove::ws::Handler = ove_httpd_ws_handler_t
 WebSocket message handler type.
 
using ove::ws::CloseHandler = ove_httpd_ws_close_handler_t
 WebSocket close handler type.
 

Functions

Result< void > ove::httpd::start (const Config &cfg={}) noexcept
 Starts the HTTP server.
 
void ove::httpd::stop ()
 Stops the HTTP server and closes the listening socket.
 
Result< void > ove::httpd::route (const char *method, const char *path, Handler handler) noexcept
 Registers a route handler.
 
void ove::httpd::register_builtin_routes ()
 Registers the built-in dashboard routes (/api/info, /api/leds, etc.).
 
void ove::httpd::set_netif (ove_netif_t netif)
 Associate a network interface with the dashboard routes.
 
void ove::httpd::set_audio_graph (struct ove_audio_graph *g)
 Set the audio graph for /api/audio/stats.
 
void ove::httpd::set_model (ove_model_t model)
 Set the ML model for /api/infer/stats.
 
Result< void > ove::ws::route (const char *path, Handler on_message, CloseHandler on_close=nullptr) noexcept
 Register a WebSocket route.
 
int ove::ws::broadcast (const char *path, const void *data, size_t len)
 Broadcast a message to all WebSocket connections on a path.
 
int ove::ws::broadcast (const char *path, std::string_view sv)
 Broadcast a string_view to all connections on a path.
 
int ove::ws::active_count ()
 Return the number of active WebSocket connections.
 

Detailed Description

C++ wrappers for the oveRTOS embedded HTTP server API.