Quellcode durchsuchen

Z991239-5596 #comment feat: PinPad增加打开设备尚未结束的标志

oilyang vor 1 Jahr
Ursprung
Commit
010830c966

+ 2 - 0
Module/mod_pinpad/PinPadFSM.cpp

@@ -46,6 +46,7 @@ void CPinPadFSM::ToLogWarnInfoAboutTermCustom()
 ErrorCodeEnum CPinPadFSM::OnInit()
 {
 	LOG_FUNCTION();
+	m_bOpening = true;
 	CSystemStaticInfo sysInfo;
 	m_csMachineType = m_csSite = m_terminalNo = "";
 	GetEntityBase()->GetFunction()->GetSystemStaticInfo(sysInfo);
@@ -395,6 +396,7 @@ int CPinPadFSM::Initial()
 		DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("Open pinpad failed.");
 		return 1;
 	}
+	m_bOpening = false;
 	m_bOpened = true;
 
 	//oiltmp comment the following 20160406

+ 1 - 1
Module/mod_pinpad/PinPadFSM.h

@@ -218,7 +218,7 @@ public:
 	int GetInput(SpReqAnsContext<PinPadService_GetInputSM_Req, PinPadService_GetInputSM_Ans>::Pointer ctxSM);
 	ErrorCodeEnum GetEncryptText(SpReqAnsContext<PinPadService_GetInputSM_Req, PinPadService_GetInputSM_Ans>::Pointer ctxSM);
 	bool GetDevInitFlag(){ return m_bOpened;}
-	void ResetDevInitFlag() { m_bOpened = false; }
+	bool GetDeviceOpeningFlag() { return m_bOpening; }
 	void SetExitFlag(){m_bExit = true;}
 	bool GetEntityExit() { return m_bEntityExit;}
 	void SetCtx(SpReqAnsContext<PinPadService_GetInputSM_Req, PinPadService_GetInputSM_Ans>::Pointer ctxSM)

+ 1 - 0
Module/mod_pinpad/PinPad_UserErrorCode.h

@@ -39,5 +39,6 @@ enum PinPad_UserErrorCode {
 	PinPad_UserErrorCode_UnknownSMFlag = 0x20600222,
 	PinPad_UserErrorCode_DevConnect_CostTime = 0x20600223,
 	PinPad_UserErrorCode_NoPlainInput = 0x20600224,
+	PinPad_UserErrorCode_NotInit = 0x20600225,
 };
 #endif //_PINPAD_USER_ERROR_CODE_H

+ 3 - 1
Module/mod_pinpad/mod_PinPad.h

@@ -172,7 +172,9 @@ public:
 	}
 	void GetDevInfo(SpReqAnsContext<PinPadService_GetDevInfo_Req, PinPadService_GetDevInfo_Ans>::Pointer ctx)
 	{
-		if (m_fsm.GetDevInitFlag())
+		if (m_fsm.GetDeviceOpeningFlag())
+			ctx->Answer(Error_NotInit, PinPad_UserErrorCode_PinPad_DevOpenFailed);
+		else if (m_fsm.GetDevInitFlag())
 		{
 			DevCategoryInfo devInfo;
 			memset(&devInfo, 0, sizeof(devInfo));