#pragma once #include #include "key_value_store.h" namespace roro { // Settings persistence in the ESP32's internal flash (NVS). class NvsStore : public KeyValueStore { public: void begin() { prefs_.begin("roro", false); } bool getInt(const char* key, int32_t& out) override { if (!prefs_.isKey(key)) return false; out = prefs_.getInt(key); return true; } bool getString(const char* key, std::string& out) override { if (!prefs_.isKey(key)) return false; out = prefs_.getString(key).c_str(); return true; } void putInt(const char* key, int32_t value) override { prefs_.putInt(key, value); } void putString(const char* key, const std::string& value) override { prefs_.putString(key, value.c_str()); } private: Preferences prefs_; }; } // namespace roro