Quellcode durchsuchen

V2.0
1、新增了MQTT内容,直接读取配置文件的mqtt信息获取webapi数据
2、新增MQTT监听管理站发送的刷新信号
3、现在这个页面禁用编辑,只是展示

Apple vor 3 Wochen
Ursprung
Commit
b492be651c
86 geänderte Dateien mit 2264 neuen und 2 gelöschten Zeilen
  1. 3 0
      CMakeLists.txt
  2. 4 0
      TransmitterSwitch/CMakeLists.txt
  3. 117 0
      TransmitterSwitch/Network/FromMQTT.cpp
  4. 49 0
      TransmitterSwitch/Network/FromMQTT.h
  5. 55 0
      TransmitterSwitch/common/commonDefine.h
  6. 163 0
      TransmitterSwitch/common/qmqtt/Findqmqtt.cmake
  7. 38 0
      TransmitterSwitch/common/qmqtt/inc/qmqtt.h
  8. 286 0
      TransmitterSwitch/common/qmqtt/inc/qmqtt_client.h
  9. 137 0
      TransmitterSwitch/common/qmqtt/inc/qmqtt_frame.h
  10. 48 0
      TransmitterSwitch/common/qmqtt/inc/qmqtt_global.h
  11. 96 0
      TransmitterSwitch/common/qmqtt/inc/qmqtt_message.h
  12. 92 0
      TransmitterSwitch/common/qmqtt/inc/qmqtt_networkinterface.h
  13. 71 0
      TransmitterSwitch/common/qmqtt/inc/qmqtt_routedmessage.h
  14. 60 0
      TransmitterSwitch/common/qmqtt/inc/qmqtt_router.h
  15. 79 0
      TransmitterSwitch/common/qmqtt/inc/qmqtt_routesubscription.h
  16. 84 0
      TransmitterSwitch/common/qmqtt/inc/qmqtt_socketinterface.h
  17. 62 0
      TransmitterSwitch/common/qmqtt/inc/qmqtt_timerinterface.h
  18. BIN
      TransmitterSwitch/common/qmqtt/lib/gcc/5.12.12/Qt5Qmqtt.dll
  19. 5 0
      TransmitterSwitch/common/qmqtt/lib/gcc/5.12.12/Qt5Qmqtt.prl
  20. BIN
      TransmitterSwitch/common/qmqtt/lib/gcc/5.12.12/Qt5Qmqttd.dll
  21. 5 0
      TransmitterSwitch/common/qmqtt/lib/gcc/5.12.12/Qt5Qmqttd.prl
  22. BIN
      TransmitterSwitch/common/qmqtt/lib/gcc/5.12.12/libQt5Qmqtt.a
  23. BIN
      TransmitterSwitch/common/qmqtt/lib/gcc/5.12.12/libQt5Qmqttd.a
  24. 13 0
      TransmitterSwitch/common/qmqtt/lib/gcc/5.12.12/pkgconfig/Qt5Qmqtt.pc
  25. BIN
      TransmitterSwitch/common/qmqtt/lib/gcc/5.15.2/debug/Qt5Qmqtt.dll
  26. BIN
      TransmitterSwitch/common/qmqtt/lib/gcc/5.15.2/debug/Qt5Qmqtt.dll.debug
  27. 5 0
      TransmitterSwitch/common/qmqtt/lib/gcc/5.15.2/debug/Qt5Qmqtt.prl
  28. BIN
      TransmitterSwitch/common/qmqtt/lib/gcc/5.15.2/debug/libQt5Qmqtt.a
  29. 13 0
      TransmitterSwitch/common/qmqtt/lib/gcc/5.15.2/debug/pkgconfig/Qt5Qmqtt.pc
  30. BIN
      TransmitterSwitch/common/qmqtt/lib/gcc/5.15.2/release/Qt5Qmqtt.dll
  31. BIN
      TransmitterSwitch/common/qmqtt/lib/gcc/5.15.2/release/Qt5Qmqtt.dll.debug
  32. 5 0
      TransmitterSwitch/common/qmqtt/lib/gcc/5.15.2/release/Qt5Qmqtt.prl
  33. BIN
      TransmitterSwitch/common/qmqtt/lib/gcc/5.15.2/release/libQt5Qmqtt.a
  34. 13 0
      TransmitterSwitch/common/qmqtt/lib/gcc/5.15.2/release/pkgconfig/Qt5Qmqtt.pc
  35. BIN
      TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3.7z
  36. 1 0
      TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.12.12/debug/libQt5Qmqtt.so
  37. 1 0
      TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.12.12/debug/libQt5Qmqtt.so.1
  38. 1 0
      TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.12.12/debug/libQt5Qmqtt.so.1.0
  39. BIN
      TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.12.12/debug/libQt5Qmqtt.so.1.0.3
  40. BIN
      TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.12.12/debug/libQt5Qmqtt.so.1.0.3.debug
  41. 1 0
      TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.12.12/release/libQt5Qmqtt.so
  42. 1 0
      TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.12.12/release/libQt5Qmqtt.so.1
  43. 1 0
      TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.12.12/release/libQt5Qmqtt.so.1.0
  44. BIN
      TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.12.12/release/libQt5Qmqtt.so.1.0.3
  45. BIN
      TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.12.12/release/libQt5Qmqtt.so.1.0.3.debug
  46. 1 0
      TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.15.14/debug/libQt5Qmqtt.so
  47. 1 0
      TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.15.14/debug/libQt5Qmqtt.so.1
  48. 1 0
      TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.15.14/debug/libQt5Qmqtt.so.1.0
  49. BIN
      TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.15.14/debug/libQt5Qmqtt.so.1.0.3
  50. 1 0
      TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.15.14/release/libQt5Qmqtt.so
  51. 1 0
      TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.15.14/release/libQt5Qmqtt.so.1
  52. 1 0
      TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.15.14/release/libQt5Qmqtt.so.1.0
  53. BIN
      TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.15.14/release/libQt5Qmqtt.so.1.0.3
  54. BIN
      TransmitterSwitch/common/qmqtt/lib/msvc/5.12.12/Qt5Qmqtt.dll
  55. BIN
      TransmitterSwitch/common/qmqtt/lib/msvc/5.12.12/Qt5Qmqtt.exp
  56. BIN
      TransmitterSwitch/common/qmqtt/lib/msvc/5.12.12/Qt5Qmqtt.lib
  57. BIN
      TransmitterSwitch/common/qmqtt/lib/msvc/5.12.12/Qt5Qmqtt.pdb
  58. 5 0
      TransmitterSwitch/common/qmqtt/lib/msvc/5.12.12/Qt5Qmqtt.prl
  59. BIN
      TransmitterSwitch/common/qmqtt/lib/msvc/5.12.12/Qt5Qmqttd.dll
  60. BIN
      TransmitterSwitch/common/qmqtt/lib/msvc/5.12.12/Qt5Qmqttd.exp
  61. BIN
      TransmitterSwitch/common/qmqtt/lib/msvc/5.12.12/Qt5Qmqttd.ilk
  62. BIN
      TransmitterSwitch/common/qmqtt/lib/msvc/5.12.12/Qt5Qmqttd.lib
  63. BIN
      TransmitterSwitch/common/qmqtt/lib/msvc/5.12.12/Qt5Qmqttd.pdb
  64. 5 0
      TransmitterSwitch/common/qmqtt/lib/msvc/5.12.12/Qt5Qmqttd.prl
  65. 7 0
      TransmitterSwitch/common/qmqtt/lib/msvc/5.12.12/cmake/Qt5Qmqtt/ExtraSourceIncludes.cmake
  66. 185 0
      TransmitterSwitch/common/qmqtt/lib/msvc/5.12.12/cmake/Qt5Qmqtt/Qt5QmqttConfig.cmake
  67. 11 0
      TransmitterSwitch/common/qmqtt/lib/msvc/5.12.12/cmake/Qt5Qmqtt/Qt5QmqttConfigVersion.cmake
  68. BIN
      TransmitterSwitch/common/qmqtt/lib/msvc/5.15.2/Qt5Qmqtt.dll
  69. BIN
      TransmitterSwitch/common/qmqtt/lib/msvc/5.15.2/Qt5Qmqtt.exp
  70. BIN
      TransmitterSwitch/common/qmqtt/lib/msvc/5.15.2/Qt5Qmqtt.lib
  71. BIN
      TransmitterSwitch/common/qmqtt/lib/msvc/5.15.2/Qt5Qmqtt.pdb
  72. 5 0
      TransmitterSwitch/common/qmqtt/lib/msvc/5.15.2/Qt5Qmqtt.prl
  73. BIN
      TransmitterSwitch/common/qmqtt/lib/msvc/5.15.2/Qt5Qmqttd.dll
  74. BIN
      TransmitterSwitch/common/qmqtt/lib/msvc/5.15.2/Qt5Qmqttd.exp
  75. BIN
      TransmitterSwitch/common/qmqtt/lib/msvc/5.15.2/Qt5Qmqttd.ilk
  76. BIN
      TransmitterSwitch/common/qmqtt/lib/msvc/5.15.2/Qt5Qmqttd.lib
  77. BIN
      TransmitterSwitch/common/qmqtt/lib/msvc/5.15.2/Qt5Qmqttd.pdb
  78. 5 0
      TransmitterSwitch/common/qmqtt/lib/msvc/5.15.2/Qt5Qmqttd.prl
  79. 7 0
      TransmitterSwitch/common/qmqtt/lib/msvc/5.15.2/cmake/Qt5Qmqtt/ExtraSourceIncludes.cmake
  80. 250 0
      TransmitterSwitch/common/qmqtt/lib/msvc/5.15.2/cmake/Qt5Qmqtt/Qt5QmqttConfig.cmake
  81. 11 0
      TransmitterSwitch/common/qmqtt/lib/msvc/5.15.2/cmake/Qt5Qmqtt/Qt5QmqttConfigVersion.cmake
  82. 159 0
      TransmitterSwitch/common/qmqtt/mqttBase/MQTTBase.cpp
  83. 86 0
      TransmitterSwitch/common/qmqtt/mqttBase/MQTTBase.h
  84. BIN
      TransmitterSwitch/common/qmqtt/qmqtt.zip
  85. 7 2
      TransmitterSwitch/transmitterswitch.cpp
  86. 6 0
      TransmitterSwitch/transmitterswitch.h

+ 3 - 0
CMakeLists.txt

@@ -127,6 +127,7 @@ find_package(Qt5 COMPONENTS
     Widgets
     Core
     Sql
+    Network
     REQUIRED
 )
 
@@ -134,9 +135,11 @@ find_package(Qt5 COMPONENTS
 # include(${CMAKE_SOURCE_DIR}/External/Libraries/Libraries.cmake)
 list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/TransmitterSwitch/common/LHHTTPAPI)
 list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/TransmitterSwitch/common/spdlog)
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/TransmitterSwitch/common/qmqtt)
 
 find_package(LHHTTPAPI REQUIRED)
 find_package(spdlog REQUIRED)
+find_package(qmqtt REQUIRED)
 
 #=========================================================
 #*****************  添加头文件和源文件 ********************

+ 4 - 0
TransmitterSwitch/CMakeLists.txt

@@ -20,6 +20,7 @@ file(GLOB LOCAL_SRC
     ${CMAKE_CURRENT_SOURCE_DIR}/UIStyle/*.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/ManagerPlan/*.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/CopyToOther/*.cpp
+    ${CMAKE_CURRENT_SOURCE_DIR}/Network/*.cpp
 
     ${CMAKE_CURRENT_SOURCE_DIR}/common/Thread/*.cpp
     ${CMAKE_CURRENT_SOURCE_DIR}/common/Shadow/*.cpp
@@ -63,6 +64,7 @@ target_include_directories(${lib_name} PRIVATE
     ${CMAKE_CURRENT_SOURCE_DIR}/UIStyle
     ${CMAKE_CURRENT_SOURCE_DIR}/ManagerPlan
     ${CMAKE_CURRENT_SOURCE_DIR}/CopyToOther
+    ${CMAKE_CURRENT_SOURCE_DIR}/Network
 
     ${CMAKE_CURRENT_SOURCE_DIR}/common
     ${CMAKE_CURRENT_SOURCE_DIR}/common/Thread
@@ -87,11 +89,13 @@ target_link_libraries(${lib_name} PRIVATE
     Qt5::Widgets
     Qt5::Core
     Qt5::Sql
+    Qt5::Network
 )
 
 #链接外部库
 target_link_libraries(${lib_name} PRIVATE
     ${spdlog_STATIC_LIBRARY}
+    External::qmqtt
 )
 
 #连接stdc++fs库,如果编译器版本低于GCC9.0,则需要连接这个库

+ 117 - 0
TransmitterSwitch/Network/FromMQTT.cpp

@@ -0,0 +1,117 @@
+
+#include "spdlog/spdlog.h"
+#include "FromMQTT.h"
+#include "commonDefine.h"
+
+#include <QApplication>
+#include <QSettings>
+#include <QTimer>
+#include <QEventLoop>
+
+
+FromMQTT::FromMQTT(QObject* parent)
+{
+
+}
+
+FromMQTT::~FromMQTT()
+{
+
+}
+
+
+/* 初始化MQTT */
+bool FromMQTT::initMQTT()
+{
+    readConfig();
+
+    /* 连接MQTT */
+    setIPAndPort(m_mqttIP, m_mqttPort);
+    addSubcribe(m_topic_WebAPI, 0); // 订阅WebAPI主题
+    connectToServer();
+
+    /* 等待mqtt回复webapi信息(不阻塞UI,收到立即退出)*/
+    waitForWebInfo(m_timeOut);
+
+    SPDLOG_INFO("WebAPI URL: {}", m_webAPIUrl.toStdString());
+    SPDLOG_INFO("WebAPI DBID: {}", m_webAPIID.toStdString());
+    if(m_webAPIUrl.isEmpty())
+    {
+        SPDLOG_ERROR("接收MQTT消息超时,获取WebAPI信息失败");
+        return false;
+    }
+
+    /* 开启MQTT订阅 */
+    addSubcribe(m_topic_UpdatePlan);
+
+    return true;
+}
+
+
+/* 读取配置文件 */
+void FromMQTT::readConfig()
+{
+    QString strConfigPath = QApplication::applicationDirPath() + m_configName;
+    QSettings setting(strConfigPath, QSettings::IniFormat);
+    setting.beginGroup("MQTTINFO");
+    m_mqttIP = setting.value("MQTTAddr", "").toString();
+    m_mqttPort = setting.value("MQTTPort", 1883).toInt();
+    m_timeOut = setting.value("MQTTTimeOut", 20000).toInt();
+    setting.endGroup();
+}
+
+
+/* 接收到消息,子类继承这个解析消息数据 */
+void FromMQTT::recvMessage(const QMQTT::Message& message)
+{
+    SPDLOG_TRACE("接收到MQTT消息: {}", message.payload().toStdString());
+    QString payload = QString::fromUtf8(message.payload());
+    if(message.topic() == m_topic_WebAPI) 
+    {
+        /* 处理WebAPI消息 */
+        try 
+        {
+            nJson jsonMsg = nJson::parse(payload.toStdString());
+            m_webAPIUrl = jsonMsg["webaddr"].is_null() ? "" : jsonMsg["webaddr"].get<std::string>().c_str();
+            m_webAPIID = jsonMsg["serverid"].is_null() ? "" : jsonMsg["serverid"].get<std::string>().c_str();
+            m_isGetWebInfoSuccess.store(true);
+            emit signal_webInfoReady(); // 通知等待逻辑退出
+        }nJsonCatchNoReturn
+        SPDLOG_TRACE("WebAPI信息获取成功: URL = {}, ID = {}", m_webAPIUrl.toStdString(), m_webAPIID.toStdString());
+    }
+    else if(message.topic() == m_topic_UpdatePlan)
+    {
+        /* 处理管理站消息 */
+        try
+        {
+            nJson jsonMsg = nJson::parse(payload.toStdString());
+            SPDLOG_INFO("MQTT接收到刷新报警时段消息");
+            emit signal_updatePlan();
+        }nJsonCatchNoReturn
+    }
+}
+
+/* 等待WebAPI信息到达,使用事件循环+信号的方式,不阻塞主UI刷新 */
+bool FromMQTT::waitForWebInfo(int timeoutMs)
+{
+    if(m_isGetWebInfoSuccess.load())
+        return true; // 已经有了
+
+    QEventLoop loop;
+    QTimer timer;
+    timer.setSingleShot(true);
+    if(timeoutMs > 0)
+    {
+        timer.start(timeoutMs);
+        QObject::connect(&timer, &QTimer::timeout, &loop, &QEventLoop::quit);
+    }
+    // 收到Web信息立即退出
+    QMetaObject::Connection c = QObject::connect(this, &FromMQTT::signal_webInfoReady, &loop, &QEventLoop::quit);
+    loop.exec(); // 期间UI主事件循环仍可运行
+    QObject::disconnect(c);
+    return m_isGetWebInfoSuccess.load();
+}
+
+
+
+

+ 49 - 0
TransmitterSwitch/Network/FromMQTT.h

@@ -0,0 +1,49 @@
+#ifndef _FROMMQTT_H_
+#define _FROMMQTT_H_
+
+#include <atomic>
+#include "MQTTBase.h"
+
+class FromMQTT : public MQTTBase
+{
+    Q_OBJECT
+public:
+    FromMQTT(QObject* parent = nullptr);
+    ~FromMQTT() override;
+
+    /* 初始化MQTT */
+    bool initMQTT();
+
+    
+
+    QString m_webAPIUrl;
+    QString m_webAPIID;
+
+signals:
+    /* 刷新页面信号 */
+    void signal_updatePlan();
+    /* Web信息到达信号(用于退出等待) */
+    void signal_webInfoReady();
+
+private:
+    /* 读取配置文件 */
+    void readConfig();
+    /* 等待获取到WebAPI信息(非阻塞UI,收到立即返回)*/
+    bool waitForWebInfo(int timeoutMs);
+
+protected:
+    /* 接收到消息,子类继承这个解析消息数据 */
+    void recvMessage(const QMQTT::Message& message) override;
+
+private:
+    QString m_mqttIP;                       /* MQTT服务器IP */
+    int m_mqttPort = 1883;                  /* MQTT服务器端口 */
+    int m_timeOut = 20000;                  /* 超时时间 */
+    const QString m_topic_WebAPI = "LH_WEBINFO"; /* 订阅WebAPI信息的主题 */
+    const QString m_topic_UpdatePlan = "LH_EQM_ALARM_PERIOD"; /* 订阅更新计划的主题 */
+    const QString m_configName = "/Config.ini";
+
+    std::atomic_bool m_isGetWebInfoSuccess{false}; /* 是否获取到WebAPI信息 */
+};
+
+#endif // _FROMMQTT_H_

+ 55 - 0
TransmitterSwitch/common/commonDefine.h

@@ -0,0 +1,55 @@
+#ifndef COMMONDEFINE_H
+#define COMMONDEFINE_H
+
+#include "nlohmann/json.hpp"
+
+
+/*--------------------------------------------------------------------------
+ * 公共宏定义
+ *--------------------------------------------------------------------------*/
+
+#define nJson nlohmann::json
+
+/* nJson 异常处理的宏 */
+#define nJsonCatch catch(const nJson::parse_error& e)       \
+    {   \
+        SPDLOG_WARN("nJson parse failed: {}", e.what());\
+        return false;\
+    }\
+    catch(const nJson::type_error& e)                       \
+    {\
+        SPDLOG_WARN("nJson type failed: {}", e.what());\
+        return false;\
+    }catch (const std::exception& e)\
+    {\
+        SPDLOG_WARN("nJson std failed: {}", e.what());\
+        return false;\
+    }catch(...)\
+    {\
+        SPDLOG_WARN("nJson Operated failed: unknown error");\
+        return false;\
+    }
+
+/* nJson 异常处理的宏,不带返回值 */
+#define nJsonCatchNoReturn catch(const nJson::parse_error& e)       \
+    {   \
+        SPDLOG_WARN("nJson parse failed: {}", e.what());\
+        return;\
+    }\
+    catch(const nJson::type_error& e)                       \
+    {\
+        SPDLOG_WARN("nJson type failed: {}", e.what());\
+        return;\
+    }catch (const std::exception& e)\
+    {\
+        SPDLOG_WARN("nJson std failed: {}", e.what());\
+        return;\
+    }catch(...)\
+    {\
+        SPDLOG_WARN("nJson Operated failed: unknown error");\
+        return;\
+    }
+
+
+
+#endif /* COMMONDEFINE_H */

+ 163 - 0
TransmitterSwitch/common/qmqtt/Findqmqtt.cmake

@@ -0,0 +1,163 @@
+
+#这里需要区分Qt版本,因此要放到find_package(qt)之后
+
+message(STATUS "***** Find qmqtt.cmake *****")
+
+# 0. 定义qmqtt版本
+
+
+# 1. 指定头文件路径
+unset(QMQTT_INCLUDE_DIR CACHE)
+unset(QMQTT_LIBRARY CACHE)
+unset(INCLUDE_DIR CACHE)
+find_path(INCLUDE_DIR
+    NAMES qmqtt.h
+    PATHS ${CMAKE_CURRENT_LIST_DIR}/inc
+    NO_DEFAULT_PATH
+)
+
+list(APPEND QMQTT_INCLUDE_DIR ${INCLUDE_DIR})
+
+unset(INCLUDE_DIR CACHE)
+find_path(INCLUDE_DIR
+    NAMES MQTTBase.h
+    PATHS ${CMAKE_CURRENT_LIST_DIR}/mqttBase
+    NO_DEFAULT_PATH
+)
+
+list(APPEND QMQTT_INCLUDE_DIR ${INCLUDE_DIR})
+
+
+#添加源文件
+unset(QMQTT_SOURCES CACHE)
+find_path(INCLUDE_DIR
+    NAMES MQTTBase.cpp
+    PATHS ${CMAKE_CURRENT_LIST_DIR}/mqttBase
+    NO_DEFAULT_PATH
+)
+
+list(APPEND QMQTT_SOURCES ${INCLUDE_DIR}/MQTTBase.cpp)
+
+
+#区分Qt版本
+if(QT_VERSION_MAJOR EQUAL 5)
+    # message(STATUS "----------------Qt Version : ${Qt5Core_VERSION}")
+    if(${Qt5Core_VERSION} VERSION_LESS 5.15.0 AND ${Qt5Core_VERSION} VERSION_GREATER 5.12.0)
+        set(QtVersion 5.12)
+    elseif(${Qt5Core_VERSION} VERSION_GREATER_EQUAL 5.15.0)
+        set(QtVersion 5.15)
+    endif()
+    
+elseif(QT_VERSION_MAJOR EQUAL 6)
+    message(STATUS "Qt Version : ${Qt6Core_VERSION}")
+    message(STATUS "qmqtt not support Qt6")
+endif()
+
+
+# 2. 直接指定库文件,区分gcc,msvc,debug和release
+unset(QMQTT_LIBRARY CACHE)
+if(CMAKE_SYSTEM_NAME MATCHES "Windows")
+    if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
+        if(QtVersion STREQUAL "5.12")
+            if(CMAKE_BUILD_TYPE STREQUAL "Debug")
+                list(APPEND QMQTT_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/lib/gcc/5.12.12/Qt5Qmqttd.dll)
+            else()
+                list(APPEND QMQTT_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/lib/gcc/5.12.12/Qt5Qmqtt.dll)
+            endif()
+        elseif(QtVersion STREQUAL "5.15")
+            if(CMAKE_BUILD_TYPE STREQUAL "Debug")
+                list(APPEND QMQTT_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/lib/gcc/5.15.2/debug/Qt5Qmqtt.dll)
+            else()
+                list(APPEND QMQTT_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/lib/gcc/5.15.2/release/Qt5Qmqtt.dll)
+            endif()
+        endif()
+    elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
+        # message(STATUS "MSVC")
+        if(QtVersion STREQUAL "5.12")
+            if(CMAKE_BUILD_TYPE STREQUAL "Debug")
+                list(APPEND QMQTT_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/lib/msvc/5.12.12/Qt5Qmqttd.lib)
+            else()
+                list(APPEND QMQTT_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/lib/msvc/5.12.12/Qt5Qmqtt.lib)
+            endif(CMAKE_BUILD_TYPE STREQUAL "Debug")
+            
+        elseif(QtVersion STREQUAL "5.15")
+            if(CMAKE_BUILD_TYPE STREQUAL "Debug")
+                list(APPEND QMQTT_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/lib/msvc/5.15.2/Qt5Qmqttd.lib)
+            else()
+                list(APPEND QMQTT_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/lib/msvc/5.15.2/Qt5Qmqtt.lib)
+            endif()
+        endif()
+    endif()
+#添加Linux库
+elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
+    # message(STATUS "Using ${CMAKE_SYSTEM_NAME} System")
+    if(QtVersion STREQUAL "5.12")
+        if(CMAKE_BUILD_TYPE STREQUAL "Debug")
+            list(APPEND QMQTT_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/lib/linux_gcc8.3/5.12.12/debug/libQt5Qmqtt.so)
+        else()
+            list(APPEND QMQTT_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/lib/linux_gcc8.3/5.12.12/release/libQt5Qmqtt.so)
+        endif()
+    elseif(QtVersion STREQUAL "5.15")
+        if(CMAKE_BUILD_TYPE STREQUAL "Debug")
+            list(APPEND QMQTT_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/lib/linux_gcc8.3/5.15.14/debug/libQt5Qmqtt.so)
+        else()
+            list(APPEND QMQTT_LIBRARY ${CMAKE_CURRENT_LIST_DIR}/lib/linux_gcc8.3/5.15.14/debug/libQt5Qmqtt.so)
+        endif()
+    endif()
+endif()
+
+
+# message("Include: " ${QMQTT_INCLUDE_DIR})
+# message("Library: " ${QMQTT_LIBRARY})
+# 3. 设置查找到了变量
+if(QMQTT_INCLUDE_DIR AND QMQTT_LIBRARY)
+    set(QMQTT_FOUND TRUE)
+    set(QMQTT_VERSION 1.0.3)
+
+    # message(STATUS "qmqtt Version : ${QMQTT_VERSION}")
+    # message(STATUS "include : QMQTT_INCLUDE_DIR")
+    # message(STATUS "Library : QMQTT_LIBRARY")
+    # message(STATUS "Sources : QMQTT_SOURCES")
+
+    message(STATUS "target_link_libraries(YourTarget PRIVATE External::qmqtt)")
+else()
+    set(QMQTT_FOUND FALSE)
+endif()
+
+
+message(STATUS "qmqtt Found : ${QMQTT_FOUND}")
+message(STATUS "qmqtt Version : ${QMQTT_VERSION}")
+message(STATUS "--------------------------------------------------")
+
+
+#导入目标
+if(QMQTT_FOUND)
+    if(NOT TARGET External::qmqtt)
+        add_library(External::qmqtt UNKNOWN IMPORTED)
+        #添加头文件
+        set_target_properties(External::qmqtt PROPERTIES
+            INTERFACE_INCLUDE_DIRECTORIES "${QMQTT_INCLUDE_DIR}")
+
+        #添加库文件
+
+        set_target_properties(External::qmqtt PROPERTIES
+            IMPORTED_LOCATION "${QMQTT_LIBRARY}")
+        #添加spdlog需要的依赖库
+        # set_target_properties(External::qmqtt PROPERTIES
+        #     INTERFACE_LINK_LIBRARIES "pthread")
+
+
+        #添加源文件
+        set_target_properties(External::qmqtt PROPERTIES
+           INTERFACE_SOURCES "${QMQTT_SOURCES}")
+    endif()
+endif()
+
+# 标记这些变量为高级变量
+mark_as_advanced(
+    QMQTT_INCLUDE_DIR 
+    QMQTT_LIBRARY 
+    QMQTT_SOURCES
+)
+
+

+ 38 - 0
TransmitterSwitch/common/qmqtt/inc/qmqtt.h

@@ -0,0 +1,38 @@
+/*
+ * qmqtt.h - qmqtt library heaer
+ *
+ * Copyright (c) 2013  Ery Lee <ery.lee at gmail dot com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright notice,
+ *     this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *   * Neither the name of mqttc nor the names of its contributors may be used
+ *     to endorse or promote products derived from this software without
+ *     specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef QMQTT_H
+#define QMQTT_H
+
+#include <qmqtt_message.h>
+#include <qmqtt_client.h>
+
+#endif // QMQTT_H

+ 286 - 0
TransmitterSwitch/common/qmqtt/inc/qmqtt_client.h

@@ -0,0 +1,286 @@
+/*
+ * qmqtt_client.h - qmqtt client header
+ *
+ * Copyright (c) 2013  Ery Lee <ery.lee at gmail dot com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright notice,
+ *     this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *   * Neither the name of mqttc nor the names of its contributors may be used
+ *     to endorse or promote products derived from this software without
+ *     specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef QMQTT_CLIENT_H
+#define QMQTT_CLIENT_H
+
+#include <qmqtt_global.h>
+
+#include <QObject>
+#include <QString>
+#include <QHostAddress>
+#include <QByteArray>
+#include <QAbstractSocket>
+#include <QScopedPointer>
+#include <QList>
+
+#ifdef QT_WEBSOCKETS_LIB
+#include <QWebSocket>
+#endif // QT_WEBSOCKETS_LIB
+
+#ifndef QT_NO_SSL
+#include <QSslConfiguration>
+QT_FORWARD_DECLARE_CLASS(QSslError)
+#endif // QT_NO_SSL
+
+#ifndef Q_ENUM_NS
+#define Q_ENUM_NS(x)
+#endif // Q_ENUM_NS
+
+namespace QMQTT {
+#if (QT_VERSION >= QT_VERSION_CHECK(5, 8, 0))
+Q_MQTT_EXPORT Q_NAMESPACE
+#endif
+
+static const quint8 LIBRARY_VERSION_MAJOR = 0;
+static const quint8 LIBRARY_VERSION_MINOR = 3;
+static const quint8 LIBRARY_VERSION_REVISION = 1;
+//static const char* LIBRARY_VERSION = "0.3.1";
+
+enum MQTTVersion
+{
+    V3_1_0 = 3,
+    V3_1_1 = 4
+};
+Q_ENUM_NS(MQTTVersion)
+
+enum ConnectionState
+{
+    STATE_INIT = 0,
+    STATE_CONNECTING,
+    STATE_CONNECTED,
+    STATE_DISCONNECTED
+};
+Q_ENUM_NS(ConnectionState)
+
+enum ClientError
+{
+    UnknownError = 0,
+    SocketConnectionRefusedError,
+    SocketRemoteHostClosedError,
+    SocketHostNotFoundError,
+    SocketAccessError,
+    SocketResourceError,
+    SocketTimeoutError,
+    SocketDatagramTooLargeError,
+    SocketNetworkError,
+    SocketAddressInUseError,
+    SocketAddressNotAvailableError,
+    SocketUnsupportedSocketOperationError,
+    SocketUnfinishedSocketOperationError,
+    SocketProxyAuthenticationRequiredError,
+    SocketSslHandshakeFailedError,
+    SocketProxyConnectionRefusedError,
+    SocketProxyConnectionClosedError,
+    SocketProxyConnectionTimeoutError,
+    SocketProxyNotFoundError,
+    SocketProxyProtocolError,
+    SocketOperationError,
+    SocketSslInternalError,
+    SocketSslInvalidUserDataError,
+    SocketTemporaryError,
+    MqttUnacceptableProtocolVersionError=1<<16,
+    MqttIdentifierRejectedError,
+    MqttServerUnavailableError,
+    MqttBadUserNameOrPasswordError,
+    MqttNotAuthorizedError,
+    MqttNoPingResponse
+};
+Q_ENUM_NS(ClientError)
+
+class ClientPrivate;
+class Message;
+class Frame;
+class NetworkInterface;
+
+class Q_MQTT_EXPORT Client : public QObject
+{
+    Q_OBJECT
+    Q_PROPERTY(quint16 _port READ port WRITE setPort)
+    Q_PROPERTY(QHostAddress _host READ host WRITE setHost)
+    Q_PROPERTY(QString _hostName READ hostName WRITE setHostName)
+    Q_PROPERTY(QString _clientId READ clientId WRITE setClientId)
+    Q_PROPERTY(QString _username READ username WRITE setUsername)
+    Q_PROPERTY(QByteArray _password READ password WRITE setPassword)
+    Q_PROPERTY(quint16 _keepAlive READ keepAlive WRITE setKeepAlive)
+    Q_PROPERTY(MQTTVersion _version READ version WRITE setVersion)
+    Q_PROPERTY(bool _autoReconnect READ autoReconnect WRITE setAutoReconnect)
+    Q_PROPERTY(int _autoReconnectInterval READ autoReconnectInterval WRITE setAutoReconnectInterval)
+    Q_PROPERTY(bool _cleanSession READ cleanSession WRITE setCleanSession)
+    Q_PROPERTY(QString _willTopic READ willTopic WRITE setWillTopic)
+    Q_PROPERTY(quint8 _willQos READ willQos WRITE setWillQos)
+    Q_PROPERTY(bool _willRetain READ willRetain WRITE setWillRetain)
+    Q_PROPERTY(QByteArray _willMessage READ willMessage WRITE setWillMessage)
+    Q_PROPERTY(ConnectionState _connectionState READ connectionState)
+#ifndef QT_NO_SSL
+    Q_PROPERTY(QSslConfiguration _sslConfiguration READ sslConfiguration WRITE setSslConfiguration)
+#endif // QT_NO_SSL
+
+public:
+    Client(const QHostAddress& host = QHostAddress::LocalHost,
+           const quint16 port = 1883,
+           QObject* parent = nullptr);
+
+#ifndef QT_NO_SSL
+    Client(const QString& hostName,
+           const quint16 port,
+           const QSslConfiguration& config,
+           const bool ignoreSelfSigned=false,
+           QObject* parent = nullptr);
+#endif // QT_NO_SSL
+
+    // This function is provided for backward compatibility with older versions of QMQTT.
+    // If the ssl parameter is true, this function will load a private key ('cert.key') and a local
+    // certificate ('cert.crt') from the current working directory. It will also set PeerVerifyMode
+    // to None. This may not be the safest way to set up an SSL connection.
+    Client(const QString& hostName,
+           const quint16 port,
+           const bool ssl,
+           const bool ignoreSelfSigned,
+           QObject* parent = nullptr);
+
+#ifdef QT_WEBSOCKETS_LIB
+    // Create a connection over websockets
+    Client(const QString& url,
+           const QString& origin,
+           QWebSocketProtocol::Version version,
+           bool ignoreSelfSigned = false,
+           QObject* parent = nullptr);
+
+#ifndef QT_NO_SSL
+    Client(const QString& url,
+           const QString& origin,
+           QWebSocketProtocol::Version version,
+           const QSslConfiguration& config,
+           const bool ignoreSelfSigned = false,
+           QObject* parent = nullptr);
+#endif // QT_NO_SSL
+#endif // QT_WEBSOCKETS_LIB
+
+    // for testing purposes only
+    Client(NetworkInterface* network,
+           const QHostAddress& host = QHostAddress::LocalHost,
+           const quint16 port = 1883,
+           QObject* parent = nullptr);
+
+    virtual ~Client();
+
+    QHostAddress host() const;
+    QString hostName() const;
+    quint16 port() const;
+    QString clientId() const;
+    QString username() const;
+    QByteArray password() const;
+    QMQTT::MQTTVersion version() const;
+    quint16 keepAlive() const;
+    bool cleanSession() const;
+    bool autoReconnect() const;
+    int autoReconnectInterval() const;
+    ConnectionState connectionState() const;
+    QString willTopic() const;
+    quint8 willQos() const;
+    bool willRetain() const;
+    QByteArray willMessage() const;
+
+    bool isConnectedToHost() const;
+#ifndef QT_NO_SSL
+    QSslConfiguration sslConfiguration() const;
+    void setSslConfiguration(const QSslConfiguration& config);
+#endif // QT_NO_SSL
+
+public Q_SLOTS:
+    void setHost(const QHostAddress& host);
+    void setHostName(const QString& hostName);
+    void setPort(const quint16 port);
+    void setClientId(const QString& clientId);
+    void setUsername(const QString& username);
+    void setPassword(const QByteArray& password);
+    void setVersion(const MQTTVersion version);
+    void setKeepAlive(const quint16 keepAlive);
+    void setCleanSession(const bool cleanSession);
+    void setAutoReconnect(const bool value);
+    void setAutoReconnectInterval(const int autoReconnectInterval);
+    void setWillTopic(const QString& willTopic);
+    void setWillQos(const quint8 willQos);
+    void setWillRetain(const bool willRetain);
+    void setWillMessage(const QByteArray& willMessage);
+
+    void connectToHost();
+    void disconnectFromHost();
+
+    void subscribe(const QString& topic, const quint8 qos = 0);
+    void unsubscribe(const QString& topic);
+
+    quint16 publish(const QMQTT::Message& message);
+
+#ifndef QT_NO_SSL
+    void ignoreSslErrors();
+    void ignoreSslErrors(const QList<QSslError>& errors);
+#endif // QT_NO_SSL
+
+Q_SIGNALS:
+    void connected();
+    void disconnected();
+    void error(const QMQTT::ClientError error);
+
+    void subscribed(const QString& topic, const quint8 qos = 0);
+    void unsubscribed(const QString& topic);
+    void published(const QMQTT::Message& message, quint16 msgid = 0);
+    void received(const QMQTT::Message& message);
+    void pingresp();
+#ifndef QT_NO_SSL
+    void sslErrors(const QList<QSslError>& errors);
+#endif // QT_NO_SSL
+
+protected Q_SLOTS:
+    void onNetworkConnected();
+    void onNetworkDisconnected();
+    void onNetworkReceived(const QMQTT::Frame& frame);
+    void onTimerPingReq();
+    void onPingTimeout();
+    void onNetworkError(QAbstractSocket::SocketError error);
+#ifndef QT_NO_SSL
+    void onSslErrors(const QList<QSslError>& errors);
+#endif // QT_NO_SSL
+
+protected:
+    QScopedPointer<ClientPrivate> d_ptr;
+
+private:
+    Q_DISABLE_COPY(Client)
+    Q_DECLARE_PRIVATE(Client)
+};
+
+} // namespace QMQTT
+
+Q_DECLARE_METATYPE(QMQTT::ClientError)
+
+#endif // QMQTT_CLIENT_H

+ 137 - 0
TransmitterSwitch/common/qmqtt/inc/qmqtt_frame.h

@@ -0,0 +1,137 @@
+/*
+ * qmqtt_frame.h - qmqtt frame heaer
+ *
+ * Copyright (c) 2013  Ery Lee <ery.lee at gmail dot com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright notice,
+ *     this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *   * Neither the name of mqttc nor the names of its contributors may be used
+ *     to endorse or promote products derived from this software without
+ *     specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef QMQTT_FRAME_H
+#define QMQTT_FRAME_H
+
+#include <qmqtt_global.h>
+
+#include <QMetaType>
+#include <QByteArray>
+#include <QString>
+
+QT_FORWARD_DECLARE_CLASS(QDataStream)
+
+#define PROTOCOL_MAGIC_3_1_0 "MQIsdp"
+#define PROTOCOL_MAGIC_3_1_1 "MQTT"
+
+#define RANDOM_CLIENT_PREFIX "QMQTT-"
+
+#define CONNECT 0x10
+#define CONNACK 0x20
+#define PUBLISH 0x30
+#define PUBACK 0x40
+#define PUBREC 0x50
+#define PUBREL 0x60
+#define PUBCOMP 0x70
+#define SUBSCRIBE 0x80
+#define SUBACK 0x90
+#define UNSUBSCRIBE 0xA0
+#define UNSUBACK 0xB0
+#define PINGREQ 0xC0
+#define PINGRESP 0xD0
+#define DISCONNECT 0xE0
+
+#define LSB(A) quint8(A & 0x00FF)
+#define MSB(A) quint8((A & 0xFF00) >> 8)
+
+/*
+|--------------------------------------
+| 7 6 5 4 |     3    |  2 1  | 0      |
+|  Type   | DUP flag |  QoS  | RETAIN |
+|--------------------------------------
+*/
+#define GETTYPE(HDR)		(HDR & 0xF0)
+#define SETQOS(HDR, Q)		(HDR | ((Q) << 1))
+#define GETQOS(HDR)			((HDR & 0x06) >> 1)
+#define SETDUP(HDR, D)		(HDR | ((D) << 3))
+#define GETDUP(HDR)			((HDR & 0x08) >> 3)
+#define SETRETAIN(HDR, R)	(HDR | (R))
+#define GETRETAIN(HDR)		(HDR & 0x01)
+
+/*
+|----------------------------------------------------------------------------------
+|     7    |    6     |      5     |  4   3  |     2    |       1      |     0    |
+| username | password | willretain | willqos | willflag | cleansession | reserved |
+|----------------------------------------------------------------------------------
+*/
+#define FLAG_CLEANSESS(F, C)	(F | ((C) << 1))
+#define FLAG_WILL(F, W)			(F | ((W) << 2))
+#define FLAG_WILLQOS(F, Q)		(F | ((Q) << 3))
+#define FLAG_WILLRETAIN(F, R) 	(F | ((R) << 5))
+#define FLAG_PASSWD(F, P)		(F | ((P) << 6))
+#define FLAG_USERNAME(F, U)		(F | ((U) << 7))
+
+namespace QMQTT {
+
+class Q_MQTT_EXPORT Frame
+{
+public:
+    explicit Frame();
+    explicit Frame(const quint8 header);
+    explicit Frame(const quint8 header, const QByteArray &data);
+    virtual ~Frame();
+
+    Frame(const Frame& other);
+    Frame& operator=(const Frame& other);
+
+    bool operator==(const Frame& other) const;
+    inline bool operator!=(const Frame& other) const
+    { return !operator==(other); }
+
+    quint8 header() const;
+    QByteArray data() const;
+
+    quint16 readInt();
+    quint8 readChar();
+    QByteArray readByteArray();
+    QString readString();
+
+    void writeInt(const quint16 i);
+    void writeChar(const quint8 c);
+    void writeByteArray(const QByteArray &data);
+    void writeString(const QString &string);
+    void writeRawData(const QByteArray &data);
+
+    //TODO: FIXME LATER
+    void write(QDataStream &stream) const;
+    bool encodeLength(QByteArray &lenbuf, int length) const;
+
+private:
+    quint8 _header;
+    QByteArray _data;
+};
+
+} // namespace QMQTT
+
+Q_DECLARE_METATYPE(QMQTT::Frame)
+
+#endif // QMQTT_FRAME_H

+ 48 - 0
TransmitterSwitch/common/qmqtt/inc/qmqtt_global.h

@@ -0,0 +1,48 @@
+/*
+ * qmqtt_global.h - qmqtt libray global
+ *
+ * Copyright (c) 2013  Ery Lee <ery.lee at gmail dot com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright notice,
+ *     this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *   * Neither the name of mqttc nor the names of its contributors may be used
+ *     to endorse or promote products derived from this software without
+ *     specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef QMQTT_GLOBAL_H
+#define QMQTT_GLOBAL_H
+
+#include <QtGlobal>
+
+#if !defined(QT_STATIC) && !defined(MQTT_PROJECT_INCLUDE_SRC)
+#  if defined(QT_BUILD_QMQTT_LIB)
+#    define Q_MQTT_EXPORT Q_DECL_EXPORT
+#  else
+#    define Q_MQTT_EXPORT Q_DECL_IMPORT
+#  endif
+#else
+#  define Q_MQTT_EXPORT
+#endif
+
+#endif // QMQTT_GLOBAL_H
+

+ 96 - 0
TransmitterSwitch/common/qmqtt/inc/qmqtt_message.h

@@ -0,0 +1,96 @@
+/*
+ * qmqtt_message.h - qmqtt message header
+ *
+ * Copyright (c) 2013  Ery Lee <ery.lee at gmail dot com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright notice,
+ *     this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *   * Neither the name of mqttc nor the names of its contributors may be used
+ *     to endorse or promote products derived from this software without
+ *     specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef QMQTT_MESSAGE_H
+#define QMQTT_MESSAGE_H
+
+#include <qmqtt_global.h>
+
+#include <QMetaType>
+#include <QString>
+#include <QByteArray>
+#include <QSharedDataPointer>
+
+namespace QMQTT {
+
+class MessagePrivate;
+
+class Q_MQTT_EXPORT Message
+{
+public:
+    Message();
+    explicit Message(const quint16 id, const QString &topic, const QByteArray &payload,
+                     const quint8 qos = 0, const bool retain = false, const bool dup = false);
+    Message(const Message &other);
+    ~Message();
+
+    Message &operator=(const Message &other);
+#ifdef Q_COMPILER_RVALUE_REFS
+    inline Message &operator=(Message &&other) Q_DECL_NOTHROW
+    { swap(other); return *this; }
+#endif
+
+    bool operator==(const Message &other) const;
+    inline bool operator!=(const Message &other) const
+    { return !operator==(other); }
+
+    inline void swap(Message &other) Q_DECL_NOTHROW
+    { qSwap(d, other.d); }
+
+    quint16 id() const;
+    void setId(const quint16 id);
+
+    quint8 qos() const;
+    void setQos(const quint8 qos);
+
+    bool retain() const;
+    void setRetain(const bool retain);
+
+    bool dup() const;
+    void setDup(const bool dup);
+
+    QString topic() const;
+    void setTopic(const QString &topic);
+
+    QByteArray payload() const;
+    void setPayload(const QByteArray &payload);
+
+private:
+    QSharedDataPointer<MessagePrivate> d;
+};
+
+} // namespace QMQTT
+
+Q_DECLARE_SHARED(QMQTT::Message)
+
+Q_DECLARE_METATYPE(QMQTT::Message)
+
+#endif // QMQTT_MESSAGE_H

+ 92 - 0
TransmitterSwitch/common/qmqtt/inc/qmqtt_networkinterface.h

@@ -0,0 +1,92 @@
+/*
+ * qmqtt_networkinterface.h - qmqtt network interface header
+ *
+ * Copyright (c) 2013  Ery Lee <ery.lee at gmail dot com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright notice,
+ *     this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *   * Neither the name of mqttc nor the names of its contributors may be used
+ *     to endorse or promote products derived from this software without
+ *     specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef QMQTT_NETWORK_INTERFACE_H
+#define QMQTT_NETWORK_INTERFACE_H
+
+#include <qmqtt_global.h>
+
+#include <QObject>
+#include <QAbstractSocket>
+#include <QHostAddress>
+#include <QString>
+#include <QList>
+
+#ifndef QT_NO_SSL
+#include <QSslConfiguration>
+QT_FORWARD_DECLARE_CLASS(QSslError)
+#endif // QT_NO_SSL
+
+namespace QMQTT {
+
+class Frame;
+
+class Q_MQTT_EXPORT NetworkInterface : public QObject
+{
+    Q_OBJECT
+public:
+    explicit NetworkInterface(QObject* parent = nullptr) : QObject(parent) {}
+    virtual ~NetworkInterface() {}
+
+    virtual void sendFrame(const Frame& frame) = 0;
+    virtual bool isConnectedToHost() const = 0;
+    virtual bool autoReconnect() const = 0;
+    virtual void setAutoReconnect(const bool autoReconnect) = 0;
+    virtual int autoReconnectInterval() const = 0;
+    virtual void setAutoReconnectInterval(const int autoReconnectInterval) = 0;
+    virtual QAbstractSocket::SocketState state() const = 0;
+#ifndef QT_NO_SSL
+    virtual void ignoreSslErrors(const QList<QSslError>& errors) = 0;
+    virtual QSslConfiguration sslConfiguration() const = 0;
+    virtual void setSslConfiguration(const QSslConfiguration& config) = 0;
+#endif // QT_NO_SSL
+
+public Q_SLOTS:
+    virtual void connectToHost(const QHostAddress& host, const quint16 port) = 0;
+    virtual void connectToHost(const QString& hostName, const quint16 port) = 0;
+    virtual void disconnectFromHost() = 0;
+#ifndef QT_NO_SSL
+    virtual void ignoreSslErrors() = 0;
+#endif // QT_NO_SSL
+
+Q_SIGNALS:
+    void connected();
+    void disconnected();
+    void received(const QMQTT::Frame& frame);
+    void error(QAbstractSocket::SocketError error);
+#ifndef QT_NO_SSL
+    void sslErrors(const QList<QSslError>& errors);
+#endif // QT_NO_SSL
+};
+
+} // namespace QMQTT
+
+#endif // QMQTT_NETWORK_INTERFACE_H

+ 71 - 0
TransmitterSwitch/common/qmqtt/inc/qmqtt_routedmessage.h

@@ -0,0 +1,71 @@
+/*
+ * qmqtt_router.h - qmqtt router
+ *
+ * Copyright (c) 2013  Ery Lee <ery.lee at gmail dot com>
+ * Router added by Niklas Wulf <nwulf at geenen-it-systeme dot de>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright notice,
+ *     this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *   * Neither the name of mqttc nor the names of its contributors may be used
+ *     to endorse or promote products derived from this software without
+ *     specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef QMQTT_ROUTEDMESSAGE_H
+#define QMQTT_ROUTEDMESSAGE_H
+
+#include <qmqtt_message.h>
+
+#include <QMetaType>
+#include <QHash>
+#include <QString>
+
+namespace QMQTT {
+
+class RouteSubscription;
+
+class Q_MQTT_EXPORT RoutedMessage
+{
+public:
+    inline RoutedMessage()
+    {}
+    inline RoutedMessage(const Message &message)
+        : _message(message)
+    {}
+
+    inline const Message &message() const
+    { return _message; }
+    inline QHash<QString, QString> parameters() const
+    { return _parameters; }
+
+private:
+    friend class RouteSubscription;
+
+    Message _message;
+    QHash<QString, QString> _parameters;
+};
+
+} // namespace QMQTT
+
+Q_DECLARE_METATYPE(QMQTT::RoutedMessage)
+
+#endif // QMQTT_ROUTEDMESSAGE_H

+ 60 - 0
TransmitterSwitch/common/qmqtt/inc/qmqtt_router.h

@@ -0,0 +1,60 @@
+/*
+ * qmqtt_router.h - qmqtt router
+ *
+ * Copyright (c) 2013  Ery Lee <ery.lee at gmail dot com>
+ * Router added by Niklas Wulf <nwulf at geenen-it-systeme dot de>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright notice,
+ *     this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *   * Neither the name of mqttc nor the names of its contributors may be used
+ *     to endorse or promote products derived from this software without
+ *     specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef QMQTT_ROUTER_H
+#define QMQTT_ROUTER_H
+
+#include <qmqtt_global.h>
+
+#include <QObject>
+
+namespace QMQTT {
+
+class Client;
+class RouteSubscription;
+
+class Q_MQTT_EXPORT Router : public QObject
+{
+    Q_OBJECT
+public:
+    explicit Router(Client *parent = nullptr);
+
+    RouteSubscription *subscribe(const QString &route);
+    Client *client() const;
+
+private:
+    Client *_client;
+};
+
+} // namespace QMQTT
+
+#endif // QMQTT_ROUTER_H

+ 79 - 0
TransmitterSwitch/common/qmqtt/inc/qmqtt_routesubscription.h

@@ -0,0 +1,79 @@
+/*
+ * qmqtt_router.h - qmqtt router
+ *
+ * Copyright (c) 2013  Ery Lee <ery.lee at gmail dot com>
+ * Router added by Niklas Wulf <nwulf at geenen-it-systeme dot de>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright notice,
+ *     this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *   * Neither the name of mqttc nor the names of its contributors may be used
+ *     to endorse or promote products derived from this software without
+ *     specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef QMQTT_ROUTESUBSCRIPTION_H
+#define QMQTT_ROUTESUBSCRIPTION_H
+
+#include <qmqtt_global.h>
+
+#include <QObject>
+#include <QPointer>
+#include <QString>
+#include <QRegularExpression>
+#include <QStringList>
+
+namespace QMQTT {
+
+class Client;
+class Message;
+class RoutedMessage;
+class Router;
+
+class Q_MQTT_EXPORT RouteSubscription : public QObject
+{
+    Q_OBJECT
+public:
+    ~RouteSubscription();
+
+    QString route() const;
+
+Q_SIGNALS:
+    void received(const RoutedMessage &message);
+
+private Q_SLOTS:
+    void routeMessage(const Message &message);
+
+private:
+    friend class Router;
+
+    explicit RouteSubscription(Router *parent = nullptr);
+    void setRoute(const QString &route);
+
+    QPointer<Client> _client;
+    QString _topic;
+    QRegularExpression _regularExpression;
+    QStringList _parameterNames;
+};
+
+} // namespace QMQTT
+
+#endif // QMQTT_ROUTESUBSCRIPTION_H

+ 84 - 0
TransmitterSwitch/common/qmqtt/inc/qmqtt_socketinterface.h

@@ -0,0 +1,84 @@
+/*
+ * qmqtt_socketinterface.h - qmqtt socket interface header
+ *
+ * Copyright (c) 2013  Ery Lee <ery.lee at gmail dot com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright notice,
+ *     this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *   * Neither the name of mqttc nor the names of its contributors may be used
+ *     to endorse or promote products derived from this software without
+ *     specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef QMQTT_SOCKET_INTERFACE_H
+#define QMQTT_SOCKET_INTERFACE_H
+
+#include <qmqtt_global.h>
+
+#include <QObject>
+#include <QHostAddress>
+#include <QString>
+#include <QAbstractSocket>
+#include <QList>
+
+#ifndef QT_NO_SSL
+#include <QSslConfiguration>
+QT_FORWARD_DECLARE_CLASS(QSslError)
+#endif // QT_NO_SSL
+
+QT_FORWARD_DECLARE_CLASS(QIODevice)
+
+namespace QMQTT
+{
+
+class Q_MQTT_EXPORT SocketInterface : public QObject
+{
+    Q_OBJECT
+public:
+    explicit SocketInterface(QObject* parent = nullptr) : QObject(parent) {}
+    virtual ~SocketInterface() {}
+
+    virtual QIODevice* ioDevice() = 0;
+    virtual void connectToHost(const QHostAddress& address, quint16 port) = 0;
+    virtual void connectToHost(const QString& hostName, quint16 port) = 0;
+    virtual void disconnectFromHost() = 0;
+    virtual QAbstractSocket::SocketState state() const = 0;
+    virtual QAbstractSocket::SocketError error() const = 0;
+#ifndef QT_NO_SSL
+    virtual void ignoreSslErrors(const QList<QSslError>& errors) { Q_UNUSED(errors); }
+    virtual void ignoreSslErrors() {}
+    virtual QSslConfiguration sslConfiguration() const { return QSslConfiguration(); }
+    virtual void setSslConfiguration(const QSslConfiguration& config) { Q_UNUSED(config); }
+#endif // QT_NO_SSL
+
+Q_SIGNALS:
+    void connected();
+    void disconnected();
+    void error(QAbstractSocket::SocketError socketError);
+#ifndef QT_NO_SSL
+    void sslErrors(const QList<QSslError>& errors);
+#endif // QT_NO_SSL
+};
+
+}
+
+#endif // QMQTT_SOCKET_INTERFACE_H

+ 62 - 0
TransmitterSwitch/common/qmqtt/inc/qmqtt_timerinterface.h

@@ -0,0 +1,62 @@
+/*
+ * qmqtt_timerinterface.h - qmqtt timer interface header
+ *
+ * Copyright (c) 2013  Ery Lee <ery.lee at gmail dot com>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *   * Redistributions of source code must retain the above copyright notice,
+ *     this list of conditions and the following disclaimer.
+ *   * Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *   * Neither the name of mqttc nor the names of its contributors may be used
+ *     to endorse or promote products derived from this software without
+ *     specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+#ifndef QMQTT_TIMER_INTERFACE_H
+#define QMQTT_TIMER_INTERFACE_H
+
+#include <qmqtt_global.h>
+
+#include <QObject>
+
+namespace QMQTT {
+
+class Q_MQTT_EXPORT TimerInterface : public QObject
+{
+    Q_OBJECT
+public:
+    explicit TimerInterface(QObject* parent = nullptr) : QObject(parent) {}
+    virtual ~TimerInterface() {}
+
+    virtual bool isSingleShot() const = 0;
+    virtual void setSingleShot(bool singleShot) = 0;
+    virtual int interval() const = 0;
+    virtual void setInterval(int msec) = 0;
+    virtual void start() = 0;
+    virtual void stop() = 0;
+
+Q_SIGNALS:
+    void timeout();
+};
+
+}
+
+#endif // QMQTT_TIMER_INTERFACE_H
+

BIN
TransmitterSwitch/common/qmqtt/lib/gcc/5.12.12/Qt5Qmqtt.dll


+ 5 - 0
TransmitterSwitch/common/qmqtt/lib/gcc/5.12.12/Qt5Qmqtt.prl

@@ -0,0 +1,5 @@
+QMAKE_PRL_BUILD_DIR = D:/_SourceFile/qmqtt-1.0.3/build-qmqtt-Desktop_Qt_5_12_12_MinGW_64_bit-Debug/src/mqtt
+QMAKE_PRO_INPUT = qmqtt.pro
+QMAKE_PRL_TARGET = libQt5Qmqtt.a
+QMAKE_PRL_CONFIG = lex yacc depend_includepath testcase_targets import_plugins import_qpa_plugin windows qt_build_extra file_copies qmake_use qt warn_on release link_prl debug_and_release precompile_header shared release no_plugin_manifest win32 mingw gcc copy_dir_files sse2 aesni sse3 ssse3 sse4_1 sse4_2 compile_examples largefile optimize_debug precompile_header rdrnd shani x86SimdAlways prefix_build force_independent utf8_source create_prl link_prl prepare_docs qt_docs_targets no_private_qt_headers_warning QTDIR_build qt_example_installs exceptions_off testcase_exceptions warning_clean release ReleaseBuild Release build_pass qml_debug release ReleaseBuild Release build_pass relative_qt_rpath qmake_cache target_qt c++11 strict_c++ c++14 c++1z c99 c11 split_incpath qt_install_headers need_fwd_pri qt_install_module debug_and_release build_all create_cmake skip_target_version_ext compiler_supports_fpmath create_pc release ReleaseBuild Release build_pass have_target dll exclusive_builds no_autoqmake thread moc resources
+QMAKE_PRL_VERSION = 1.0.3

BIN
TransmitterSwitch/common/qmqtt/lib/gcc/5.12.12/Qt5Qmqttd.dll


+ 5 - 0
TransmitterSwitch/common/qmqtt/lib/gcc/5.12.12/Qt5Qmqttd.prl

@@ -0,0 +1,5 @@
+QMAKE_PRL_BUILD_DIR = D:/_SourceFile/qmqtt-1.0.3/build-qmqtt-Desktop_Qt_5_12_12_MinGW_64_bit-Debug/src/mqtt
+QMAKE_PRO_INPUT = qmqtt.pro
+QMAKE_PRL_TARGET = libQt5Qmqttd.a
+QMAKE_PRL_CONFIG = lex yacc debug depend_includepath testcase_targets import_plugins import_qpa_plugin windows qt_build_extra file_copies qmake_use qt warn_on link_prl debug_and_release precompile_header shared no_plugin_manifest win32 mingw gcc copy_dir_files sse2 aesni sse3 ssse3 sse4_1 sse4_2 compile_examples largefile optimize_debug precompile_header rdrnd shani x86SimdAlways prefix_build force_independent utf8_source create_prl link_prl prepare_docs qt_docs_targets no_private_qt_headers_warning QTDIR_build qt_example_installs exceptions_off testcase_exceptions warning_clean debug DebugBuild Debug build_pass debug qml_debug debug DebugBuild Debug build_pass relative_qt_rpath qmake_cache target_qt c++11 strict_c++ c++14 c++1z c99 c11 split_incpath qt_install_headers need_fwd_pri qt_install_module debug_and_release build_all create_cmake skip_target_version_ext compiler_supports_fpmath create_pc debug DebugBuild Debug build_pass have_target dll no_plist exclusive_builds debug_info no_autoqmake thread moc resources
+QMAKE_PRL_VERSION = 1.0.3

BIN
TransmitterSwitch/common/qmqtt/lib/gcc/5.12.12/libQt5Qmqtt.a


BIN
TransmitterSwitch/common/qmqtt/lib/gcc/5.12.12/libQt5Qmqttd.a


+ 13 - 0
TransmitterSwitch/common/qmqtt/lib/gcc/5.12.12/pkgconfig/Qt5Qmqtt.pc

@@ -0,0 +1,13 @@
+prefix=D:/EngineeringSoftware/Qt/Qt5.12.12/5.12.12/mingw73_64
+exec_prefix=${prefix}
+libdir=${prefix}/lib
+includedir=${prefix}/include
+
+
+Name: Qt5 Qmqtt
+Description: Qt Qmqtt module
+Version: 1.0.3
+Libs: -L${libdir} -lQt5Qmqtt 
+Cflags: -DQT_QMQTT_LIB -I${includedir}/QtQmqtt -I${includedir}
+Requires: Qt5Core Qt5Network
+

BIN
TransmitterSwitch/common/qmqtt/lib/gcc/5.15.2/debug/Qt5Qmqtt.dll


BIN
TransmitterSwitch/common/qmqtt/lib/gcc/5.15.2/debug/Qt5Qmqtt.dll.debug


+ 5 - 0
TransmitterSwitch/common/qmqtt/lib/gcc/5.15.2/debug/Qt5Qmqtt.prl

@@ -0,0 +1,5 @@
+QMAKE_PRL_BUILD_DIR = D:/_SourceFile/qmqtt-1.0.3/build-qmqtt-Desktop_Qt_5_15_2_MinGW_8_1_0_64_bit-Debug/src/mqtt
+QMAKE_PRO_INPUT = qmqtt.pro
+QMAKE_PRL_TARGET = libQt5Qmqtt.a
+QMAKE_PRL_CONFIG = lex yacc depend_includepath testcase_targets import_plugins import_qpa_plugin windows prepare_docs qt_docs_targets qt_build_extra file_copies qmake_use qt warn_on release link_prl debug_and_release precompile_header shared shared release no_plugin_manifest win32 mingw gcc copy_dir_files sse2 aesni sse3 ssse3 sse4_1 sse4_2 compile_examples force_debug_info largefile precompile_header rdrnd shani x86SimdAlways prefix_build force_independent utf8_source create_prl link_prl no_private_qt_headers_warning QTDIR_build qt_example_installs exceptions_off testcase_exceptions warning_clean release ReleaseBuild Release build_pass qml_debug release ReleaseBuild Release build_pass relative_qt_rpath target_qt c++11 strict_c++ c++14 c++1z c99 c11 separate_debug_info split_incpath qt_install_headers need_fwd_pri qt_install_module create_cmake skip_target_version_ext compiler_supports_fpmath create_pc release ReleaseBuild Release build_pass have_target dll exclusive_builds debug_info no_autoqmake thread moc resources
+QMAKE_PRL_VERSION = 1.0.3

BIN
TransmitterSwitch/common/qmqtt/lib/gcc/5.15.2/debug/libQt5Qmqtt.a


+ 13 - 0
TransmitterSwitch/common/qmqtt/lib/gcc/5.15.2/debug/pkgconfig/Qt5Qmqtt.pc

@@ -0,0 +1,13 @@
+prefix=D:/EngineeringSoftware/Qt/Qt5.15.2/5.15.2/mingw81_64
+exec_prefix=${prefix}
+libdir=${prefix}/lib
+includedir=${prefix}/include
+
+
+Name: Qt5 Qmqtt
+Description: Qt Qmqtt module
+Version: 1.0.3
+Libs: -L${libdir} -lQt5Qmqtt 
+Cflags: -DQT_QMQTT_LIB -I${includedir}/QtQmqtt -I${includedir}
+Requires: Qt5Core Qt5Network
+

BIN
TransmitterSwitch/common/qmqtt/lib/gcc/5.15.2/release/Qt5Qmqtt.dll


BIN
TransmitterSwitch/common/qmqtt/lib/gcc/5.15.2/release/Qt5Qmqtt.dll.debug


+ 5 - 0
TransmitterSwitch/common/qmqtt/lib/gcc/5.15.2/release/Qt5Qmqtt.prl

@@ -0,0 +1,5 @@
+QMAKE_PRL_BUILD_DIR = D:/_SourceFile/qmqtt-1.0.3/build-qmqtt-Desktop_Qt_5_15_2_MinGW_8_1_0_64_bit-Release/src/mqtt
+QMAKE_PRO_INPUT = qmqtt.pro
+QMAKE_PRL_TARGET = libQt5Qmqtt.a
+QMAKE_PRL_CONFIG = lex yacc debug depend_includepath testcase_targets import_plugins import_qpa_plugin windows prepare_docs qt_docs_targets qt_build_extra file_copies qmake_use qt warn_on link_prl debug_and_release precompile_header shared shared no_plugin_manifest win32 mingw gcc copy_dir_files sse2 aesni sse3 ssse3 sse4_1 sse4_2 compile_examples force_debug_info largefile precompile_header rdrnd shani x86SimdAlways prefix_build force_independent utf8_source create_prl link_prl no_private_qt_headers_warning QTDIR_build qt_example_installs exceptions_off testcase_exceptions warning_clean debug DebugBuild Debug build_pass qtquickcompiler debug DebugBuild Debug build_pass relative_qt_rpath target_qt c++11 strict_c++ c++14 c++1z c99 c11 separate_debug_info split_incpath qt_install_headers need_fwd_pri qt_install_module create_cmake skip_target_version_ext compiler_supports_fpmath create_pc debug DebugBuild Debug build_pass have_target dll no_plist exclusive_builds debug_info no_autoqmake thread moc resources
+QMAKE_PRL_VERSION = 1.0.3

BIN
TransmitterSwitch/common/qmqtt/lib/gcc/5.15.2/release/libQt5Qmqtt.a


+ 13 - 0
TransmitterSwitch/common/qmqtt/lib/gcc/5.15.2/release/pkgconfig/Qt5Qmqtt.pc

@@ -0,0 +1,13 @@
+prefix=D:/EngineeringSoftware/Qt/Qt5.15.2/5.15.2/mingw81_64
+exec_prefix=${prefix}
+libdir=${prefix}/lib
+includedir=${prefix}/include
+
+
+Name: Qt5 Qmqtt
+Description: Qt Qmqtt module
+Version: 1.0.3
+Libs: -L${libdir} -lQt5Qmqtt 
+Cflags: -DQT_QMQTT_LIB -I${includedir}/QtQmqtt -I${includedir}
+Requires: Qt5Core Qt5Network
+

BIN
TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3.7z


+ 1 - 0
TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.12.12/debug/libQt5Qmqtt.so

@@ -0,0 +1 @@
+libQt5Qmqtt.so.1.0.3

+ 1 - 0
TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.12.12/debug/libQt5Qmqtt.so.1

@@ -0,0 +1 @@
+libQt5Qmqtt.so.1.0.3

+ 1 - 0
TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.12.12/debug/libQt5Qmqtt.so.1.0

@@ -0,0 +1 @@
+libQt5Qmqtt.so.1.0.3

BIN
TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.12.12/debug/libQt5Qmqtt.so.1.0.3


BIN
TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.12.12/debug/libQt5Qmqtt.so.1.0.3.debug


+ 1 - 0
TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.12.12/release/libQt5Qmqtt.so

@@ -0,0 +1 @@
+libQt5Qmqtt.so.1.0.3

+ 1 - 0
TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.12.12/release/libQt5Qmqtt.so.1

@@ -0,0 +1 @@
+libQt5Qmqtt.so.1.0.3

+ 1 - 0
TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.12.12/release/libQt5Qmqtt.so.1.0

@@ -0,0 +1 @@
+libQt5Qmqtt.so.1.0.3

BIN
TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.12.12/release/libQt5Qmqtt.so.1.0.3


BIN
TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.12.12/release/libQt5Qmqtt.so.1.0.3.debug


+ 1 - 0
TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.15.14/debug/libQt5Qmqtt.so

@@ -0,0 +1 @@
+libQt5Qmqtt.so.1.0.3

+ 1 - 0
TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.15.14/debug/libQt5Qmqtt.so.1

@@ -0,0 +1 @@
+libQt5Qmqtt.so.1.0.3

+ 1 - 0
TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.15.14/debug/libQt5Qmqtt.so.1.0

@@ -0,0 +1 @@
+libQt5Qmqtt.so.1.0.3

BIN
TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.15.14/debug/libQt5Qmqtt.so.1.0.3


+ 1 - 0
TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.15.14/release/libQt5Qmqtt.so

@@ -0,0 +1 @@
+libQt5Qmqtt.so.1.0.3

+ 1 - 0
TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.15.14/release/libQt5Qmqtt.so.1

@@ -0,0 +1 @@
+libQt5Qmqtt.so.1.0.3

+ 1 - 0
TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.15.14/release/libQt5Qmqtt.so.1.0

@@ -0,0 +1 @@
+libQt5Qmqtt.so.1.0.3

BIN
TransmitterSwitch/common/qmqtt/lib/linux_gcc8.3/5.15.14/release/libQt5Qmqtt.so.1.0.3


BIN
TransmitterSwitch/common/qmqtt/lib/msvc/5.12.12/Qt5Qmqtt.dll


BIN
TransmitterSwitch/common/qmqtt/lib/msvc/5.12.12/Qt5Qmqtt.exp


BIN
TransmitterSwitch/common/qmqtt/lib/msvc/5.12.12/Qt5Qmqtt.lib


BIN
TransmitterSwitch/common/qmqtt/lib/msvc/5.12.12/Qt5Qmqtt.pdb


+ 5 - 0
TransmitterSwitch/common/qmqtt/lib/msvc/5.12.12/Qt5Qmqtt.prl

@@ -0,0 +1,5 @@
+QMAKE_PRL_BUILD_DIR = D:/_SourceFile/qmqtt-1.0.3/build-qmqtt-Desktop_Qt_5_12_12_MSVC2017_64bit-Debug/src/mqtt
+QMAKE_PRO_INPUT = qmqtt.pro
+QMAKE_PRL_TARGET = Qt5Qmqtt.lib
+QMAKE_PRL_CONFIG = lex yacc depend_includepath testcase_targets import_plugins import_qpa_plugin windows qt_build_extra file_copies qmake_use qt warn_on release link_prl flat debug_and_release precompile_header autogen_precompile_source embed_manifest_dll embed_manifest_exe shared release no_plugin_manifest win32 msvc copy_dir_files sse2 aesni sse3 ssse3 sse4_1 sse4_2 avx avx2 avx512f avx512bw avx512cd avx512dq avx512er avx512ifma avx512pf avx512vbmi avx512vl compile_examples f16c force_debug_info largefile precompile_header rdrnd shani x86SimdAlways prefix_build force_independent utf8_source create_prl link_prl prepare_docs qt_docs_targets no_private_qt_headers_warning QTDIR_build qt_example_installs exceptions_off testcase_exceptions warning_clean release ReleaseBuild Release build_pass c++11 qml_debug release ReleaseBuild Release build_pass relative_qt_rpath qmake_cache target_qt c++11 strict_c++ c++14 c++1z split_incpath qt_install_headers need_fwd_pri qt_install_module debug_and_release build_all create_cmake skip_target_version_ext release ReleaseBuild Release build_pass have_target dll exclusive_builds debug_info no_autoqmake thread moc resources
+QMAKE_PRL_VERSION = 1.0.3

BIN
TransmitterSwitch/common/qmqtt/lib/msvc/5.12.12/Qt5Qmqttd.dll


BIN
TransmitterSwitch/common/qmqtt/lib/msvc/5.12.12/Qt5Qmqttd.exp


BIN
TransmitterSwitch/common/qmqtt/lib/msvc/5.12.12/Qt5Qmqttd.ilk


BIN
TransmitterSwitch/common/qmqtt/lib/msvc/5.12.12/Qt5Qmqttd.lib


BIN
TransmitterSwitch/common/qmqtt/lib/msvc/5.12.12/Qt5Qmqttd.pdb


+ 5 - 0
TransmitterSwitch/common/qmqtt/lib/msvc/5.12.12/Qt5Qmqttd.prl

@@ -0,0 +1,5 @@
+QMAKE_PRL_BUILD_DIR = D:/_SourceFile/qmqtt-1.0.3/build-qmqtt-Desktop_Qt_5_12_12_MSVC2017_64bit-Debug/src/mqtt
+QMAKE_PRO_INPUT = qmqtt.pro
+QMAKE_PRL_TARGET = Qt5Qmqttd.lib
+QMAKE_PRL_CONFIG = lex yacc debug depend_includepath testcase_targets import_plugins import_qpa_plugin windows qt_build_extra file_copies qmake_use qt warn_on link_prl flat debug_and_release precompile_header autogen_precompile_source embed_manifest_dll embed_manifest_exe shared no_plugin_manifest win32 msvc copy_dir_files sse2 aesni sse3 ssse3 sse4_1 sse4_2 avx avx2 avx512f avx512bw avx512cd avx512dq avx512er avx512ifma avx512pf avx512vbmi avx512vl compile_examples f16c force_debug_info largefile precompile_header rdrnd shani x86SimdAlways prefix_build force_independent utf8_source create_prl link_prl prepare_docs qt_docs_targets no_private_qt_headers_warning QTDIR_build qt_example_installs exceptions_off testcase_exceptions warning_clean debug DebugBuild Debug build_pass c++11 debug qml_debug debug DebugBuild Debug build_pass relative_qt_rpath qmake_cache target_qt c++11 strict_c++ c++14 c++1z split_incpath qt_install_headers need_fwd_pri qt_install_module debug_and_release build_all create_cmake skip_target_version_ext debug DebugBuild Debug build_pass have_target dll no_plist exclusive_builds debug_info no_autoqmake thread moc resources
+QMAKE_PRL_VERSION = 1.0.3

+ 7 - 0
TransmitterSwitch/common/qmqtt/lib/msvc/5.12.12/cmake/Qt5Qmqtt/ExtraSourceIncludes.cmake

@@ -0,0 +1,7 @@
+
+list(APPEND _Qt5Qmqtt_OWN_INCLUDE_DIRS
+    "D:/_SourceFile/qmqtt-1.0.3/qmqtt-1.0.3/include" "D:/_SourceFile/qmqtt-1.0.3/qmqtt-1.0.3/include/QtQmqtt"
+)
+set(Qt5Qmqtt_PRIVATE_INCLUDE_DIRS
+    "D:/_SourceFile/qmqtt-1.0.3/qmqtt-1.0.3/include/QtQmqtt/1.0.3" "D:/_SourceFile/qmqtt-1.0.3/qmqtt-1.0.3/include/QtQmqtt/1.0.3/QtQmqtt"
+)

+ 185 - 0
TransmitterSwitch/common/qmqtt/lib/msvc/5.12.12/cmake/Qt5Qmqtt/Qt5QmqttConfig.cmake

@@ -0,0 +1,185 @@
+
+if (CMAKE_VERSION VERSION_LESS 3.1.0)
+    message(FATAL_ERROR "Qt 5 Qmqtt module requires at least CMake version 3.1.0")
+endif()
+
+get_filename_component(_qt5Qmqtt_install_prefix "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
+
+# For backwards compatibility only. Use Qt5Qmqtt_VERSION instead.
+set(Qt5Qmqtt_VERSION_STRING 1.0.3)
+
+set(Qt5Qmqtt_LIBRARIES Qt5::Qmqtt)
+
+macro(_qt5_Qmqtt_check_file_exists file)
+    if(NOT EXISTS "${file}" )
+        message(FATAL_ERROR "The imported target \"Qt5::Qmqtt\" references the file
+   \"${file}\"
+but this file does not exist.  Possible reasons include:
+* The file was deleted, renamed, or moved to another location.
+* An install or uninstall procedure did not complete successfully.
+* The installation package was faulty and contained
+   \"${CMAKE_CURRENT_LIST_FILE}\"
+but not all the files it references.
+")
+    endif()
+endmacro()
+
+macro(_populate_Qmqtt_target_properties Configuration LIB_LOCATION IMPLIB_LOCATION)
+    set_property(TARGET Qt5::Qmqtt APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+
+    set(imported_location "${_qt5Qmqtt_install_prefix}/bin/${LIB_LOCATION}")
+    _qt5_Qmqtt_check_file_exists(${imported_location})
+    set_target_properties(Qt5::Qmqtt PROPERTIES
+        "INTERFACE_LINK_LIBRARIES" "${_Qt5Qmqtt_LIB_DEPENDENCIES}"
+        "IMPORTED_LOCATION_${Configuration}" ${imported_location}
+        # For backward compatibility with CMake < 2.8.12
+        "IMPORTED_LINK_INTERFACE_LIBRARIES_${Configuration}" "${_Qt5Qmqtt_LIB_DEPENDENCIES}"
+    )
+
+    set(imported_implib "${_qt5Qmqtt_install_prefix}/lib/${IMPLIB_LOCATION}")
+    _qt5_Qmqtt_check_file_exists(${imported_implib})
+    if(NOT "${IMPLIB_LOCATION}" STREQUAL "")
+        set_target_properties(Qt5::Qmqtt PROPERTIES
+        "IMPORTED_IMPLIB_${Configuration}" ${imported_implib}
+        )
+    endif()
+endmacro()
+
+if (NOT TARGET Qt5::Qmqtt)
+
+    set(_Qt5Qmqtt_OWN_INCLUDE_DIRS "${_qt5Qmqtt_install_prefix}/include/" "${_qt5Qmqtt_install_prefix}/include/QtQmqtt")
+    set(Qt5Qmqtt_PRIVATE_INCLUDE_DIRS "")
+    include("${CMAKE_CURRENT_LIST_DIR}/ExtraSourceIncludes.cmake" OPTIONAL)
+
+    foreach(_dir ${_Qt5Qmqtt_OWN_INCLUDE_DIRS})
+        _qt5_Qmqtt_check_file_exists(${_dir})
+    endforeach()
+
+    # Only check existence of private includes if the Private component is
+    # specified.
+    list(FIND Qt5Qmqtt_FIND_COMPONENTS Private _check_private)
+    if (NOT _check_private STREQUAL -1)
+        foreach(_dir ${Qt5Qmqtt_PRIVATE_INCLUDE_DIRS})
+            _qt5_Qmqtt_check_file_exists(${_dir})
+        endforeach()
+    endif()
+
+    set(Qt5Qmqtt_INCLUDE_DIRS ${_Qt5Qmqtt_OWN_INCLUDE_DIRS})
+
+    set(Qt5Qmqtt_DEFINITIONS -DQT_QMQTT_LIB)
+    set(Qt5Qmqtt_COMPILE_DEFINITIONS QT_QMQTT_LIB)
+    set(_Qt5Qmqtt_MODULE_DEPENDENCIES "Network;Core")
+
+
+    set(Qt5Qmqtt_OWN_PRIVATE_INCLUDE_DIRS ${Qt5Qmqtt_PRIVATE_INCLUDE_DIRS})
+
+    set(_Qt5Qmqtt_FIND_DEPENDENCIES_REQUIRED)
+    if (Qt5Qmqtt_FIND_REQUIRED)
+        set(_Qt5Qmqtt_FIND_DEPENDENCIES_REQUIRED REQUIRED)
+    endif()
+    set(_Qt5Qmqtt_FIND_DEPENDENCIES_QUIET)
+    if (Qt5Qmqtt_FIND_QUIETLY)
+        set(_Qt5Qmqtt_DEPENDENCIES_FIND_QUIET QUIET)
+    endif()
+    set(_Qt5Qmqtt_FIND_VERSION_EXACT)
+    if (Qt5Qmqtt_FIND_VERSION_EXACT)
+        set(_Qt5Qmqtt_FIND_VERSION_EXACT EXACT)
+    endif()
+
+    set(Qt5Qmqtt_EXECUTABLE_COMPILE_FLAGS "")
+
+    foreach(_module_dep ${_Qt5Qmqtt_MODULE_DEPENDENCIES})
+        if (NOT Qt5${_module_dep}_FOUND)
+            find_package(Qt5${_module_dep}
+                1.0.3 ${_Qt5Qmqtt_FIND_VERSION_EXACT}
+                ${_Qt5Qmqtt_DEPENDENCIES_FIND_QUIET}
+                ${_Qt5Qmqtt_FIND_DEPENDENCIES_REQUIRED}
+                PATHS "${CMAKE_CURRENT_LIST_DIR}/.." NO_DEFAULT_PATH
+            )
+        endif()
+
+        if (NOT Qt5${_module_dep}_FOUND)
+            set(Qt5Qmqtt_FOUND False)
+            return()
+        endif()
+
+        list(APPEND Qt5Qmqtt_INCLUDE_DIRS "${Qt5${_module_dep}_INCLUDE_DIRS}")
+        list(APPEND Qt5Qmqtt_PRIVATE_INCLUDE_DIRS "${Qt5${_module_dep}_PRIVATE_INCLUDE_DIRS}")
+        list(APPEND Qt5Qmqtt_DEFINITIONS ${Qt5${_module_dep}_DEFINITIONS})
+        list(APPEND Qt5Qmqtt_COMPILE_DEFINITIONS ${Qt5${_module_dep}_COMPILE_DEFINITIONS})
+        list(APPEND Qt5Qmqtt_EXECUTABLE_COMPILE_FLAGS ${Qt5${_module_dep}_EXECUTABLE_COMPILE_FLAGS})
+    endforeach()
+    list(REMOVE_DUPLICATES Qt5Qmqtt_INCLUDE_DIRS)
+    list(REMOVE_DUPLICATES Qt5Qmqtt_PRIVATE_INCLUDE_DIRS)
+    list(REMOVE_DUPLICATES Qt5Qmqtt_DEFINITIONS)
+    list(REMOVE_DUPLICATES Qt5Qmqtt_COMPILE_DEFINITIONS)
+    list(REMOVE_DUPLICATES Qt5Qmqtt_EXECUTABLE_COMPILE_FLAGS)
+
+    set(_Qt5Qmqtt_LIB_DEPENDENCIES "Qt5::Network;Qt5::Core")
+
+
+    add_library(Qt5::Qmqtt SHARED IMPORTED)
+
+    set_property(TARGET Qt5::Qmqtt PROPERTY
+      INTERFACE_INCLUDE_DIRECTORIES ${_Qt5Qmqtt_OWN_INCLUDE_DIRS})
+    set_property(TARGET Qt5::Qmqtt PROPERTY
+      INTERFACE_COMPILE_DEFINITIONS QT_QMQTT_LIB)
+
+    set_property(TARGET Qt5::Qmqtt PROPERTY INTERFACE_QT_ENABLED_FEATURES )
+    set_property(TARGET Qt5::Qmqtt PROPERTY INTERFACE_QT_DISABLED_FEATURES )
+
+    set(_Qt5Qmqtt_PRIVATE_DIRS_EXIST TRUE)
+    foreach (_Qt5Qmqtt_PRIVATE_DIR ${Qt5Qmqtt_OWN_PRIVATE_INCLUDE_DIRS})
+        if (NOT EXISTS ${_Qt5Qmqtt_PRIVATE_DIR})
+            set(_Qt5Qmqtt_PRIVATE_DIRS_EXIST FALSE)
+        endif()
+    endforeach()
+
+    if (_Qt5Qmqtt_PRIVATE_DIRS_EXIST)
+        add_library(Qt5::QmqttPrivate INTERFACE IMPORTED)
+        set_property(TARGET Qt5::QmqttPrivate PROPERTY
+            INTERFACE_INCLUDE_DIRECTORIES ${Qt5Qmqtt_OWN_PRIVATE_INCLUDE_DIRS}
+        )
+        set(_Qt5Qmqtt_PRIVATEDEPS)
+        foreach(dep ${_Qt5Qmqtt_LIB_DEPENDENCIES})
+            if (TARGET ${dep}Private)
+                list(APPEND _Qt5Qmqtt_PRIVATEDEPS ${dep}Private)
+            endif()
+        endforeach()
+        set_property(TARGET Qt5::QmqttPrivate PROPERTY
+            INTERFACE_LINK_LIBRARIES Qt5::Qmqtt ${_Qt5Qmqtt_PRIVATEDEPS}
+        )
+    endif()
+
+    _populate_Qmqtt_target_properties(RELEASE "Qt5Qmqtt.dll" "Qt5Qmqtt.lib" )
+
+
+
+    _populate_Qmqtt_target_properties(DEBUG "Qt5Qmqttd.dll" "Qt5Qmqttd.lib" )
+
+
+
+    file(GLOB pluginTargets "${CMAKE_CURRENT_LIST_DIR}/Qt5Qmqtt_*Plugin.cmake")
+
+    macro(_populate_Qmqtt_plugin_properties Plugin Configuration PLUGIN_LOCATION)
+        set_property(TARGET Qt5::${Plugin} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+
+        set(imported_location "${_qt5Qmqtt_install_prefix}/plugins/${PLUGIN_LOCATION}")
+        _qt5_Qmqtt_check_file_exists(${imported_location})
+        set_target_properties(Qt5::${Plugin} PROPERTIES
+            "IMPORTED_LOCATION_${Configuration}" ${imported_location}
+        )
+    endmacro()
+
+    if (pluginTargets)
+        foreach(pluginTarget ${pluginTargets})
+            include(${pluginTarget})
+        endforeach()
+    endif()
+
+
+
+
+_qt5_Qmqtt_check_file_exists("${CMAKE_CURRENT_LIST_DIR}/Qt5QmqttConfigVersion.cmake")
+
+endif()

+ 11 - 0
TransmitterSwitch/common/qmqtt/lib/msvc/5.12.12/cmake/Qt5Qmqtt/Qt5QmqttConfigVersion.cmake

@@ -0,0 +1,11 @@
+
+set(PACKAGE_VERSION 1.0.3)
+
+if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
+    set(PACKAGE_VERSION_COMPATIBLE FALSE)
+else()
+    set(PACKAGE_VERSION_COMPATIBLE TRUE)
+    if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
+        set(PACKAGE_VERSION_EXACT TRUE)
+    endif()
+endif()

BIN
TransmitterSwitch/common/qmqtt/lib/msvc/5.15.2/Qt5Qmqtt.dll


BIN
TransmitterSwitch/common/qmqtt/lib/msvc/5.15.2/Qt5Qmqtt.exp


BIN
TransmitterSwitch/common/qmqtt/lib/msvc/5.15.2/Qt5Qmqtt.lib


BIN
TransmitterSwitch/common/qmqtt/lib/msvc/5.15.2/Qt5Qmqtt.pdb


+ 5 - 0
TransmitterSwitch/common/qmqtt/lib/msvc/5.15.2/Qt5Qmqtt.prl

@@ -0,0 +1,5 @@
+QMAKE_PRL_BUILD_DIR = D:/_SourceFile/qmqtt-1.0.3/build-qmqtt-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug/src/mqtt
+QMAKE_PRO_INPUT = qmqtt.pro
+QMAKE_PRL_TARGET = Qt5Qmqtt.lib
+QMAKE_PRL_CONFIG = lex yacc depend_includepath testcase_targets import_plugins import_qpa_plugin windows prepare_docs qt_docs_targets qt_build_extra file_copies qmake_use qt warn_on release link_prl flat debug_and_release precompile_header autogen_precompile_source embed_manifest_dll embed_manifest_exe shared shared release no_plugin_manifest win32 msvc copy_dir_files sse2 aesni sse3 ssse3 sse4_1 sse4_2 avx avx2 avx512f avx512bw avx512cd avx512dq avx512er avx512ifma avx512pf avx512vbmi avx512vl compile_examples f16c force_debug_info largefile precompile_header rdrnd rdseed shani x86SimdAlways prefix_build force_independent utf8_source create_prl link_prl no_private_qt_headers_warning QTDIR_build qt_example_installs exceptions_off testcase_exceptions warning_clean release ReleaseBuild Release build_pass c++11 qml_debug release ReleaseBuild Release build_pass relative_qt_rpath target_qt c++11 strict_c++ c++14 c++1z split_incpath qt_install_headers need_fwd_pri qt_install_module debug_and_release build_all create_cmake skip_target_version_ext release ReleaseBuild Release build_pass have_target dll exclusive_builds debug_info no_autoqmake thread moc resources
+QMAKE_PRL_VERSION = 1.0.3

BIN
TransmitterSwitch/common/qmqtt/lib/msvc/5.15.2/Qt5Qmqttd.dll


BIN
TransmitterSwitch/common/qmqtt/lib/msvc/5.15.2/Qt5Qmqttd.exp


BIN
TransmitterSwitch/common/qmqtt/lib/msvc/5.15.2/Qt5Qmqttd.ilk


BIN
TransmitterSwitch/common/qmqtt/lib/msvc/5.15.2/Qt5Qmqttd.lib


BIN
TransmitterSwitch/common/qmqtt/lib/msvc/5.15.2/Qt5Qmqttd.pdb


+ 5 - 0
TransmitterSwitch/common/qmqtt/lib/msvc/5.15.2/Qt5Qmqttd.prl

@@ -0,0 +1,5 @@
+QMAKE_PRL_BUILD_DIR = D:/_SourceFile/qmqtt-1.0.3/build-qmqtt-Desktop_Qt_5_15_2_MSVC2019_64bit-Debug/src/mqtt
+QMAKE_PRO_INPUT = qmqtt.pro
+QMAKE_PRL_TARGET = Qt5Qmqttd.lib
+QMAKE_PRL_CONFIG = lex yacc debug depend_includepath testcase_targets import_plugins import_qpa_plugin windows prepare_docs qt_docs_targets qt_build_extra file_copies qmake_use qt warn_on link_prl flat debug_and_release precompile_header autogen_precompile_source embed_manifest_dll embed_manifest_exe shared shared no_plugin_manifest win32 msvc copy_dir_files sse2 aesni sse3 ssse3 sse4_1 sse4_2 avx avx2 avx512f avx512bw avx512cd avx512dq avx512er avx512ifma avx512pf avx512vbmi avx512vl compile_examples f16c force_debug_info largefile precompile_header rdrnd rdseed shani x86SimdAlways prefix_build force_independent utf8_source create_prl link_prl no_private_qt_headers_warning QTDIR_build qt_example_installs exceptions_off testcase_exceptions warning_clean debug DebugBuild Debug build_pass c++11 debug qml_debug debug DebugBuild Debug build_pass relative_qt_rpath target_qt c++11 strict_c++ c++14 c++1z split_incpath qt_install_headers need_fwd_pri qt_install_module debug_and_release build_all create_cmake skip_target_version_ext debug DebugBuild Debug build_pass have_target dll no_plist exclusive_builds debug_info no_autoqmake thread moc resources
+QMAKE_PRL_VERSION = 1.0.3

+ 7 - 0
TransmitterSwitch/common/qmqtt/lib/msvc/5.15.2/cmake/Qt5Qmqtt/ExtraSourceIncludes.cmake

@@ -0,0 +1,7 @@
+
+list(APPEND _Qt5Qmqtt_OWN_INCLUDE_DIRS
+    "D:/_SourceFile/qmqtt-1.0.3/qmqtt-1.0.3/include" "D:/_SourceFile/qmqtt-1.0.3/qmqtt-1.0.3/include/QtQmqtt"
+)
+set(Qt5Qmqtt_PRIVATE_INCLUDE_DIRS
+    "D:/_SourceFile/qmqtt-1.0.3/qmqtt-1.0.3/include/QtQmqtt/1.0.3" "D:/_SourceFile/qmqtt-1.0.3/qmqtt-1.0.3/include/QtQmqtt/1.0.3/QtQmqtt"
+)

+ 250 - 0
TransmitterSwitch/common/qmqtt/lib/msvc/5.15.2/cmake/Qt5Qmqtt/Qt5QmqttConfig.cmake

@@ -0,0 +1,250 @@
+if (CMAKE_VERSION VERSION_LESS 3.1.0)
+    message(FATAL_ERROR "Qt 5 Qmqtt module requires at least CMake version 3.1.0")
+endif()
+
+get_filename_component(_qt5Qmqtt_install_prefix "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE)
+
+# For backwards compatibility only. Use Qt5Qmqtt_VERSION instead.
+set(Qt5Qmqtt_VERSION_STRING 1.0.3)
+
+set(Qt5Qmqtt_LIBRARIES Qt5::Qmqtt)
+
+macro(_qt5_Qmqtt_check_file_exists file)
+    if(NOT EXISTS "${file}" )
+        message(FATAL_ERROR "The imported target \"Qt5::Qmqtt\" references the file
+   \"${file}\"
+but this file does not exist.  Possible reasons include:
+* The file was deleted, renamed, or moved to another location.
+* An install or uninstall procedure did not complete successfully.
+* The installation package was faulty and contained
+   \"${CMAKE_CURRENT_LIST_FILE}\"
+but not all the files it references.
+")
+    endif()
+endmacro()
+
+
+macro(_populate_Qmqtt_target_properties Configuration LIB_LOCATION IMPLIB_LOCATION
+      IsDebugAndRelease)
+    set_property(TARGET Qt5::Qmqtt APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+
+    set(imported_location "${_qt5Qmqtt_install_prefix}/bin/${LIB_LOCATION}")
+    _qt5_Qmqtt_check_file_exists(${imported_location})
+    set(_deps
+        ${_Qt5Qmqtt_LIB_DEPENDENCIES}
+    )
+    set(_static_deps
+    )
+
+    set_target_properties(Qt5::Qmqtt PROPERTIES
+        "IMPORTED_LOCATION_${Configuration}" ${imported_location}
+        # For backward compatibility with CMake < 2.8.12
+        "IMPORTED_LINK_INTERFACE_LIBRARIES_${Configuration}" "${_deps};${_static_deps}"
+    )
+    set_property(TARGET Qt5::Qmqtt APPEND PROPERTY INTERFACE_LINK_LIBRARIES
+                 "${_deps}"
+    )
+
+
+    set(imported_implib "${_qt5Qmqtt_install_prefix}/lib/${IMPLIB_LOCATION}")
+    _qt5_Qmqtt_check_file_exists(${imported_implib})
+    if(NOT "${IMPLIB_LOCATION}" STREQUAL "")
+        set_target_properties(Qt5::Qmqtt PROPERTIES
+        "IMPORTED_IMPLIB_${Configuration}" ${imported_implib}
+        )
+    endif()
+endmacro()
+
+if (NOT TARGET Qt5::Qmqtt)
+
+    set(_Qt5Qmqtt_OWN_INCLUDE_DIRS "${_qt5Qmqtt_install_prefix}/include/" "${_qt5Qmqtt_install_prefix}/include/QtQmqtt")
+    set(Qt5Qmqtt_PRIVATE_INCLUDE_DIRS "")
+    include("${CMAKE_CURRENT_LIST_DIR}/ExtraSourceIncludes.cmake" OPTIONAL)
+
+    foreach(_dir ${_Qt5Qmqtt_OWN_INCLUDE_DIRS})
+        _qt5_Qmqtt_check_file_exists(${_dir})
+    endforeach()
+
+    # Only check existence of private includes if the Private component is
+    # specified.
+    list(FIND Qt5Qmqtt_FIND_COMPONENTS Private _check_private)
+    if (NOT _check_private STREQUAL -1)
+        foreach(_dir ${Qt5Qmqtt_PRIVATE_INCLUDE_DIRS})
+            _qt5_Qmqtt_check_file_exists(${_dir})
+        endforeach()
+    endif()
+
+    set(Qt5Qmqtt_INCLUDE_DIRS ${_Qt5Qmqtt_OWN_INCLUDE_DIRS})
+
+    set(Qt5Qmqtt_DEFINITIONS -DQT_QMQTT_LIB)
+    set(Qt5Qmqtt_COMPILE_DEFINITIONS QT_QMQTT_LIB)
+    set(_Qt5Qmqtt_MODULE_DEPENDENCIES "Network;Core")
+
+
+    set(Qt5Qmqtt_OWN_PRIVATE_INCLUDE_DIRS ${Qt5Qmqtt_PRIVATE_INCLUDE_DIRS})
+
+    set(_Qt5Qmqtt_FIND_DEPENDENCIES_REQUIRED)
+    if (Qt5Qmqtt_FIND_REQUIRED)
+        set(_Qt5Qmqtt_FIND_DEPENDENCIES_REQUIRED REQUIRED)
+    endif()
+    set(_Qt5Qmqtt_FIND_DEPENDENCIES_QUIET)
+    if (Qt5Qmqtt_FIND_QUIETLY)
+        set(_Qt5Qmqtt_DEPENDENCIES_FIND_QUIET QUIET)
+    endif()
+    set(_Qt5Qmqtt_FIND_VERSION_EXACT)
+    if (Qt5Qmqtt_FIND_VERSION_EXACT)
+        set(_Qt5Qmqtt_FIND_VERSION_EXACT EXACT)
+    endif()
+
+    set(Qt5Qmqtt_EXECUTABLE_COMPILE_FLAGS "")
+
+    foreach(_module_dep ${_Qt5Qmqtt_MODULE_DEPENDENCIES})
+        if (NOT Qt5${_module_dep}_FOUND)
+            find_package(Qt5${_module_dep}
+                1.0.3 ${_Qt5Qmqtt_FIND_VERSION_EXACT}
+                ${_Qt5Qmqtt_DEPENDENCIES_FIND_QUIET}
+                ${_Qt5Qmqtt_FIND_DEPENDENCIES_REQUIRED}
+                PATHS "${CMAKE_CURRENT_LIST_DIR}/.." NO_DEFAULT_PATH
+            )
+        endif()
+
+        if (NOT Qt5${_module_dep}_FOUND)
+            set(Qt5Qmqtt_FOUND False)
+            return()
+        endif()
+
+        list(APPEND Qt5Qmqtt_INCLUDE_DIRS "${Qt5${_module_dep}_INCLUDE_DIRS}")
+        list(APPEND Qt5Qmqtt_PRIVATE_INCLUDE_DIRS "${Qt5${_module_dep}_PRIVATE_INCLUDE_DIRS}")
+        list(APPEND Qt5Qmqtt_DEFINITIONS ${Qt5${_module_dep}_DEFINITIONS})
+        list(APPEND Qt5Qmqtt_COMPILE_DEFINITIONS ${Qt5${_module_dep}_COMPILE_DEFINITIONS})
+        list(APPEND Qt5Qmqtt_EXECUTABLE_COMPILE_FLAGS ${Qt5${_module_dep}_EXECUTABLE_COMPILE_FLAGS})
+    endforeach()
+    list(REMOVE_DUPLICATES Qt5Qmqtt_INCLUDE_DIRS)
+    list(REMOVE_DUPLICATES Qt5Qmqtt_PRIVATE_INCLUDE_DIRS)
+    list(REMOVE_DUPLICATES Qt5Qmqtt_DEFINITIONS)
+    list(REMOVE_DUPLICATES Qt5Qmqtt_COMPILE_DEFINITIONS)
+    list(REMOVE_DUPLICATES Qt5Qmqtt_EXECUTABLE_COMPILE_FLAGS)
+
+    # It can happen that the same FooConfig.cmake file is included when calling find_package()
+    # on some Qt component. An example of that is when using a Qt static build with auto inclusion
+    # of plugins:
+    #
+    # Qt5WidgetsConfig.cmake -> Qt5GuiConfig.cmake -> Qt5Gui_QSvgIconPlugin.cmake ->
+    # Qt5SvgConfig.cmake -> Qt5WidgetsConfig.cmake ->
+    # finish processing of second Qt5WidgetsConfig.cmake ->
+    # return to first Qt5WidgetsConfig.cmake ->
+    # add_library cannot create imported target Qt5::Widgets.
+    #
+    # Make sure to return early in the original Config inclusion, because the target has already
+    # been defined as part of the second inclusion.
+    if(TARGET Qt5::Qmqtt)
+        return()
+    endif()
+
+    set(_Qt5Qmqtt_LIB_DEPENDENCIES "Qt5::Network;Qt5::Core")
+
+
+    add_library(Qt5::Qmqtt SHARED IMPORTED)
+
+
+    set_property(TARGET Qt5::Qmqtt PROPERTY
+      INTERFACE_INCLUDE_DIRECTORIES ${_Qt5Qmqtt_OWN_INCLUDE_DIRS})
+    set_property(TARGET Qt5::Qmqtt PROPERTY
+      INTERFACE_COMPILE_DEFINITIONS QT_QMQTT_LIB)
+
+    set_property(TARGET Qt5::Qmqtt PROPERTY INTERFACE_QT_ENABLED_FEATURES )
+    set_property(TARGET Qt5::Qmqtt PROPERTY INTERFACE_QT_DISABLED_FEATURES )
+
+    # Qt 6 forward compatible properties.
+    set_property(TARGET Qt5::Qmqtt
+                 PROPERTY QT_ENABLED_PUBLIC_FEATURES
+                 )
+    set_property(TARGET Qt5::Qmqtt
+                 PROPERTY QT_DISABLED_PUBLIC_FEATURES
+                 )
+    set_property(TARGET Qt5::Qmqtt
+                 PROPERTY QT_ENABLED_PRIVATE_FEATURES
+                 )
+    set_property(TARGET Qt5::Qmqtt
+                 PROPERTY QT_DISABLED_PRIVATE_FEATURES
+                 )
+
+    set_property(TARGET Qt5::Qmqtt PROPERTY INTERFACE_QT_PLUGIN_TYPES "")
+
+    set(_Qt5Qmqtt_PRIVATE_DIRS_EXIST TRUE)
+    foreach (_Qt5Qmqtt_PRIVATE_DIR ${Qt5Qmqtt_OWN_PRIVATE_INCLUDE_DIRS})
+        if (NOT EXISTS ${_Qt5Qmqtt_PRIVATE_DIR})
+            set(_Qt5Qmqtt_PRIVATE_DIRS_EXIST FALSE)
+        endif()
+    endforeach()
+
+    if (_Qt5Qmqtt_PRIVATE_DIRS_EXIST)
+        add_library(Qt5::QmqttPrivate INTERFACE IMPORTED)
+        set_property(TARGET Qt5::QmqttPrivate PROPERTY
+            INTERFACE_INCLUDE_DIRECTORIES ${Qt5Qmqtt_OWN_PRIVATE_INCLUDE_DIRS}
+        )
+        set(_Qt5Qmqtt_PRIVATEDEPS)
+        foreach(dep ${_Qt5Qmqtt_LIB_DEPENDENCIES})
+            if (TARGET ${dep}Private)
+                list(APPEND _Qt5Qmqtt_PRIVATEDEPS ${dep}Private)
+            endif()
+        endforeach()
+        set_property(TARGET Qt5::QmqttPrivate PROPERTY
+            INTERFACE_LINK_LIBRARIES Qt5::Qmqtt ${_Qt5Qmqtt_PRIVATEDEPS}
+        )
+
+        # Add a versionless target, for compatibility with Qt6.
+        if(NOT "${QT_NO_CREATE_VERSIONLESS_TARGETS}" AND NOT TARGET Qt::QmqttPrivate)
+            add_library(Qt::QmqttPrivate INTERFACE IMPORTED)
+            set_target_properties(Qt::QmqttPrivate PROPERTIES
+                INTERFACE_LINK_LIBRARIES "Qt5::QmqttPrivate"
+            )
+        endif()
+    endif()
+
+    _populate_Qmqtt_target_properties(RELEASE "Qt5Qmqtt.dll" "Qt5Qmqtt.lib" TRUE)
+
+
+
+    _populate_Qmqtt_target_properties(DEBUG "Qt5Qmqttd.dll" "Qt5Qmqttd.lib" TRUE)
+
+
+
+    # In Qt 5.15 the glob pattern was relaxed to also catch plugins not literally named Plugin.
+    # Define QT5_STRICT_PLUGIN_GLOB or ModuleName_STRICT_PLUGIN_GLOB to revert to old behavior.
+    if (QT5_STRICT_PLUGIN_GLOB OR Qt5Qmqtt_STRICT_PLUGIN_GLOB)
+        file(GLOB pluginTargets "${CMAKE_CURRENT_LIST_DIR}/Qt5Qmqtt_*Plugin.cmake")
+    else()
+        file(GLOB pluginTargets "${CMAKE_CURRENT_LIST_DIR}/Qt5Qmqtt_*.cmake")
+    endif()
+
+    macro(_populate_Qmqtt_plugin_properties Plugin Configuration PLUGIN_LOCATION
+          IsDebugAndRelease)
+        set_property(TARGET Qt5::${Plugin} APPEND PROPERTY IMPORTED_CONFIGURATIONS ${Configuration})
+
+        set(imported_location "${_qt5Qmqtt_install_prefix}/plugins/${PLUGIN_LOCATION}")
+        _qt5_Qmqtt_check_file_exists(${imported_location})
+        set_target_properties(Qt5::${Plugin} PROPERTIES
+            "IMPORTED_LOCATION_${Configuration}" ${imported_location}
+        )
+
+    endmacro()
+
+    if (pluginTargets)
+        foreach(pluginTarget ${pluginTargets})
+            include(${pluginTarget})
+        endforeach()
+    endif()
+
+
+
+    _qt5_Qmqtt_check_file_exists("${CMAKE_CURRENT_LIST_DIR}/Qt5QmqttConfigVersion.cmake")
+endif()
+
+# Add a versionless target, for compatibility with Qt6.
+if(NOT "${QT_NO_CREATE_VERSIONLESS_TARGETS}" AND TARGET Qt5::Qmqtt AND NOT TARGET Qt::Qmqtt)
+    add_library(Qt::Qmqtt INTERFACE IMPORTED)
+    set_target_properties(Qt::Qmqtt PROPERTIES
+        INTERFACE_LINK_LIBRARIES "Qt5::Qmqtt"
+    )
+endif()

+ 11 - 0
TransmitterSwitch/common/qmqtt/lib/msvc/5.15.2/cmake/Qt5Qmqtt/Qt5QmqttConfigVersion.cmake

@@ -0,0 +1,11 @@
+
+set(PACKAGE_VERSION 1.0.3)
+
+if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
+    set(PACKAGE_VERSION_COMPATIBLE FALSE)
+else()
+    set(PACKAGE_VERSION_COMPATIBLE TRUE)
+    if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION)
+        set(PACKAGE_VERSION_EXACT TRUE)
+    endif()
+endif()

+ 159 - 0
TransmitterSwitch/common/qmqtt/mqttBase/MQTTBase.cpp

@@ -0,0 +1,159 @@
+#include "MQTTBase.h"
+
+#include <QDebug>
+
+
+#include "qmqtt_message.h"
+#include "spdlog/spdlog.h"
+
+
+MQTTBase::MQTTBase(QObject* parent) : QObject(parent)
+{
+    /* 获取日志 */
+    // m_logger = spdlog::get("MQTT");
+    // if(m_logger == nullptr)
+    // {
+    //     SPDLOG_ERROR("获取MQTT logger 失败!");
+    //     exit(-1);
+    // }
+
+    /* 连接信号和槽 */
+    connect(&m_client,SIGNAL(connected()),this,SLOT(do_connected()));
+    connect(&m_client,SIGNAL(disconnected()),this,SLOT(do_disconnect()));
+    connect(&m_client,SIGNAL(error(QMQTT::ClientError)),this,SLOT(do_error(QMQTT::ClientError)));
+    connect(&m_client,SIGNAL(subscribed(QString,quint8)),this,SLOT(do_subscribed(QString, quint8)));
+
+    connect(&m_client,SIGNAL(received(QMQTT::Message)),this,SLOT(do_received(QMQTT::Message)));
+    connect(&m_client, &QMQTT::Client::received, this, &MQTTBase::signal_recvMessage);
+}
+
+/* 设置地址 */
+void MQTTBase::setIPAndPort(const QString& IP, int port)
+{
+    m_mqttIP = IP;
+    m_mqttPort = port;
+    QHostAddress addr = QHostAddress(IP);
+    m_client.setHost(addr);
+    m_client.setPort(port);
+}
+
+/* 设置订阅 */
+void MQTTBase::addSubcribe(const QString& topic, int qos)
+{
+    if(qos > 2)
+    {
+        SPDLOG_ERROR("QoS值不合法:{}", qos);
+        return;
+    }
+    if(m_isConnected)
+    {
+        /* 已连接到MQTT,之前添加的主题已经订阅,现在添加的也直接添加订阅 */
+        m_client.subscribe(topic, qos);
+        m_mapTopic.insert(topic, qos);
+    }else 
+    {
+        /* 还未连接到MQTT,直接加入到订阅列表 */
+        m_mapTopic.insert(topic, qos);
+    }
+}
+
+/* 设置自动重连 */
+void MQTTBase::setAutoReconnect(bool isAuto)
+{
+    m_client.setAutoReconnect(isAuto);
+}
+
+/* 连接到服务器 */
+void MQTTBase::connectToServer()
+{
+    m_client.connectToHost();
+}
+
+/* 获取连接状态 */
+QMQTT::ConnectionState MQTTBase::connectState()
+{
+    return m_client.connectionState();
+}
+
+/* 发送消息 */
+bool MQTTBase::sendMessage(const QString& topic, const QByteArray& message, int qos)
+{
+    if(m_isConnected == false)
+    {
+        SPDLOG_ERROR("MQTT未连接到服务器,发送消息失败");
+        return false;
+    }
+    QMQTT::Message msg(0, topic, message, qos);
+    auto ret = m_client.publish(msg);
+    if(ret != 0)
+    {
+        SPDLOG_ERROR("发送消息失败:{}, 错误代码:{}", topic.toStdString(), ret);
+        return false;
+    }
+
+    return true;
+}
+
+/* 发送消息,设置消息保留 */
+bool MQTTBase::sendMessage(const QString& topic, const QByteArray& message, int qos, bool retain)
+{
+    if(m_isConnected == false)
+    {
+        SPDLOG_ERROR("MQTT未连接到服务器,发送消息失败");
+        return false;
+    }
+    QMQTT::Message msg;
+    msg.setTopic(topic);
+    msg.setPayload(message);
+    msg.setQos(qos);
+    msg.setRetain(retain); // 设置消息保留
+    auto ret = m_client.publish(msg);
+    if(ret != 0)
+    {
+        SPDLOG_ERROR("发送消息失败:{}, 错误代码:{}", topic.toStdString(), ret);
+        return false;
+    }
+
+    return true;
+}
+
+
+
+/* 连接成功 */
+void MQTTBase::do_connected()
+{
+    SPDLOG_INFO("MQTT IP:{} ,Port:{} 连接成功!", m_mqttIP.toStdString(), m_mqttPort);
+    m_isConnected = true;
+    /* 订阅所有的主题 */
+    for(auto& it : m_mapTopic.keys())
+    {
+        auto qos = m_mapTopic.value(it);
+        m_client.subscribe(it, qos);
+    }
+}
+
+/* 断开连接 */
+void MQTTBase::do_disconnect()
+{
+    SPDLOG_INFO("MQTT 断开连接!");
+}
+
+/* 错误 */
+void MQTTBase::do_error(const QMQTT::ClientError error)
+{
+    SPDLOG_ERROR("MQTT 错误:{}", (int)error);
+}
+
+/* 订阅成功 */
+void MQTTBase::do_subscribed(const QString& topic, const quint8 qos)
+{
+    SPDLOG_INFO("MQTT 订阅:{}, QoS:{} 成功", topic.toStdString(), qos);
+}
+
+/* 接收到消息 */
+void MQTTBase::do_received(const QMQTT::Message& message)
+{
+    // SPDLOG_INFO("MQTTBase接收到一条消息:{}", message.topic().toStdString());
+    recvMessage(message);
+}
+

+ 86 - 0
TransmitterSwitch/common/qmqtt/mqttBase/MQTTBase.h

@@ -0,0 +1,86 @@
+#ifndef MQTTBase_H
+#define MQTTBase_H
+
+#include <QObject>
+#include <QMap>
+#include <QChar>
+
+#include "qmqtt.h"
+
+
+/**
+    使用说明:
+        1. 子类可以继承这个类,重新实现 recvMessage 函数,这个函数是接收到消息的回调函数
+        2. 使用SPDLOG日志库,不需要设置日志记录器
+    
+    在C++线程池中使用注意事项:
+        1、这个库依赖的是Qt的网络库,所以需要依赖Qt的事件循环
+        2、如果线程是由C++创建的,需要将这个线程交给Qt的事件循环来管理,在线程中创建一个QEventLoop,然后执行
+           exec()函数,这样才能正常接收、发送消息
+        3、线程归属权问题,QObject及子类有线程归属权问题,在哪个线程中创建的就归属于哪个线程,除非使用moveToThread()修改线程,
+            但是C++线程无法被move,所以推荐这个子线程使用一个壳函数作为线程功能函数,在线程函数中创建功能类,这样整个类的归属权都是子线程
+            class A;
+            void thread_task() { new A; }
+            CPPTP.add_task(thread_task);
+        4、如果功能类是单例或者全局变量,无法在线程创建之后new出来,在线程中连接信号和槽的时候设置为Qt::DirectConnection,
+           这样才能在子线程中调用槽函数
+        5、MQTTBase及其子类,连接服务器的时候依赖信号和槽的返回,因此连接服务器最好在运行exec()之后进行。
+ */
+
+
+
+class MQTTBase : public QObject
+{
+    Q_OBJECT
+public:
+    MQTTBase(QObject* parent = nullptr);
+
+    /* 设置地址 */
+    void setIPAndPort(const QString& IP, int port = 1883);
+    /* 设置订阅 */
+    void addSubcribe(const QString& topic,int qos = 0);
+    /* 设置自动重连 */
+    void setAutoReconnect(bool isAuto = true);
+    /* 连接到服务器 */
+    void connectToServer();
+    /* 断开连接 */
+    void disconnectFromServer() {m_client.disconnectFromHost();}
+    /* 获取连接状态 */
+    QMQTT::ConnectionState connectState();
+    /* 发送消息 */
+    bool sendMessage(const QString& topic, const QByteArray& message, int qos = 0);
+    /* 发送消息,设置消息保留 */
+    bool sendMessage(const QString& topic, const QByteArray& message, int qos = 0, bool retain = false);
+    
+    
+signals:
+    /* 接收到消息,对消息进行了转发 */
+    // void signal_recvMessage(const QString& message);
+    /* 原地转发消息 */
+    void signal_recvMessage(const QMQTT::Message& message);
+
+protected:
+    /* 接收到消息,子类继承这个解析消息数据 */
+    virtual void recvMessage(const QMQTT::Message& message) = 0;
+
+protected slots:
+    void do_connected();                            /* 连接成功 */
+    void do_disconnect();                           /* 断开连接 */
+    void do_error(const QMQTT::ClientError error);  /* 错误 */
+    void do_subscribed(const QString& topic, const quint8 qos);     /* 订阅成功 */
+
+    void do_received(const QMQTT::Message& message);/* 接收到消息,子类继承这个解析消息数据 */
+
+
+protected:
+    // std::shared_ptr<spdlog::logger> m_logger = nullptr;
+    bool m_isConnected = false;                     /* 是否连接成功 */
+    QString m_mqttIP;                               /* MQTT服务器IP */
+    int m_mqttPort;                                 /* MQTT服务器端口 */
+
+    QMap<QString, int> m_mapTopic;                  /* 订阅的主题和QOS */
+    QMQTT::Client m_client;                         /* MQTT客户端 */
+};
+
+
+#endif /* MQTTBase_H */

BIN
TransmitterSwitch/common/qmqtt/qmqtt.zip


+ 7 - 2
TransmitterSwitch/transmitterswitch.cpp

@@ -120,9 +120,13 @@ TransmitterSwitch::~TransmitterSwitch()
 /* 初始化webAPI,重载版 */
 void TransmitterSwitch::initTS(const InitData& data)
 {
-    setWebAPIInfo(data.url, data.serverID, data.serverKey);
+    m_fromMQTT.initMQTT();
+
+    // setWebAPIInfo(data.url, data.serverID, data.serverKey);
+    setWebAPIInfo(m_fromMQTT.m_webAPIUrl, m_fromMQTT.m_webAPIID, data.serverKey);
     /* 设置权限 */
-    setUserPermission(data.userPermission);
+    // setUserPermission(data.userPermission);
+    setUserPermission(1);
 }
 
 
@@ -1235,6 +1239,7 @@ void TransmitterSwitch::do_callBack(int actionID)
 
 
 
+
 /* 添加一个频率,包括左侧按钮和右侧卡片 */
 void TransmitterSwitch::createOneCard(const ChannelInfo& chnInfo)
 {

+ 6 - 0
TransmitterSwitch/transmitterswitch.h

@@ -8,6 +8,7 @@
 
 #include "flowlayout.h"
 #include "TransmitterSwitchInfo.h"
+#include "FromMQTT.h"
 
 class WidgetItems;
 class FromWebAPI;
@@ -179,6 +180,11 @@ private:
     const int m_cardVerSpacing = 12;        /* 卡片间的纵向间距 */
     int m_cardHorNumber = 4;          /* 卡片的横向数量 */
     int m_cardVerNumber = 2;          /* 卡片的纵向数量 */
+
+    /* ------------------------------- MQTT相关数据 ------------------------------- */
+    FromMQTT m_fromMQTT;                  /* MQTT */
+    
+    
 };
 
 #endif // TRANSMITTERSWITCH_H