clientthread.h 690 B

123456789101112131415161718192021222324252627282930313233343536
  1. #ifndef CLIENTTHREAD_H
  2. #define CLIENTTHREAD_H
  3. #include <QThread>
  4. #include <QTcpSocket>
  5. #include <QDateTime>
  6. #include <QHostAddress>
  7. class ClientThread : public QThread
  8. {
  9. Q_OBJECT
  10. public:
  11. explicit ClientThread(QObject *parent = nullptr);
  12. void run();
  13. void stop();
  14. void deviceStatus();
  15. void readData(QTcpSocket *so,QString devCode);
  16. void controlData(QString deviceId,int switchStatus);
  17. signals:
  18. void mqttData(QString msg);
  19. void dataListLog(QString log);
  20. void responseMsg(QString msg);
  21. public slots:
  22. private:
  23. QTcpSocket *so;
  24. bool keep;
  25. QList<QByteArray> CmdList;
  26. QString devCode;
  27. int switch_status;
  28. };
  29. #endif // CLIENTTHREAD_H