libxr
Embedded C++ framework for bare-metal, RTOS and Linux
Loading...
Searching...
No Matches
LibXR::ESP32NvsFlashDatabase Class Reference

ESP32 NVS 数据库存储实现 / ESP32 NVS-backed database implementation. More...

#include <esp32_nvs_flash_database.hpp>

Inheritance diagram for LibXR::ESP32NvsFlashDatabase:
[legend]
Collaboration diagram for LibXR::ESP32NvsFlashDatabase:
[legend]

Public Member Functions

 ESP32NvsFlashDatabase (const char *namespace_name="storage")
 构造并初始化 NVS / Construct and initialize NVS storage
 
bool IsValid () const
 查询初始化状态 / Check initialization state
 

Detailed Description

ESP32 NVS 数据库存储实现 / ESP32 NVS-backed database implementation.

Definition at line 18 of file esp32_nvs_flash_database.hpp.

Constructor & Destructor Documentation

◆ ESP32NvsFlashDatabase()

LibXR::ESP32NvsFlashDatabase::ESP32NvsFlashDatabase ( const char * namespace_name = "storage")
inlineexplicit

构造并初始化 NVS / Construct and initialize NVS storage

Parameters
namespace_name命名空间名称 / Namespace name (default: "storage")

Definition at line 25 of file esp32_nvs_flash_database.hpp.

26 : namespace_(namespace_name)
27 {
28 esp_err_t err = nvs_flash_init();
29 if (err == ESP_ERR_NVS_NO_FREE_PAGES || err == ESP_ERR_NVS_NEW_VERSION_FOUND)
30 {
31 nvs_flash_erase();
32 err = nvs_flash_init();
33 }
34 valid_ = (err == ESP_OK);
35 }

Member Function Documentation

◆ IsValid()

bool LibXR::ESP32NvsFlashDatabase::IsValid ( ) const
inline

查询初始化状态 / Check initialization state

Definition at line 40 of file esp32_nvs_flash_database.hpp.

40{ return valid_; }

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