/*
 * @Author: your name
 * @Date: 2023-07-23 19:47:38
 * @LastEditors: your name
 * @LastEditTime: 2023-07-23 19:49:54
 * @Description: file content
 * @FilePath: /shigetai_lirs/nvidia_ascend_engine/common_engine/DataUploadEngine/DeviceStatusUpSerEngine.h
 * 
 * Copyright © 2022 <Shandong Matrix Software Engineering Co., Ltd>
 */
/**
 * 上传结果到http服务器
 * */

#ifndef DeviceStatusUpSerEngine_H
#define DeviceStatusUpSerEngine_H

#include "AppCommon.h"
#include "MyYaml.h"
#include "EngineBase.h"
#include "EngineFactory.h"

#include <mutex>
#include <curl/curl.h>
#include <libssh2.h>
#include "json/json.h"

using namespace ai_matrix;

class DeviceStatusUpSerEngine : public ai_matrix::EngineBase
{
public:
    DeviceStatusUpSerEngine();
    ~DeviceStatusUpSerEngine();

    APP_ERROR Init() override;
    APP_ERROR DeInit() override;
    APP_ERROR Process() override;

private:
    //libcurl回调函数
    static size_t WriteCallBack(void *pBuffer, size_t size, size_t nmemb, std::string &strResp);
    // 调用http接口获取token
    bool GetToken(std::string &strBladeAuth);
    //列车信息提交http接口
    bool ResultToHttpSrv(Json::Value &jvRequest);

    std::string strPort0_;
    std::string strURL_;
    CURL *pCurl_ = nullptr;
    int iNoDataCnt_ = 0;
    std::string strPoundNo_;
    std::string strGetTokenURL_;
};

ENGINE_REGIST(DeviceStatusUpSerEngine)

#endif
