HF Interface Wrapper 0.1.0-dev
Embedded C++ hardware abstraction layer
Loading...
Searching...
No Matches
BaseNvs.h File Reference

Abstract base class for Non-Volatile Storage implementations in the HardFOC system. More...

#include "HardwareTypes.h"
#include <cstdint>
#include <string_view>
Include dependency graph for BaseNvs.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  hf_nvs_statistics_t
 NVS operation statistics. More...
 
struct  hf_nvs_diagnostics_t
 NVS diagnostic information. More...
 
class  BaseNvs
 Abstract base class for non-volatile storage operations. More...
 

Macros

#define HF_NVS_ERR_LIST(X)
 HardFOC NVS error codes.
 
#define X(name, value, desc)   name = value,
 
#define X(NAME, VALUE, DESC)
 

Enumerations

enum class  hf_nvs_err_t : hf_i32_t {
  X , NVS_SUCCESS = 0 , NVS_ERR_FAILURE = 1 , NVS_ERR_NOT_INITIALIZED = 2 ,
  NVS_ERR_ALREADY_INITIALIZED = 3 , NVS_ERR_INVALID_PARAMETER = 4 , NVS_ERR_NULL_POINTER = 5 , NVS_ERR_OUT_OF_MEMORY = 6 ,
  NVS_ERR_KEY_NOT_FOUND = 7 , NVS_ERR_KEY_TOO_LONG = 8 , NVS_ERR_VALUE_TOO_LARGE = 9 , NVS_ERR_NAMESPACE_NOT_FOUND = 10 ,
  NVS_ERR_STORAGE_FULL = 11 , NVS_ERR_INVALID_DATA = 12 , NVS_ERR_READ_ONLY = 13 , NVS_ERR_CORRUPTED = 14 ,
  NVS_ERR_ENCRYPTION_FAILED = 15 , NVS_ERR_DECRYPTION_FAILED = 16 , NVS_ERR_ENCRYPTION_NOT_CONFIGURED = 17 , NVS_ERR_ENCRYPTION_NOT_SUPPORTED = 18 ,
  NVS_ERR_KEY_PARTITION_CORRUPTED = 19 , NVS_ERR_WRONG_ENCRYPTION_SCHEME = 20 , NVS_ERR_VERSION_MISMATCH = 21 , NVS_ERR_NO_FREE_PAGES = 22 ,
  NVS_ERR_PARTITION_NOT_FOUND = 23 , NVS_ERR_ITERATOR_INVALID = 24 , NVS_ERR_SECURITY_VIOLATION = 25 , NVS_ERR_UNSUPPORTED_OPERATION = 26 ,
  NVS_ERR_UNKNOWN = 27
}
 

Functions

constexpr std::string_view HfNvsErrToString (hf_nvs_err_t err) noexcept
 Convert NVS error code to string view.
 

Detailed Description

Abstract base class for Non-Volatile Storage implementations in the HardFOC system.

This header-only file defines the abstract base class for non-volatile storage that provides a consistent API across different storage implementations. Concrete implementations for various storage devices inherit from this class to provide key-value storage, settings persistence, and configuration management.

Author
Nebiyu Tadesse
Date
2025
Note
This is a header-only abstract base class following the same pattern as BaseCan.
Users should program against this interface, not specific implementations.

Macro Definition Documentation

◆ X [1/2]

#define X ( name,
value,
desc )   name = value,

◆ X [2/2]

#define X ( NAME,
VALUE,
DESC )
Value:
case hf_nvs_err_t::NAME: \
return DESC;

Enumeration Type Documentation

◆ hf_nvs_err_t

enum class hf_nvs_err_t : hf_i32_t
strong
Enumerator
NVS_SUCCESS 
NVS_ERR_FAILURE 
NVS_ERR_NOT_INITIALIZED 
NVS_ERR_ALREADY_INITIALIZED 
NVS_ERR_INVALID_PARAMETER 
NVS_ERR_NULL_POINTER 
NVS_ERR_OUT_OF_MEMORY 
NVS_ERR_KEY_NOT_FOUND 
NVS_ERR_KEY_TOO_LONG 
NVS_ERR_VALUE_TOO_LARGE 
NVS_ERR_NAMESPACE_NOT_FOUND 
NVS_ERR_STORAGE_FULL 
NVS_ERR_INVALID_DATA 
NVS_ERR_READ_ONLY 
NVS_ERR_CORRUPTED 
NVS_ERR_ENCRYPTION_FAILED 
NVS_ERR_DECRYPTION_FAILED 
NVS_ERR_ENCRYPTION_NOT_CONFIGURED 
NVS_ERR_ENCRYPTION_NOT_SUPPORTED 
NVS_ERR_KEY_PARTITION_CORRUPTED 
NVS_ERR_WRONG_ENCRYPTION_SCHEME 
NVS_ERR_VERSION_MISMATCH 
NVS_ERR_NO_FREE_PAGES 
NVS_ERR_PARTITION_NOT_FOUND 
NVS_ERR_ITERATOR_INVALID 
NVS_ERR_SECURITY_VIOLATION 
NVS_ERR_UNSUPPORTED_OPERATION 
NVS_ERR_UNKNOWN 

Function Documentation

◆ HfNvsErrToString()

constexpr std::string_view HfNvsErrToString ( hf_nvs_err_t err)
constexprnoexcept

Convert NVS error code to string view.

Parameters
errThe error code to convert
Returns
String view of the error description