12345678910111213141516171819202122232425262728293031323334 |
- #ifndef MQTTALARMDATATHREAD_H
- #define MQTTALARMDATATHREAD_H
- #include <QThread>
- #include <qmqtt.h>
- #include <QDateTime>
- #include <QTimer>
- class MqttAlarmDataThread : public QThread
- {
- Q_OBJECT
- public:
- explicit MqttAlarmDataThread(QObject *parent = nullptr);
- void run();
- void mqtt_conf(QString ip,QString port,QString username,QString password);
- signals:
- void mq_log(QString log);
- void sendMqttData(QString topic,QByteArray data);
- public slots:
- void time_out();
- void onConnected();
- void onReceived(const QMQTT::Message &message);
- private:
- QString mqtt_ip,mqtt_port,mqtt_username,mqtt_passwd;
- QTimer *timer;
- QMQTT::Client *m_client;
- };
- #endif // MQTTALARMDATATHREAD_H
|