Logic_library
Library for Logic board by RoboticsBrno.
Loading...
Searching...
No Matches
Nvs.hpp
Go to the documentation of this file.
1#pragma once
2
3#include <string>
4
5#include <esp_system.h>
6#include <nvs.h>
7#include <nvs_flash.h>
8
9class Nvs {
10public:
11 Nvs(const char* name_space, const char* partition = "nvs");
12 ~Nvs();
13 Nvs(const Nvs&) = delete;
14
15 bool existsInt(const char* key);
16 std::int32_t getInt(const char* key);
17 void writeInt(const char* key, std::int32_t value);
18
19 bool existsString(const char* key);
20 std::string getString(const char* key);
21 void writeString(const char* key, const std::string& value);
22
23 void commit();
24
25private:
26 esp_err_t initFlash();
27
28 nvs_handle m_handle;
29 bool m_dirty;
30};
Definition: Nvs.hpp:9
void writeInt(const char *key, std::int32_t value)
Definition: Nvs.cpp:42
void writeString(const char *key, const std::string &value)
Definition: Nvs.cpp:61
std::int32_t getInt(const char *key)
Definition: Nvs.cpp:36
bool existsString(const char *key)
Definition: Nvs.cpp:47
bool existsInt(const char *key)
Definition: Nvs.cpp:31
std::string getString(const char *key)
Definition: Nvs.cpp:52
void commit()
Definition: Nvs.cpp:66
Nvs(const Nvs &)=delete
~Nvs()
Definition: Nvs.cpp:13