//
// Created by Mr.V on 2024/4/3.
//

#ifndef TRAIN_RFID_UPRESULTTHREAD_H
#define TRAIN_RFID_UPRESULTTHREAD_H

#include <QThread>
#include "common.h"
#include "MQueue.h"
#include "httplib.h"
#include "json.h"
#include "ConfigUtil.h"

using namespace ai_matrix;

class UpResultThread : public QThread{
    Q_OBJECT
public:
    ~UpResultThread() {};

    UpResultThread(MQueue<TrainInfo> *queueTrainInfo, QObject *parent = nullptr);

    void run() override;

private:
    MQueue<TrainInfo> *queueTrainInfo_ = nullptr;
    ai_matrix::BaseConfig baseConfig_;
    ai_matrix::InterfaceConfig interfaceConfig_;
    std::string webToken;        //授权信息

    bool upWeb(TrainInfo &trainInfo);
    bool getToken();

signals:
    void DebugSignals(const QString &info);
    void InfoSignals(const QString &info);
    void WarnSignals(const QString &info);
    void ErrorSignals(const QString &info);
};


#endif //TRAIN_RFID_UPRESULTTHREAD_H
