|
@@ -15,7 +15,7 @@ using namespace std;
|
|
|
|
|
|
namespace HttpStruct
|
|
|
{
|
|
|
- //发送文件hash列表接口
|
|
|
+ //鍙戦€佹枃浠秇ash鍒楄〃鎺ュ彛
|
|
|
struct SendSM3TaskReq : CHTTPReq {
|
|
|
string m_reqStr;
|
|
|
string ToJson() {
|
|
@@ -30,7 +30,7 @@ namespace HttpStruct
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- //更新任务状态接口
|
|
|
+ //鏇存柊浠诲姟鐘舵€佹帴鍙�
|
|
|
struct UpdateTaskStatusReq : CHTTPReq {
|
|
|
string m_reqStr;
|
|
|
string ToJson() {
|
|
@@ -45,7 +45,7 @@ namespace HttpStruct
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- //查询当前任务
|
|
|
+ //鏌ヨ�褰撳墠浠诲姟
|
|
|
struct QueryCurrTaskReq : CHTTPReq {
|
|
|
string m_reqStr;
|
|
|
string ToJson() {
|
|
@@ -60,7 +60,7 @@ namespace HttpStruct
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- //查询新任务
|
|
|
+ //鏌ヨ�鏂颁换鍔�
|
|
|
struct QueryNewTaskReq : CHTTPReq {
|
|
|
string m_reqStr;
|
|
|
string ToJson() {
|
|
@@ -75,7 +75,7 @@ namespace HttpStruct
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- //断点下载升级包
|
|
|
+ //鏂�偣涓嬭浇鍗囩骇鍖�
|
|
|
struct DownloadPackTaskRet{
|
|
|
long content_length;
|
|
|
long origin_file_length;
|
|
@@ -87,7 +87,7 @@ namespace HttpStruct
|
|
|
|
|
|
|
|
|
|
|
|
-// 升级任务状态机
|
|
|
+// 鍗囩骇浠诲姟鐘舵€佹満
|
|
|
class CUpgradeTaskFSM : public FSMImpl<CUpgradeTaskFSM>, public IFSMStateHooker, public ISysVarListener
|
|
|
{
|
|
|
public:
|
|
@@ -125,7 +125,7 @@ public:
|
|
|
|
|
|
struct SendSM3TaskEvent:public FSMEvent
|
|
|
{
|
|
|
- bool isSucc;//是否写入成功
|
|
|
+ bool isSucc;//鏄�惁鍐欏叆鎴愬姛
|
|
|
SendSM3TaskEvent(bool isSendSucc)
|
|
|
: FSMEvent(Event_EndSendSM3Task), isSucc(isSendSucc)
|
|
|
{}
|
|
@@ -134,7 +134,7 @@ public:
|
|
|
|
|
|
struct UpdateTaskStatusEvent:public FSMEvent
|
|
|
{
|
|
|
- bool isSucc;//是否更新成功
|
|
|
+ bool isSucc;//鏄�惁鏇存柊鎴愬姛
|
|
|
UpdateTaskStatusEvent(bool isSendSucc)
|
|
|
: FSMEvent(Event_EndUpdateTask), isSucc(isSendSucc)
|
|
|
{}
|
|
@@ -142,8 +142,8 @@ public:
|
|
|
|
|
|
struct QueryCurrTaskEvent:public FSMEvent
|
|
|
{
|
|
|
- bool isSucc;//是否查询成功
|
|
|
- bool isTask_valid;//任务是否有效
|
|
|
+ bool isSucc;//鏄�惁鏌ヨ�鎴愬姛
|
|
|
+ bool isTask_valid;//浠诲姟鏄�惁鏈夋晥
|
|
|
QueryCurrTaskEvent(bool isSendSucc,bool isValid)
|
|
|
: FSMEvent(Event_EndQueryCurrTask), isSucc(isSendSucc),isTask_valid(isValid)
|
|
|
{}
|
|
@@ -151,7 +151,7 @@ public:
|
|
|
|
|
|
struct QueryNewTaskEvent:public FSMEvent
|
|
|
{
|
|
|
- bool isSucc;//是否查询成功
|
|
|
+ bool isSucc;//鏄�惁鏌ヨ�鎴愬姛
|
|
|
QueryNewTaskEvent(bool isSendSucc)
|
|
|
: FSMEvent(Event_EndPoll), isSucc(isSendSucc)
|
|
|
{}
|
|
@@ -159,7 +159,7 @@ public:
|
|
|
|
|
|
struct QueryNewContinueTaskEvent:public FSMEvent
|
|
|
{
|
|
|
- int retParam;//是否查询成功
|
|
|
+ int retParam;//鏄�惁鏌ヨ�鎴愬姛
|
|
|
QueryNewContinueTaskEvent(int ret)
|
|
|
: FSMEvent(Event_EndContinuePoll)
|
|
|
{
|
|
@@ -169,7 +169,7 @@ public:
|
|
|
|
|
|
struct QueryNewPreTaskEvent:public FSMEvent
|
|
|
{
|
|
|
- bool isSucc;//是否查询成功
|
|
|
+ bool isSucc;//鏄�惁鏌ヨ�鎴愬姛
|
|
|
QueryNewPreTaskEvent(bool isSendSucc)
|
|
|
: FSMEvent(Event_EndPrePoll), isSucc(isSendSucc)
|
|
|
{}
|
|
@@ -177,8 +177,8 @@ public:
|
|
|
|
|
|
struct QueryTaskStatusEvent:public FSMEvent
|
|
|
{
|
|
|
- bool isSucc;//是否查询成功
|
|
|
- bool isTask_valid;//任务是否有效
|
|
|
+ bool isSucc;//鏄�惁鏌ヨ�鎴愬姛
|
|
|
+ bool isTask_valid;//浠诲姟鏄�惁鏈夋晥
|
|
|
QueryTaskStatusEvent(bool isSendSucc,bool isValid)
|
|
|
: FSMEvent(Event_EndQueryTaskStatus), isSucc(isSendSucc),isTask_valid(isValid)
|
|
|
{}
|
|
@@ -194,7 +194,7 @@ public:
|
|
|
|
|
|
struct DownloadPackTaskFailEvent:public FSMEvent
|
|
|
{
|
|
|
- string errMsg;//错误信息
|
|
|
+ string errMsg;//閿欒�淇℃伅
|
|
|
DownloadPackTaskFailEvent(string errorMsg)
|
|
|
: FSMEvent(Event_Download_Fail), errMsg(errorMsg)
|
|
|
{}
|
|
@@ -228,79 +228,79 @@ public:
|
|
|
|
|
|
struct CInstallStep
|
|
|
{
|
|
|
- //不存储到运行时
|
|
|
- int stepSeq; //步骤序号
|
|
|
- CSimpleStringA cmdType; //升级安装需执行命令类型:Delete、Copy、Run
|
|
|
- int cmdFail; //0:执行失败认为升级失败 1:执行失败忽略继续升级
|
|
|
- CSimpleStringA srcPathType; //0:相对路径 1:绝对路径 2:当前版本相对路径 3:升级包相对路径
|
|
|
+ //涓嶅瓨鍌ㄥ埌杩愯�鏃�
|
|
|
+ int stepSeq; //姝ラ�搴忓彿
|
|
|
+ CSimpleStringA cmdType; //鍗囩骇瀹夎�闇€鎵ц�鍛戒护绫诲瀷:Delete銆丆opy銆丷un
|
|
|
+ int cmdFail; //0锛氭墽琛屽け璐ヨ�涓哄崌绾уけ璐� 1锛氭墽琛屽け璐ュ拷鐣ョ户缁�崌绾�
|
|
|
+ CSimpleStringA srcPathType; //0锛氱浉瀵硅矾寰� 1锛氱粷瀵硅矾寰� 2锛氬綋鍓嶇増鏈�浉瀵硅矾寰� 3锛氬崌绾у寘鐩稿�璺�緞
|
|
|
CSimpleStringA srcPath;
|
|
|
- CSimpleStringA dstPathType; //0:相对路径 1:绝对路径 2:当前版本相对路径 3:升级版本相对路径 4:升级包相对路径
|
|
|
+ CSimpleStringA dstPathType; //0锛氱浉瀵硅矾寰� 1锛氱粷瀵硅矾寰� 2锛氬綋鍓嶇増鏈�浉瀵硅矾寰� 3锛氬崌绾х増鏈�浉瀵硅矾寰� 4锛氬崌绾у寘鐩稿�璺�緞
|
|
|
CSimpleStringA dstPath;
|
|
|
};
|
|
|
|
|
|
- // 待安装任务信息(运行时保存的中间变量)
|
|
|
+ // 寰呭畨瑁呬换鍔′俊鎭�紙杩愯�鏃朵繚瀛樼殑涓�棿鍙橀噺锛�
|
|
|
struct CTaskInfo
|
|
|
- { //存储到运行时
|
|
|
- CSimpleStringA upgradeTaskId; //升级任务编号
|
|
|
- CSimpleStringA createTaskVersion;//创建升级任务时的版本号
|
|
|
- CSimpleStringA cPendingState; // 已下载D、安装中I、等待切换S、任务结果确认T
|
|
|
- CSimpleStringA NewVersion; // 任务升级后的版本号
|
|
|
- CSimpleStringA pack_name; //升级包名
|
|
|
- //不存储到运行时
|
|
|
- CSimpleStringA pack_version; //升级包指定的版本号
|
|
|
- //CSimpleStringA to_copy; //拷贝文件列表
|
|
|
- //CSimpleStringA to_run; //体系外运行脚本文件名称
|
|
|
- bool stop_media_play; //停止广告播放(0:不停止 1:停止)
|
|
|
- int reboot_type; //重启策略类型(0:不启动 1:重启框架 2:重启系统)
|
|
|
- CSimpleStringA file_path; //升级包路径
|
|
|
- CSimpleStringA download_url; //升级包下载地址
|
|
|
- CSimpleStringA pack_hash; //升级包hash值
|
|
|
- long pack_length; //升级包长度(服务端暂时不传)
|
|
|
-
|
|
|
- queue<CInstallStep*> install_step;//安装步骤队列
|
|
|
+ { //瀛樺偍鍒拌繍琛屾椂
|
|
|
+ CSimpleStringA upgradeTaskId; //鍗囩骇浠诲姟缂栧彿
|
|
|
+ CSimpleStringA createTaskVersion;//鍒涘缓鍗囩骇浠诲姟鏃剁殑鐗堟湰鍙�
|
|
|
+ CSimpleStringA cPendingState; // 宸蹭笅杞紻銆佸畨瑁呬腑I銆佺瓑寰呭垏鎹�銆佷换鍔$粨鏋滅‘璁�
|
|
|
+ CSimpleStringA NewVersion; // 浠诲姟鍗囩骇鍚庣殑鐗堟湰鍙�
|
|
|
+ CSimpleStringA pack_name; //鍗囩骇鍖呭悕
|
|
|
+ //涓嶅瓨鍌ㄥ埌杩愯�鏃�
|
|
|
+ CSimpleStringA pack_version; //鍗囩骇鍖呮寚瀹氱殑鐗堟湰鍙�
|
|
|
+ //CSimpleStringA to_copy; //鎷疯礉鏂囦欢鍒楄〃
|
|
|
+ //CSimpleStringA to_run; //浣撶郴澶栬繍琛岃剼鏈�枃浠跺悕绉�
|
|
|
+ bool stop_media_play; //鍋滄�骞垮憡鎾�斁锛�0:涓嶅仠姝� 1:鍋滄�锛�
|
|
|
+ int reboot_type; //閲嶅惎绛栫暐绫诲瀷锛�0:涓嶅惎鍔� 1:閲嶅惎妗嗘灦 2:閲嶅惎绯荤粺锛�
|
|
|
+ CSimpleStringA file_path; //鍗囩骇鍖呰矾寰�
|
|
|
+ CSimpleStringA download_url; //鍗囩骇鍖呬笅杞藉湴鍧€
|
|
|
+ CSimpleStringA pack_hash; //鍗囩骇鍖卙ash鍊�
|
|
|
+ long pack_length; //鍗囩骇鍖呴暱搴�(鏈嶅姟绔�殏鏃朵笉浼�)
|
|
|
+
|
|
|
+ queue<CInstallStep*> install_step;//瀹夎�姝ラ�闃熷垪
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
struct CTaskProcess
|
|
|
{
|
|
|
- CSimpleStringA strPackName;//包名
|
|
|
- CSimpleStringA installVersion;//安装版本号
|
|
|
- CVersion CurrentVersion;//当前版本号
|
|
|
- CSimpleStringA cInstallState;//升级状态
|
|
|
- CSimpleStringA strInstallComment;//升级状态备注
|
|
|
+ CSimpleStringA strPackName;//鍖呭悕
|
|
|
+ CSimpleStringA installVersion;//瀹夎�鐗堟湰鍙�
|
|
|
+ CVersion CurrentVersion;//褰撳墠鐗堟湰鍙�
|
|
|
+ CSimpleStringA cInstallState;//鍗囩骇鐘舵€�
|
|
|
+ CSimpleStringA strInstallComment;//鍗囩骇鐘舵€佸�娉�
|
|
|
};
|
|
|
|
|
|
struct CenterUrl
|
|
|
{
|
|
|
- string updateTaskUrl; //更新升级任务url
|
|
|
- string queryCurrTaskUrl; //查询当前任务url
|
|
|
- string queryNewTaskUrl; //查询新任务url(旧版本使用)
|
|
|
- string queryPreTaskUrl; //预查询新任务url
|
|
|
- string queryContinueTaskUrl; //继续查询新任务url
|
|
|
- string queryTaskStatus; //查询当前任务是否有效url
|
|
|
- string sendSM3TaskUrl; //发送文件hashurl
|
|
|
+ string updateTaskUrl; //鏇存柊鍗囩骇浠诲姟url
|
|
|
+ string queryCurrTaskUrl; //鏌ヨ�褰撳墠浠诲姟url
|
|
|
+ string queryNewTaskUrl; //鏌ヨ�鏂颁换鍔�rl锛堟棫鐗堟湰浣跨敤锛�
|
|
|
+ string queryPreTaskUrl; //棰勬煡璇㈡柊浠诲姟url
|
|
|
+ string queryContinueTaskUrl; //缁х画鏌ヨ�鏂颁换鍔�rl
|
|
|
+ string queryTaskStatus; //鏌ヨ�褰撳墠浠诲姟鏄�惁鏈夋晥url
|
|
|
+ string sendSM3TaskUrl; //鍙戦€佹枃浠秇ashurl
|
|
|
};
|
|
|
|
|
|
struct HashScanSet
|
|
|
{
|
|
|
- CSimpleStringA relativeDir; //相对路径
|
|
|
- CSimpleStringA absoluteDir; //绝对路径
|
|
|
- CSimpleStringA currVerDir; //当前版本相对路径
|
|
|
- CSimpleStringA blackFile; //不纳入扫描的文件名称
|
|
|
- CSimpleStringA blackDir; //不纳入扫描的文件夹
|
|
|
+ CSimpleStringA relativeDir; //鐩稿�璺�緞
|
|
|
+ CSimpleStringA absoluteDir; //缁濆�璺�緞
|
|
|
+ CSimpleStringA currVerDir; //褰撳墠鐗堟湰鐩稿�璺�緞
|
|
|
+ CSimpleStringA blackFile; //涓嶇撼鍏ユ壂鎻忕殑鏂囦欢鍚嶇О
|
|
|
+ CSimpleStringA blackDir; //涓嶇撼鍏ユ壂鎻忕殑鏂囦欢澶�
|
|
|
};
|
|
|
|
|
|
public:
|
|
|
CUpgradeTaskFSM(){
|
|
|
- isSendHash = false;//默认查询策略不发送hash
|
|
|
- m_isSM3HashSucc = false;//默认hash计算失败
|
|
|
+ isSendHash = false;//榛樿�鏌ヨ�绛栫暐涓嶅彂閫乭ash
|
|
|
+ m_isSM3HashSucc = false;//榛樿�hash璁$畻澶辫触
|
|
|
m_bDownloadIdle = false;
|
|
|
m_bTaskCancel=false;
|
|
|
- m_fileSM3ListHash="";//终端hash列表64位hash值
|
|
|
- m_fileSM3List = "";//终端hash列表值
|
|
|
- m_strPreTaskId="";//预检查任务ID
|
|
|
- m_bNeedHash=0;//预检查是否需要hash
|
|
|
+ m_fileSM3ListHash="";//缁堢�hash鍒楄〃64浣峢ash鍊�
|
|
|
+ m_fileSM3List = "";//缁堢�hash鍒楄〃鍊�
|
|
|
+ m_strPreTaskId="";//棰勬�鏌ヤ换鍔�D
|
|
|
+ m_bNeedHash=0;//棰勬�鏌ユ槸鍚﹂渶瑕乭ash
|
|
|
m_eachDownloadLen=DOWNLOAD_CONTENT_EACH_LEN;
|
|
|
m_newEachDownloadLen=DOWNLOAD_CONTENT_EACH_LEN;
|
|
|
m_PrintHttpLog =false;
|
|
@@ -308,37 +308,37 @@ public:
|
|
|
m_iBlackFileCount=0;
|
|
|
}
|
|
|
~CUpgradeTaskFSM(){}
|
|
|
- //具体实现方法
|
|
|
- //ErrorCodeEnum UpdatePackInstall(string updatePackName,CSimpleStringA &strErrMsg);//系统升级包安装
|
|
|
- ErrorCodeEnum CreateNewVersion(CVersion NewSoftwareVersion,CSimpleStringA &strErrInfo);//创建新版本
|
|
|
- ErrorCodeEnum ClearUpgradeFailVersion(CVersion NewSoftwareVersion);//清理升级新版本临时文件
|
|
|
- //int SysPackInstall(string sysPackName, CSimpleStringA &strErrMsg);//体系外升级包安装 0:失败 1:成功 -1:未知
|
|
|
- bool GetSysUpgradeResult(const char *pszResultLog, CSimpleStringA &eErrorCode, CSimpleStringA &strErrMsg);//从体系外生成的result.log文件中获取结果
|
|
|
- //ErrorCodeEnum LightPackInstall(string LightPackName, CSimpleStringA &strErrMsg);//轻量升级包安装
|
|
|
-
|
|
|
- //安装执行步骤方法
|
|
|
- int ExecInstall(CSimpleStringA &strErrMsg);//升级安装 0:失败 1:成功 -1:未知
|
|
|
+ //鍏蜂綋瀹炵幇鏂规硶
|
|
|
+ //ErrorCodeEnum UpdatePackInstall(string updatePackName,CSimpleStringA &strErrMsg);//绯荤粺鍗囩骇鍖呭畨瑁�
|
|
|
+ ErrorCodeEnum CreateNewVersion(CVersion NewSoftwareVersion,CSimpleStringA &strErrInfo);//鍒涘缓鏂扮増鏈�
|
|
|
+ ErrorCodeEnum ClearUpgradeFailVersion(CVersion NewSoftwareVersion);//娓呯悊鍗囩骇鏂扮増鏈�复鏃舵枃浠�
|
|
|
+ //int SysPackInstall(string sysPackName, CSimpleStringA &strErrMsg);//浣撶郴澶栧崌绾у寘瀹夎� 0:澶辫触 1:鎴愬姛 -1:鏈�煡
|
|
|
+ bool GetSysUpgradeResult(const char *pszResultLog, CSimpleStringA &eErrorCode, CSimpleStringA &strErrMsg);//浠庝綋绯诲�鐢熸垚鐨剅esult.log鏂囦欢涓�幏鍙栫粨鏋�
|
|
|
+ //ErrorCodeEnum LightPackInstall(string LightPackName, CSimpleStringA &strErrMsg);//杞婚噺鍗囩骇鍖呭畨瑁�
|
|
|
+
|
|
|
+ //瀹夎�鎵ц�姝ラ�鏂规硶
|
|
|
+ int ExecInstall(CSimpleStringA &strErrMsg);//鍗囩骇瀹夎� 0锛氬け璐� 1锛氭垚鍔� -1锛氭湭鐭�
|
|
|
int ExecRunCmd(CSimpleStringA &strErrMsg,CInstallStep* ins);
|
|
|
bool ExecDeleteCmd(CSimpleStringA &strErrMsg,CInstallStep* ins);
|
|
|
bool ExecCpoyCmd(CSimpleStringA &strErrMsg,CInstallStep* ins);
|
|
|
- bool GetRootTypePath(int rootType,CSimpleStringA &rootPath);//1:相对路径 2:当前版本相对路径 3:升级版本相对路径 4:升级包相对路径
|
|
|
+ bool GetRootTypePath(int rootType,CSimpleStringA &rootPath);//1:鐩稿�璺�緞 2锛氬綋鍓嶇増鏈�浉瀵硅矾寰� 3锛氬崌绾х増鏈�浉瀵硅矾寰� 4锛氬崌绾у寘鐩稿�璺�緞
|
|
|
ErrorCodeEnum CopyFileOperate(const char* srcPath, const char* destPath, int nCopyMode, CSimpleStringA &strErrMsg);
|
|
|
|
|
|
|
|
|
|
|
|
- //ErrorCodeEnum CopyFileToNewVersion(string updatePackPath,const char *pszRelativeFile,const char * newVersion, int nCopyMode);//拷贝增量文件到新版本
|
|
|
- ErrorCodeEnum SetRunSucceed(const char* pPackFile);//成功切换新版本
|
|
|
- ErrorCodeEnum UpgradeToNewVersion();//设置新版本状态
|
|
|
- ErrorCodeEnum RollBackToHistoryVersion(CVersion historyVersion);//回退到某个历史版本
|
|
|
+ //ErrorCodeEnum CopyFileToNewVersion(string updatePackPath,const char *pszRelativeFile,const char * newVersion, int nCopyMode);//鎷疯礉澧為噺鏂囦欢鍒版柊鐗堟湰
|
|
|
+ ErrorCodeEnum SetRunSucceed(const char* pPackFile);//鎴愬姛鍒囨崲鏂扮増鏈�
|
|
|
+ ErrorCodeEnum UpgradeToNewVersion();//璁剧疆鏂扮増鏈�姸鎬�
|
|
|
+ ErrorCodeEnum RollBackToHistoryVersion(CVersion historyVersion);//鍥為€€鍒版煇涓�巻鍙茬増鏈�
|
|
|
|
|
|
//ErrorCodeEnum CopyFolder(CSimpleStringA strSourcePath, CSimpleStringA strDestPath);
|
|
|
void RecursiveGetSubFiles(const char *pszDir, const char *pszTrimStart, list<CSimpleStringA>& retList);
|
|
|
bool IsFileMatch(const char *pszFilter, const char *pszFileName);
|
|
|
- bool RecursiveCopyDir(const char *pszSourceDir, const char *pszDestDir,CSimpleStringA &strErrInfo);//可以合并
|
|
|
- CSimpleStringA GetFileDirectory(const char *pszFullPath);//查找文件的父路径
|
|
|
- bool IsWow64Process();//判断是否是64位windows程序
|
|
|
- int system_on(string cmdFilePath, bool isWait,CSimpleStringA &errMsg);//cmd窗口程序
|
|
|
- int waitSystem(string cmd, const char * par, bool nShow,CSimpleStringA &errMsg);//起进程执行cmd
|
|
|
+ bool RecursiveCopyDir(const char *pszSourceDir, const char *pszDestDir,CSimpleStringA &strErrInfo);//鍙�互鍚堝苟
|
|
|
+ CSimpleStringA GetFileDirectory(const char *pszFullPath);//鏌ユ壘鏂囦欢鐨勭埗璺�緞
|
|
|
+ bool IsWow64Process();//鍒ゆ柇鏄�惁鏄�64浣峸indows绋嬪簭
|
|
|
+ int system_on(string cmdFilePath, bool isWait,CSimpleStringA &errMsg);//cmd绐楀彛绋嬪簭
|
|
|
+ int waitSystem(string cmd, const char * par, bool nShow,CSimpleStringA &errMsg);//璧疯繘绋嬫墽琛宑md
|
|
|
|
|
|
|
|
|
char* ConvertUtf8ToGBK(const char* strUtf8);
|
|
@@ -347,8 +347,8 @@ public:
|
|
|
void ConvertGBKToUtf8(std::string &str);
|
|
|
bool is_str_utf8(const char* str);
|
|
|
|
|
|
- ErrorCodeEnum UnzipPack(const char* unZipPackName);//解压文件
|
|
|
- ErrorCodeEnum DeleteUnzipDir();//清理临时解压包文件
|
|
|
+ ErrorCodeEnum UnzipPack(const char* unZipPackName);//瑙e帇鏂囦欢
|
|
|
+ ErrorCodeEnum DeleteUnzipDir();//娓呯悊涓存椂瑙e帇鍖呮枃浠�
|
|
|
|
|
|
|
|
|
|
|
@@ -356,31 +356,31 @@ public:
|
|
|
ErrorCodeEnum GetRunConfigStrValue(const char *pszSection, const char *pszKey, CSimpleStringA &strValue);
|
|
|
ErrorCodeEnum SetRunConfigStrValue(const char *pszSection, const char *pszKey, const char *pszValue);
|
|
|
|
|
|
- bool ClearCurrTaskInfo();//任务无效清除运行时记录和残留下载包
|
|
|
- bool ClearInstallStep();//清理历史任务安装步骤
|
|
|
+ bool ClearCurrTaskInfo();//浠诲姟鏃犳晥娓呴櫎杩愯�鏃惰�褰曞拰娈嬬暀涓嬭浇鍖�
|
|
|
+ bool ClearInstallStep();//娓呯悊鍘嗗彶浠诲姟瀹夎�姝ラ�
|
|
|
|
|
|
- ErrorCodeEnum LoadPersistTaskInfo();//启动开始加载运行时文件
|
|
|
- ErrorCodeEnum loadCenterCfgInfo();//启动开始加载集中配置文件
|
|
|
+ ErrorCodeEnum LoadPersistTaskInfo();//鍚�姩寮€濮嬪姞杞借繍琛屾椂鏂囦欢
|
|
|
+ ErrorCodeEnum loadCenterCfgInfo();//鍚�姩寮€濮嬪姞杞介泦涓�厤缃�枃浠�
|
|
|
|
|
|
- bool GetFileLength(const char* filePath,long &fileLen);//获取文件长度
|
|
|
- ErrorCodeEnum GetSM3List(CSimpleStringA &strSM3List);//获取版本文件hash集合字符串
|
|
|
+ bool GetFileLength(const char* filePath,long &fileLen);//鑾峰彇鏂囦欢闀垮害
|
|
|
+ ErrorCodeEnum GetSM3List(CSimpleStringA &strSM3List);//鑾峰彇鐗堟湰鏂囦欢hash闆嗗悎瀛楃�涓�
|
|
|
//ErrorCodeEnum SM3Folder(CSimpleStringA strFolderPath,CSimpleStringA replaceStr,CSimpleStringA prefix,bool isDepDir=false);
|
|
|
ErrorCodeEnum ScanSM3ByType(int type,CSimpleStringA pathFilter);
|
|
|
- ErrorCodeEnum NewSM3Folder(CSimpleStringA scanFilter,CSimpleStringA replaceDir);//新的hash扫描文件夹实现
|
|
|
+ ErrorCodeEnum NewSM3Folder(CSimpleStringA scanFilter,CSimpleStringA replaceDir);//鏂扮殑hash鎵�弿鏂囦欢澶瑰疄鐜�
|
|
|
|
|
|
- //新国密SM3函数,isSub表示是否截取新国密中间一段密文
|
|
|
+ //鏂板浗瀵哠M3鍑芥暟锛宨sSub琛ㄧず鏄�惁鎴�彇鏂板浗瀵嗕腑闂翠竴娈靛瘑鏂�
|
|
|
ErrorCodeEnum SM3FileToStr(CSimpleStringA strFilePath, CSimpleStringA &strSM3,bool isSub);
|
|
|
ErrorCodeEnum SM3DataToStr(CSimpleStringA strData, CSimpleStringA &strSM3,bool isSub);
|
|
|
ErrorCodeEnum SM3_Str(CSimpleStringA &strSM3,BYTE * SM3Byte,bool isSub);
|
|
|
|
|
|
- bool IsPackDownloaded(const char *pPackName,const char* packHash,long packLen);//判断安装包是否已下载成功
|
|
|
+ bool IsPackDownloaded(const char *pPackName,const char* packHash,long packLen);//鍒ゆ柇瀹夎�鍖呮槸鍚﹀凡涓嬭浇鎴愬姛
|
|
|
bool DownloadFileWrite(byte* content,long contentLen,const char* filePath);
|
|
|
|
|
|
- bool CheckIfCanSwitchNow();//是否允许切换
|
|
|
- ErrorCodeEnum SwitchUpgradeNow();//切换版本
|
|
|
+ bool CheckIfCanSwitchNow();//鏄�惁鍏佽�鍒囨崲
|
|
|
+ ErrorCodeEnum SwitchUpgradeNow();//鍒囨崲鐗堟湰
|
|
|
|
|
|
- ErrorCodeEnum DownloadProgress(long tempFileLen,long fileSumLen);//返回下载进度
|
|
|
- char GetInstallState(int nState);//根据状态机获取升级状态
|
|
|
+ ErrorCodeEnum DownloadProgress(long tempFileLen,long fileSumLen);//杩斿洖涓嬭浇杩涘害
|
|
|
+ char GetInstallState(int nState);//鏍规嵁鐘舵€佹満鑾峰彇鍗囩骇鐘舵€�
|
|
|
ErrorCodeEnum GetUpgradeState(bool &bInstalling, CSimpleStringA &strPackFile, CSimpleStringA &strExecID,
|
|
|
char &cInstallState, bool &bSysInstall, bool &bLightPack, CSimpleStringA &strNewVersion);
|
|
|
|
|
@@ -401,13 +401,13 @@ private:
|
|
|
enum{s1, s2, s3, s4, s5, s6, s7};
|
|
|
|
|
|
BEGIN_FSM_STATE(CUpgradeTaskFSM)
|
|
|
- FSM_STATE_ENTRY(s1, "Start",s1_on_entry,s1_on_exit,s1_on_event)//计算hash值
|
|
|
- FSM_STATE_ENTRY(s2, "DealTask",s2_on_entry,s2_on_exit,s2_on_event)//处理上个任务,反馈任务结果,并根据任务状态跳转到其他状态
|
|
|
- FSM_STATE_ENTRY(s3, "Poll",s3_on_entry,s3_on_exit,s3_on_event)//查询任务
|
|
|
- FSM_STATE_ENTRY(s4, "Download", s4_on_entry, s4_on_exit, s4_on_event)//下载安装包
|
|
|
- FSM_STATE_ENTRY(s5, "Install", s5_on_entry, s5_on_exit, s5_on_event)//安装升级包
|
|
|
- FSM_STATE_ENTRY(s6, "Switch", s6_on_entry, s6_on_exit, s6_on_event)//进行版本切换
|
|
|
- FSM_STATE_ENTRY(s7, "Disable", s7_on_entry, s7_on_exit, s7_on_event)//静止状态
|
|
|
+ FSM_STATE_ENTRY(s1, "Start",s1_on_entry,s1_on_exit,s1_on_event)//璁$畻hash鍊�
|
|
|
+ FSM_STATE_ENTRY(s2, "DealTask",s2_on_entry,s2_on_exit,s2_on_event)//澶勭悊涓婁釜浠诲姟锛屽弽棣堜换鍔$粨鏋滐紝骞舵牴鎹�换鍔$姸鎬佽烦杞�埌鍏朵粬鐘舵€�
|
|
|
+ FSM_STATE_ENTRY(s3, "Poll",s3_on_entry,s3_on_exit,s3_on_event)//鏌ヨ�浠诲姟
|
|
|
+ FSM_STATE_ENTRY(s4, "Download", s4_on_entry, s4_on_exit, s4_on_event)//涓嬭浇瀹夎�鍖�
|
|
|
+ FSM_STATE_ENTRY(s5, "Install", s5_on_entry, s5_on_exit, s5_on_event)//瀹夎�鍗囩骇鍖�
|
|
|
+ FSM_STATE_ENTRY(s6, "Switch", s6_on_entry, s6_on_exit, s6_on_event)//杩涜�鐗堟湰鍒囨崲
|
|
|
+ FSM_STATE_ENTRY(s7, "Disable", s7_on_entry, s7_on_exit, s7_on_event)//闈欐�鐘舵€�
|
|
|
END_FSM_STATE()
|
|
|
|
|
|
BEGIN_FSM_RULE(CUpgradeTaskFSM,s1)
|
|
@@ -418,37 +418,37 @@ private:
|
|
|
FSM_RULE_ENTRY(s2, s6, Event_EndQueryCurrTask, 6)
|
|
|
FSM_RULE_ENTRY_ANY(s3, s4, Event_StartDownload)
|
|
|
FSM_RULE_ENTRY_ANY(s4, s5, Event_StartInstall)
|
|
|
- FSM_RULE_ENTRY_ANY(s4, s3, Event_StartPoll)//任务取消进入S3
|
|
|
- FSM_RULE_ENTRY_ANY(s4, s2, Event_StartDealTask)//下载失败进入S2
|
|
|
+ FSM_RULE_ENTRY_ANY(s4, s3, Event_StartPoll)//浠诲姟鍙栨秷杩涘叆S3
|
|
|
+ FSM_RULE_ENTRY_ANY(s4, s2, Event_StartDealTask)//涓嬭浇澶辫触杩涘叆S2
|
|
|
FSM_RULE_ENTRY_ANY(s5, s6, Event_StartSwitch)
|
|
|
- FSM_RULE_ENTRY_ANY(s5, s2, Event_StartDealTask)//安装失败进入S2
|
|
|
- FSM_RULE_ENTRY_ANY(s6, s2, Event_StartDealTask)//无需重启框架和系统切换成功进入S2
|
|
|
- FSM_RULE_ENTRY_ANY(s6, s3, Event_StartPoll)//取消任务进入S3
|
|
|
- FSM_RULE_ENTRY_ANY(s6, s7, Event_PreRestart)//重启服务
|
|
|
+ FSM_RULE_ENTRY_ANY(s5, s2, Event_StartDealTask)//瀹夎�澶辫触杩涘叆S2
|
|
|
+ FSM_RULE_ENTRY_ANY(s6, s2, Event_StartDealTask)//鏃犻渶閲嶅惎妗嗘灦鍜岀郴缁熷垏鎹㈡垚鍔熻繘鍏�2
|
|
|
+ FSM_RULE_ENTRY_ANY(s6, s3, Event_StartPoll)//鍙栨秷浠诲姟杩涘叆S3
|
|
|
+ FSM_RULE_ENTRY_ANY(s6, s7, Event_PreRestart)//閲嶅惎鏈嶅姟
|
|
|
END_FSM_RULE()
|
|
|
|
|
|
private:
|
|
|
- //完成
|
|
|
+ //瀹屾垚
|
|
|
void s1_on_entry();
|
|
|
void s1_on_exit();
|
|
|
unsigned int s1_on_event(FSMEvent* event);
|
|
|
- //完成
|
|
|
+ //瀹屾垚
|
|
|
void s2_on_entry();
|
|
|
void s2_on_exit();
|
|
|
unsigned int s2_on_event(FSMEvent* event);
|
|
|
- //完成
|
|
|
+ //瀹屾垚
|
|
|
void s3_on_entry();
|
|
|
void s3_on_exit();
|
|
|
unsigned int s3_on_event(FSMEvent* event);
|
|
|
- //完成
|
|
|
+ //瀹屾垚
|
|
|
void s4_on_entry();
|
|
|
void s4_on_exit();
|
|
|
unsigned int s4_on_event(FSMEvent* event);
|
|
|
- //完成
|
|
|
+ //瀹屾垚
|
|
|
void s5_on_entry();
|
|
|
void s5_on_exit();
|
|
|
unsigned int s5_on_event(FSMEvent* event);
|
|
|
- //完成
|
|
|
+ //瀹屾垚
|
|
|
void s6_on_entry();
|
|
|
void s6_on_exit();
|
|
|
unsigned int s6_on_event(FSMEvent* event);
|
|
@@ -461,36 +461,36 @@ private:
|
|
|
|
|
|
|
|
|
|
|
|
- list<CSimpleStringA> m_DepWhitelist; //dep文件夹白名单
|
|
|
- list<CSimpleStringA> m_DirBlacklist; //整体文件夹黑名单
|
|
|
- list<CSimpleStringA> m_FileBlacklist; //整体文件黑名单
|
|
|
+ list<CSimpleStringA> m_DepWhitelist; //dep鏂囦欢澶圭櫧鍚嶅崟
|
|
|
+ list<CSimpleStringA> m_DirBlacklist; //鏁翠綋鏂囦欢澶归粦鍚嶅崟
|
|
|
+ list<CSimpleStringA> m_FileBlacklist; //鏁翠綋鏂囦欢榛戝悕鍗�
|
|
|
|
|
|
public:
|
|
|
- map<CSimpleStringA, CSimpleStringA> m_fileSM3Map; // 版本文件hash值集合
|
|
|
+ map<CSimpleStringA, CSimpleStringA> m_fileSM3Map; // 鐗堟湰鏂囦欢hash鍊奸泦鍚�
|
|
|
|
|
|
- CTaskInfo m_currentTask; //当前的任务缓存变量
|
|
|
- CVersion m_currentVersion; //当前终端版本
|
|
|
+ CTaskInfo m_currentTask; //褰撳墠鐨勪换鍔$紦瀛樺彉閲�
|
|
|
+ CVersion m_currentVersion; //褰撳墠缁堢�鐗堟湰
|
|
|
|
|
|
- CenterUrl m_centerUrl;//访问总行的url地址集合
|
|
|
- int m_eachDownloadLen;//每次下载数据长度阈值(M)
|
|
|
- int m_newEachDownloadLen;//新的每次下载数据长度阈值(k)
|
|
|
- bool m_PrintHttpLog; //是否打印通讯日志
|
|
|
- bool m_startFlag; //升级实体启动标志位,默认是不开,
|
|
|
- HashScanSet m_hashScanSet;//扫描文件hash设置
|
|
|
+ CenterUrl m_centerUrl;//璁块棶鎬昏�鐨剈rl鍦板潃闆嗗悎
|
|
|
+ int m_eachDownloadLen;//姣忔�涓嬭浇鏁版嵁闀垮害闃堝€�(M)
|
|
|
+ int m_newEachDownloadLen;//鏂扮殑姣忔�涓嬭浇鏁版嵁闀垮害闃堝€�(k)
|
|
|
+ bool m_PrintHttpLog; //鏄�惁鎵撳嵃閫氳�鏃ュ織
|
|
|
+ bool m_startFlag; //鍗囩骇瀹炰綋鍚�姩鏍囧織浣�,榛樿�鏄�笉寮€锛�
|
|
|
+ HashScanSet m_hashScanSet;//鎵�弿鏂囦欢hash璁剧疆
|
|
|
|
|
|
- bool m_isSM3HashSucc;//hash是否计算成功
|
|
|
- bool isSendHash;//hash是否发送
|
|
|
- CSimpleStringA m_fileSM3ListHash;//SM3 64位hash
|
|
|
- CSimpleStringA m_fileSM3List;//版本文件hash集合字符串
|
|
|
- DWORD m_beginSendSM3Time;//开始发送sm3hahs时间
|
|
|
- int m_queryNewTaskCount;//查询新任务时无任务次数
|
|
|
+ bool m_isSM3HashSucc;//hash鏄�惁璁$畻鎴愬姛
|
|
|
+ bool isSendHash;//hash鏄�惁鍙戦€�
|
|
|
+ CSimpleStringA m_fileSM3ListHash;//SM3 64浣峢ash
|
|
|
+ CSimpleStringA m_fileSM3List;//鐗堟湰鏂囦欢hash闆嗗悎瀛楃�涓�
|
|
|
+ DWORD m_beginSendSM3Time;//寮€濮嬪彂閫乻m3hahs鏃堕棿
|
|
|
+ int m_queryNewTaskCount;//鏌ヨ�鏂颁换鍔℃椂鏃犱换鍔℃�鏁�
|
|
|
|
|
|
- bool m_bDownloadIdle; //是否下载空闲 true: 不能下载,false: 可下载
|
|
|
- bool m_bTaskCancel; //是否任务取消 true: 任务取消,false: 未取消
|
|
|
+ bool m_bDownloadIdle; //鏄�惁涓嬭浇绌洪棽 true: 涓嶈兘涓嬭浇锛宖alse: 鍙�笅杞�
|
|
|
+ bool m_bTaskCancel; //鏄�惁浠诲姟鍙栨秷 true: 浠诲姟鍙栨秷锛宖alse: 鏈�彇娑�
|
|
|
|
|
|
- int m_iBlackFileCount; //黑名单文件数量
|
|
|
+ int m_iBlackFileCount; //榛戝悕鍗曟枃浠舵暟閲�
|
|
|
|
|
|
- CSimpleStringA m_strPreTaskId; //预检查taskId
|
|
|
- int m_bNeedHash;//是否需要hash对比查询任务
|
|
|
+ CSimpleStringA m_strPreTaskId; //棰勬�鏌�askId
|
|
|
+ int m_bNeedHash;//鏄�惁闇€瑕乭ash瀵规瘮鏌ヨ�浠诲姟
|
|
|
};
|
|
|
#endif //RVC_MOD_UPGRADETASK_FSM_H_
|