1234567891011121314151617181920212223242526272829303132333435 |
- #ifndef MQTTEVENTDATATHREAD_H
- #define MQTTEVENTDATATHREAD_H
- #include <QThread>
- #include <qmqtt.h>
- #include <QDateTime>
- #include <QTimer>
- class MqttEventDataThread : public QThread
- {
- Q_OBJECT
- public:
- explicit MqttEventDataThread(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 // MQTTEVENTDATATHREAD_H
|