Rishka
RISC-V virtual runtime in C/C++ made for ESP32-WROVER
NVS Class Referencefinal

Provides an interface to the non-volatile storage (NVS) in the Rishka system. More...

#include <nvs.h>

Static Public Member Functions

static bool commit ()
 Commits the changes to the NVS. More...
 
static bool erase_all (bool force=true)
 Erases all key-value pairs in the NVS. More...
 
static bool erase (string key, bool force=true)
 Erases a specific key-value pair from the NVS. More...
 
static bool set_i8 (string key, i8 value, bool force=true)
 Sets an 8-bit signed integer value in the NVS. More...
 
static bool set_i16 (string key, i16 value, bool force=true)
 Sets a 16-bit signed integer value in the NVS. More...
 
static bool set_i32 (string key, i32 value, bool force=true)
 Sets a 32-bit signed integer value in the NVS. More...
 
static bool set_i64 (string key, i64 value, bool force=true)
 Sets a 64-bit signed integer value in the NVS. More...
 
static bool set_u8 (string key, u8 value, bool force=true)
 Sets an 8-bit unsigned integer value in the NVS. More...
 
static bool set_u16 (string key, u16 value, bool force=true)
 Sets a 16-bit unsigned integer value in the NVS. More...
 
static bool set_u32 (string key, u32 value, bool force=true)
 Sets a 32-bit unsigned integer value in the NVS. More...
 
static bool set_u64 (string key, u64 value, bool force=true)
 Sets a 64-bit unsigned integer value in the NVS. More...
 
static i8 get_i8 (string key, i8 defvalue)
 Retrieves an 8-bit signed integer value from the NVS. More...
 
static i16 get_i16 (string key, i16 defvalue)
 Retrieves a 16-bit signed integer value from the NVS. More...
 
static i32 get_i32 (string key, i32 defvalue)
 Retrieves a 32-bit signed integer value from the NVS. More...
 
static i64 get_i64 (string key, i64 defvalue)
 Retrieves a 64-bit signed integer value from the NVS. More...
 
static u8 get_u8 (string key, u8 defvalue)
 Retrieves an 8-bit unsigned integer value from the NVS. More...
 
static u16 get_u16 (string key, u16 defvalue)
 Retrieves a 16-bit unsigned integer value from the NVS. More...
 
static u32 get_u32 (string key, u32 defvalue)
 Retrieves a 32-bit unsigned integer value from the NVS. More...
 
static u64 get_u64 (string key, u64 defvalue)
 Retrieves a 64-bit unsigned integer value from the NVS. More...
 
static bool set_string (string key, string value, bool force=true)
 Sets a string value in the NVS. More...
 
static string get_string (string key)
 Retrieves a string value from the NVS. More...
 
static bool has_wifi_config ()
 Checks if a Wi-Fi configuration is available in the NVS. More...
 
static bool set_wifi_ssid (string ssid)
 Sets the Wi-Fi SSID in the NVS. More...
 
static bool set_wifi_pword (string pword)
 Sets the Wi-Fi password in the NVS. More...
 

Detailed Description

Provides an interface to the non-volatile storage (NVS) in the Rishka system.

The NVS class offers a variety of static methods to handle persistent storage of key-value pairs. It supports storing and retrieving different types of data, including integers, unsigned integers, and strings. Additionally, it provides methods to manage Wi-Fi configuration data.

Member Function Documentation

◆ commit()

bool NVS::commit ( )
static

Commits the changes to the NVS.

Returns
true if the commit was successful, false otherwise.

◆ erase()

bool NVS::erase ( string  key,
bool  force = true 
)
static

Erases a specific key-value pair from the NVS.

Parameters
keyThe key to be erased.
forceIf true, forces the erase operation.
Returns
true if the erase was successful, false otherwise.

◆ erase_all()

bool NVS::erase_all ( bool  force = true)
static

Erases all key-value pairs in the NVS.

Parameters
forceIf true, forces the erase operation.
Returns
true if the erase was successful, false otherwise.

◆ get_i16()

i16 NVS::get_i16 ( string  key,
i16  defvalue 
)
static

Retrieves a 16-bit signed integer value from the NVS.

Parameters
keyThe key associated with the value.
defvalueThe default value if the key is not found.
Returns
The value associated with the key, or defvalue if the key is not found.

◆ get_i32()

i32 NVS::get_i32 ( string  key,
i32  defvalue 
)
static

Retrieves a 32-bit signed integer value from the NVS.

Parameters
keyThe key associated with the value.
defvalueThe default value if the key is not found.
Returns
The value associated with the key, or defvalue if the key is not found.

◆ get_i64()

i64 NVS::get_i64 ( string  key,
i64  defvalue 
)
static

Retrieves a 64-bit signed integer value from the NVS.

Parameters
keyThe key associated with the value.
defvalueThe default value if the key is not found.
Returns
The value associated with the key, or defvalue if the key is not found.

◆ get_i8()

i8 NVS::get_i8 ( string  key,
i8  defvalue 
)
static

Retrieves an 8-bit signed integer value from the NVS.

Parameters
keyThe key associated with the value.
defvalueThe default value if the key is not found.
Returns
The value associated with the key, or defvalue if the key is not found.

◆ get_string()

string NVS::get_string ( string  key)
static

Retrieves a string value from the NVS.

Parameters
keyThe key associated with the value.
Returns
The string value associated with the key.

◆ get_u16()

u16 NVS::get_u16 ( string  key,
u16  defvalue 
)
static

Retrieves a 16-bit unsigned integer value from the NVS.

Parameters
keyThe key associated with the value.
defvalueThe default value if the key is not found.
Returns
The value associated with the key, or defvalue if the key is not found.

◆ get_u32()

u32 NVS::get_u32 ( string  key,
u32  defvalue 
)
static

Retrieves a 32-bit unsigned integer value from the NVS.

Parameters
keyThe key associated with the value.
defvalueThe default value if the key is not found.
Returns
The value associated with the key, or defvalue if the key is not found.

◆ get_u64()

u64 NVS::get_u64 ( string  key,
u64  defvalue 
)
static

Retrieves a 64-bit unsigned integer value from the NVS.

Parameters
keyThe key associated with the value.
defvalueThe default value if the key is not found.
Returns
The value associated with the key, or defvalue if the key is not found.

◆ get_u8()

u8 NVS::get_u8 ( string  key,
u8  defvalue 
)
static

Retrieves an 8-bit unsigned integer value from the NVS.

Parameters
keyThe key associated with the value.
defvalueThe default value if the key is not found.
Returns
The value associated with the key, or defvalue if the key is not found.

◆ has_wifi_config()

bool NVS::has_wifi_config ( )
static

Checks if a Wi-Fi configuration is available in the NVS.

Returns
true if Wi-Fi configuration is available, false otherwise.

◆ set_i16()

bool NVS::set_i16 ( string  key,
i16  value,
bool  force = true 
)
static

Sets a 16-bit signed integer value in the NVS.

Parameters
keyThe key associated with the value.
valueThe value to be stored.
forceIf true, forces the set operation.
Returns
true if the set operation was successful, false otherwise.

◆ set_i32()

bool NVS::set_i32 ( string  key,
i32  value,
bool  force = true 
)
static

Sets a 32-bit signed integer value in the NVS.

Parameters
keyThe key associated with the value.
valueThe value to be stored.
forceIf true, forces the set operation.
Returns
true if the set operation was successful, false otherwise.

◆ set_i64()

bool NVS::set_i64 ( string  key,
i64  value,
bool  force = true 
)
static

Sets a 64-bit signed integer value in the NVS.

Parameters
keyThe key associated with the value.
valueThe value to be stored.
forceIf true, forces the set operation.
Returns
true if the set operation was successful, false otherwise.

◆ set_i8()

bool NVS::set_i8 ( string  key,
i8  value,
bool  force = true 
)
static

Sets an 8-bit signed integer value in the NVS.

Parameters
keyThe key associated with the value.
valueThe value to be stored.
forceIf true, forces the set operation.
Returns
true if the set operation was successful, false otherwise.

◆ set_string()

bool NVS::set_string ( string  key,
string  value,
bool  force = true 
)
static

Sets a string value in the NVS.

Parameters
keyThe key associated with the value.
valueThe string to be stored.
forceIf true, forces the set operation.
Returns
true if the set operation was successful, false otherwise.

◆ set_u16()

bool NVS::set_u16 ( string  key,
u16  value,
bool  force = true 
)
static

Sets a 16-bit unsigned integer value in the NVS.

Parameters
keyThe key associated with the value.
valueThe value to be stored.
forceIf true, forces the set operation.
Returns
true if the set operation was successful, false otherwise.

◆ set_u32()

bool NVS::set_u32 ( string  key,
u32  value,
bool  force = true 
)
static

Sets a 32-bit unsigned integer value in the NVS.

Parameters
keyThe key associated with the value.
valueThe value to be stored.
forceIf true, forces the set operation.
Returns
true if the set operation was successful, false otherwise.

◆ set_u64()

bool NVS::set_u64 ( string  key,
u64  value,
bool  force = true 
)
static

Sets a 64-bit unsigned integer value in the NVS.

Parameters
keyThe key associated with the value.
valueThe value to be stored.
forceIf true, forces the set operation.
Returns
true if the set operation was successful, false otherwise.

◆ set_u8()

bool NVS::set_u8 ( string  key,
u8  value,
bool  force = true 
)
static

Sets an 8-bit unsigned integer value in the NVS.

Parameters
keyThe key associated with the value.
valueThe value to be stored.
forceIf true, forces the set operation.
Returns
true if the set operation was successful, false otherwise.

◆ set_wifi_pword()

bool NVS::set_wifi_pword ( string  pword)
static

Sets the Wi-Fi password in the NVS.

Parameters
pwordThe password to be stored.
Returns
true if the set operation was successful, false otherwise.

◆ set_wifi_ssid()

bool NVS::set_wifi_ssid ( string  ssid)
static

Sets the Wi-Fi SSID in the NVS.

Parameters
ssidThe SSID to be stored.
Returns
true if the set operation was successful, false otherwise.

The documentation for this class was generated from the following files: