config: add new Configuration class to simplify handling json config update api
This commit is contained in:
21
src/Config.h
21
src/Config.h
@@ -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;
|
||||
|
Reference in New Issue
Block a user