--- a/src/MainWindow.h Sun Mar 27 22:03:18 2022 +0200 +++ b/src/MainWindow.h Mon Mar 28 16:54:08 2022 +0200 @@ -52,6 +52,7 @@ #include <QMap> #include <QPrinter> #include <QWidget> +#include <QWebSocket> typedef struct IniMySQL @@ -67,16 +68,15 @@ static IniMySQL dbProd; static IniMySQL dbDev; -typedef struct IniMQTT + +typedef struct IniWS { QString host; ///< MQTT host QString port; ///< MQTT port - QString user; ///< MQTT username - QString pass; ///< MQTT password -} IniMQTT; +} IniWS; -static IniMQTT mqttProd; -static IniMQTT mqttDev; +static IniWS wsProd; +static IniWS wsDev; namespace Ui { @@ -144,6 +144,20 @@ private: Ui::MainWindow *ui; + QWebSocket *webSocket; + + /** + * @brief Open Websocket connection. + * @param develop Is true if connect to develop server, else production. + * @return Returns true if succes. + */ + bool openWS(bool develop); + + void wsConnected(); + + void wsClosed(); + + void wsTextMessageReceived(QString message); /** * @brief Read user settings for the MySQL connection.