httpthread.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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,QString url1,QString key1,QString signature1);
  24. signals:
  25. void dataLog(QString log);
  26. void mqttData(QString mqtt_msg);
  27. void mqttEvent(QString mqtt_event);
  28. void appendSql(QString sql);
  29. public slots:
  30. void time_out();
  31. void finishedSlot(QNetworkReply *reply);
  32. void finishedSlot1(QNetworkReply *reply);
  33. void reply_timeout();
  34. void reply_timeout1();
  35. private:
  36. bool isWaiting,isWaiting1;
  37. bool keep;
  38. int minute,hour,minute1;
  39. QString startTime;
  40. QString endTime;
  41. QNetworkAccessManager *networkManager,*networkManager1;
  42. QSslConfiguration config;
  43. QTimer *timer;
  44. QString url, key, signature, url1, key1, signature1;
  45. };
  46. #endif // HTTPTHREAD_H