|
@@ -256,7 +256,8 @@ void CHealthManagerEntity::OnCheckTimeTimeout()
|
|
|
ErrorCodeEnum eErrCode;
|
|
|
eErrCode = GetFunction()->GetSysVar("TerminalStage", csTermStage);
|
|
|
Dbg("OnCheckTimeTimeout::ToRestartByCenterSetting to get termstage %s", csTermStage.GetData());
|
|
|
- if (m_bInMainPage || csTermStage.Compare("A"))
|
|
|
+ //oilyang@20250313 in Main page('UIState' is 'M') or TerminalStage is (NOT 'S') AND (NOT 'A'),that is in close page which caused by terminal app
|
|
|
+ if (CheckUIStateIsM() || (!CheckUIStateIsM() && csTermStage.Compare("S") != 0 && csTermStage.Compare("A") != 0) )
|
|
|
{
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("THE key CenterSetting updated,we must restart framework right now.");
|
|
|
m_fsm.QuitFrameworkAndSaveInfo(RebootTrigger_Resource, RebootWay_Framework);
|
|
@@ -299,9 +300,12 @@ void CHealthManagerEntity::OnCheckTimeTimeout()
|
|
|
//2、have ever enter main page OR
|
|
|
if (!m_bSayIdle)
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("m_fsm.GetAccessAuthFlag():%d, m_bEnterMainPageEver:%d, m_bInMainPage:%d", m_fsm.GetAccessAuthFlag()
|
|
|
- , m_bEnterMainPageEver, m_bInMainPage);
|
|
|
- //oilyang@20241230 check accessauth flag AND if in Main page now or ever
|
|
|
- if (m_fsm.GetAccessAuthFlag() && (m_bEnterMainPageEver || (!m_bEnterMainPageEver && m_bInMainPage)))
|
|
|
+ , m_bEnterMainPageEver, CheckUIStateIsM());
|
|
|
+ //oilyang@20241230 check accessauth flag AND if in Main page ever
|
|
|
+ //oilyang@20250313 "Main page ever" has two scenes
|
|
|
+ //1. have enter main page ever,that is "m_bEnterMainPageEver is true"
|
|
|
+ //2. healthmanager have been lost at some point in the past,we check the "UIState" value if 'M'
|
|
|
+ if (m_fsm.GetAccessAuthFlag() && (m_bEnterMainPageEver || (!m_bEnterMainPageEver && CheckUIStateIsM())))
|
|
|
{
|
|
|
iCheckGuardian = CheckGuardianIsRun(true);
|
|
|
if (!m_bSayIdle)
|
|
@@ -313,8 +317,7 @@ void CHealthManagerEntity::OnCheckTimeTimeout()
|
|
|
{
|
|
|
if (m_pfUpgradeRestart != NULL)
|
|
|
{
|
|
|
- eErr = m_pfUpgradeRestart(3, 0);
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("healthmanager say idle,so tell the guardian.%d", eErr);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("healthmanager say idle,so tell the guardian.%d", m_pfUpgradeRestart(3, 0));
|
|
|
}
|
|
|
}
|
|
|
CSimpleStringA csRunCfgPath(""), csStartTime("");
|
|
@@ -348,9 +351,10 @@ void CHealthManagerEntity::OnCheckTimeTimeout()
|
|
|
if (m_pfShake != NULL)
|
|
|
{
|
|
|
WorkStateEnum eShake;
|
|
|
- ErrorCodeEnum eErrShake = m_pfShake(eShake);
|
|
|
+ m_pfShake(eShake);
|
|
|
+ m_ullGuardShakeCount++;
|
|
|
}
|
|
|
- if (m_guardianCount == 0)//in the next timeout(1 minute later than before,to restart guardian)
|
|
|
+ if (m_ullGuardShakeCount == 2)//in the next timeout(1 minute later than before,to restart guardian)
|
|
|
{
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("准备重新启动guardian");
|
|
|
bool bStop = StopGuardian();
|
|
@@ -360,7 +364,10 @@ void CHealthManagerEntity::OnCheckTimeTimeout()
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("restart guardian %d", bGuardian);
|
|
|
}
|
|
|
}
|
|
|
- m_guardianCount--;
|
|
|
+ else if (m_ullGuardShakeCount % 5 == 0)
|
|
|
+ {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("the %d shake hand(guardian)", m_ullGuardShakeCount);
|
|
|
+ }
|
|
|
}
|
|
|
else if (iCheckGuardian == -1)
|
|
|
{
|
|
@@ -378,17 +385,13 @@ void CHealthManagerEntity::OnCheckTimeTimeout()
|
|
|
{
|
|
|
if (m_pfUpgradeRestart != NULL)
|
|
|
{
|
|
|
- eErr = m_pfUpgradeRestart(5, 0);
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("auth suc,so tell the guardian.%d", eErr);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("auth suc,so tell the guardian.%d", m_pfUpgradeRestart(5, 0));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- m_bSayIdle = false;
|
|
|
- }
|
|
|
+
|
|
|
//oilyang@20210331 if accessauth told me not to restart framework,so that it can have time to retry
|
|
|
if (!m_bNeedGuardianRestart)
|
|
|
{
|
|
@@ -397,8 +400,7 @@ void CHealthManagerEntity::OnCheckTimeTimeout()
|
|
|
if (m_pfShake != NULL)
|
|
|
{
|
|
|
WorkStateEnum eShake;
|
|
|
- eErr = m_pfShake(eShake);
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("accessauth told me not to restart framework,so that it can have time to retry.%d", eErr);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("accessauth told me not to restart framework,so that it can have time to retry.%d", m_pfShake(eShake));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -886,14 +888,14 @@ bool CHealthManagerEntity::DoRestart()
|
|
|
if (m_bNeedGuardian)
|
|
|
{
|
|
|
DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("to tell guardian framework is starting.");
|
|
|
- eErr = m_pfUpgradeRestart(4, 0);//tell guardian framework is starting...oilyang 20150514
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("feedback of framework is starting.%d", eErr);
|
|
|
+ //tell guardian framework is starting...oilyang 20150514
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("feedback of framework is starting.%d", m_pfUpgradeRestart(4, 0));
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("need Upgrade guardian only");
|
|
|
- eErr = m_pfUpgradeRestart(6, 0);//tell guardian framework we need Upgrade !!!Only!!! oilyang@20211221
|
|
|
- DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("feedback of need Upgrade guardian only.%d", eErr);
|
|
|
+ //tell guardian framework we need Upgrade !!!Only!!! oilyang@20211221
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("feedback of need Upgrade guardian only.%d", m_pfUpgradeRestart(6, 0));
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1417,9 +1419,8 @@ void CHealthManagerEntity::WarnAndRestartFunc(RebootTriggerEnum eTrigger, Reboot
|
|
|
if (CheckGuardianIsRun(true) > 0)
|
|
|
{
|
|
|
ErrorCodeEnum eErr = Error_Unexpect;
|
|
|
- eErr = m_pfUpgradeRestart(1, 0);
|
|
|
//Dbg("to tell guardian framework is restarting.%d",eErr);
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("to tell guardian framework is restarting.%d", eErr);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("to tell guardian framework is restarting.%d", m_pfUpgradeRestart(1, 0));
|
|
|
}
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("framework shutdown in restart task");
|
|
|
}
|
|
@@ -1512,16 +1513,7 @@ void CHealthManagerEntity::OnEntityStateHook(const char* pszEntityName, const ch
|
|
|
m_modRunInfo[pszEntityName].bAbnormalBusy = true;
|
|
|
m_modRunInfo[pszEntityName].abnormalCount++;
|
|
|
EntityLostProcTask* task;
|
|
|
- //oiltmp@20240415 to be delete after x months
|
|
|
- if (_strnicmp("CardIssuer", pszEntityName, strlen(pszEntityName)) == 0)
|
|
|
- {
|
|
|
- if (m_sysStaticInfo.strMachineType.Compare("RVC.CardStore") == 0 || m_sysStaticInfo.strMachineType.Compare("RVC.CardPrinter") == 0)
|
|
|
- task = new EntityLostProcTask(this, "CardIssuerStore");
|
|
|
- else
|
|
|
- task = new EntityLostProcTask(this, "CardIssuerStand");
|
|
|
- }
|
|
|
- else
|
|
|
- task = new EntityLostProcTask(this, pszEntityName);
|
|
|
+ task = new EntityLostProcTask(this, pszEntityName);
|
|
|
GetFunction()->PostThreadPoolTask(task);
|
|
|
}
|
|
|
}
|
|
@@ -1579,28 +1571,12 @@ void CHealthManagerEntity::OnAnswer(CSmartPointer<IAsynWaitSp> pAsynWaitSp)
|
|
|
new_entry->state = entry->state;
|
|
|
|
|
|
if (new_entry->op == Test_ShakeHand && new_entry->ErrorResult != Error_Succeed) {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("shake hand %s turns out %s, entity state: %s, bBusy:%d", (LPCTSTR)new_entry->EntityName
|
|
|
- , SpStrError(new_entry->ErrorResult), SpStrEntityState((EntityStateEnum)new_entry->state), m_modRunInfo[new_entry->EntityName].bAbnormalBusy);
|
|
|
if (!m_modRunInfo[new_entry->EntityName].bAbnormalBusy)
|
|
|
{
|
|
|
- //oiltmp@20240415 to be delete after x months
|
|
|
- if (_strnicmp("CardIssuer", new_entry->EntityName.GetData(), new_entry->EntityName.GetLength()) == 0)
|
|
|
- {
|
|
|
- if (m_sysStaticInfo.strMachineType.Compare("RVC.CardStore") == 0 || m_sysStaticInfo.strMachineType.Compare("RVC.CardPrinter") == 0)
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("ExceptionErrorProcess CardIssuerStore");
|
|
|
- ExceptionErrorProcess("CardIssuerStore", new_entry->ErrorResult);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("ExceptionErrorProcess CardIssuerStand");
|
|
|
- ExceptionErrorProcess("CardIssuerStand", new_entry->ErrorResult);
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- ExceptionErrorProcess((const char*)new_entry->EntityName, new_entry->ErrorResult);
|
|
|
+ ExceptionErrorProcess((const char*)new_entry->EntityName, new_entry->ErrorResult);
|
|
|
std::map<std::string, std::string> msgInfo;
|
|
|
msgInfo["EntityName"] = new_entry->EntityName.GetData();
|
|
|
+ msgInfo["EntityState"] = SpStrEntityState((EntityStateEnum)new_entry->state);
|
|
|
msgInfo["SelfTestReturnCode"] = SpStrError(new_entry->ErrorResult);
|
|
|
std::pair<bool, std::string> strResult;
|
|
|
strResult = generateJsonStr(msgInfo);
|
|
@@ -1685,22 +1661,7 @@ ErrorCodeEnum CHealthManagerEntity::CheckEntity(const char* pszEntityName, Entit
|
|
|
CSmartPointer<IEntityFunctionPrivilege> pFuncPrivilege = pFunc.ConvertCase<IEntityFunctionPrivilege>();
|
|
|
CSmartPointer<IAsynWaitSp> spWait;
|
|
|
ErrorCodeEnum errCode;
|
|
|
- //oiltmp@20240415 to be delete after x months
|
|
|
- if (_strnicmp("CardIssuer", pszEntityName, strlen(pszEntityName)) == 0)
|
|
|
- {
|
|
|
- if (m_sysStaticInfo.strMachineType.Compare("RVC.CardStore") == 0 || m_sysStaticInfo.strMachineType.Compare("RVC.CardPrinter") == 0)
|
|
|
- {
|
|
|
- errCode = pFuncPrivilege->TestEntity("CardIssuerStore", eTestType, spWait);
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("TestEntity CardIssuerStore");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- errCode = pFuncPrivilege->TestEntity("CardIssuerStand", eTestType, spWait);
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("TestEntity CardIssuerStand");
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- errCode = pFuncPrivilege->TestEntity(pszEntityName, eTestType, spWait);
|
|
|
+ errCode = pFuncPrivilege->TestEntity(pszEntityName, eTestType, spWait);
|
|
|
|
|
|
if (errCode == Error_Succeed)
|
|
|
{
|
|
@@ -1745,7 +1706,8 @@ void CHealthManagerEntity::OnSelfCheckTimeout()
|
|
|
else if (tmpTerminalStage.Compare("A") != 0)
|
|
|
{
|
|
|
//the hardward entity and some other entity no need to test
|
|
|
- if (_strnicmp("PinPad", pszEntityName, strlen("PinPad")) == 0 || _strnicmp("CardIssuer", pszEntityName, strlen("CardIssuer")) == 0
|
|
|
+ if (_strnicmp("PinPad", pszEntityName, strlen("PinPad")) == 0
|
|
|
+ || _strnicmp("CardIssuerStand", pszEntityName, strlen("CardIssuerStand")) == 0 || _strnicmp("CardIssuerStore", pszEntityName, strlen("CardIssuerStore")) == 0
|
|
|
|| _strnicmp("ContactlessCard", pszEntityName, strlen("ContactlessCard")) == 0
|
|
|
|| _strnicmp("IDCertificate", pszEntityName, strlen("IDCertificate")) == 0
|
|
|
|| _strnicmp("gpio", pszEntityName, strlen("gpio")) == 0 || _strnicmp("HSPScanner", pszEntityName, strlen("HSPScanner")) == 0
|
|
@@ -1789,6 +1751,16 @@ void CHealthManagerEntity::EntityLostProc(CSimpleStringA entityName)
|
|
|
}
|
|
|
m_modRunInfo[entityName].bAbnormalBusy = false;
|
|
|
}
|
|
|
+bool CHealthManagerEntity::CheckUIStateIsM()
|
|
|
+{
|
|
|
+ if (m_bInMainPage)
|
|
|
+ return true;
|
|
|
+ CSimpleStringA uiState(true);
|
|
|
+ if (GetFunction()->GetSysVar("UIState", uiState) != Error_Succeed || uiState.Compare("M") != 0)
|
|
|
+ return false;
|
|
|
+ else
|
|
|
+ return true;
|
|
|
+}
|
|
|
SP_BEGIN_ENTITY_MAP()
|
|
|
SP_ENTITY(CHealthManagerEntity)
|
|
|
SP_END_ENTITY_MAP()
|