Răsfoiți Sursa

Z991239-4870 #comment 信创反向同步到win

oilyang 2 ani în urmă
părinte
comite
93cb96233f

+ 10 - 0
Module/mod_ContactlessCard/ContactlessCard_def_g.h

@@ -32,6 +32,16 @@ namespace ContactlessCard {
 #define ContactlessCardService_MethodSignature_QueryCardInfo 154962579
 #define ContactlessCardService_MethodSignature_GetDevInfo 296205965
 
+#define ContactlessCardService_LogCode_Insert "QLR040221300"
+#define ContactlessCardService_LogCode_CancelInsert "QLR040221301"
+#define ContactlessCardService_LogCode_InsertWaitMore "QLR040221302"
+#define ContactlessCardService_LogCode_PreOnline "QLR040221303"
+#define ContactlessCardService_LogCode_PostOnline "QLR040221304"
+#define ContactlessCardService_LogCode_Eject "QLR040221305"
+#define ContactlessCardService_LogCode_Exit "QLR040221306"
+#define ContactlessCardService_LogCode_QueryCardInfo "QLR040221307"
+#define ContactlessCardService_LogCode_GetDevInfo "QLR040221399"
+
 struct ContactlessCardService_Insert_Req
 {
 	CSimpleStringA aid;

+ 2 - 2
Module/mod_ContactlessCard/ContactlessFSM.cpp

@@ -7,9 +7,9 @@
 #include "ContactlessCard_UserErrorCode.h"
 #include "CommDevEntityErrorCode.h"
 #include <map>
-//#include "RVCComm.h"
+
 #include "publicFunExport.h"
-#include "json/json.h"
+
 
 
 const int GET_DEV_STATUS_COUNT = 3;

+ 4 - 0
Module/mod_ContactlessCard/ContactlessFSM.h

@@ -12,7 +12,11 @@
 #include "ContactlessCard_server_g.h"
 #include "ContactlessCard_msg_g.h"
 #include "ContactlessCard_UserErrorCode.h"
+#if defined(RVC_OS_LINUX)
 #include "json/json.h"
+#else
+#include "json.h"
+#endif
 enum EvtType
 {
 	USER_EVT_TEST = EVT_USER+1,

+ 9 - 0
Module/mod_ContactlessCard/mod_ContactlessCard.cpp

@@ -9,24 +9,28 @@ bool bCard = false;
 void ContactlessCardServerSession::Handle_Insert(SpReqAnsContext<ContactlessCardService_Insert_Req, ContactlessCardService_Insert_Ans>::Pointer ctx)
 {
 	LOG_FUNCTION();
+	DbgToBeidou(ctx->link, __FUNCTION__)();
 	DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI("Insert")("Invoke Insert");
 	m_pEntity->Insert(ctx);
 }
 void ContactlessCardServerSession::Handle_CancelInsert(SpOnewayCallContext<ContactlessCardService_CancelInsert_Info>::Pointer ctx)
 {
 	LOG_FUNCTION();
+	DbgToBeidou(ctx->link, __FUNCTION__)();
 	DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI("CancelInsert")("Invoke CancelInsert");
 	m_pEntity->CancelInsert(ctx);
 }
 void ContactlessCardServerSession::Handle_InsertWaitMore(SpOnewayCallContext<ContactlessCardService_InsertWaitMore_Info>::Pointer ctx)
 {
 	LOG_FUNCTION();
+	DbgToBeidou(ctx->link, __FUNCTION__)();
 	DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI("InsertWaitMore")("Invoke InsertWaitMore");
 	m_pEntity->InsertWaitMore(ctx);
 }
 void ContactlessCardServerSession::Handle_PreOnline(SpReqAnsContext<ContactlessCardService_PreOnline_Req, ContactlessCardService_PreOnline_Ans>::Pointer ctx)
 {
 	LOG_FUNCTION();
+	DbgToBeidou(ctx->link, __FUNCTION__)();
 	DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI("PreOnline")("Invoke PreOnline");
 	m_pEntity->PreOnline(ctx);
 }
@@ -34,6 +38,7 @@ void ContactlessCardServerSession::Handle_PreOnline(SpReqAnsContext<ContactlessC
 void ContactlessCardServerSession::Handle_PostOnline(SpReqAnsContext<ContactlessCardService_PostOnline_Req, ContactlessCardService_PostOnline_Ans>::Pointer ctx)
 {
 	LOG_FUNCTION();
+	DbgToBeidou(ctx->link, __FUNCTION__)();
 	DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI("PostOnline")("Invoke PostOnline");
 	m_pEntity->PostOnline(ctx);
 }
@@ -41,6 +46,7 @@ void ContactlessCardServerSession::Handle_PostOnline(SpReqAnsContext<Contactless
 void ContactlessCardServerSession::Handle_Eject(SpReqAnsContext<ContactlessCardService_Eject_Req, ContactlessCardService_Eject_Ans>::Pointer ctx)
 {
 	LOG_FUNCTION();
+	DbgToBeidou(ctx->link, __FUNCTION__)();
 	DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI("Eject")("Invoke Eject");
 	m_pEntity->Eject(ctx);
 }
@@ -48,18 +54,21 @@ void ContactlessCardServerSession::Handle_Eject(SpReqAnsContext<ContactlessCardS
 void ContactlessCardServerSession::Handle_Exit(SpOnewayCallContext<ContactlessCardService_Exit_Info>::Pointer ctx)
 {
 	LOG_FUNCTION();
+	DbgToBeidou(ctx->link, __FUNCTION__)();
 	DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI("Exit")("Invoke Exit");
 	m_pEntity->Exit(ctx);
 }
 void ContactlessCardServerSession::Handle_QueryCardInfo(SpReqAnsContext<ContactlessCardService_QueryCardInfo_Req, ContactlessCardService_QueryCardInfo_Ans>::Pointer ctx)
 {
 	LOG_FUNCTION();
+	DbgToBeidou(ctx->link, __FUNCTION__)();
 	DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI("QueryCardInfo")("Invoke QueryCardInfo");
 	m_pEntity->QueryCardInfo(ctx);
 }
 void ContactlessCardServerSession::Handle_GetDevInfo(SpReqAnsContext<ContactlessCardService_GetDevInfo_Req, ContactlessCardService_GetDevInfo_Ans>::Pointer ctx)
 {
 	LOG_FUNCTION();
+	DbgToBeidou(ctx->link, __FUNCTION__)();
 	DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI("GetDevInfo")("Invoke GetDevInfo");
 	m_pEntity->GetDevInfo(ctx);
 }

+ 6 - 2
Module/mod_healthmanager/HealthManagerFSM.cpp

@@ -70,9 +70,13 @@ void CHealthManagerFSM::WaitALittleIfNecessary()
     if (IsCoolBootThisTime()) {
         GetEntityBase()->GetFunction()->ShowStartupInfo("正在初始化,请稍等片刻......");
         int millsec = 0;
-        SP::Module::Comm::Settings::ReadConfigFromCenterSettings(m_pEntity, "CoolBootDefaultWaitMillsecs", NULL, &millsec);
+        SP::Module::Comm::Settings::ReadConfigFromCenterAfterCfg(m_pEntity, "SleepColdBootMS", NULL, &millsec);
         if (millsec <= 0) {
+			//need TODO:boot reform
+#if defined(RVC_OS_LINUX)
 			millsec = 30000;
+#endif // defined(RVC_OS_LINUX)
+			millsec = 10000;
         }
 
         DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Sleep a little time %d", millsec);
@@ -315,7 +319,7 @@ bool CHealthManagerFSM::IsCoolBootThisTime()
 //系统启动小于1.5分钟,认为是冷启动
 	m_ullElapseFromOSStart = GetTickCount64();
 	int millsec = 0;
-	SP::Module::Comm::Settings::ReadConfigFromCenterSettings(m_pEntity, "BootMaxMillsecsSeeAsAutoRun", NULL, &millsec);
+	SP::Module::Comm::Settings::ReadConfigFromCenterAfterCfg(m_pEntity, "BootMaxMillsecsSeeAsAutoRun", NULL, &millsec);
 	if (millsec <= 0) {
 		millsec = 90000;
 	}

+ 1 - 0
Module/mod_healthmanager/HealthManager_def_g.h

@@ -253,6 +253,7 @@ struct HealthManagerService_GetAuthErrMsg_Ans
 	}
 
 };
+
 struct HealthManagerService_ControlTerminalLife_Req
 {
 	int cmdType;

+ 14 - 1
Module/mod_healthmanager/mod_healthmanager.cpp

@@ -124,61 +124,73 @@ static void PrintTerminalRegistInfo(const TerminalRegistRet* info)
 void HealthManagerSession::Handle_EnterState(SpReqAnsContext<HealthManagerService_EnterState_Req, HealthManagerService_EnterState_Ans>::Pointer ctx)
 {
 	LOG_FUNCTION();
+	DbgToBeidou(ctx->link, __FUNCTION__)();
 	m_pEntity->EnterState(ctx);
 }
 
 void HealthManagerSession::Handle_ExitState(SpReqAnsContext<HealthManagerService_ExitState_Req, HealthManagerService_ExitState_Ans>::Pointer ctx)
 {
 	LOG_FUNCTION();
+	DbgToBeidou(ctx->link, __FUNCTION__)();
 	m_pEntity->ExitState(ctx);
 }
 
 void HealthManagerSession::Handle_DoEvent(SpReqAnsContext<HealthManagerService_DoEvent_Req, HealthManagerService_DoEvent_Ans>::Pointer ctx)
 {
 	LOG_FUNCTION();
+	DbgToBeidou(ctx->link, __FUNCTION__)();
 	m_pEntity->DoEvent(ctx);
 }
 void HealthManagerSession::Handle_GetEntityCfgInfo(SpReqAnsContext<HealthManagerService_GetEntityCfgInfo_Req, HealthManagerService_GetEntityCfgInfo_Ans>::Pointer ctx)
 {
+	DbgToBeidou(ctx->link, __FUNCTION__)();
 	m_pEntity->GetEntityCfgInfo(ctx);
 }
 void HealthManagerSession::Handle_GetNetworkState(SpReqAnsContext<HealthManagerService_GetNetworkState_Req, HealthManagerService_GetNetworkState_Ans>::Pointer ctx)
 {
+	DbgToBeidou(ctx->link, __FUNCTION__)();
 	m_pEntity->GetNetworkState(ctx);
 }
 void HealthManagerSession::Handle_QueryHardwareInfo(SpReqAnsContext<HealthManagerService_QueryHardwareInfo_Req, HealthManagerService_QueryHardwareInfo_Ans>::Pointer ctx)
 {
+	DbgToBeidou(ctx->link, __FUNCTION__)();
 	m_pEntity->QueryHardwareInfo(ctx);
 }
 void HealthManagerSession::Handle_ReadCenterConfigStr(SpReqAnsContext<HealthManagerService_ReadCenterConfigStr_Req, HealthManagerService_ReadCenterConfigStr_Ans>::Pointer ctx)
 {
 	LOG_FUNCTION();
+	DbgToBeidou(ctx->link, __FUNCTION__)();
 }
 void HealthManagerSession::Handle_GetAuthErrMsg(SpReqAnsContext<HealthManagerService_GetAuthErrMsg_Req, HealthManagerService_GetAuthErrMsg_Ans>::Pointer ctx)
 {
+	DbgToBeidou(ctx->link, __FUNCTION__)();
 	m_pEntity->GetAuthErrMsg(ctx);
 }
 void HealthManagerSession::Handle_ControlTerminalLife(
 	SpReqAnsContext<HealthManagerService_ControlTerminalLife_Req, HealthManagerService_ControlTerminalLife_Ans>::Pointer ctx)
 {
     LOG_FUNCTION();
+	DbgToBeidou(ctx->link, __FUNCTION__)();
 	m_pEntity->ControlTerminalLife(ctx);
 }
 void HealthManagerSession::Handle_DeployTerminal(SpReqAnsContext<HealthManagerService_DeployTerminal_Req, HealthManagerService_DeployTerminal_Ans>::Pointer ctx)
 {
     LOG_FUNCTION();
+	DbgToBeidou(ctx->link, __FUNCTION__)();
     m_pEntity->DeployTerminal(ctx);
 }
 
 void HealthManagerSession::Handle_ControlEntityLife(SpReqAnsContext<HealthManagerService_ControlEntityLife_Req, HealthManagerService_ControlEntityLife_Ans>::Pointer ctx)
 {
     LOG_FUNCTION();
+	DbgToBeidou(ctx->link, __FUNCTION__)();
     m_pEntity->ControlEntityLife(ctx);
 }
 
 void HealthManagerSession::Handle_Gateway(SpReqAnsContext<HealthManagerService_Gateway_Req, HealthManagerService_Gateway_Ans>::Pointer ctx)
 {
     LOG_FUNCTION();
+	DbgToBeidou(ctx->link, __FUNCTION__)();
     m_pEntity->Gateway(ctx);
 }
 
@@ -1415,6 +1427,8 @@ bool CHealthManagerEntity::DoRestart()
 	if(csimpleStrMachineTypeCfg.IndexOf(m_sysStaticInfo.strMachineType)>=0)
 	{
 		LogWarn(Severity_Low, Error_Unexpect, HealthManager_UserErrorCode_Need_No_Guardian, "terminal is not need start up guardian");
+		bool bStop = StopGuardian();
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("no need for guardian, to stop guardian:%d", bStop);
 		m_bNeedGuardian = false;
 		//设置一个系统变量给关门页面使用
 		//liuwt@20220104 N noguardian Y needguardian
@@ -2009,7 +2023,6 @@ void CHealthManagerEntity::OnLog(const CAutoArray<CUUID>& SubIDs, const CUUID nL
 	}
 	break;
 	case ERR_ACCESSAUTH_SERVICE_FAILED: //准入服务返回失败
-		Sleep(10000);
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("unkown access failed.no retry, no restart.");
 		m_bNeedAuthRetry = false;
 		m_bNeedGuardianRestart = false; //服务端准入失败无需重启

+ 4 - 0
Module/mod_pinpad/PinPadFSM.h

@@ -9,7 +9,11 @@
 #include "DevFSMCommBase.hpp"
 #include "CommEntityUtil.hpp"
 #include "PinPad_UserErrorCode.h"
+#if defined(RVC_OS_LINUX)
 #include "json/json.h"
+#else
+#include "json.h"
+#endif
 enum EvtType
 {
 	USER_EVT_TEST =	EVT_USER+1,

+ 73 - 15
Module/mod_selfchecker/SelfCheckerFSM.cpp

@@ -1,7 +1,6 @@
 #include "stdafx.h"
 #define WIN32_LEAN_AND_MEAN
 #include "SelfCheckerFSM.h"
-#include "SpHelper.h"
 #include "EventCode.h"
 #pragma comment(lib,"user32.lib")
 class	CSelfCheckerEntity;
@@ -74,17 +73,6 @@ DWORD CodeStrToInt(const char* pCode)
 	}
 	return dwRet;
 }
-unsigned long long GetTickCountRVC() {
-#ifdef RVC_OS_WIN
-	return GetTickCount64();
-#else
-	struct timespec ts;
-
-	clock_gettime(CLOCK_MONOTONIC, &ts);
-
-	return (ts.tv_sec * 1000 + ts.tv_nsec / 1000000);
-#endif //RVC_OS_WIN
-}
 ErrorCodeEnum CSelfCheckerFSM::OnInit()
 {
 	m_xIdlePre = m_xKernelPre = m_xUserPre = 0;
@@ -266,7 +254,7 @@ ErrorCodeEnum CSelfCheckerFSM::Initial()
 	ifstream is;
 	CSimpleStringA cfgPath(""), cfgXml("");
 	err = GetEntityBase()->GetFunction()->GetPath("cfg", cfgPath);
-	cfgXml = cfgPath + "/SelfCheckerProc.xml";
+	cfgXml = cfgPath + SPLIT_SLASH_STR + "SelfCheckerProc.xml";
 	ReadXmlFile(cfgXml);
 	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("cfgxml[%s]", cfgXml);
 	//auto list = m_csKeyEntity.Split(',');
@@ -468,8 +456,29 @@ ErrorCodeEnum CSelfCheckerFSM::ExceptionErrorProcess(const char* pszEntityName,
 
 	return eErrCode;
 }
-ErrorCodeEnum CSelfCheckerFSM::CheckEntity(const char *pszEntityName,EntityTestEnum eTestType)
+ErrorCodeEnum CSelfCheckerFSM::CheckEntity(const char* pszEntityName, EntityTestEnum eTestType, bool bNormalCheck)
 {
+	if (bNormalCheck)
+	{
+		//oilyang@20230426 ,常规自检时,针对"TerminalStage"做对应处理(自检分常规自检和即时自检)
+		//"S":准入服务告知准入不过,不再进行实体自检
+		//非"A":其他启动失败导致进关门页,不再对硬件以及其他没必要自检的实体进行自检
+		CSimpleStringA tmpTerminalStage("");
+		GetEntityBase()->GetFunction()->GetSysVar("TerminalStage", tmpTerminalStage);
+		if (tmpTerminalStage.Compare("S") == 0)
+			return Error_Succeed;
+		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
+				|| _strnicmp("CardSwiper", pszEntityName, strlen("CardSwiper")) == 0 || _strnicmp("ContactlessCard", pszEntityName, strlen("ContactlessCard")) == 0
+				|| _strnicmp("IDCertificate", pszEntityName, strlen("IDCertificate")) == 0 || _strnicmp("ups", pszEntityName, strlen("ups")) == 0
+				|| _strnicmp("gpio", pszEntityName, strlen("gpio")) == 0 || _strnicmp("HSPScanner", pszEntityName, strlen("HSPScanner")) == 0
+				|| _strnicmp("FingerPrint", pszEntityName, strlen("FingerPrint")) == 0
+				)
+				return Error_Succeed;
+		}
+	}
 	//oilyang@20170926 no need to check by self.Let the HealthManager entity to do it.
 	if (pszEntityName != NULL && strnicmp(pszEntityName, GetEntityBase()->GetEntityName(), strlen(GetEntityBase()->GetEntityName())) == 0)
 		return Error_Succeed;
@@ -492,8 +501,19 @@ ErrorCodeEnum CSelfCheckerFSM::CheckEntity(const char *pszEntityName,EntityTestE
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Test %s,%d", pszEntityName, errCode);
 	return errCode;
 }
-void CSelfCheckerFSM::OnNormalWorkTimerout(void *pData)
+void CSelfCheckerFSM::OnNormalWorkTimerout(void* pData)
 {
+	if (!m_bFWBEntityAdd)
+	{
+		//oilyang@20220415 special process of RVC.PAD with FWB
+		CSimpleStringA tmpFWBDevSN("");
+		GetEntityBase()->GetFunction()->GetSysVar("FWBDevSN", tmpFWBDevSN);
+		if (m_sysInfo.strMachineType.Compare("RVC.PAD", true) == 0 && !tmpFWBDevSN.IsNullOrEmpty())
+		{
+			AddFWBEntityToList();
+			m_bFWBEntityAdd = true;
+		}
+	}
 	CSmartPointer<IEntityFunction> pFunc = GetEntityBase()->GetFunction();
 	CSmartPointer<IEntityFunctionPrivilege> pFuncPrivilege = pFunc.ConvertCase<IEntityFunctionPrivilege>();
 	CSmartPointer<IAsynWaitSp> spWait;
@@ -1223,4 +1243,42 @@ void CSelfCheckerFSM::SetEverEnterMainPageFlag(bool bValue)
 			}
 		}
 	}
+}
+void CSelfCheckerFSM::AddFWBEntityToList()
+{
+	vector<CSimpleStringA>::iterator it, itAct;
+	bool bPinPadFound(false),bIDCertFound(false),bFingerPrintFound(false)
+		,bActPinPadFound(false), bActIDCertFound(false), bActFingerPrintFound(false);
+	//template ?
+	for (it = m_allEntity.begin(); it != m_allEntity.end(); ++it)
+	{
+		if (!strnicmp("PinPad", *it, it->GetLength()))
+			bPinPadFound = true;
+		else if (!strnicmp("IDCertificate", *it, it->GetLength()))
+			bIDCertFound = true;
+		else if (!strnicmp("FingerPrint", *it, it->GetLength()))
+			bFingerPrintFound = true;
+	}
+	if (!bPinPadFound)
+		m_allEntity.push_back("PinPad");
+	if (!bIDCertFound)
+		m_allEntity.push_back("IDCertificate");
+	if (!bPinPadFound)
+		m_allEntity.push_back("FingerPrint");
+
+	for (itAct = m_activeEntity.begin(); itAct != m_activeEntity.end(); ++itAct)
+	{
+		if (!strnicmp("PinPad", *itAct, itAct->GetLength()))
+			bActPinPadFound = true;
+		else if (!strnicmp("IDCertificate", *itAct, itAct->GetLength()))
+			bActIDCertFound = true;
+		else if (!strnicmp("FingerPrint", *itAct, itAct->GetLength()))
+			bActFingerPrintFound = true;
+	}
+	if (!bActPinPadFound)
+		m_activeEntity.push_back("PinPad");
+	if (!bActIDCertFound)
+		m_activeEntity.push_back("IDCertificate");
+	if (!bActFingerPrintFound)
+		m_activeEntity.push_back("FingerPrint");
 }

+ 4 - 3
Module/mod_selfchecker/SelfCheckerFSM.h

@@ -144,7 +144,7 @@ public:
 		END_FSM_RULE()
 
 		CSelfCheckerFSM() :m_warmLevel(0), m_bFirstCalcCpu(true), m_pHealthClient(NULL) , m_diskLastWarnHour(1)
-	, m_bEverInMainPage(false), m_bHaveGetEntityList(false){}
+	, m_bEverInMainPage(false), m_bHaveGetEntityList(false), m_bFWBEntityAdd(false){}
 	~CSelfCheckerFSM(){}
 	virtual ErrorCodeEnum OnInit();
 	virtual ErrorCodeEnum OnExit();
@@ -170,13 +170,14 @@ public:
 	void DoOnClosed(const char *pszEntityName,EntityCloseCauseEnum eCloseCause,ErrorCodeEnum eOnCloseErrorCode,const char *pszCallerEntity);
 	void DoOnException(const char *pszEntityName,const char *pszFunctionName,EntityStateEnum eState,EntityStateEnum eLastState,ErrorCodeEnum eErrorCode);
 	ErrorCodeEnum GetAllLiveEntity(CAutoArray<CSimpleString> &allEntitys);
-	ErrorCodeEnum CheckEntity(const char *pszEntityName,EntityTestEnum eTestType);
+	ErrorCodeEnum CheckEntity(const char* pszEntityName, EntityTestEnum eTestType, bool bNormalCheck = true);
 	int AddEntityState(const char *pszEntityName,EntityStateEnum eState);
 	ErrorCodeEnum GetEntityErrorList(int &warmLevel,CSimpleStringA &strList);
 	void SetEntityCfgInfo(const char *pszEntityName,int loadOpt){m_entRunInfo[pszEntityName].loadOpt = loadOpt;};
 	void SetEntityRestarting(const char* pszEntityName,bool flag) { m_entRunInfo[pszEntityName].bRestarting = flag;}
 	int Proc(string entity, ProcType eType, DWORD dwCode,const char *pszMessage="");
 	void SetEverEnterMainPageFlag(bool bValue = true);
+	void AddFWBEntityToList();
 private:
 	ErrorCodeEnum Initial();
 	void OnNormalWorkTimerout(void *pData);
@@ -198,7 +199,7 @@ private:
 	int m_restartNormal,m_restartSpecial,m_maxOsRestart,m_maxPowerRestart
 		,m_warmLevel,m_diskLastWarnHour;
 	DWORD m_dwIssueCount,m_dwCaptureCount;
-	bool m_bInIssue,m_bFirstCalcCpu, m_bEverInMainPage,m_bHaveGetEntityList;
+	bool m_bInIssue,m_bFirstCalcCpu, m_bEverInMainPage,m_bHaveGetEntityList,m_bFWBEntityAdd;
 	//CSimpleStringA m_csKeyEntity;
 	__int64  m_xIdlePre,m_xKernelPre,m_xUserPre;
 	HealthManagerService_ClientBase *m_pHealthClient;

+ 3 - 0
Module/mod_selfchecker/SelfChecker_def_g.h

@@ -18,6 +18,9 @@ namespace SelfChecker {
 #define SelfCheckerService_MethodSignature_RealCheck -229957154
 #define SelfCheckerService_MethodSignature_GetEntityErrorList 528023449
 
+#define SelfCheckerService_LogCode_RealCheck "QLR040250500"
+#define SelfCheckerService_LogCode_GetEntityErrorList "QLR040250501"
+
 struct SelfCheckerService_RealCheck_Req
 {
 	CSimpleStringA name;

+ 27 - 41
Module/mod_selfchecker/mod_selfchecker.cpp

@@ -5,15 +5,17 @@
 #include "mod_selfchecker.h"
 #include "EventCode.h"
 #include "ModuleMix.h"
-#include "SpHelper.h"
+
 
 void SelfCheckerSession::Handle_RealCheck(SpReqAnsContext<SelfCheckerService_RealCheck_Req, SelfCheckerService_RealCheck_Ans>::Pointer ctx)
 {
 	LOG_FUNCTION();
+	DbgToBeidou(ctx->link, __FUNCTION__)();
 	m_pEntity->RealCheck(ctx);
 }
 void SelfCheckerSession::Handle_GetEntityErrorList(SpReqAnsContext<SelfCheckerService_GetEntityErrorList_Req, SelfCheckerService_GetEntityErrorList_Ans>::Pointer ctx)
 {
+	DbgToBeidou(ctx->link, __FUNCTION__)();
 	m_pEntity->GetEntityErrorList(ctx);
 }
 ErrorCodeEnum CSelfCheckerEntity::GetLiveEntityList(CAutoArray<CSimpleString>& LiveEntitys)
@@ -88,6 +90,27 @@ void CSelfCheckerEntity::OnEntityStateHook(const char* pszEntityName, const char
 		case EntityState_Lost:
 			{
 				//oilyang@20220415 special process of RVC.PAD with FWB
+				CSimpleStringA tmpFWBDevSN("");
+				GetFunction()->GetSysVar("FWBDevSN", tmpFWBDevSN);
+				if (m_sysInfo.strMachineType.Compare("RVC.PAD", true) == 0 && !tmpFWBDevSN.IsNullOrEmpty())
+				{
+					if (_strnicmp("PinPad", pszEntityName, strlen("PinPad")) == 0
+						|| _strnicmp("IDCertificate", pszEntityName, strlen("IDCertificate")) == 0
+						|| _strnicmp("FingerPrint", pszEntityName, strlen("FingerPrint")) == 0)
+					{
+						count = m_entityProcInfo[pszEntityName].restartTimes;
+						if (count >= m_maxEtyRestartTimes)
+						{
+							LogWarn(Severity_Middle, Error_Unexpect, LOG_WARN_SELFCHECK_ENTITY_LOST_TIMES
+								, CSimpleStringA::Format("%s restart %d times, give up.", pszEntityName, count).GetData());
+							break;
+						}
+						m_fsm.CheckEntity(pszEntityName, Test_ShakeHand);
+						m_entityProcInfo[pszEntityName].restartTimes = count + 1;
+					}
+					break;
+				}
+
 				//doing nothing except for loading stage. HandShake will take it.
 				//and only for MediaController module.
 				//oilyang@20210809 add entity lost LogWarn
@@ -188,7 +211,7 @@ void CSelfCheckerEntity::OnCloseConnection(const char* pszCallerEntity, const ch
 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);
-	m_fsm.CheckEntity(ctx->Req.name,Test_ShakeHand);
+	m_fsm.CheckEntity(ctx->Req.name, Test_ShakeHand, false);
 	ctx->Answer(Error_Succeed);
 }
 void CSelfCheckerEntity::GetEntityErrorList(SpReqAnsContext<SelfCheckerService_GetEntityErrorList_Req, SelfCheckerService_GetEntityErrorList_Ans>::Pointer ctx)
@@ -200,45 +223,6 @@ void CSelfCheckerEntity::OnLog(const CAutoArray<CUUID>& SubIDs, const CUUID nLog
 	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)
-	{
-
-	}
-	//oilyang@20200407 move the following RestartModule from Healthmanager to here
-	switch (dwUserCode)
-	{
-	case LOG_EVT_CARDSWIPER_PINPAD_RESTART:
-	{
-		RestartModule("PinPad");
-	}
-	break;
-	case LOG_EVT_CARDSWIPER_CARDSWIPER_RESTART:
-	{
-		RestartModule("CardSwiper");
-	}
-	break;
-	case LOG_EVT_CARDSWIPER_DEVICECONTROL_RESTART:
-	{
-		RestartModule("DeviceControl");
-	}
-	break;
-	case LOG_EVT_CARDSWIPER_IDCERTIFICATE_RESTART:
-	{
-		RestartModule("IDCertificate");
-	}
-	break;
-	case LOG_EVT_CARDSWIPER_FINGERPRINT_RESTART:
-	{
-		RestartModule("FingerPrint");
-	}
-	break;
-	case LOG_EVT_CARDSWIPER_SENSORS_RESTART:
-	{
-		RestartModule("Sensors");
-	}
-	break;
-	}
 	//oilyang@20170918 only process the Log_Error of Severity_High
 	if (eLogType != Log_Error || eLevel != Severity_High)
 		return;
@@ -326,6 +310,7 @@ ErrorCodeEnum CSelfCheckerEntity::ConnectToAssistChannel()
 				{
 					DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("BeginState biz channel failed!");
 					m_pAssChanClient->GetFunction()->CloseSession();
+					m_pAssChanClient->SafeDelete();
 					m_pAssChanClient = NULL;
 					return Error_Unexpect;
 				}
@@ -343,6 +328,7 @@ ErrorCodeEnum CSelfCheckerEntity::ConnectToAssistChannel()
 				{
 					DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Begin BeginRecv ACM_TYPE_DEVICE failed!");
 					m_pAssChanClient->GetFunction()->CloseSession();
+					m_pAssChanClient->SafeDelete();
 					m_pAssChanClient = NULL;
 					return Error_Unexpect;
 				}