mirror of
https://github.com/78/xiaozhi-esp32.git
synced 2025-08-06 18:29:41 +08:00
24 lines
579 B
C++
24 lines
579 B
C++
#ifndef SETTINGS_H
|
|
#define SETTINGS_H
|
|
|
|
#include <string>
|
|
#include <nvs_flash.h>
|
|
|
|
class Settings {
|
|
public:
|
|
Settings(const std::string& ns, bool read_write = false);
|
|
~Settings();
|
|
|
|
std::string GetString(const std::string& key, const std::string& default_value = "");
|
|
void SetString(const std::string& key, const std::string& value);
|
|
int32_t GetInt(const std::string& key, int32_t default_value = 0);
|
|
void SetInt(const std::string& key, int32_t value);
|
|
|
|
private:
|
|
std::string ns_;
|
|
nvs_handle_t nvs_handle_ = 0;
|
|
bool read_write_ = false;
|
|
};
|
|
|
|
#endif
|