|
HF Interface Wrapper 0.1.0-dev
Embedded C++ hardware abstraction layer
|
Abstract base class for non-volatile storage operations. More...
#include <BaseNvs.h>
Public Member Functions | |
| virtual | ~BaseNvs () noexcept=default |
| Virtual destructor to ensure proper cleanup. | |
| BaseNvs (const BaseNvs &)=delete | |
| BaseNvs & | operator= (const BaseNvs &)=delete |
| bool | EnsureInitialized () |
| Ensures that the NVS storage is initialized (lazy initialization). | |
| bool | EnsureDeinitialized () |
| Ensures that the NVS storage is deinitialized. | |
| bool | IsInitialized () const noexcept |
| Check if storage is initialized. | |
| virtual hf_nvs_err_t | Initialize () noexcept=0 |
| Initialize the storage system and open the namespace. | |
| virtual hf_nvs_err_t | Deinitialize () noexcept=0 |
| Deinitialize the storage system and close the namespace. | |
| virtual hf_nvs_err_t | SetU32 (const char *key, hf_u32_t value) noexcept=0 |
| Store a 32-bit unsigned integer value. | |
| virtual hf_nvs_err_t | GetU32 (const char *key, hf_u32_t &value) noexcept=0 |
| Retrieve a 32-bit unsigned integer value. | |
| virtual hf_nvs_err_t | SetString (const char *key, const char *value) noexcept=0 |
| Store a string value. | |
| virtual hf_nvs_err_t | GetString (const char *key, char *buffer, size_t buffer_size, size_t *actual_size=nullptr) noexcept=0 |
| Retrieve a string value. | |
| virtual hf_nvs_err_t | SetBlob (const char *key, const void *data, size_t data_size) noexcept=0 |
| Store binary data (blob). | |
| virtual hf_nvs_err_t | GetBlob (const char *key, void *buffer, size_t buffer_size, size_t *actual_size=nullptr) noexcept=0 |
| Retrieve binary data (blob). | |
| virtual hf_nvs_err_t | EraseKey (const char *key) noexcept=0 |
| Remove a key from storage. | |
| virtual hf_nvs_err_t | Commit () noexcept=0 |
| Commit any pending writes to non-volatile storage. | |
| virtual bool | KeyExists (const char *key) noexcept=0 |
| Check if a key exists in storage. | |
| virtual hf_nvs_err_t | GetSize (const char *key, size_t &size) noexcept=0 |
| Get the size of a stored value. | |
| const char * | GetNamespace () const noexcept |
| Get the namespace name. | |
| virtual const char * | GetDescription () const noexcept=0 |
| Get description of this storage implementation. | |
| virtual size_t | GetMaxKeyLength () const noexcept=0 |
| Get maximum key length supported. | |
| virtual size_t | GetMaxValueSize () const noexcept=0 |
| Get maximum value size supported. | |
| virtual hf_nvs_err_t | ResetStatistics () noexcept |
| Reset NVS operation statistics. | |
| virtual hf_nvs_err_t | ResetDiagnostics () noexcept |
| Reset NVS diagnostic information. | |
| virtual hf_nvs_err_t | GetStatistics (hf_nvs_statistics_t &statistics) const noexcept |
| Get NVS operation statistics. | |
| virtual hf_nvs_err_t | GetDiagnostics (hf_nvs_diagnostics_t &diagnostics) const noexcept |
| Get NVS diagnostic information. | |
Protected Member Functions | |
| BaseNvs (const char *namespace_name) noexcept | |
| Protected constructor with namespace specification. | |
| void | SetInitialized (bool initialized) noexcept |
| Set the initialized state. | |
Protected Attributes | |
| const char * | namespace_name_ |
| Namespace name. | |
| bool | initialized_ |
| Initialization status. | |
| hf_nvs_statistics_t | statistics_ |
| NVS operation statistics. | |
| hf_nvs_diagnostics_t | diagnostics_ |
| NVS diagnostic information. | |
Abstract base class for non-volatile storage operations.
This class provides a consistent interface for non-volatile storage across different hardware platforms and storage mechanisms. It supports key-value storage with various data types and namespace organization.
Key Features:
|
virtualdefaultnoexcept |
Virtual destructor to ensure proper cleanup.
|
delete |
|
inlineexplicitprotectednoexcept |
Protected constructor with namespace specification.
| namespace_name | Name of the storage namespace |
|
pure virtualnoexcept |
Commit any pending writes to non-volatile storage.
|
pure virtualnoexcept |
Deinitialize the storage system and close the namespace.
|
inline |
Ensures that the NVS storage is deinitialized.
|
inline |
Ensures that the NVS storage is initialized (lazy initialization).
|
pure virtualnoexcept |
Remove a key from storage.
| key | Storage key to remove |
|
pure virtualnoexcept |
Retrieve binary data (blob).
| key | Storage key (null-terminated string) |
| buffer | Buffer to store the retrieved data |
| buffer_size | Size of the buffer in bytes |
| actual_size | Actual size of the data (optional) |
|
pure virtualnoexcept |
|
inlinevirtualnoexcept |
Get NVS diagnostic information.
| diagnostics | Reference to store diagnostics data |
Reimplemented in EspNvs.
|
pure virtualnoexcept |
|
pure virtualnoexcept |
|
inlinenoexcept |
Get the namespace name.
|
pure virtualnoexcept |
Get the size of a stored value.
| key | Storage key |
| size | Reference to store the size |
|
inlinevirtualnoexcept |
Get NVS operation statistics.
| statistics | Reference to store statistics data |
Reimplemented in EspNvs.
|
pure virtualnoexcept |
Retrieve a string value.
| key | Storage key (null-terminated string) |
| buffer | Buffer to store the retrieved string |
| buffer_size | Size of the buffer in bytes |
| actual_size | Actual size of the string (optional) |
|
pure virtualnoexcept |
Retrieve a 32-bit unsigned integer value.
| key | Storage key (null-terminated string) |
| value | Reference to store the retrieved value |
|
pure virtualnoexcept |
Initialize the storage system and open the namespace.
|
inlinenoexcept |
Check if storage is initialized.
|
pure virtualnoexcept |
|
inlinevirtualnoexcept |
Reset NVS diagnostic information.
|
inlinevirtualnoexcept |
Reset NVS operation statistics.
|
pure virtualnoexcept |
Store binary data (blob).
| key | Storage key (null-terminated string) |
| data | Pointer to data to store |
| data_size | Size of data in bytes |
|
inlineprotectednoexcept |
Set the initialized state.
| initialized | New initialization state |
|
pure virtualnoexcept |
Store a string value.
| key | Storage key (null-terminated string) |
| value | String value to store |
|
pure virtualnoexcept |
Store a 32-bit unsigned integer value.
| key | Storage key (null-terminated string) |
| value | Value to store |
|
protected |
NVS diagnostic information.
|
protected |
Initialization status.
|
protected |
Namespace name.
|
protected |
NVS operation statistics.