|
@@ -253,6 +253,7 @@ ErrorCodeEnum CVtmLoaderFSM::OnInit()
|
|
|
|
|
|
ErrorCodeEnum CVtmLoaderFSM::OnExit()
|
|
|
{
|
|
|
+ GetEntityBase()->GetFunction()->KillTimer(TIMER_CENTERSETTING_UPDATE_CHECK);
|
|
|
RemoveStateHooker(this);
|
|
|
return Error_Succeed;
|
|
|
}
|
|
@@ -1762,8 +1763,10 @@ bool CVtmLoaderFSM::GetConfig()
|
|
|
}
|
|
|
refreshLogLevel();
|
|
|
|
|
|
-
|
|
|
- //all cfg is ready, then init the entity
|
|
|
+ //all cfg is ready, then init the entity, set centersetting update timer
|
|
|
+ void* pTmpData = NULL;
|
|
|
+ ITimerListener* pListener = new TimerOutHelper<CVtmLoaderFSM>(this, &CVtmLoaderFSM::OnCentersettingUpdateTimeout, pTmpData);
|
|
|
+ GetEntityBase()->GetFunction()->SetTimer(TIMER_CENTERSETTING_UPDATE_CHECK, pListener, CENTERSETTING_UPDATE_CHECK_TIME);
|
|
|
|
|
|
eErr = SubscribeEntitysEvents();
|
|
|
if (eErr != Error_Succeed)
|
|
@@ -3032,4 +3035,46 @@ void CVtmLoaderFSM::DoSpecialJobInTestRoom()
|
|
|
Sleep(10000);
|
|
|
GetEntityBase()->GetFunction()->GetPrivilegeFunction()->Reboot(RebootTrigger_ManualLocal, RebootWayEnum::RebootWay_Framework);
|
|
|
}
|
|
|
+}
|
|
|
+
|
|
|
+DWORD CVtmLoaderFSM::GetCenterCfgThread()
|
|
|
+{
|
|
|
+ bool isUpdate = false, isReset = false;
|
|
|
+ CSimpleString version;
|
|
|
+ if (false == GetEntityBase()->GetFunction()->HasPrivilege())
|
|
|
+ {
|
|
|
+ LogWarn(Severity_High, Error_Unexpect, VtmLoader_CenterSettingConnectFailed,
|
|
|
+ CSimpleStringA::Format("下载集中配置失败:%s do not has privilege", __FUNCTION__));
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setLogCode("QLR0402101Z01").setResultCode("RTA1104")("集中配置下载失败");
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ auto ret = GetEntityBase()->GetFunction()->GetPrivilegeFunction()->TryUpdateCenterCfg(isUpdate, isReset, version);
|
|
|
+ if (ret != ErrorCodeEnum::Error_Succeed)
|
|
|
+ {
|
|
|
+ LogWarn(Severity_High, Error_Unexpect, VtmLoader_CenterSettingConnectFailed,
|
|
|
+ CSimpleStringA::Format("下载集中配置失败:%d", ret));
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setLogCode("QLR0402101Z01").setResultCode("RTA1104")("集中配置下载失败");
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!isUpdate)
|
|
|
+ {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("GetCenterSetting")("Centersetting not changed from spshell");
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+
|
|
|
+ LogWarn(Severity_Low, Error_Succeed, VtmLoader_CenterSettingConnectFailed,
|
|
|
+ CSimpleStringA::Format("下载集中配置成功,版本号变更成:%s", version.GetData()));
|
|
|
+
|
|
|
+ if (isReset)
|
|
|
+ LogEvent(Severity_Middle, EVENT_MOD_CENTERSETTING_CRITICAL_UPDATE, "SpShell:Update centersetting with critical items.");
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+void CVtmLoaderFSM::OnCentersettingUpdateTimeout(void* pData)
|
|
|
+{
|
|
|
+ GetCenterCfgThread();
|
|
|
+ GetEntityBase()->GetFunction()->ResetTimer(TIMER_CENTERSETTING_UPDATE_CHECK, CENTERSETTING_UPDATE_CHECK_TIME);
|
|
|
}
|