httpthread.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #ifndef HTTPTHREAD_H
  2. #define HTTPTHREAD_H
  3. #include <QObject>
  4. #include <QDateTime>
  5. #include <QTimer>
  6. #include <QNetworkAccessManager>
  7. #include <QNetworkRequest>
  8. #include <QNetworkReply>
  9. #include <QSslConfiguration>
  10. #include <QJsonDocument>
  11. #include <QJsonArray>
  12. #include <QJsonObject>
  13. #include <QJsonValue>
  14. #include <QJsonParseError>
  15. #include "../QReplyTimeout.h"
  16. class HttpThread : public QObject
  17. {
  18. Q_OBJECT
  19. public:
  20. explicit HttpThread(QObject *parent = nullptr);
  21. void run();
  22. void stop();
  23. signals:
  24. void dataLog(QString log);
  25. void mqttData(QString mqtt_msg);
  26. void mqttAlarm(QString mqtt_alarm);
  27. void appendSql(QString sql);
  28. public slots:
  29. void time_out();
  30. void finishedSlot(QNetworkReply *reply);
  31. void finishedSlot1(QNetworkReply *reply);
  32. void finishedSlot2(QNetworkReply *reply);
  33. void reply_timeout();
  34. void reply_timeout1();
  35. void reply_timeout2();
  36. private:
  37. bool isWaiting,isWaiting1,isWaiting2;
  38. bool keep;
  39. int minute,minute1,minute2;
  40. QString startTime,endTime;
  41. QList<int> list;
  42. QNetworkAccessManager *networkManager,*networkManager1,*networkManager2;
  43. QSslConfiguration config;
  44. QTimer *timer;
  45. };
  46. #endif // HTTPTHREAD_H