BedSideLamp/include/config.h
Philip Johansson 04c1f802a8 Added debug topic
For now the current configuration is published on this topic at boot
Further it could be used for any kind of debug information
2020-07-05 13:48:10 +02:00

47 lines
753 B
C++

#pragma once
#include <Arduino.h>
class Config {
public:
typedef struct {
char hostname[20];
char ssid[20];
char pass[20];
char mqttServer[20];
char mqttUser[10];
char mqttPass[20];
int mqttPort;
uint8_t brightness;
std::array<uint8_t, 3> color;
} Data;
enum MqttTopic {
OutTopic,
InTopic,
ConfigTopic,
AvailabilityTopic,
DebugTopic,
};
static Config& Instance();
Config(Config&) = delete;
void operator=(Config const&) = delete;
void load();
void write();
void write(Data data);
String getMqttTopic(MqttTopic);
Data data;
private:
static Config& _instance;
Config(){};
};