Initial commit
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
#ifndef TOON_MESSAGEHANDLER_H
|
||||
#define TOON_MESSAGEHANDLER_H
|
||||
|
||||
#include <MQTT.h>
|
||||
#include <SimpleSignal.h>
|
||||
#include <json.hpp>
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace ToonBridge {
|
||||
namespace Toon {
|
||||
|
||||
class MessageHandler
|
||||
{
|
||||
public:
|
||||
MessageHandler(MQTT::MQTT& mqtt);
|
||||
~MessageHandler();
|
||||
|
||||
void HandleMessage(const std::string& message);
|
||||
|
||||
public:
|
||||
typedef std::function<void(int timeToLive)> TTLCallbackMethod;
|
||||
|
||||
public:
|
||||
size_t Connect(TTLCallbackMethod function);
|
||||
void Disconnect(size_t connection);
|
||||
|
||||
private:
|
||||
typedef Simple::Signal<void(int timeToLive)> TTLMessage;
|
||||
|
||||
private:
|
||||
void HandlePowerUsageMessage(const nlohmann::json& data);
|
||||
void HandleGasUsageMessage(const nlohmann::json& data);
|
||||
void HandleWaterUsageMessage(const nlohmann::json& data);
|
||||
void HandleThermostatInfoMessage(const nlohmann::json& data);
|
||||
void HandleThermostatStatesMessage(const nlohmann::json& data);
|
||||
|
||||
private:
|
||||
MQTT::MQTT& m_mqtt;
|
||||
TTLMessage m_signal;
|
||||
};
|
||||
|
||||
} // namespace Toon
|
||||
} // namespace ToonBridge
|
||||
|
||||
#endif // DEVICE_ACTIVITYDEVICE_H
|
||||
Reference in New Issue
Block a user