|
oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
|
Top-level namespace for all oveRTOS C++ abstractions. More...
Namespaces | |
| namespace | audio |
| Audio graph engine — typed node factories, device configuration helpers, and graph lifecycle (init/build/start/stop/process). | |
| namespace | board |
| Thin C++ wrappers around the oveRTOS board description API. | |
| namespace | bsp |
Backward-compatibility wrappers delegating to board, gpio, and led. | |
| namespace | console |
| Thin C++ wrappers around the oveRTOS console (serial I/O) API. | |
| namespace | dns |
| DNS resolution helpers. | |
| namespace | fs |
| Thin C++ wrappers around the oveRTOS filesystem utility functions. | |
| namespace | gpio |
| Thin C++ wrappers around the oveRTOS GPIO API. | |
| namespace | http |
| C++ wrappers around the oveRTOS HTTP client API. | |
| namespace | httpd |
| C++ wrappers around the oveRTOS embedded HTTP server API. | |
| namespace | led |
| Thin C++ wrappers around the oveRTOS LED control API. | |
| namespace | lvgl |
| C++ abstractions for the LVGL embedded GUI library. | |
| namespace | mqtt |
| C++ wrappers around the oveRTOS MQTT client API. | |
| namespace | nvs |
| Thin C++ wrappers around the oveRTOS non-volatile storage API. | |
| namespace | pm |
| Thin C++ wrappers around the oveRTOS power management API. | |
| namespace | shell |
| Thin C++ wrappers around the oveRTOS interactive shell API. | |
| namespace | sntp |
| C++ wrappers around the oveRTOS SNTP client API. | |
| namespace | this_thread |
| Free functions that operate on the currently running thread. | |
| namespace | time |
| Thin C++ wrappers around the oveRTOS time and delay API. | |
| namespace | tls |
TLS session wrapper over mbedTLS. Provides handshake, send, recv, and close on top of a connected ove_socket_t. | |
| namespace | ws |
| C++ wrappers around the oveRTOS WebSocket API. | |
Classes | |
| class | Address |
Lightweight wrapper around ove_sockaddr_t. More... | |
| class | CondVar |
| RAII wrapper around an oveRTOS condition variable. More... | |
| class | Dir |
| RAII wrapper around an oveRTOS directory handle. More... | |
| class | Event |
| RAII wrapper around an oveRTOS binary event flag. More... | |
| class | EventGroup |
| RAII wrapper around an oveRTOS event-group (bit-field synchronisation object). More... | |
| class | File |
| RAII wrapper around an oveRTOS file handle. More... | |
| class | I2c |
| RAII wrapper around an oveRTOS I2C bus controller. More... | |
| class | LockGuard |
Scoped RAII guard that locks a Mutex on construction and unlocks it on destruction. More... | |
| struct | MemStats |
| System heap statistics snapshot. More... | |
| class | Model |
| RAII wrapper for an ML inference model session. More... | |
| class | Mutex |
| RAII wrapper around an oveRTOS non-recursive mutex. More... | |
| class | NetIf |
| RAII wrapper around an oveRTOS network interface. More... | |
| class | NetIfConfig |
Builder for ove_netif_config_t. More... | |
| class | Queue |
| RAII wrapper around an oveRTOS typed message queue. More... | |
| class | RecursiveMutex |
| RAII wrapper around an oveRTOS recursive mutex. More... | |
| class | Semaphore |
| RAII wrapper around an oveRTOS counting semaphore. More... | |
| class | Spi |
| RAII wrapper around an oveRTOS SPI bus controller. More... | |
| class | StaticCell |
Thread-safe, lazily initialised storage cell for a single object of type T. More... | |
| struct | steady_clock |
| Steady-clock wrapping the substrate's monotonic time source. More... | |
| class | stop_source |
Writable counterpart to stop_token. std::stop_source analog. More... | |
| class | stop_token |
| Lightweight read-only handle to a thread's cooperative cancellation flag. More... | |
| class | Stream |
| RAII wrapper around an oveRTOS byte-stream (ring-buffer) object. More... | |
| class | TcpListener |
| RAII wrapper around an oveRTOS TCP listening socket. More... | |
| class | TcpSocket |
| RAII wrapper around an oveRTOS TCP (stream) socket. More... | |
| class | Thread |
| RAII wrapper around an oveRTOS thread (task). More... | |
| class | thread_id |
Opaque identity for an oveRTOS thread. std::thread::id analog. More... | |
| class | Timer |
| RAII wrapper around an oveRTOS software timer. More... | |
| class | Uart |
| RAII wrapper around an oveRTOS UART peripheral. More... | |
| class | UdpSocket |
| RAII wrapper around an oveRTOS UDP (datagram) socket. More... | |
| class | Watchdog |
| RAII wrapper around an oveRTOS hardware watchdog timer. More... | |
| class | Work |
| RAII wrapper representing a single deferred work item. More... | |
| class | Workqueue |
| RAII wrapper around an oveRTOS workqueue (dedicated worker thread). More... | |
Concepts | |
| concept | CooperativeThreadEntry |
Stateless callable invocable as void(stop_token). | |
| concept | CapturingCooperativeEntry |
Capturing callable invocable as void(stop_token). | |
| concept | TimerCallback |
Concept satisfied by any callable convertible to ove_timer_fn. | |
| concept | ThreadEntry |
Concept satisfied by any callable convertible to void(*)(void*). | |
| concept | WorkHandler |
Concept satisfied by any callable convertible to ove_work_fn. | |
Typedefs | |
| template<class T = void> | |
| using | Result = std::expected< T, Error > |
std::expected-based result alias. | |
| using | ThreadInfo = ove_thread_info |
| Snapshot of a single thread. | |
Enumerations | |
| enum class | Error : int { Ok = OVE_OK , NotRegistered = OVE_ERR_NOT_REGISTERED , InvalidParam = OVE_ERR_INVALID_PARAM , NoMemory = OVE_ERR_NO_MEMORY , Timeout = OVE_ERR_TIMEOUT , NotSupported = OVE_ERR_NOT_SUPPORTED , QueueFull = OVE_ERR_QUEUE_FULL , MlFailed = OVE_ERR_ML_FAILED , NetRefused = OVE_ERR_NET_REFUSED , NetUnreachable = OVE_ERR_NET_UNREACHABLE , NetAddrInUse = OVE_ERR_NET_ADDR_IN_USE , NetReset = OVE_ERR_NET_RESET , NetDnsFail = OVE_ERR_NET_DNS_FAIL , NetClosed = OVE_ERR_NET_CLOSED , BusNack = OVE_ERR_BUS_NACK , BusBusy = OVE_ERR_BUS_BUSY , BusError = OVE_ERR_BUS_ERROR , QueueEmpty = OVE_ERR_QUEUE_EMPTY , WouldBlock = OVE_ERR_WOULD_BLOCK , Eof = OVE_ERR_EOF , Inval = OVE_ERR_INVAL , NotFound = OVE_ERR_NOT_FOUND } |
Strong-typed mirror of substrate OVE_ERR_* codes. More... | |
Functions | |
| void | run () |
| Starts the oveRTOS scheduler and enters the main event loop. | |
| const std::error_category & | error_category () noexcept |
Returns the singleton std::error_category for Error. | |
| std::error_code | make_error_code (Error e) noexcept |
ADL-discoverable factory for std::error_code from Error. | |
| Result< void > | from_rc (int rc) noexcept |
Lifts a substrate rc-code into a Result<void>. | |
| template<class T > | |
| Result< std::decay_t< T > > | from_rc (int rc, T &&value) |
Lifts a substrate rc + success-side value into a Result<T>. | |
| Result< MemStats > | get_mem_stats () noexcept |
| Query system heap statistics. | |
| Result< size_t > | thread_list (ThreadInfo *out, size_t max) noexcept |
| List all threads in the system. | |
| template<typename Rep , typename Period > | |
| constexpr uint64_t | to_timeout_ns (std::chrono::duration< Rep, Period > d) noexcept |
Convert a chrono duration to uint64_t nanoseconds for the C API. | |
| constexpr uint64_t | to_deadline_ns (steady_clock::time_point tp) noexcept |
Convert an ove::steady_clock::time_point to uint64_t nanoseconds for the substrate's _until APIs. | |
Variables | |
| constexpr std::chrono::nanoseconds | wait_forever = std::chrono::nanoseconds::max() |
| Sentinel duration meaning "block indefinitely". | |
Top-level namespace for all oveRTOS C++ abstractions.
The ove namespace provides C++20 RAII wrappers around the oveRTOS C API. All sync primitives, threads, queues, timers, and peripheral helpers live here. Nested namespaces (ove::console, ove::time, ove::gpio, etc.) group thin inline wrappers around optional subsystem APIs that are enabled by their corresponding CONFIG_OVE_* Kconfig options.
CONFIG_OVE_ZERO_HEAP is set, in which case the underlying kernel object lives in a member storage buffer and the address of that buffer must remain stable for the lifetime of the wrapper. | using ove::Result = typedef std::expected<T, Error> |
std::expected-based result alias.
Carries either a value of type T or an Error. Default template argument T = void covers fallible operations that have no success-side payload (Result<void> is the analogue of an int rc with OVE_OK success semantics).
Composes with the full std::expected monadic surface: .and_then, .or_else, .transform, .value_or.
| using ove::ThreadInfo = typedef ove_thread_info |
Snapshot of a single thread.
Alias of the C ove_thread_info struct. Exposes the full set of fields the substrate provides (name, state, priority, stack_used, stack_size, cpu_percent_x100, state_times), unchanged from the C layer. Default-initialise with ThreadInfo info{}; for zero-init.
Previous versions of the binding defined a C++-only subset struct here and did a per-field copy in thread_list. That added a silent 16-entry truncation cap (the binding's temp buffer was fixed-size). Aliasing the C struct lets thread_list pass the caller's array straight to the substrate — no temp buffer, no copy, no binding-side cap.
|
strong |
Strong-typed mirror of substrate OVE_ERR_* codes.
Underlying type is int so static_cast<int>(Error::Timeout) gives back the original substrate rc-value bit-for-bit. Every variant is pinned to its substrate constant via static_assert immediately below this enum — a drift in either layer triggers a compile error.
Error::Ok is included so the enum can round-trip a "no error" value through std::error_code (where value() == 0 denotes success). Constructing a Result<T> with Error::Ok as the error state is a misuse — prefer from_rc which maps OVE_OK to the expected-value side of the std::expected.
|
inline |
Starts the oveRTOS scheduler and enters the main event loop.
This function does not return under normal circumstances. Call it at the end of the C ove_main() entry point (or from OVE_MAIN()).
|
inlinenoexcept |
Returns the singleton std::error_category for Error.
Thread-safe under C++11+ guaranteed initialisation of function-local statics. The returned reference has static storage duration.
|
inlinenoexcept |
ADL-discoverable factory for std::error_code from Error.
Together with the std::is_error_code_enum specialisation at the bottom of this header, this enables implicit conversion:
|
inlinenoexcept |
Lifts a substrate rc-code into a Result<void>.
Maps OVE_OK → expected value, anything else → Error of the corresponding variant. This is the canonical bridge between the C substrate's int rc convention and the C++ Result<> convention.
| rc | Return code from a substrate call (e.g. ove_mutex_lock). |
Result<void> on success, unexpected(Error) on failure.
|
inline |
Lifts a substrate rc + success-side value into a Result<T>.
from_rc(rc, value) returns:
Result<T>{std::forward<T>(value)} if rc is OVE_OK std::unexpected{static_cast<Error>(rc)} otherwiseUseful for substrate calls that return both an rc and an out-value — wrap the rc + value in a single expression on the way out.
| T | Deduced from value; the success-side payload type after std::decay (so a string literal lands as Result<const char*>, not Result<char[N]>). |
| rc | Return code from the substrate call. |
| value | The success-side value, forwarded into the Result. |
|
inlinenoexcept |
List all threads in the system.
Fills out with up to max ThreadInfo entries.
OVE_THREAD_LIST_MAX (16 in the current implementation; tracked in c-substrate-findings.md P2-2 for promotion to a public constant). If max exceeds the substrate's cap, the cap wins and the returned count reflects the substrate limit, not max.| [out] | out | Array to fill with thread info. |
| [in] | max | Maximum entries the out buffer can hold. |
out. On failure, an unexpected Error.
|
inlineconstexprnoexcept |
Convert a chrono duration to uint64_t nanoseconds for the C API.
Used internally by every wrapper that calls a substrate function taking uint64_t timeout_ns. Saturates to 0 on negative durations and maps wait_forever (== nanoseconds::max()) to OVE_WAIT_FOREVER.
|
inlineconstexprnoexcept |
Convert an ove::steady_clock::time_point to uint64_t nanoseconds for the substrate's _until APIs.
Preserves the time_point whose duration equals std::chrono::nanoseconds::max() as the OVE_WAIT_FOREVER sentinel so passing steady_clock::time_point::max() blocks indefinitely.
|
inlineconstexpr |
Sentinel duration meaning "block indefinitely".
Represented as std::chrono::nanoseconds::max() (≈ 292 years; signed int64_t representation). to_timeout_ns recognises this exact value and emits the C-side OVE_WAIT_FOREVER (= UINT64_MAX) sentinel.
Primitives split forever-blocking from bounded-wait into separate methods — the forever form takes no timeout argument; the bounded form takes a std::chrono::duration. Pass wait_forever to the C-style helpers that still accept a single nanoseconds timeout (network sockets, I2C/SPI/UART transfers, …).