-
Notifications
You must be signed in to change notification settings - Fork 0
/
mqttwidget.h
57 lines (48 loc) · 1.12 KB
/
mqttwidget.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef MQTTWIDGET_H
#define MQTTWIDGET_H
#include <QWidget>
#include <QMenu>
#include <QSslSocket>
#include <QtMqtt/QMqttClient>
#include <QFileDialog>
#include "tabledelegate.h"
#include "mqttexception.h"
//#include "abstractmqtt.h"
namespace Ui {
class MqttWidget;
}
struct MqttParams
{
QString server;
QString deviceSK;
QString deviceID;
};
class MqttRequest;
class MqttResponse;
class MqttWidget : public QWidget
{
Q_OBJECT
public:
explicit MqttWidget(QWidget *parent = nullptr);
~MqttWidget();
void initConnect();
void initMqttEvents();
void initStatus();
void initTabOrder();
void setOnlineStatus(bool flag);
void addHistory(QString event, QString topic, QString msg, QString qos, QString retain);
private:
MqttResponse doRegister(MqttRequest request) noexcept(false);
private:
Ui::MqttWidget *ui;
QMenu *m_menu;
QAction *m_clear;
TopicModel *m_model;
QSslSocket *m_ssl;
QMqttClient *m_client;
//AbstractMqtt *m_client;
MqttParams *m_params;
MqttRequest *m_request;
MqttResponse *m_response;
};
#endif // MQTTWIDGET_H