BeeeOn Gateway  v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
MqttExporter.h
1 #pragma once
2 
3 #include <string>
4 
5 #include <Poco/Logger.h>
6 #include <Poco/SharedPtr.h>
7 
8 #include "core/Exporter.h"
9 #include "net/MqttClient.h"
10 #include "util/Loggable.h"
11 
12 namespace BeeeOn {
13 
14 class SensorDataFormatter;
15 
16 class MqttExporter :
17  public Exporter,
18  protected Loggable {
19 public:
20  MqttExporter();
21  ~MqttExporter();
22 
23  bool ship(const SensorData &data) override;
24 
25  void setTopic(const std::string &topic);
26 
27  void setQos(int qos);
28 
29  void setMqttClient(MqttClient::Ptr client);
30 
31  void setFormatter(const Poco::SharedPtr<SensorDataFormatter> formatter);
32 
33 private:
34  std::string m_topic;
35  MqttMessage::QoS m_qos;
36  std::string m_clientID;
37  Poco::SharedPtr<SensorDataFormatter> m_formatter;
38  MqttClient::Ptr m_mqtt;
39 };
40 
41 }
Definition: SensorData.h:20
Definition: Exporter.h:11
bool ship(const SensorData &data) override
Definition: MqttExporter.cpp:51
Definition: MqttExporter.h:16
Definition: Loggable.h:19