httpthread.h 974 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. void app_info(QString url,QString key,QString signature);
  24. signals:
  25. void dataLog(QString log);
  26. void mqttData(QString mqtt_msg);
  27. public slots:
  28. void time_out();
  29. void finishedSlot(QNetworkReply *reply);
  30. void reply_timeout();
  31. private:
  32. bool isWaiting;
  33. bool keep;
  34. int minute,hour;
  35. QNetworkAccessManager *networkManager;
  36. QSslConfiguration config;
  37. QTimer *timer;
  38. QString url, key, signature;
  39. };
  40. #endif // HTTPTHREAD_H