#include "MqttTopic.h" #include "memepp/string_def.hpp" mqtt::MqttTopic::MqttTopic(const std::string& topic, const std::string& stationId) { this->topic_ = topic; this->stationId_ = stationId; } mqtt::MqttTopic::MqttTopic(const std::string& topic, const std::string& stationId, bool hasReply) { this->topic_ = topic; this->stationId_ = stationId; this->hasReply_ = hasReply; } mqtt::MqttTopic::MqttTopic(const std::string& topic, const std::string& stationId, bool hasReply, bool is_gateway_active) { this->topic_ = topic; this->stationId_ = stationId; this->hasReply_ = hasReply; this->is_gateway_active_ = is_gateway_active; } memepp::string mqtt::MqttTopic::get_subscribe_topic() const { if (this->topic_ == "/data/up-call") { return ("/hyper/itv_" + this->stationId_ + this->topic_ + "reply").c_str(); } else if (this->topic_=="bridge") { return ("/dis/interface/point/bridge/respone/" + stationId_).c_str(); } else { return ("/hyper/itv_" + this->stationId_ + this->topic_ + "_reply").c_str(); } } memepp::string mqtt::MqttTopic::get_publish_topic() const { if (this->topic_ == "bridge") { return ("/dis/interface/point/bridge/request/" + stationId_).c_str(); } else { return ("/hyper/itv_" + this->stationId_ + this->topic_).c_str(); } }