Add deserialization logic

This commit is contained in:
2022-09-24 17:23:12 +02:00
parent 61923121f0
commit d3cd6857d0
8 changed files with 79 additions and 17 deletions

View File

@@ -7,6 +7,10 @@
#include <nlohmann/json.hpp>
#include <fan/Fan.h>
#include <sensor/Sensor.h>
#define SERIALIZATION_DIR "/etc/fantasize"
#define FANS_JSON_FILENAME "fans.json"
using json = nlohmann::json;
@@ -14,9 +18,12 @@ class Serializer {
public:
Serializer();
void Serialize(std::vector<std::shared_ptr<Fan>> fans);
std::vector<std::shared_ptr<Fan>>
Deserialize(std::vector<std::shared_ptr<Sensor>> availableSensors);
private:
void WriteJson(json o);
json ReadJson();
};
#endif // SERIALIZER_H_