39 lines
939 B
C++
39 lines
939 B
C++
/**
|
|
* @file nvsFunctions.hpp
|
|
* @author Gustice
|
|
* @brief NVS-Diagnosis utility
|
|
*
|
|
* @copyright Copyright (c) 2024
|
|
*/
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
class NvsApi {
|
|
|
|
public:
|
|
/// @brief Init and mount file system
|
|
/// @param mount rooted SubType of partition eg "nvs"
|
|
static void init(std::string mount = std::string{"nvs"});
|
|
|
|
/// @brief Get instance, ensure initialization
|
|
/// @param mount rooted SubType of partition eg "nvs"
|
|
/// @return Instance reference
|
|
static NvsApi &getInstance(std::string mount = std::string{"nvs"});
|
|
|
|
void setValue(const std::string &key, const std::string &value);
|
|
std::string getValue(const std::string &key);
|
|
|
|
// Disable move and assignment
|
|
NvsApi(NvsApi &other) = delete;
|
|
void operator=(const NvsApi &) = delete;
|
|
|
|
protected:
|
|
NvsApi(std::string mount);
|
|
~NvsApi();
|
|
|
|
private:
|
|
static NvsApi *_instance;
|
|
const std::string _mountingPoint;
|
|
};
|