#include <MqttModel.h>
Classes | |
| class | MqttModelEntry |
| class | EventReceiver |
Public Member Functions | |
| void | addClient (const std::string &clientId, Mqtt *mqtt) |
| void | delClient (const std::string &clientId) |
| std::map< std::string, MqttModelEntry > & | getClients () |
| const Mqtt * | getMqtt (const std::string &clientId) |
| std::string | onlineSince () |
| std::string | onlineDuration () |
| void | addEventReceiver (const std::shared_ptr< express::Response > &response, const std::string &lastEventId) |
| void | publish (const iot::mqtt::packets::Publish &publish) |
Static Public Member Functions | |
| static MqttModel & | instance () |
Protected Attributes | |
| std::map< std::string, MqttModelEntry > | modelMap |
| std::list< EventReceiver > | eventReceiverList |
| std::chrono::time_point< std::chrono::system_clock > | onlineSinceTimePoint |
| uint64_t | id = 0 |
Private Member Functions | |
| MqttModel () | |
| void | sendEvent (const std::string &data, const std::string &event="", const std::string &id="") |
Static Private Member Functions | |
| static std::string | timePointToString (const std::chrono::time_point< std::chrono::system_clock > &timePoint) |
| static std::string | durationToString (const std::chrono::time_point< std::chrono::system_clock > &bevore, const std::chrono::time_point< std::chrono::system_clock > &later=std::chrono::system_clock::now()) |
Definition at line 71 of file MqttModel.h.
|
private |
Definition at line 72 of file MqttModel.cpp.
References onlineSinceTimePoint.
| void mqtt::mqttbroker::lib::MqttModel::addClient | ( | const std::string & | clientId, |
| Mqtt * | mqtt ) |
Definition at line 116 of file MqttModel.cpp.
References mqtt::mqttbroker::lib::href(), id, modelMap, mqtt::mqttbroker::lib::MqttModel::MqttModelEntry::MqttModelEntry(), mqtt::mqttbroker::lib::MqttModel::MqttModelEntry::onlineDuration(), mqtt::mqttbroker::lib::MqttModel::MqttModelEntry::onlineSince(), sendEvent(), and mqtt::mqttbroker::lib::windowId().
Referenced by mqtt::mqttbroker::lib::Mqtt::onConnect().
| void mqtt::mqttbroker::lib::MqttModel::addEventReceiver | ( | const std::shared_ptr< express::Response > & | response, |
| const std::string & | lastEventId ) |
Definition at line 161 of file MqttModel.cpp.
References eventReceiverList, mqtt::mqttbroker::lib::MqttModel::MqttModelEntry::getMqtt(), mqtt::mqttbroker::lib::href(), id, modelMap, mqtt::mqttbroker::lib::MqttModel::MqttModelEntry::onlineDuration(), mqtt::mqttbroker::lib::MqttModel::MqttModelEntry::onlineSince(), sendEvent(), and mqtt::mqttbroker::lib::windowId().
Referenced by getRouter().
| void mqtt::mqttbroker::lib::MqttModel::delClient | ( | const std::string & | clientId | ) |
Definition at line 132 of file MqttModel.cpp.
References id, modelMap, and sendEvent().
Referenced by mqtt::mqttbroker::lib::Mqtt::onDisconnected().
|
staticprivate |
Definition at line 241 of file MqttModel.cpp.
| std::map< std::string, MqttModel::MqttModelEntry > & mqtt::mqttbroker::lib::MqttModel::getClients | ( | ) |
| const Mqtt * mqtt::mqttbroker::lib::MqttModel::getMqtt | ( | const std::string & | clientId | ) |
Definition at line 142 of file MqttModel.cpp.
References mqtt::mqttbroker::lib::MqttModel::MqttModelEntry::getMqtt(), and modelMap.
Referenced by getRouter().
|
static |
Definition at line 76 of file MqttModel.cpp.
Referenced by getRouter(), mqtt::mqttbroker::lib::Mqtt::onConnect(), mqtt::mqttbroker::lib::Mqtt::onDisconnected(), and mqtt::mqttbroker::lib::Mqtt::onPublish().
| std::string mqtt::mqttbroker::lib::MqttModel::onlineDuration | ( | ) |
Definition at line 157 of file MqttModel.cpp.
References onlineSinceTimePoint.
Referenced by getOverviewPage().
| std::string mqtt::mqttbroker::lib::MqttModel::onlineSince | ( | ) |
Definition at line 153 of file MqttModel.cpp.
References onlineSinceTimePoint.
Referenced by getOverviewPage().
| void mqtt::mqttbroker::lib::MqttModel::publish | ( | const iot::mqtt::packets::Publish & | publish | ) |
Definition at line 182 of file MqttModel.cpp.
Referenced by mqtt::mqttbroker::lib::Mqtt::onPublish().
|
private |
Definition at line 209 of file MqttModel.cpp.
References eventReceiverList, and mqtt::mqttbroker::lib::MqttModel::EventReceiver::response.
Referenced by addClient(), addEventReceiver(), and delClient().
|
staticprivate |
Definition at line 226 of file MqttModel.cpp.
|
protected |
Definition at line 134 of file MqttModel.h.
Referenced by addEventReceiver(), and sendEvent().
|
protected |
Definition at line 138 of file MqttModel.h.
Referenced by addClient(), addEventReceiver(), and delClient().
|
protected |
Definition at line 132 of file MqttModel.h.
Referenced by addClient(), addEventReceiver(), delClient(), getClients(), and getMqtt().
|
protected |
Definition at line 136 of file MqttModel.h.
Referenced by MqttModel(), onlineDuration(), and onlineSince().