/** * 上传结果到http服务器 * */ #ifndef RESULTTOHTTPSRVENGINE_H #define RESULTTOHTTPSRVENGINE_H #include "AppCommon.h" #include "MyYaml.h" #include "EngineBase.h" #include "EngineFactory.h" #include #include #include #include "json/json.h" using namespace ai_matrix; class ResultToHttpSrvEngine : public ai_matrix::EngineBase { public: ResultToHttpSrvEngine(); ~ResultToHttpSrvEngine(); 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); //处理上传失败的信息 void DealHttpFailInfo(); // 保存http上传失败的信息 bool SaveHttpFailInfo(Json::Value &jvRequest, std::string &strFilePath); std::string strPort0_; std::string strUsername_; std::string strPassword_; std::string strURL_; std::string strGetTokenURL_; std::string strImageSrv_; CURL *pCurl_ = nullptr; int iNoDataCnt_ = 0; std::string strFailSavePath_; std::string strFailSaveBakPath_; std::string strPoundNo_; }; ENGINE_REGIST(ResultToHttpSrvEngine) #endif