oveRTOS C++ API
C++20 RAII wrappers for the oveRTOS C API
Loading...
Searching...
No Matches
Functions
ove::nvs Namespace Reference

Thin C++ wrappers around the oveRTOS non-volatile storage API. More...

Functions

Result< void > init () noexcept
 Initialises the NVS subsystem.
 
void deinit ()
 Deinitialises the NVS subsystem and frees associated resources.
 
Result< size_t > read (const char *key, void *buf, size_t len) noexcept
 Reads the value associated with a key from NVS.
 
Result< void > write (const char *key, const void *data, size_t len) noexcept
 Writes a value associated with a key to NVS.
 
Result< void > erase (const char *key) noexcept
 Erases the value associated with a key from NVS.
 

Detailed Description

Thin C++ wrappers around the oveRTOS non-volatile storage API.

Available when CONFIG_OVE_NVS is enabled. Keys are null-terminated strings; values are arbitrary byte buffers.

Function Documentation

◆ init()

Result< void > ove::nvs::init ( )
inlinenoexcept

Initialises the NVS subsystem.

Returns
Empty Result<void> on success; unexpected Error on failure.

◆ read()

Result< size_t > ove::nvs::read ( const char *  key,
void *  buf,
size_t  len 
)
inlinenoexcept

Reads the value associated with a key from NVS.

Parameters
[in]keyThe null-terminated key string.
[out]bufBuffer to receive the stored value.
[in]lenSize of buf in bytes.
Returns
On success, the number of bytes actually read. On failure, an unexpected Error (Error::NotFound, …).

◆ write()

Result< void > ove::nvs::write ( const char *  key,
const void *  data,
size_t  len 
)
inlinenoexcept

Writes a value associated with a key to NVS.

Parameters
[in]keyThe null-terminated key string.
[in]dataPointer to the data to store.
[in]lenNumber of bytes to write.
Returns
Empty Result<void> on success; unexpected Error on failure.

◆ erase()

Result< void > ove::nvs::erase ( const char *  key)
inlinenoexcept

Erases the value associated with a key from NVS.

Parameters
[in]keyThe null-terminated key string.
Returns
Empty Result<void> on success; unexpected Error on failure (Error::NotFound if no such key).