Browse Source

#IQRV #comment 合并引发的冲突解决

80374374 2 tháng trước cách đây
mục cha
commit
ea2392bdb1
1 tập tin đã thay đổi với 168 bổ sung168 xóa
  1. 168 168
      Module/mod_UpgradeMgr/UpgradeTaskFSM.h

+ 168 - 168
Module/mod_UpgradeMgr/UpgradeTaskFSM.h

@@ -14,12 +14,12 @@
 #define	QUERY_IS_WORK_WARN_LIMIT 10
 using namespace std;
 
-#define WARN_TASK_COPY_FILE_ZERO 0x50620022 //锟斤拷锟斤拷copy锟侥硷拷锟斤拷锟侥硷拷锟斤拷锟斤拷为0
-#define ERR_TASK_QUERY_PRE_NEW_TASK_FAIL 0x50620023 //锟斤拷询锟斤拷锟斤拷锟今报达拷
-#define ERR_TASK_QUERY_CONTINUE_NEW_TASK_FAIL 0x50620024 //锟斤拷询锟斤拷锟斤拷锟斤拷锟斤拷锟今报达拷
-#define ERR_TASK_QUERY_CONTINUE_NEW_TASK_ERR 0x50620025 //锟斤拷询锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟届
+#define WARN_TASK_COPY_FILE_ZERO 0x50620022 //升级copy文件夹文件个数为0
+#define ERR_TASK_QUERY_PRE_NEW_TASK_FAIL 0x50620023 //查询新任务报错
+#define ERR_TASK_QUERY_CONTINUE_NEW_TASK_FAIL 0x50620024 //查询继续新任务报错
+#define ERR_TASK_QUERY_CONTINUE_NEW_TASK_ERR 0x50620025 //查询继续新任务异
 
-//#define WARN_BLACK_FILE_SUM 0x50600023 //锟斤拷锟斤拷锟斤拷锟侥硷拷锟斤拷锟斤拷
+//#define WARN_BLACK_FILE_SUM 0x50600023 //黑名单文件数量
 
 #define UpgradeMgr_VERSION_DOWNLOAD_ID "QLR0402506Z10101"
 #define UpgradeMgr_VERSION_INSTALL_ID "QLR0402506Z10201"
@@ -42,7 +42,7 @@ using namespace std;
 
 namespace HttpStruct
 {
-	//锟斤拷锟斤拷锟侥硷拷hash锟叫憋拷涌锟�
+	//发送文件hash列表接口
 	struct SendSM3TaskReq : CHTTPReq {
 		string m_reqStr;
 		string ToJson() {
@@ -57,7 +57,7 @@ namespace HttpStruct
 		}
 	};
 
-	//锟斤拷锟斤拷锟斤拷锟斤拷状态锟接匡拷
+	//更新任务状态接口
 	struct UpdateTaskStatusReq : CHTTPReq {
 		string m_reqStr;
 		string ToJson() {
@@ -72,7 +72,7 @@ namespace HttpStruct
 		}
 	};
 
-	//锟斤拷询锟斤拷前锟斤拷锟斤拷
+	//查询当前任务
 	struct QueryCurrTaskReq : CHTTPReq {
 		string m_reqStr;
 		string ToJson() {
@@ -87,7 +87,7 @@ namespace HttpStruct
 		}
 	};
 
-	//锟斤拷询锟斤拷锟斤拷锟斤拷
+	//查询新任务
 	struct QueryNewTaskReq : CHTTPReq {
 		string m_reqStr;
 		string ToJson() {
@@ -102,7 +102,7 @@ namespace HttpStruct
 		}
 	};
 
-	//锟较碉拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷
+	//断点下载升级包
 	struct DownloadPackTaskRet{
 		long content_length;
         long origin_file_length;
@@ -114,7 +114,7 @@ namespace HttpStruct
 
 
 
-// 锟斤拷锟斤拷锟斤拷锟斤拷状态锟斤拷
+// 升级任务状态机
 class CUpgradeTaskFSM : public FSMImpl<CUpgradeTaskFSM>, public IFSMStateHooker, public ISysVarListener
 {
 public:
@@ -153,7 +153,7 @@ public:
 
 	struct SendSM3TaskEvent:public FSMEvent
 	{
-		bool isSucc;//锟角凤拷写锟斤拷晒锟�
+		bool isSucc;//是否写入成功
 		SendSM3TaskEvent(bool isSendSucc) 
 			: FSMEvent(Event_EndSendSM3Task), isSucc(isSendSucc)
 		{}
@@ -162,7 +162,7 @@ public:
 
 	struct UpdateTaskStatusEvent:public FSMEvent
 	{
-		bool isSucc;//锟角凤拷锟斤拷鲁晒锟�
+		bool isSucc;//是否更新成功
 		UpdateTaskStatusEvent(bool isSendSucc) 
 			: FSMEvent(Event_EndUpdateTask), isSucc(isSendSucc)
 		{}
@@ -170,8 +170,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)
 		{}
@@ -179,7 +179,7 @@ public:
 
 	struct QueryNewTaskEvent:public FSMEvent
 	{
-		bool isSucc;//锟角凤拷锟窖�拷晒锟�
+		bool isSucc;//是否查询成功
 		QueryNewTaskEvent(bool isSendSucc) 
 			: FSMEvent(Event_EndPoll), isSucc(isSendSucc)
 		{}
@@ -187,7 +187,7 @@ public:
 
 	struct QueryNewContinueTaskEvent:public FSMEvent
 	{
-		int retParam;//锟角凤拷锟窖�拷晒锟�
+		int retParam;//是否查询成功
 		QueryNewContinueTaskEvent(int ret) 
 			: FSMEvent(Event_EndContinuePoll)
 		{
@@ -197,7 +197,7 @@ public:
 
 	struct QueryNewPreTaskEvent:public FSMEvent
 	{
-		bool isSucc;//锟角凤拷锟窖�拷晒锟�
+		bool isSucc;//是否查询成功
 		QueryNewPreTaskEvent(bool isSendSucc) 
 			: FSMEvent(Event_EndPrePoll), isSucc(isSendSucc)
 		{}
@@ -205,8 +205,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)
 		{}
@@ -222,7 +222,7 @@ public:
 
 	struct DownloadPackTaskFailEvent:public FSMEvent
 	{
-		string errMsg;//锟斤拷锟斤拷锟斤拷
+		string errMsg;//错误信
 		DownloadPackTaskFailEvent(string errorMsg) 
 			: FSMEvent(Event_Download_Fail), errMsg(errorMsg)
 		{}
@@ -266,124 +266,124 @@ 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、Copy、Run
+		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 task_type;		//锟斤拷锟斤拷锟斤拷锟斤拷 U:锟斤拷锟斤拷锟斤拷锟斤拷 R:锟斤拷锟斤拷锟斤拷锟斤拷
-		CSimpleStringA depNewVersion;    //锟斤拷锟斤拷锟斤拷锟铰版本锟斤拷
-		//CSimpleStringA task_class;      //锟斤拷锟斤拷锟斤拷锟� A:应锟矫版本锟斤拷锟斤拷 D:锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 T:锟斤拷系锟斤拷锟斤拷锟斤拷
-		//锟斤拷锟芥储锟斤拷锟斤拷锟斤拷
-		CSimpleStringA pack_version;	//锟斤拷锟斤拷锟斤拷指锟斤拷锟侥版本锟斤拷
-		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;	// 已下载D、安装中I、等待切换S、任务结果确认T
+		CSimpleStringA NewVersion;		// 任务升级后的版本号
+		CSimpleStringA pack_name;		//升级包名
+		CSimpleStringA task_type;		//任务类型 U:升级任务 R:回退任务
+		CSimpleStringA depNewVersion;    //适配器新版本号
+		//CSimpleStringA task_class;      //任务类别 A:应用版本任务 D:适配器任务 T:体系外任务
+		//不存储到运行
+		CSimpleStringA pack_version;	//升级包指定的版本号
+		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;//安装步骤队列
 
 	};
 
 	
 	struct CTaskProcess
 	{
-		CSimpleStringA strPackName;//锟斤拷锟斤拷
-		CSimpleStringA installVersion;//锟斤拷装锟芥本锟斤拷
-		CSimpleStringA CurrentVersion;//锟斤拷前锟芥本锟斤拷
-		CSimpleStringA cInstallState;//锟斤拷锟斤拷状态
-		CSimpleStringA strInstallComment;//锟斤拷锟斤拷状态锟斤拷
+		CSimpleStringA strPackName;//包名
+		CSimpleStringA installVersion;//安装版本号
+		CSimpleStringA CurrentVersion;//当前版本号
+		CSimpleStringA cInstallState;//升级状态
+		CSimpleStringA strInstallComment;//升级状态备
 	};
 
 	struct CenterUrl
 	{
-		string updateTaskUrl;		//锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷url
-		string queryCurrTaskUrl;	//锟斤拷询锟斤拷前锟斤拷锟斤拷url
-		string queryNewTaskUrl;		//锟斤拷询锟斤拷锟斤拷锟斤拷url锟斤拷锟缴版本使锟矫o拷
-		string queryPreTaskUrl;		//预锟斤拷询锟斤拷锟斤拷锟斤拷url
-		string queryContinueTaskUrl; //锟斤拷锟斤拷锟斤拷询锟斤拷锟斤拷锟斤拷url
-		string queryTaskStatus;		//锟斤拷询锟斤拷前锟斤拷锟斤拷锟角凤拷锟斤拷效url
-		string sendSM3TaskUrl;		//锟斤拷锟斤拷锟侥硷拷hashurl
+		string updateTaskUrl;		//更新升级任务url
+		string queryCurrTaskUrl;	//查询当前任务url
+		string queryNewTaskUrl;		//查询新任务url(旧版本使用)
+		string queryPreTaskUrl;		//预查询新任务url
+		string queryContinueTaskUrl; //继续查询新任务url
+		string queryTaskStatus;		//查询当前任务是否有效url
+		string sendSM3TaskUrl;		//发送文件hashurl
 	};
 
 	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;//默认查询策略不发送hash
+		m_isSM3HashSucc = false;//默认hash计算失败
 		m_bDownloadIdle = false;
 		m_bTaskCancel=false;
-		m_fileSM3ListHash="";//锟秸讹拷hash锟叫憋拷64位hash值
-		m_fileSM3List = "";//锟秸讹拷hash锟叫憋拷
-		m_strPreTaskId="";//预锟斤拷锟斤拷锟斤拷锟絀D
-		m_bNeedHash=0;//预锟斤拷锟斤拷欠锟斤拷锟揭猦ash
+		m_fileSM3ListHash="";//终端hash列表64位hash值
+		m_fileSM3List = "";//终端hash列表
+		m_strPreTaskId="";//预检查任务ID
+		m_bNeedHash=0;//预检查是否需要hash
 		m_newEachDownloadLen=DOWNLOAD_CONTENT_EACH_LEN;
 		m_PrintHttpLog =false;
 		m_startFlag = false;
 		m_iBlackFileCount=0;
 		m_bSwitchFlag = false;
 		m_bRollbackTask = false;
-		m_TempDepUpgradeFlag = false;//默锟较凤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷
-		m_queryNewTaskInterval = 240;//默锟较诧拷询锟斤拷锟斤拷时锟斤拷锟斤拷
-		m_installStopCopyDep = false;//默锟较匡拷锟斤拷
+		m_TempDepUpgradeFlag = false;//默认非适配器升级
+		m_queryNewTaskInterval = 240;//默认查询任务时间间隔
+		m_installStopCopyDep = false;//默认拷贝
 		m_downloadBreakOffCount = 0; 
 		m_queryIsWorkCount = 0;
 	}
 	~CUpgradeTaskFSM(){}
-	//锟斤拷锟斤拷实锟街凤拷锟斤拷
-	ErrorCodeEnum CreateNewVersion(CVersion NewSoftwareVersion,CSimpleStringA &strErrInfo);//锟斤拷锟斤拷锟铰版本
-	ErrorCodeEnum ClearUpgradeFailVersion(CVersion NewSoftwareVersion);//锟斤拷锟斤拷锟斤拷锟斤拷锟铰版本锟斤拷时锟侥硷拷
-	bool GetSysUpgradeResult(const char *pszResultLog, CSimpleStringA &eErrorCode, CSimpleStringA &strErrMsg);//锟斤拷锟斤拷系锟斤拷锟斤拷锟缴碉拷result.log锟侥硷拷锟叫伙拷取锟斤拷锟�
+	//具体实现方法
+	ErrorCodeEnum CreateNewVersion(CVersion NewSoftwareVersion,CSimpleStringA &strErrInfo);//创建新版本
+	ErrorCodeEnum ClearUpgradeFailVersion(CVersion NewSoftwareVersion);//清理升级新版本临时文件
+	bool GetSysUpgradeResult(const char *pszResultLog, CSimpleStringA &eErrorCode, CSimpleStringA &strErrMsg);//从体系外生成的result.log文件中获取结果
 	
-	//锟斤拷装执锟叫诧拷锟借方锟斤拷
-	int ExecInstall(CSimpleStringA &strErrMsg);//锟斤拷锟斤拷锟斤拷装 0锟斤拷失锟斤拷 1锟斤拷锟缴癸拷 -1锟斤拷未知
+	//安装执行步骤方法
+	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 SetRunSucceed(const char* pPackFile);//锟缴癸拷锟叫伙拷锟铰版本
-	ErrorCodeEnum UpgradeToNewVersion();//锟斤拷锟斤拷锟铰版本状态
-	ErrorCodeEnum RollBackToHistoryVersion(CVersion historyVersion);//锟斤拷锟剿碉拷某锟斤拷锟斤拷史锟芥
+	ErrorCodeEnum SetRunSucceed(const char* pPackFile);//成功切换新版本
+	ErrorCodeEnum UpgradeToNewVersion();//设置新版本状态
+	ErrorCodeEnum RollBackToHistoryVersion(CVersion historyVersion);//回退到某个历史版
 	
 	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);//锟斤拷锟斤拷锟侥硷拷锟侥革拷路锟斤拷
-	//TODO: CrossPlaform  [Gifur@2025729]
-	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);//锟斤拷锟斤拷锟街达拷锟絚md
-
-	ErrorCodeEnum UnzipPack(const char* unZipPackName);//锟斤拷压锟侥硷拷
-	ErrorCodeEnum DeleteUnzipDir();//锟斤拷锟斤拷锟斤拷时锟斤拷压锟斤拷锟侥硷拷
-	ErrorCodeEnum RollBackVersionCheck(string &failReason, CSimpleStringA& strErrMsg);//锟斤拷锟剿版本锟斤拷锟� C锟斤拷一锟斤拷锟斤拷锟� X锟斤拷锟秸讹拷锟揭诧拷锟斤拷锟斤拷要锟斤拷锟剿的版本锟侥硷拷锟斤拷 锟斤拷锟斤拷锟剿版本锟斤拷锟斤拷锟节版本锟斤拷
+	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
+	
+
+	ErrorCodeEnum UnzipPack(const char* unZipPackName);//解压文件
+	ErrorCodeEnum DeleteUnzipDir();//清理临时解压包文件
+	ErrorCodeEnum RollBackVersionCheck(string &failReason, CSimpleStringA& strErrMsg);//回退版本检查 C:一般错误 X:终端找不到需要回退的版本文件夹 、回退版本比现在版本高
 	
 	
 
@@ -391,56 +391,56 @@ 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 ScanSM3ByType(int type,CSimpleStringA pathFilter);
-	ErrorCodeEnum NewSM3Folder(CSimpleStringA scanFilter,CSimpleStringA replaceDir);//锟铰碉拷hash扫锟斤拷锟侥硷拷锟斤拷实锟斤拷
+	ErrorCodeEnum NewSM3Folder(CSimpleStringA scanFilter,CSimpleStringA replaceDir);//新的hash扫描文件夹实现
 
-	//锟铰癸拷锟斤拷SM3锟斤拷锟斤拷锟斤拷isSub锟斤拷示锟角凤拷锟饺★拷鹿锟斤拷锟斤拷屑锟揭伙拷锟斤拷锟斤拷锟�
+	//新国密SM3函数,isSub表示是否截取新国密中间一段密文
 	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);
 	
 	static void HttpsLogCallBack(const char* logtxt);
 
-	void judgeTaskClass();//锟斤拷时锟叫讹拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟�
-	ErrorCodeEnum judgeRollbackTaskClass(CSimpleStringA verDirName, string& failReason, CSimpleStringA& strErrMsg);//锟斤拷时锟叫讹拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟�
+	void judgeTaskClass();//临时判定升级任务类别
+	ErrorCodeEnum judgeRollbackTaskClass(CSimpleStringA verDirName, string& failReason, CSimpleStringA& strErrMsg);//临时判定回退任务类别
 	
-	ErrorCodeEnum CreateNewDepVersion(CSimpleStringA NewSoftwareVersion, CSimpleStringA& strErrInfo);//锟斤拷锟斤拷时锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟芥
-	ErrorCodeEnum CreateInstallDepVersion(CSimpleStringA NewSoftwareVersion, CSimpleStringA& strErrInfo);//锟斤拷装时锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟芥
-	ErrorCodeEnum ClearUpgradeFailDepVersion(CSimpleStringA NewSoftwareVersion);//锟斤拷锟斤拷锟斤拷锟斤拷锟铰版本锟斤拷时锟侥硷拷
-	ErrorCodeEnum UpgradeDepToNewVersion();//锟斤拷锟斤拷depactive锟侥硷拷
-	ErrorCodeEnum SwitchUpgradeDepNow();//锟叫伙拷锟斤拷锟斤拷锟斤拷锟芥
-	ErrorCodeEnum RollBackDepVersionCheck(string& failReason, CSimpleStringA& strErrMsg);//锟斤拷锟剿版本锟斤拷锟� C锟斤拷一锟斤拷锟斤拷锟� X锟斤拷锟秸讹拷锟揭诧拷锟斤拷锟斤拷要锟斤拷锟剿的版本锟侥硷拷锟斤拷
-	ErrorCodeEnum RollBackToHistoryDepVersion(CSimpleStringA historyDepVersion);//锟斤拷锟斤拷锟斤拷锟斤拷锟剿碉拷某锟斤拷锟斤拷史锟芥
-
-	//锟斤拷锟斤拷锟斤拷锟斤拷装锟斤拷锟斤拷
-	int ExecDepInstall(CSimpleStringA& strErrMsg);//锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷 0锟斤拷失锟斤拷 1锟斤拷锟缴癸拷 
+	ErrorCodeEnum CreateNewDepVersion(CSimpleStringA NewSoftwareVersion, CSimpleStringA& strErrInfo);//升级时创建新适配器版
+	ErrorCodeEnum CreateInstallDepVersion(CSimpleStringA NewSoftwareVersion, CSimpleStringA& strErrInfo);//安装时创建新适配器版
+	ErrorCodeEnum ClearUpgradeFailDepVersion(CSimpleStringA NewSoftwareVersion);//清理升级新版本临时文件
+	ErrorCodeEnum UpgradeDepToNewVersion();//更新depactive文件
+	ErrorCodeEnum SwitchUpgradeDepNow();//切换适配器版
+	ErrorCodeEnum RollBackDepVersionCheck(string& failReason, CSimpleStringA& strErrMsg);//回退版本检查 C:一般错误 X:终端找不到需要回退的版本文件夹
+	ErrorCodeEnum RollBackToHistoryDepVersion(CSimpleStringA historyDepVersion);//适配器回退到某个历史版
+
+	//适配器安装函数
+	int ExecDepInstall(CSimpleStringA& strErrMsg);//适配器升级 0:失败 1:成功 
 	int ExecDepRunCmd(CSimpleStringA& strErrMsg, CInstallStep* ins);
 	bool ExecDepDeleteCmd(CSimpleStringA& strErrMsg, CInstallStep* ins);
 	bool ExecDepCpoyCmd(CSimpleStringA& strErrMsg, CInstallStep* ins);
-	bool GetDepRootTypePath(int rootType, CSimpleStringA& rootPath);//1:锟斤拷锟铰凤拷锟� 2锟斤拷锟斤拷前锟芥本锟斤拷锟铰凤拷锟� 3锟斤拷锟斤拷锟斤拷锟芥本锟斤拷锟铰凤拷锟� 4锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟铰凤拷锟�
+	bool GetDepRootTypePath(int rootType, CSimpleStringA& rootPath);//1:相对路径 2:当前版本相对路径 3:升级版本相对路径 4:升级包相对路径
 
 	CSimpleStringA getAlarmCurrVersion();
 
-	//锟斤拷锟斤拷时锟斤拷臃锟斤拷锟角斤拷锟斤拷锟�
+	//升级时添加防火墙策略
 	ErrorCodeEnum SetNewVersionPathToFirewall();
 
 	bool isWork();
@@ -463,13 +463,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)
@@ -479,39 +479,39 @@ private:
 		FSM_RULE_ENTRY(s2, s5, Event_EndQueryCurrTask, 5)	
 		FSM_RULE_ENTRY(s2, s6, Event_EndQueryCurrTask, 6)
 		FSM_RULE_ENTRY_ANY(s3, s4, Event_StartDownload)
-		FSM_RULE_ENTRY_ANY(s3, s5, Event_StartInstall)//锟斤拷锟斤拷
+		FSM_RULE_ENTRY_ANY(s3, s5, Event_StartInstall)//回退
 		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)//取锟斤拷锟斤拷锟斤拷锟斤拷锟絊3
-		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)//无需重启框架和系统切换成功进入S2
+		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);
@@ -524,45 +524,45 @@ 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;  //锟斤拷前锟秸端版本
-	CSimpleStringA m_currentDepVersion; //锟斤拷前锟斤拷锟斤拷锟斤拷锟芥
+	CTaskInfo m_currentTask;	//当前的任务缓存变量
+	CVersion m_currentVersion;  //当前终端版本
+	CSimpleStringA m_currentDepVersion; //当前适配器版
 
-	CenterUrl m_centerUrl;//锟斤拷锟斤拷锟斤拷锟叫碉拷url锟斤拷址锟斤拷锟斤拷
-	int m_newEachDownloadLen;//锟铰碉拷每锟斤拷锟斤拷锟斤拷锟斤拷锟捷筹拷锟斤拷锟斤拷值(k)
-	bool m_PrintHttpLog;  //锟角凤拷锟接⊥ㄑ讹拷锟街�
-	bool m_startFlag; //锟斤拷锟斤拷实锟斤拷锟斤拷锟斤拷锟街疚�,默锟斤拷锟角诧拷锟斤拷锟斤拷
-	bool m_stopSetFirewall;//锟角凤拷停止锟斤拷锟矫凤拷锟斤拷墙路锟斤拷锟斤拷默锟斤拷锟角诧拷停止
-	HashScanSet m_hashScanSet;//扫锟斤拷锟侥硷拷hash锟斤拷锟斤拷
+	CenterUrl m_centerUrl;//访问总行的url地址集合
+	int m_newEachDownloadLen;//新的每次下载数据长度阈值(k)
+	bool m_PrintHttpLog;  //是否打印通讯日志
+	bool m_startFlag; //升级实体启动标志位,默认是不开,
+	bool m_stopSetFirewall;//是否停止设置防火墙路径,默认是不停止
+	HashScanSet m_hashScanSet;//扫描文件hash设置
 
-	bool m_isSM3HashSucc;//hash锟角凤拷锟斤拷锟缴癸拷
-	bool isSendHash;//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;//锟斤拷询锟斤拷锟斤拷锟斤拷时锟斤拷锟斤拷锟斤拷锟斤拷锟�
+	CSimpleStringA m_fileSM3List;//版本文件hash集合字符串
+	DWORD m_beginSendSM3Time;//开始发送sm3hahs时间
+	int m_queryNewTaskCount;//查询新任务时无任务次数
 	int m_queryIsWorkCount;
 	int m_downloadBreakOffCount;
 
-	bool m_bDownloadIdle;	//锟角凤拷锟斤拷锟截匡拷锟斤拷 true: 锟斤拷锟斤拷锟斤拷锟截o拷false: 锟斤拷锟斤拷锟斤拷
-	bool m_bTaskCancel;		//锟角凤拷锟斤拷锟斤拷取锟斤拷 true: 锟斤拷锟斤拷取锟斤拷锟斤拷false: 未取锟斤拷
+	bool m_bDownloadIdle;	//是否下载空闲 true: 不能下载,false: 可下载
+	bool m_bTaskCancel;		//是否任务取消 true: 任务取消,false: 未取消
 
-	int m_iBlackFileCount;    //锟斤拷锟斤拷锟斤拷锟侥硷拷锟斤拷锟斤拷
+	int m_iBlackFileCount;    //黑名单文件数量
 
-	CSimpleStringA m_strPreTaskId; //预锟斤拷锟絫askId
-	int m_bNeedHash;//锟角凤拷锟斤拷要hash锟皆比诧拷询锟斤拷锟斤拷
-	bool m_bSwitchFlag;//锟角凤拷锟斤拷锟斤拷锟斤拷谢锟斤拷锟斤拷锟街憋拷咏锟斤拷锟斤拷
-	bool m_bRollbackTask;//锟角凤拷锟窖撅拷锟斤拷锟节伙拷锟斤拷锟斤拷锟教★拷
+	CSimpleStringA m_strPreTaskId; //预检查taskId
+	int m_bNeedHash;//是否需要hash对比查询任务
+	bool m_bSwitchFlag;//是否启动后切换流程直接进入标
+	bool m_bRollbackTask;//是否已经处于回退流程。
 
-	bool m_TempDepUpgradeFlag;//锟斤拷时锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷装锟斤拷锟叫讹拷锟斤拷志 true 锟斤拷锟斤拷锟斤拷 false 锟斤拷锟斤拷锟斤拷锟斤拷
-	int m_queryNewTaskInterval;//锟斤拷询锟斤拷锟斤拷时锟斤拷锟斤拷锟侥�拷锟斤拷锟�240s
-	bool m_installStopCopyDep;//锟斤拷装时锟角凤拷停止锟斤拷锟斤拷应锟斤拷dep锟斤拷锟斤拷锟侥硷拷锟斤拷
+	bool m_TempDepUpgradeFlag;//临时适配器升级安装的判定标志 true 适配器 false 非适配器
+	int m_queryNewTaskInterval;//查询任务时间间隔,默认是240s
+	bool m_installStopCopyDep;//安装时是否停止拷贝应用dep公共文件夹
 };
 #endif //RVC_MOD_UPGRADETASK_FSM_H_