config: add new Configuration class to simplify handling json config update api

This commit is contained in:
2023-02-20 07:07:32 +01:00
parent 53d5775c6a
commit 64666bbfb6
8 changed files with 85 additions and 42 deletions

View File

@@ -1,6 +1,27 @@
#pragma once
#include <Figments.h>
#include "JsonCoordinateMapping.h"
#include <ArduinoJson.h>
class Configuration {
public:
Configuration(const JsonObject& data);
const char* get(const char* key, const char* defaultVal) const;
int get(const char* key, int defaultVal) const;
bool get(const char* key, bool defaultVal) const;
private:
const JsonObject& m_json;
};
class ConfigTaskMixin : public virtual Loopable {
public:
void handleEvent(const InputEvent &evt) override;
void loop() override {}
virtual void handleConfigChange(const Configuration& config) {}
};
struct HardwareConfig {
uint8_t version = 3;