2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
42#ifndef MQTTBROKER_LIB_MQTTMODEL_H
43#define MQTTBROKER_LIB_MQTTMODEL_H
45namespace mqtt::mqttbroker::
lib {
57#ifndef DOXYGEN_SHOULD_SKIP_THIS
60#include <core/timer/Timer.h>
69namespace mqtt::mqttbroker::
lib {
110 void delClient(
const std::string& clientId);
124 void sendEvent(
const std::string& data,
const std::string& event =
"",
const std::string& id =
"");
126 static std::string timePointToString(
const std::chrono::time_point<std::chrono::system_clock>& timePoint);
128 durationToString(
const std::chrono::time_point<std::chrono::system_clock>& bevore,
129 const std::chrono::time_point<std::chrono::system_clock>& later = std::chrono::system_clock::now());
void publishMappings(const iot::mqtt::packets::Publish &publish)
MqttMapper(const nlohmann::json &mappingJson)
bool operator==(const EventReceiver &other)
std::weak_ptr< express::Response > response
EventReceiver(const std::shared_ptr< express::Response > &response)
core::timer::Timer heartbeatTimer
MqttModelEntry(MqttModelEntry &&) noexcept=default
MqttModelEntry(const Mqtt *mqtt)
std::string onlineSince() const
const Mqtt * getMqtt() const
std::string onlineDuration() const
void publish(const iot::mqtt::packets::Publish &publish)
void sendEvent(const std::string &data, const std::string &event="", const std::string &id="")
std::chrono::time_point< std::chrono::system_clock > onlineSinceTimePoint
void delClient(const std::string &clientId)
void addClient(const std::string &clientId, Mqtt *mqtt)
static MqttModel & instance()
std::list< EventReceiver > eventReceiverList
std::map< std::string, MqttModelEntry > modelMap
void addEventReceiver(const std::shared_ptr< express::Response > &response, const std::string &lastEventId)
std::string onlineSince()
std::string onlineDuration()
std::map< std::string, MqttModelEntry > & getClients()
const Mqtt * getMqtt(const std::string &clientId)
void publishMapping(const std::string &topic, const std::string &message, uint8_t qoS, bool retain) final
void onPublish(const iot::mqtt::packets::Publish &publish) final
void onConnect(const iot::mqtt::packets::Connect &connect) final
void onDisconnected() final