Files
Hotdog/lib/configurator/Configurator.h

30 lines
739 B
C++

#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