Configure shades via MQTT messages
This commit is contained in:
30
lib/configurator/Configurator.h
Normal file
30
lib/configurator/Configurator.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#ifndef CONFIGURATOR_H
|
||||
#define CONFIGURATOR_H
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <functional>
|
||||
#include "Shade.h"
|
||||
|
||||
// TODO: Allow shades to be removed
|
||||
|
||||
class Configurator
|
||||
{
|
||||
private:
|
||||
std::vector<std::function<void (Shade)>> shadeConfiguredCallbacks;
|
||||
std::map<std::string, uint16_t> discoveredIds;
|
||||
std::map<std::string, std::string> discoveredFriendlyNames;
|
||||
|
||||
std::string extractKey(std::string topic);
|
||||
bool tryBuild(std::string topic);
|
||||
|
||||
public:
|
||||
Configurator();
|
||||
|
||||
void addShadeConfiguredCallback(std::function<void (Shade)> callback);
|
||||
|
||||
void processIdMessage(std::string topic, std::string id);
|
||||
void processFriendlyNameMessage(std::string topic, std::string friendlyName);
|
||||
};
|
||||
|
||||
#endif // CONFIGURATOR_H
|
||||
Reference in New Issue
Block a user