httpthread.h 879 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. public slots:
  27. void time_out();
  28. void finishedSlot(QNetworkReply *reply);
  29. void reply_timeout();
  30. private:
  31. bool isWaiting;
  32. bool keep;
  33. int minute,hour;
  34. QNetworkAccessManager *networkManager;
  35. QSslConfiguration config;
  36. QTimer *timer;
  37. };
  38. #endif // HTTPTHREAD_H