#pragma once #include "IHttpFunc.h" #include "SimpleString.h" #include #include static void LogCallback(const char* msg) {} #define TOKEN_GETURL_ERR 0x10A00001 #define GET_CHANNELID_ERR 0x10A00002 #define GET_TOKEN_ERR 0x10A00003 struct QueryTokenHTTPRet : CHTTPRet { QueryTokenHTTPRet() {} std::string m_token; virtual bool Parse(std::string strData); }; struct QueryTokenHTTPReq : CHTTPReq { QueryTokenHTTPReq() { m_timeOut = 8000; m_withToken = false; } std::string channelId; std::string tokenSecret; std::string businessId; std::string installVersion; QueryTokenHTTPRet ret; virtual string ToJson(); }; struct TerminalCfgRet : CHTTPRet { TerminalCfgRet() :m_result(false), update(false) { center_version = root_version = shell_version = ""; } bool m_result; std::string terminalNo; string center_version; string root_version; string shell_version; bool center_update; bool center_reset; bool root_update; std::map> center_config; std::map> root_config; std::map> shell_config; bool update; bool shell_update; virtual bool Parse(string strData); static std::string ConvertMapMapConfigToStr(const std::map>& tmpMap); static bool saveMapMapToFile(const std::string fileName, const std::map>& tmpMap); static string readStrFromFile(const std::string fileName); }; struct TerminalCfgReq : CHTTPReq { TerminalCfgReq() { m_timeOut = 20; } string terminalNo; string center_version; string root_version; string shell_version; std::map> center_config; std::map> root_config; std::map> shell_config; TerminalCfgRet ret; virtual string ToJson(); }; struct VTMErrMsgCfgRet : CHTTPRet { VTMErrMsgCfgRet() {}; bool m_result; std::string error_msg; std::vector errorCodeArr; std::vector descriptionArr; std::vector remarkArr; std::string version_no; int total; int page_total; //bool update; //not care about this param, it can not keep the same sequences with server by the pages. virtual bool Parse(string strData); std::pair saveVTMErrToFile(const std::string fileName); }; struct VTMErrMsgCfgReq : CHTTPReq { VTMErrMsgCfgReq() { m_timeOut = 20; } std::string terminal_no; int page_num; VTMErrMsgCfgRet ret; virtual string ToJson(); }; struct TerminalVerUpdateReq :CHTTPReq { TerminalVerUpdateReq() { m_timeOut = 20; } string terminal_no; string center_config_version; string root_config_version; string shell_config_version; string terminal_update_time; virtual string ToJson(); }; struct TerminalVerUpdateRet : CHTTPRet { TerminalVerUpdateRet() :m_result(false) {} bool m_result; virtual bool Parse(string strData); }; struct Token_Save { static std::string channelId; static std::string token; static void getToken(std::string& t_channelId, std::string& t_token); }; std::pair GetTerminalCfgFromUrl(CSimpleString url, const std::string& terminalNo, const std::string& center_version, const std::string& root_version, const std::string& shell_version, const std::map>& tmp_centerConfig, const std::map>& tmp_rootConfig, const std::map>& tmd_shellConfig); std::pair GetVTMErrMsgCfgFromUrl(CSimpleString url, const std::string& terminalNo); std::pair ConvertStrToDeviceConfigMap(std::string input, std::map>& m_deviceConfig); bool UploadTerminalVersionFromUrl(CSimpleString url, std::string terminalNo, std::string center_config_version, std::string root_config_version, std::string shell_config_version); std::pair refreshToken(std::string terminalNo, std::string installVersion, std::string channelId, std::string tokenSecret, std::string commonUrl); //std::pair readTerminalNo_byHttpServer(); int ConvertStrToVTMErrMsg(std::string input, CAutoArray& strErrorCodeArr , CAutoArray& strDescriptionArr, CAutoArray& strRemarkArr);