|
|
@@ -7,8 +7,6 @@
|
|
|
#include "ModuleMix.h"
|
|
|
#include "SpHelper.h"
|
|
|
|
|
|
-//read from config file? oiltmp
|
|
|
-const int MAX_RESTART_COUNT = 5;
|
|
|
void SelfCheckerSession::Handle_RealCheck(SpReqAnsContext<SelfCheckerService_RealCheck_Req, SelfCheckerService_RealCheck_Ans>::Pointer ctx)
|
|
|
{
|
|
|
LOG_FUNCTION();
|
|
|
@@ -18,23 +16,23 @@ void SelfCheckerSession::Handle_GetEntityErrorList(SpReqAnsContext<SelfCheckerSe
|
|
|
{
|
|
|
m_pEntity->GetEntityErrorList(ctx);
|
|
|
}
|
|
|
-ErrorCodeEnum CSelfCheckerEntity::GetLiveEntityList(CAutoArray<CSimpleString> &LiveEntitys)
|
|
|
+ErrorCodeEnum CSelfCheckerEntity::GetLiveEntityList(CAutoArray<CSimpleString>& LiveEntitys)
|
|
|
{
|
|
|
ErrorCodeEnum errCode;
|
|
|
errCode = m_fsm.GetAllLiveEntity(LiveEntitys);
|
|
|
return errCode;
|
|
|
}
|
|
|
-ErrorCodeEnum CSelfCheckerEntity::GetEntityTestCode(const char *pszEntityName,ErrorCodeEnum &LastTestError, TestActionEnum &eLastAction)
|
|
|
+ErrorCodeEnum CSelfCheckerEntity::GetEntityTestCode(const char* pszEntityName, ErrorCodeEnum& LastTestError, TestActionEnum& eLastAction)
|
|
|
{
|
|
|
return Error_NotImpl;
|
|
|
}
|
|
|
-ErrorCodeEnum CSelfCheckerEntity::ExamineEntity(const char *pszEntityName)
|
|
|
+ErrorCodeEnum CSelfCheckerEntity::ExamineEntity(const char* pszEntityName)
|
|
|
{
|
|
|
CSmartPointer<IEntityFunction> pFunc = GetFunction();
|
|
|
CSmartPointer<IEntityFunctionPrivilege> pFuncPrivilege = pFunc.ConvertCase<IEntityFunctionPrivilege>();
|
|
|
CSmartPointer<IAsynWaitSp> spWait;
|
|
|
//ErrorCodeEnum errCode;
|
|
|
- pFuncPrivilege->TestEntity(pszEntityName,Test_Examine,spWait);
|
|
|
+ pFuncPrivilege->TestEntity(pszEntityName, Test_Examine, spWait);
|
|
|
return Error_Succeed;
|
|
|
}
|
|
|
//ErrorCodeEnum CSelfCheckerEntity::AddEntity(const char *pszEntityName)
|
|
|
@@ -54,25 +52,25 @@ ErrorCodeEnum CSelfCheckerEntity::ExamineEntity(const char *pszEntityName)
|
|
|
// return Error_Succeed;
|
|
|
//}
|
|
|
// if pszTriggerEntity=null mean created by shell
|
|
|
-void CSelfCheckerEntity::OnCreated(const char *pszEntityName,ErrorCodeEnum eOnStartErrorCode,const char *pszCallerEntity)
|
|
|
+void CSelfCheckerEntity::OnCreated(const char* pszEntityName, ErrorCodeEnum eOnStartErrorCode, const char* pszCallerEntity)
|
|
|
{
|
|
|
- m_fsm.DoOnCreated(pszEntityName,eOnStartErrorCode,pszCallerEntity);
|
|
|
+ m_fsm.DoOnCreated(pszEntityName, eOnStartErrorCode, pszCallerEntity);
|
|
|
}
|
|
|
//Call after the entity has close or killed, eOnCloseErrorCode notic if the entity do OnClose normally and resource has beed release
|
|
|
-void CSelfCheckerEntity::OnClosed(const char *pszEntityName,EntityCloseCauseEnum eCloseCause,ErrorCodeEnum eOnCloseErrorCode,const char *pszCallerEntity)
|
|
|
+void CSelfCheckerEntity::OnClosed(const char* pszEntityName, EntityCloseCauseEnum eCloseCause, ErrorCodeEnum eOnCloseErrorCode, const char* pszCallerEntity)
|
|
|
{
|
|
|
- m_fsm.DoOnClosed(pszEntityName,eCloseCause,eOnCloseErrorCode,pszCallerEntity);
|
|
|
+ m_fsm.DoOnClosed(pszEntityName, eCloseCause, eOnCloseErrorCode, pszCallerEntity);
|
|
|
}
|
|
|
//the following OnException & OnEntityStateHook doing the same thing repeatly???
|
|
|
//1 case is entity raise exception and catch by framework,but not mean the entity will close,2 case is the entity is enter lost state
|
|
|
-void CSelfCheckerEntity::OnException(const char *pszEntityName,const char *pszFunctionName,EntityStateEnum eState,EntityStateEnum eLastState,ErrorCodeEnum eErrorCode)
|
|
|
+void CSelfCheckerEntity::OnException(const char* pszEntityName, const char* pszFunctionName, EntityStateEnum eState, EntityStateEnum eLastState, ErrorCodeEnum eErrorCode)
|
|
|
{
|
|
|
- m_fsm.DoOnException(pszEntityName,pszFunctionName,eState,eLastState,eErrorCode);
|
|
|
+ m_fsm.DoOnException(pszEntityName, pszFunctionName, eState, eLastState, eErrorCode);
|
|
|
}
|
|
|
-void CSelfCheckerEntity::OnEntityStateHook(const char *pszEntityName,const char *pszTriggerEntity,EntityStateEnum eState,EntityStateEnum eLastState)
|
|
|
+void CSelfCheckerEntity::OnEntityStateHook(const char* pszEntityName, const char* pszTriggerEntity, EntityStateEnum eState, EntityStateEnum eLastState)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER)("%s trigger by %s: from %s to %s",pszEntityName,pszTriggerEntity, SpStrEntityState(eLastState), SpStrEntityState(eState));
|
|
|
- m_fsm.AddEntityState(pszEntityName,eState);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s trigger by %s: from %s to %s",pszEntityName,pszTriggerEntity, SpStrEntityState(eLastState), SpStrEntityState(eState));
|
|
|
+ m_fsm.AddEntityState(pszEntityName, eState);
|
|
|
CSmartPointer<IEntityFunction> pFunc = GetFunction();
|
|
|
CSmartPointer<IEntityFunctionPrivilege> pFuncPrivilege = pFunc.ConvertCase<IEntityFunctionPrivilege>();
|
|
|
if (pFuncPrivilege == NULL)
|
|
|
@@ -83,66 +81,65 @@ void CSelfCheckerEntity::OnEntityStateHook(const char *pszEntityName,const char
|
|
|
CSmartPointer<IAsynWaitSp> spWait;
|
|
|
ErrorCodeEnum errCode;
|
|
|
int count = 0;
|
|
|
- //oiltest
|
|
|
- //if (!_strnicmp("MediaController",pszEntityName,strlen("MediaController")))
|
|
|
+
|
|
|
{
|
|
|
- switch(eState)
|
|
|
+ switch (eState)
|
|
|
{
|
|
|
case EntityState_Lost:
|
|
|
- {
|
|
|
- //doing nothing except for loading stage. HandShake will take it.
|
|
|
- //and only for MediaController module.
|
|
|
- //oilyang@20210809 add entity lost LogWarn
|
|
|
- char tmpWarnMsg[256] = {};
|
|
|
- snprintf(tmpWarnMsg, sizeof(tmpWarnMsg), "%s lost. trig entity:%s,lastState:%d", pszEntityName, pszTriggerEntity, eLastState);
|
|
|
- CEntityStaticInfo esi = { 0 };
|
|
|
- ErrorCodeEnum ec = GetFunction()->GetEntityStaticInfo(pszEntityName, esi);
|
|
|
- LogWarn(Severity_High, Error_Unexpect, SelfChecker_UserErrorCode_EntityLost_Start + esi.wEntityDevelopID, tmpWarnMsg);
|
|
|
- if (m_bEverInMainPage && _strnicmp("TokenKeeper", pszEntityName, strlen("TokenKeeper")) == 0)
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("TokenKeeper lost");
|
|
|
- LogEvent(Severity_Middle, LOG_EVT_SELFCHECK_TOKEN_KEEPER_LOST, "TokenKeeper lost,restart and auth again.");
|
|
|
- break;
|
|
|
- }
|
|
|
- if (m_bEverInMainPage)
|
|
|
- break;
|
|
|
- if (_strnicmp("MediaController", pszEntityName, strlen("MediaController")) != 0)
|
|
|
- break;
|
|
|
- count = m_entityProcInfo[pszEntityName].restartTimes;
|
|
|
- if (count >= MAX_RESTART_COUNT)
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("%s has restart %d times,give up to restart it again.", pszEntityName, count);
|
|
|
- char xxx[256] = { 0 };
|
|
|
- sprintf(xxx, "%s restart %d times,give up.", (LPCTSTR)pszEntityName, count);
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("logwarn %s", xxx);
|
|
|
- LogWarn(Severity_Middle, Error_Unexpect, LOG_WARN_SELFCHECK_ENTITY_LOST_TIMES, xxx);
|
|
|
- break;
|
|
|
- }
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s lost count %d", pszEntityName, count);
|
|
|
- errCode = pFuncPrivilege->TerminateEntity(pszEntityName, spWait);
|
|
|
- if (errCode == Error_Succeed)
|
|
|
- {
|
|
|
- errCode = spWait->WaitAnswer(10000);
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("onlost kill wait %d", errCode);
|
|
|
- }
|
|
|
- else
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("onlost kill %d", errCode);
|
|
|
- Sleep(5000);
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("to start(lost)");
|
|
|
- errCode = pFuncPrivilege->StartEntity(pszEntityName, NULL, spWait);
|
|
|
- if (errCode == Error_Succeed)
|
|
|
{
|
|
|
- errCode = spWait->WaitAnswer(10000);
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("onlost start wait %d", errCode);
|
|
|
- }
|
|
|
- else
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("onlost start %d", errCode);
|
|
|
+ //oilyang@20220415 special process of RVC.PAD with FWB
|
|
|
+ //doing nothing except for loading stage. HandShake will take it.
|
|
|
+ //and only for MediaController module.
|
|
|
+ //oilyang@20210809 add entity lost LogWarn
|
|
|
+ char tmpWarnMsg[256] = {};
|
|
|
+ snprintf(tmpWarnMsg, sizeof(tmpWarnMsg), "%s lost. trig entity:%s,lastState:%d", pszEntityName, pszTriggerEntity, eLastState);
|
|
|
+ CEntityStaticInfo esi = { 0 };
|
|
|
+ ErrorCodeEnum ec = GetFunction()->GetEntityStaticInfo(pszEntityName, esi);
|
|
|
+ LogWarn(Severity_High, Error_Unexpect, SelfChecker_UserErrorCode_EntityLost_Start + esi.wEntityDevelopID, tmpWarnMsg);
|
|
|
+ if (m_bEverInMainPage && _strnicmp("TokenKeeper", pszEntityName, strlen("TokenKeeper")) == 0)
|
|
|
+ {
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("TokenKeeper lost");
|
|
|
+ LogEvent(Severity_Middle, LOG_EVT_SELFCHECK_TOKEN_KEEPER_LOST, "TokenKeeper lost,restart and auth again.");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (m_bEverInMainPage)
|
|
|
+ break;
|
|
|
+ if (_strnicmp("MediaController", pszEntityName, strlen("MediaController")) != 0)
|
|
|
+ break;
|
|
|
+ count = m_entityProcInfo[pszEntityName].restartTimes;
|
|
|
+ if (count >= m_maxEtyRestartTimes)
|
|
|
+ {
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("%s has restart %d times,give up to restart it again.", pszEntityName, count);
|
|
|
+ char xxx[256] = { 0 };
|
|
|
+ snprintf(xxx, sizeof(xxx), "%s restart %d times,give up.", (LPCTSTR)pszEntityName, count);
|
|
|
+ LogWarn(Severity_High, Error_Unexpect, LOG_WARN_SELFCHECK_ENTITY_LOST_TIMES, xxx);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s lost count %d", pszEntityName, count);
|
|
|
+ errCode = pFuncPrivilege->TerminateEntity(pszEntityName, spWait);
|
|
|
+ if (errCode == Error_Succeed)
|
|
|
+ {
|
|
|
+ errCode = spWait->WaitAnswer(10000);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("onlost kill wait %d", errCode);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("onlost kill %d", errCode);
|
|
|
+ Sleep(5000);
|
|
|
+ errCode = pFuncPrivilege->StartEntity(pszEntityName, NULL, spWait);
|
|
|
+ if (errCode == Error_Succeed)
|
|
|
+ {
|
|
|
+ errCode = spWait->WaitAnswer(10000);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("onlost start wait %d", errCode);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("onlost start %d", errCode);
|
|
|
|
|
|
- m_entityProcInfo[pszEntityName].restartTimes = count + 1;
|
|
|
- }
|
|
|
+ m_entityProcInfo[pszEntityName].restartTimes = count + 1;
|
|
|
+ }
|
|
|
break;
|
|
|
case EntityState_Idle:
|
|
|
{
|
|
|
+ m_entityProcInfo[pszEntityName].restartTimes = 0;
|
|
|
if (!_strnicmp("AssistantChannel", pszEntityName, strlen("AssistantChannel")))
|
|
|
{
|
|
|
if (m_pAssChanClient != NULL)
|
|
|
@@ -150,30 +147,28 @@ void CSelfCheckerEntity::OnEntityStateHook(const char *pszEntityName,const char
|
|
|
m_pAssChanClient->SafeDelete();
|
|
|
m_pAssChanClient = NULL;
|
|
|
}
|
|
|
-
|
|
|
DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("AssistantChannel change to idle.");
|
|
|
LogEvent(Severity_Middle, LOG_EVT_SELFCHECK_ASSISTANTCHANNEL_IDLE, "AssistantChannel to idle.");
|
|
|
ConnectToAssistChannel();
|
|
|
}
|
|
|
- if (!_strnicmp("SIPPhone", pszEntityName, strlen("SIPPhone")))
|
|
|
+ else if (!_strnicmp("SIPPhone", pszEntityName, strlen("SIPPhone")))
|
|
|
{
|
|
|
DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("SIPPhone change to idle.");
|
|
|
LogEvent(Severity_Middle, LOG_EVT_SELFCHECK_SIPPHONE_IDLE, "SIPPhone to idle.");
|
|
|
}
|
|
|
- if (!_strnicmp("IEBrowser", pszEntityName, strlen("IEBrowser")))
|
|
|
+ else if (!_strnicmp("HealthManager", pszEntityName, strlen("HealthManager")))
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("IEBrowser change to idle.");
|
|
|
- LogEvent(Severity_Middle, LOG_EVT_SELFCHECK_IEBROWSER_IDLE, "IEBrowser to idle.");
|
|
|
- m_bIEIdle = true;
|
|
|
}
|
|
|
- if (!_strnicmp("HealthManager", pszEntityName, strlen("HealthManager")))
|
|
|
+ else if (!_strnicmp("LocalMediaPlay", pszEntityName, strlen("LocalMediaPlay")))
|
|
|
{
|
|
|
+ LogEvent(Severity_Middle, LOG_EVT_SELFCHECK_LOCALMEDIAPLAY_IDLE, "LocalMediaPlay to idle.");
|
|
|
}
|
|
|
- if (!_strnicmp("LocalMediaPlay", pszEntityName, strlen("LocalMediaPlay")))
|
|
|
+ if (_strnicmp("Chromium", pszEntityName, strlen("Chromium")) == 0)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("LocalMediaPlay change to idle.");
|
|
|
- LogEvent(Severity_Middle, LOG_EVT_SELFCHECK_LOCALMEDIAPLAY_IDLE, "LocalMediaPlay to idle.");
|
|
|
+ LogEvent(Severity_Middle, LOG_EVT_SELFCHECK_IEBROWSER_IDLE, "Chromium to idle.");
|
|
|
+ m_bIEIdle = true;
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
|
@@ -181,29 +176,29 @@ void CSelfCheckerEntity::OnEntityStateHook(const char *pszEntityName,const char
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-void CSelfCheckerEntity::OnUserStateHook(const char *pszEntityName,DWORD dwState,DWORD dwLastState)
|
|
|
+void CSelfCheckerEntity::OnUserStateHook(const char* pszEntityName, DWORD dwState, DWORD dwLastState)
|
|
|
{
|
|
|
}
|
|
|
-void CSelfCheckerEntity::OnCeateConnection(const char *pszCallerEntity,const char *pszServiceEntity)
|
|
|
+void CSelfCheckerEntity::OnCeateConnection(const char* pszCallerEntity, const char* pszServiceEntity)
|
|
|
{
|
|
|
}
|
|
|
-void CSelfCheckerEntity::OnCloseConnection(const char *pszCallerEntity,const char *pszServiceEntity)
|
|
|
+void CSelfCheckerEntity::OnCloseConnection(const char* pszCallerEntity, const char* pszServiceEntity)
|
|
|
{
|
|
|
}
|
|
|
void CSelfCheckerEntity::RealCheck(SpReqAnsContext<SelfCheckerService_RealCheck_Req, SelfCheckerService_RealCheck_Ans>::Pointer ctx)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Real check %s",(LPCTSTR)ctx->Req.name);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Real check %s", (LPCTSTR)ctx->Req.name);
|
|
|
m_fsm.CheckEntity(ctx->Req.name,Test_ShakeHand);
|
|
|
ctx->Answer(Error_Succeed);
|
|
|
}
|
|
|
void CSelfCheckerEntity::GetEntityErrorList(SpReqAnsContext<SelfCheckerService_GetEntityErrorList_Req, SelfCheckerService_GetEntityErrorList_Ans>::Pointer ctx)
|
|
|
{
|
|
|
- ErrorCodeEnum eErr = m_fsm.GetEntityErrorList(ctx->Ans.warmLevel,ctx->Ans.list);
|
|
|
+ ErrorCodeEnum eErr = m_fsm.GetEntityErrorList(ctx->Ans.warmLevel, ctx->Ans.list);
|
|
|
ctx->Answer(eErr);
|
|
|
}
|
|
|
-void CSelfCheckerEntity::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUID nLogID,const LogTypeEnum eLogType, const SeverityLevelEnum eLevel,
|
|
|
- const DWORD dwSysError,const DWORD dwUserCode,const DWORD dwEntityInstanceID, const WORD wEntityDevelID,
|
|
|
- const CAutoArray<DWORD> &Param, const char *pszEntityName, const char *pszModuleName,const char *pszMessage, const linkContext& pLinkInfo)
|
|
|
+void CSelfCheckerEntity::OnLog(const CAutoArray<CUUID>& SubIDs, const CUUID nLogID, const LogTypeEnum eLogType, const SeverityLevelEnum eLevel,
|
|
|
+ const DWORD dwSysError, const DWORD dwUserCode, const DWORD dwEntityInstanceID, const WORD wEntityDevelID,
|
|
|
+ const CAutoArray<DWORD>& Param, const char* pszEntityName, const char* pszModuleName, const char* pszMessage, const linkContext& pLinkInfo)
|
|
|
{
|
|
|
//oilyang@20200304 add process FWB open suc.
|
|
|
if (dwUserCode == LOG_EVT_CARDREADER_OPEN_SUC_FWB)
|
|
|
@@ -247,8 +242,8 @@ void CSelfCheckerEntity::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUID nLog
|
|
|
//oilyang@20170918 only process the Log_Error of Severity_High
|
|
|
if (eLogType != Log_Error || eLevel != Severity_High)
|
|
|
return;
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("user code %d,%s",dwUserCode,(LPCTSTR)pszMessage);
|
|
|
- switch(dwUserCode)
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("user code %d,%s", dwUserCode, (LPCTSTR)pszMessage);
|
|
|
+ switch (dwUserCode)
|
|
|
{
|
|
|
case LOG_ERR_PINPAD_FAILED:
|
|
|
case ERROR_MOD_MEDIACONTROLLER_ENVCAMERA_BUG:
|
|
|
@@ -257,23 +252,23 @@ void CSelfCheckerEntity::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUID nLog
|
|
|
case ERROR_MOD_MEDIACONTROLLER_OPTCAM_OPEN:
|
|
|
case ERROR_MOD_MEDIACONTROLLER_ENVCAM_INITFAIL:
|
|
|
case ERROR_MOD_MEDIACONTROLLER_OPTCAM_INITFAIL:
|
|
|
- MsgPushedByAssChannel(ACM_TYPE_DEVICE,ACM_DEVICE_ERROR,pszEntityName,pszMessage);
|
|
|
+ MsgPushedByAssChannel(ACM_TYPE_DEVICE, ACM_DEVICE_ERROR, pszEntityName, pszMessage);
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
m_fsm.Proc(pszEntityName, ProcType_Warn, dwUserCode, pszMessage);
|
|
|
}
|
|
|
-ErrorCodeEnum CSelfCheckerEntity::MsgPushedByAssChannel(const int type,const int sub_type,const char *pszEntityName,const char *pszMessage)
|
|
|
+ErrorCodeEnum CSelfCheckerEntity::MsgPushedByAssChannel(const int type, const int sub_type, const char* pszEntityName, const char* pszMessage)
|
|
|
{
|
|
|
if (m_pAssChanClient == NULL)
|
|
|
{
|
|
|
- ErrorCodeEnum eConn = ConnectToAssistChannel();
|
|
|
- if (eConn != Error_Succeed)
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("connect to AssistantChannel failed(%d).",eConn);
|
|
|
- return Error_Resource;
|
|
|
- }
|
|
|
+ ErrorCodeEnum eConn = ConnectToAssistChannel();
|
|
|
+ if (eConn != Error_Succeed)
|
|
|
+ {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("connect to AssistantChannel failed(%d).", eConn);
|
|
|
+ return Error_Resource;
|
|
|
+ }
|
|
|
}
|
|
|
ChannelService_Send_Info Info;
|
|
|
Info.compress = false;
|
|
|
@@ -284,14 +279,14 @@ ErrorCodeEnum CSelfCheckerEntity::MsgPushedByAssChannel(const int type,const int
|
|
|
Info.data.Alloc(sizeof(int));
|
|
|
SpBuffer buf;
|
|
|
buf.OpenWrite();
|
|
|
- CSimpleStringA csEntityName(pszEntityName),csBlack(" "),csMsg(pszMessage);
|
|
|
- buf & csEntityName & csBlack & csMsg;
|
|
|
+ CSimpleStringA csEntityName(pszEntityName), csBlack(" "), csMsg(pszMessage);
|
|
|
+ buf& csEntityName& csBlack& csMsg;
|
|
|
Info.data = buf.ToBlob();
|
|
|
m_pAssChanClient->Send(Info);
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("send msg %d %d:%s %s",type,sub_type,pszEntityName,pszMessage);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("send msg %d %d:%s %s", type, sub_type, pszEntityName, pszMessage);
|
|
|
return Error_Succeed;
|
|
|
}
|
|
|
-ErrorCodeEnum CSelfCheckerEntity::GetEntityStatusStr(CSimpleStringA &result)
|
|
|
+ErrorCodeEnum CSelfCheckerEntity::GetEntityStatusStr(CSimpleStringA& result)
|
|
|
{
|
|
|
CSmartPointer<IEntityFunction> pFunc = GetFunction();
|
|
|
CEntityRunInfo runInfo;
|
|
|
@@ -299,15 +294,14 @@ ErrorCodeEnum CSelfCheckerEntity::GetEntityStatusStr(CSimpleStringA &result)
|
|
|
vector<CSimpleStringA>::iterator it;
|
|
|
for (it = m_vQueryStateEntity.begin(); it != m_vQueryStateEntity.end(); ++it)
|
|
|
{
|
|
|
- eErr = pFunc->GetEntityRunInfo(*it,runInfo);
|
|
|
+ eErr = pFunc->GetEntityRunInfo(*it, runInfo);
|
|
|
if (eErr == Error_Succeed)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s,%d",(LPCTSTR)*it,runInfo.dwUserState);
|
|
|
result += UserDefEntityMsg[runInfo.dwUserState][0];
|
|
|
result += " ;";
|
|
|
}
|
|
|
}
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("state[%s]",(LPCTSTR)result);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("state[%s]", (LPCTSTR)result);
|
|
|
return Error_Succeed;
|
|
|
}
|
|
|
ErrorCodeEnum CSelfCheckerEntity::ConnectToAssistChannel()
|
|
|
@@ -324,11 +318,11 @@ ErrorCodeEnum CSelfCheckerEntity::ConnectToAssistChannel()
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("AssistantChannel connected.");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("AssistantChannel connected.");
|
|
|
{
|
|
|
ChannelService_BeginState_Sub Sub;
|
|
|
ErrorConn = m_pAssChanClient->BeginState(Sub);
|
|
|
- if (ErrorConn != Error_Succeed)
|
|
|
+ if (ErrorConn != Error_Succeed)
|
|
|
{
|
|
|
DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("BeginState biz channel failed!");
|
|
|
m_pAssChanClient->GetFunction()->CloseSession();
|
|
|
@@ -337,7 +331,7 @@ ErrorCodeEnum CSelfCheckerEntity::ConnectToAssistChannel()
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("BeginState biz channel success!");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("BeginState biz channel success!");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -345,7 +339,7 @@ ErrorCodeEnum CSelfCheckerEntity::ConnectToAssistChannel()
|
|
|
ChannelService_BeginRecv_Sub Sub;
|
|
|
Sub.type = ACM_TYPE_DEVICE;
|
|
|
ErrorConn = m_pAssChanClient->BeginRecv(Sub);
|
|
|
- if (ErrorConn != Error_Succeed)
|
|
|
+ if (ErrorConn != Error_Succeed)
|
|
|
{
|
|
|
DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Begin BeginRecv ACM_TYPE_DEVICE failed!");
|
|
|
m_pAssChanClient->GetFunction()->CloseSession();
|
|
|
@@ -354,7 +348,7 @@ ErrorCodeEnum CSelfCheckerEntity::ConnectToAssistChannel()
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Begin BeginRecv ACM_TYPE_DEVICE success!");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Begin BeginRecv ACM_TYPE_DEVICE success!");
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -363,7 +357,7 @@ ErrorCodeEnum CSelfCheckerEntity::ConnectToAssistChannel()
|
|
|
}
|
|
|
ErrorCodeEnum CSelfCheckerEntity::RestartModule(const char* pEntityName)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("to RestartModule:%s",pEntityName);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("to RestartModule:%s", pEntityName);
|
|
|
m_fsm.SetEntityRestarting(pEntityName, true);
|
|
|
CSmartPointer<IEntityFunction> pFunc = GetFunction();
|
|
|
CSmartPointer<IEntityFunctionPrivilege> pFuncPrivilege = pFunc.ConvertCase<IEntityFunctionPrivilege>();
|
|
|
@@ -380,7 +374,7 @@ ErrorCodeEnum CSelfCheckerEntity::RestartModule(const char* pEntityName)
|
|
|
eErrCode = spWait->WaitAnswer(10000);
|
|
|
if (eErrCode != Error_Succeed)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("kill %s %d", pEntityName, eErrCode);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("kill %s %d", pEntityName, eErrCode);
|
|
|
m_fsm.SetEntityRestarting(pEntityName, false);
|
|
|
return eErrCode;
|
|
|
}
|
|
|
@@ -390,7 +384,7 @@ ErrorCodeEnum CSelfCheckerEntity::RestartModule(const char* pEntityName)
|
|
|
eErrCode = spWait->WaitAnswer(10000);
|
|
|
if (eErrCode != Error_Succeed)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("start %s %d", pEntityName, eErrCode);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("start %s %d", pEntityName, eErrCode);
|
|
|
m_fsm.SetEntityRestarting(pEntityName, false);
|
|
|
return eErrCode;
|
|
|
}
|
|
|
@@ -408,25 +402,25 @@ void CSelfCheckerEntity::OnSysVarEvent(const char* pszKey, const char* pszValue,
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-void AssistChannelSelfCheckerClient::OnMessage(ErrorCodeEnum Error, ChannelService_State_Info &Msg, CSmartPointer<IReleasable> pData)
|
|
|
+void AssistChannelSelfCheckerClient::OnMessage(ErrorCodeEnum Error, ChannelService_State_Info& Msg, CSmartPointer<IReleasable> pData)
|
|
|
{
|
|
|
|
|
|
}
|
|
|
-void AssistChannelSelfCheckerClient::OnMessage(ErrorCodeEnum Error, ChannelService_Packet_Info &Msg, CSmartPointer<IReleasable> pData)
|
|
|
+void AssistChannelSelfCheckerClient::OnMessage(ErrorCodeEnum Error, ChannelService_Packet_Info& Msg, CSmartPointer<IReleasable> pData)
|
|
|
{
|
|
|
LOG_FUNCTION();
|
|
|
- if (Error == Error_Succeed)
|
|
|
+ if (Error == Error_Succeed)
|
|
|
{
|
|
|
- CSelfCheckerEntity *pEntity = static_cast<CSelfCheckerEntity*>(m_pEntityBase);
|
|
|
- switch(Msg.sub_type)
|
|
|
+ CSelfCheckerEntity* pEntity = static_cast<CSelfCheckerEntity*>(m_pEntityBase);
|
|
|
+ switch (Msg.sub_type)
|
|
|
{
|
|
|
case ACM_ENTITY_STATE_REQ:
|
|
|
- {
|
|
|
- CSimpleStringA result;
|
|
|
- pEntity->GetEntityStatusStr(result);
|
|
|
- pEntity->MsgPushedByAssChannel(ACM_TYPE_DEVICE,ACM_ENTITY_STATE_ANS,result);
|
|
|
- }
|
|
|
- break;
|
|
|
+ {
|
|
|
+ CSimpleStringA result;
|
|
|
+ pEntity->GetEntityStatusStr(result);
|
|
|
+ pEntity->MsgPushedByAssChannel(ACM_TYPE_DEVICE, ACM_ENTITY_STATE_ANS, result);
|
|
|
+ }
|
|
|
+ break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|