FabGL2 2.0.0
ESP32 Display Controller and Graphics Library for ESP-IDF
Loading...
Searching...
No Matches
Preferences Class Reference

Simple key/value storage in non-volatile flash (NVS). More...

#include <preferences.h>

Public Member Functions

bool begin (char const *name, bool readOnly=false)
 Opens the specified namespace.
bool clear ()
 Removes all keys of the namespace.
void end ()
 Commits changes and closes the namespace.
size_t getString (char const *key, char *value, size_t maxLen)
 Gets a string.
bool isKey (char const *key)
 Determines whether the specified key exists.
bool remove (char const *key)
 Removes the specified key.

Detailed Description

Simple key/value storage in non-volatile flash (NVS).

A thin wrapper over the ESP-IDF NVS API. Each Preferences object works on one NVS namespace. nvs_flash_init() is called automatically when needed.

Example:

fabgl::Preferences preferences;
preferences.begin("MyApp");
int value = preferences.getInt("counter", 0);
preferences.putInt("counter", value + 1);

Definition at line 61 of file preferences.h.


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