|
@@ -4,6 +4,7 @@
|
|
|
#include "VtmLoader_UserCode.h"
|
|
|
#include "EventCode.h"
|
|
|
|
|
|
+
|
|
|
#if defined(RVC_OS_WIN)
|
|
|
#include <io.h>
|
|
|
#include "..\RvcVer.h"
|
|
@@ -122,8 +123,14 @@ DWORD checkUrlActive(LPVOID param)
|
|
|
, t_upload_TerminalSys_Suc, t_upload_TerminalUser_Suc, t_upload_BussinessSys_Suc, t_upload_BussinessUser_Suc, t_upload_beidou_Suc,
|
|
|
t_upload_TerminalSys_Err, t_upload_TerminalUser_Err, t_upload_BussinessSys_Err, t_upload_BussinessUser_Err, t_upload_beidou_Err).GetData());
|
|
|
}
|
|
|
+ return 0;
|
|
|
+}
|
|
|
|
|
|
-
|
|
|
+DWORD AlarmVersionErr(LPVOID param)
|
|
|
+{
|
|
|
+ CVtmLoaderFSM* cur = (CVtmLoaderFSM*)param;
|
|
|
+ Sleep(5000);//wait mod_alarm start
|
|
|
+ LogWarn(Severity_Middle, Error_Bug, VtmLoader_DETECT_VERSION_ERR, cur->m_verShowMsg.GetData());
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -147,7 +154,7 @@ CVtmLoaderFSM::CVtmLoaderFSM()
|
|
|
m_iCanIgnoreAddrDetect = 0;
|
|
|
m_ullMaxAddrDetectTime = 10*60*1000;//10 minutes
|
|
|
m_iDetectInterval = 5000;
|
|
|
- m_terminalNoFromWeb = "";
|
|
|
+ m_terminalNoFromWeb = m_verShowMsg = "";
|
|
|
}
|
|
|
|
|
|
CVtmLoaderFSM::~CVtmLoaderFSM()
|
|
@@ -393,7 +400,8 @@ void CVtmLoaderFSM::s2_on_entry()
|
|
|
DWORD elapseTimeTemp = dwElapse / 1000;
|
|
|
CSimpleStringA xMsg = CSimpleStringA::Format("{\"Decripstion\":\"Enter safeload state.\",\"version\":\"%s\",\"elapseTime\":\"%d\"}", m_sysInfo.InstallVersion.ToString().GetData(), elapseTimeTemp);
|
|
|
//LogWarn(Severity_Low, Error_Unexpect, HealthManager_UserErrorCode_Enter_SafeLoad_State, xMsg.GetData());
|
|
|
-
|
|
|
+ if (!VerifyVer())
|
|
|
+ return;
|
|
|
|
|
|
bool bAsync = false;
|
|
|
m_eStage = LOADSTAGE_SAFELOAD;
|
|
@@ -943,11 +951,6 @@ int CVtmLoaderFSM::NetWorkCheckAndGetSetting()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (!VerifyVer())
|
|
|
- return -1;
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
m_ullGetConfigCost = (SP::Module::Comm::RVCGetTickCount() - ullTmpStart) / 1000;//second
|
|
|
//加载实体列表
|
|
|
|
|
@@ -1137,6 +1140,17 @@ int CVtmLoaderFSM::EntityLoad()
|
|
|
DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("StartEntity HealthManager failed(%d).", eErrCode);
|
|
|
return -1;
|
|
|
}
|
|
|
+ eErrCode = pFuncPrivilege->StartEntity("InteractiveControl", NULL, spWait);
|
|
|
+ if (eErrCode == Error_Succeed)
|
|
|
+ {
|
|
|
+ if (spWait != NULL)
|
|
|
+ eErrCode = spWait->WaitAnswer(MAX_AYSNC_TIMEOUT);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("StartEntity InteractiveControl failed(%d).", eErrCode);
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
//wait for all the things have beed done,then save TerminalNo to root.ini
|
|
|
while (true)
|
|
|
{
|
|
@@ -1457,7 +1471,6 @@ bool CVtmLoaderFSM::VerifyVer()
|
|
|
CSmartPointer<IConfigInfo> pConfig;
|
|
|
GetEntityBase()->GetFunction()->OpenConfig(Config_CenterSetting, pConfig);
|
|
|
|
|
|
-
|
|
|
int VerifyVersion = 0;
|
|
|
CSimpleStringA activeVer;
|
|
|
bool isVerEqual = false;
|
|
@@ -1471,6 +1484,7 @@ bool CVtmLoaderFSM::VerifyVer()
|
|
|
#endif
|
|
|
if (curVer == activeVer.GetData())
|
|
|
isVerEqual = true;
|
|
|
+
|
|
|
if (!isVerEqual)
|
|
|
{
|
|
|
CSimpleString showMsg = CSimpleString::Format("version not equal, file version:%s, acitve verion:%s", curVer.c_str(), activeVer.GetData());
|
|
@@ -1480,10 +1494,12 @@ bool CVtmLoaderFSM::VerifyVer()
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)(showMsg.GetData());
|
|
|
break;
|
|
|
case 1:
|
|
|
- LogWarn(Severity_Middle, Error_Unexpect, VtmLoader_DETECT_VERSION_ERR, showMsg.GetData());
|
|
|
+ m_verShowMsg = showMsg;
|
|
|
+ CloseHandle(CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&AlarmVersionErr, this, 0, NULL));
|
|
|
break;
|
|
|
case 2:
|
|
|
- LogWarn(Severity_Middle, Error_Unexpect, VtmLoader_DETECT_VERSION_ERR, showMsg.GetData());
|
|
|
+ m_verShowMsg = showMsg;
|
|
|
+ CloseHandle(CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&AlarmVersionErr, this, 0, NULL));
|
|
|
return false;
|
|
|
break;
|
|
|
default:
|
|
@@ -1791,13 +1807,13 @@ bool CVtmLoaderFSM::RefreshDeviceConfig(SpReqAnsContext<VtmLoaderService_CheckDe
|
|
|
{
|
|
|
if (ctx->Req.entityName.IsNullOrEmpty() || ctx->Req.paramNum <= 0)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER)("param error! nothing to refresh");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER)("param error! nothing to refresh");
|
|
|
return false;
|
|
|
}
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_USER)("entityName:%s,paramNum:%d,module.GetCount:%d",ctx->Req.entityName.GetData(),ctx->Req.paramNum,ctx->Req.module.GetCount());
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER)("entityName:%s,paramNum:%d,module.GetCount:%d",ctx->Req.entityName.GetData(),ctx->Req.paramNum,ctx->Req.module.GetCount());
|
|
|
if (ctx->Req.module.GetCount() < ctx->Req.paramNum || ctx->Req.name.GetCount() < ctx->Req.paramNum || ctx->Req.value.GetCount() < ctx->Req.paramNum)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER)("param array length error! nothing to refresh");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER)("param array length error! nothing to refresh");
|
|
|
return false;
|
|
|
}
|
|
|
for (int i = 0; i < ctx->Req.paramNum; i++)
|
|
@@ -1844,7 +1860,7 @@ void CVtmLoaderFSM::CheckDeviceBaseEntity(SpReqAnsContext<VtmLoaderService_Check
|
|
|
ctx->Answer(Error_Unexpect, VtmLoader_FailToStartEntity);
|
|
|
return;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
//TODO we should wait for device entity open suc?
|
|
|
int count = 0;
|
|
|
do
|