#ifndef MQTTSUB_H #define MQTTSUB_H #include #include #include #include class MqttSub : public QThread { Q_OBJECT public: explicit MqttSub(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; int minute; }; #endif // MQTTSUB_H