bolar_1 date 2026-7-1 d:/proc

This commit is contained in:
2026-11-27 17:44:38 +08:00
commit 0dbdfa57bc
890 changed files with 325428 additions and 0 deletions

26
main/settings.h Normal file
View File

@@ -0,0 +1,26 @@
#pragma once
#include <string>
#include "nvs.h"
// NVS 持久化配置存储(与 xiaozhi Settings 对齐)
// 每个实例绑定一个 NVS namespace
class Settings {
public:
Settings(const char* ns, bool read_write = true);
~Settings();
std::string GetString(const char* key, const std::string& default_val = "") const;
void SetString(const char* key, const std::string& value);
int GetInt(const char* key, int default_val = 0) const;
void SetInt(const char* key, int value);
void EraseKey(const char* key);
void EraseAll();
private:
nvs_handle_t handle_ = 0;
bool dirty_ = false;
bool read_write_ = false;
};