| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- #ifndef TOON_BRIDGE_H
- #define TOON_BRIDGE_H
- #include "MessageHandler.h"
- #include "MQTTSettings.h"
- #include "ToonSettings.h"
- #include "WebSocketSubscription.h"
- #include <HttpServer.h>
- #include <MQTT.h>
- #include <memory>
- #include <string>
- namespace ToonBridge {
- namespace Toon {
- class Bridge
- {
- public:
- Bridge(int port, const ToonSettings& toonSettings, const MQTTSettings& mqttSettings);
- ~Bridge();
- void Wait();
- private:
- void Start();
- Http::HttpServer::HttpReply HttpCallback(const std::string& uri, const std::vector<Http::HttpPostData>& postData);
- void TimeToLiveCallback(WebSocketSubscription* pSubscription, int timeToLive);
- private:
- std::unique_ptr<Http::HttpServer> m_pHttpServer;
- MQTT::MQTT m_mqttClient;
- MessageHandler m_messageHandler;
- int m_port;
- ToonSettings m_toonSettings;
- MQTTSettings m_mqttSettings;
- std::unique_ptr<WebSocketSubscription> m_pWebSocketSubscription;
- };
- } // namespace Toon
- } // namespace ToonBridge
- #endif // TOON_BRIDGE_H
|