|
@@ -1129,6 +1129,13 @@ namespace Task
|
|
|
rootReq["software_version"] = strInstallVersion.GetData();
|
|
|
rootReq["os_version"] = strOSVersion.GetData();
|
|
|
rootReq["machine_version"] = strMachineVersion.GetData();
|
|
|
+ //预查询判断加入查询何种任务。
|
|
|
+ if (m_fsm->isTerminalInstall()) {
|
|
|
+ rootReq["task_type"] = "I";//安装任务
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ rootReq["task_type"] = "U";//升级任务
|
|
|
+ }
|
|
|
|
|
|
string jsonReq = writer.write(rootReq);
|
|
|
qTempReq.m_reqStr = jsonReq;//请求参数
|
|
@@ -4750,6 +4757,11 @@ bool CUpgradeTaskFSM::DownloadFileWrite(byte* content,long contentLen,const char
|
|
|
|
|
|
bool CUpgradeTaskFSM::CheckIfCanSwitchNow()
|
|
|
{
|
|
|
+ //对于终端初始化安装时,直接通过。
|
|
|
+ if (isTerminalInstall()) {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("CheckIfCanSwitchNow")("CheckIfCanSwitchNow terminal new install,return true");
|
|
|
+ return true;
|
|
|
+ }
|
|
|
//非重启操作,则直接可以进行切换,不用等待时机
|
|
|
if(m_currentTask.reboot_type == 0){
|
|
|
return true;
|
|
@@ -4960,7 +4972,15 @@ bool CUpgradeTaskFSM::isWork()
|
|
|
DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM).setAPI("isWork")("upgrade startFlag is true");
|
|
|
return true;
|
|
|
}
|
|
|
-
|
|
|
+ //判断是否在设备安装状态,不受一般升级影响
|
|
|
+ if (isTerminalInstall()) {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("isWork")("isTerminalInstall get TerminalStage is N");
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("isWork")("isTerminalInstall get TerminalStage is not N");
|
|
|
+ }
|
|
|
+
|
|
|
//判断升级实体是否工作
|
|
|
//1.当有版本升级任务时,判断是否处于Guardian升级回退过程,如果已经升级成功或者回退成功,则开始工作,否则等待中
|
|
|
//2.当无任务或者非版本升级任务时,判断TerminalStage这个变量,非X状态,当A状态并且进入首页,则开始工作
|
|
@@ -5026,6 +5046,32 @@ bool CUpgradeTaskFSM::isAuthSucc() {
|
|
|
return false;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+bool CUpgradeTaskFSM::isTerminalInstall() {
|
|
|
+ CSimpleStringA strValue;
|
|
|
+ if (m_pEntity->GetFunction()->GetSysVar("TerminalStage", strValue) == Error_Succeed) {
|
|
|
+ if (strValue.Compare("N") == 0) {
|
|
|
+ return true; //表示安装模式
|
|
|
+ }else{
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("isTerminalInstall")("isTerminalInstall get TerminalStage is error , default return fasle");
|
|
|
+ return false;//默认认为在升级状态
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void CUpgradeTaskFSM::upgradeSuccStateBroadCast() {
|
|
|
+ UpgradeStateEvent stateEvent;
|
|
|
+ stateEvent.strPackName = m_currentTask.pack_name.GetData();
|
|
|
+ stateEvent.strExecID = m_currentTask.upgradeTaskId.GetData();
|
|
|
+ stateEvent.cInstallState = 'A';//表示成功状态
|
|
|
+ stateEvent.bSysInstall = false;
|
|
|
+ stateEvent.bLightPack = false;
|
|
|
+ stateEvent.strNewVersion = m_currentTask.NewVersion;
|
|
|
+ SpSendBroadcast(m_pEntity->GetFunction(), eMsg_UpgradeStateEvent, eMsgSig_UpgradeStateEvent, stateEvent);
|
|
|
+}
|
|
|
#ifdef RVC_OS_WIN
|
|
|
#else
|
|
|
int CUpgradeTaskFSM::changeFileAtt(const char* path)
|
|
@@ -5303,6 +5349,7 @@ unsigned int CUpgradeTaskFSM::s2_on_event(FSMEvent* event)
|
|
|
up.cInstallState = "A";
|
|
|
up.strInstallComment = "启动成功";
|
|
|
SendUpgradeTaskProgress(up);
|
|
|
+ upgradeSuccStateBroadCast();//广播告知升级成功
|
|
|
if(m_currentTask.NewVersion.IsNullOrEmpty()){
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(UpgradeMgr_OUTSIDE_SYSTEM_START_ID)("体系外升级启动成功");
|
|
|
}else{
|
|
@@ -5865,6 +5912,11 @@ unsigned int CUpgradeTaskFSM::s5_on_event(FSMEvent* event)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //对于终端初始化安装时,直接通过。
|
|
|
+ if (isTerminalInstall()) {
|
|
|
+ doInstall = true;
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("s5 create InstallPackTask terminal new install");
|
|
|
+ }
|
|
|
|
|
|
if (doInstall)
|
|
|
{
|
|
@@ -5919,6 +5971,11 @@ unsigned int CUpgradeTaskFSM::s5_on_event(FSMEvent* event)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ //对于终端初始化安装时,直接通过。
|
|
|
+ if (isTerminalInstall()) {
|
|
|
+ doInstall = true;
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("s5 create InstallPackTask terminal new install");
|
|
|
+ }
|
|
|
|
|
|
if (doInstall)
|
|
|
{
|