#ifndef HTTPTHREAD_H
#define HTTPTHREAD_H

#include <QObject>
#include <QDateTime>
#include <QTimer>
#include <QNetworkAccessManager>
#include <QNetworkRequest>
#include <QNetworkReply>
#include <QSslConfiguration>
#include <QJsonDocument>
#include <QJsonArray>
#include <QJsonObject>
#include <QJsonValue>
#include <QJsonParseError>
#include "../QReplyTimeout.h"

class HttpThread : public QObject
{
    Q_OBJECT
public:
    explicit HttpThread(QObject *parent = nullptr);
    void run();
    void stop();
    void app_info(QString url,QString key,QString signature,QString url1,QString key1,QString signature1);

signals:
    void dataLog(QString log);
    void mqttData(QString mqtt_msg);
    void mqttEvent(QString mqtt_event);
    void appendSql(QString sql);

public slots:
    void time_out();
    void finishedSlot(QNetworkReply *reply);
    void finishedSlot1(QNetworkReply *reply);
    void reply_timeout();
    void reply_timeout1();

private:
    bool isWaiting,isWaiting1;
    bool keep;
    int minute,hour,minute1;
    QString startTime;
    QString endTime;
    QNetworkAccessManager *networkManager,*networkManager1;
    QSslConfiguration config;
    QTimer *timer;
    QString url, key, signature, url1, key1, signature1;

};

#endif // HTTPTHREAD_H
