|
@@ -7,7 +7,9 @@
|
|
|
#include "toolkit.h"
|
|
|
#include "SpUtility.h"
|
|
|
#include "DevFSMCommBase.hpp"
|
|
|
-#include "DeviceBaseHelper.h"
|
|
|
+#include "CommEntityUtil.hpp"
|
|
|
+#include "PinPad_UserErrorCode.h"
|
|
|
+#include "json/json.h"
|
|
|
enum EvtType
|
|
|
{
|
|
|
USER_EVT_TEST = EVT_USER+1,
|
|
@@ -15,17 +17,11 @@ enum EvtType
|
|
|
USER_EVT_QUIT,
|
|
|
USER_EVT_INIT,
|
|
|
USER_EVT_INITFINISHED,
|
|
|
- USER_EVT_GETINPUT,
|
|
|
- USER_EVT_GETINPUTFINISHED,
|
|
|
USER_EVT_SETACCOUNT,
|
|
|
USER_EVT_SETACCOUNTFINISHED,
|
|
|
USER_EVT_INPUTCANCEL,
|
|
|
USER_EVT_INPUTWAITINGMORE,
|
|
|
USER_EVT_EXIT,
|
|
|
- USER_EVT_LOADKEY,
|
|
|
- USER_EVT_LOADKEYFINISHED,
|
|
|
- USER_EVT_ENCRYPT,
|
|
|
- USER_EVT_ENCRYPTFINISHED,
|
|
|
USER_EVT_GETINPUT_SM,
|
|
|
USER_EVT_GETINPUT_SM_FINISHED,
|
|
|
USER_EVT_LOADKEY_SM,
|
|
@@ -34,22 +30,19 @@ enum EvtType
|
|
|
USER_EVT_ENCRYPT_SM_FINISHED,
|
|
|
USER_EVT_GET_CHECKCODE,
|
|
|
USER_EVT_GET_CHECKCODE_FINISHED,
|
|
|
+ USER_EVT_TODO_INIT,
|
|
|
+ USER_EVT_TODO_INIT_FINISHED,
|
|
|
};
|
|
|
#include "PinPad_server_g.h"
|
|
|
#include "PinPad_msg_g.h"
|
|
|
|
|
|
#include "PinPadClass.h"
|
|
|
-#include "DeviceCrossHelper.h"
|
|
|
+#include "DeviceBaseHelper.h"
|
|
|
+
|
|
|
//using namespace PinPad;
|
|
|
-using PinPad::PinPadService_GetInput_Req;
|
|
|
-using PinPad::PinPadService_GetInput_Ans;
|
|
|
using PinPad::PinPadService_InputWaitMore_Info;
|
|
|
using PinPad::PinPadService_InputCancel_Info;
|
|
|
using PinPad::PinPadService_Exit_Info;
|
|
|
-using PinPad::PinPadService_LoadKeys_Req;
|
|
|
-using PinPad::PinPadService_LoadKeys_Ans;
|
|
|
-using PinPad::PinPadService_EncryptData_Req;
|
|
|
-using PinPad::PinPadService_EncryptData_Ans;
|
|
|
using PinPad::PinPadService_GetInputSM_Req;
|
|
|
using PinPad::PinPadService_GetInputSM_Ans;
|
|
|
using PinPad::PinPadService_LoadKeysSM_Req;
|
|
@@ -60,17 +53,15 @@ using PinPad::PinPadService_QueryFunc_Req;
|
|
|
using PinPad::PinPadService_QueryFunc_Ans;
|
|
|
using PinPad::PinPadService_GetCheckCode_Req;
|
|
|
using PinPad::PinPadService_GetCheckCode_Ans;
|
|
|
-using PinPad::PinPadService_CrossTermCall_Req;
|
|
|
-using PinPad::PinPadService_CrossTermCall_Ans;
|
|
|
-using PinPad::PinPadService_CrossTermInvokeInfo_Info;
|
|
|
using PinPad::PinPadService_GetDevInfo_Req;
|
|
|
using PinPad::PinPadService_GetDevInfo_Ans;
|
|
|
using PinPad::InputContent;
|
|
|
-#include "HeartBeat_client_g.h"
|
|
|
-using namespace HeartBeat;
|
|
|
+
|
|
|
#include <map>
|
|
|
using namespace std;
|
|
|
|
|
|
+#include "DeviceBaseHelper.h"
|
|
|
+
|
|
|
struct CtxInfo
|
|
|
{
|
|
|
int dataSize;
|
|
@@ -80,6 +71,8 @@ struct CtxInfo
|
|
|
class CPinPadEntity;
|
|
|
class CPinPadFSM;
|
|
|
|
|
|
+unsigned int __stdcall DoWork(void* pData);
|
|
|
+
|
|
|
class PinPadInitFinishedEvent : public FSMEvent
|
|
|
{
|
|
|
public:
|
|
@@ -99,42 +92,6 @@ public:
|
|
|
~InputWaitingMoreEvent(){}
|
|
|
};
|
|
|
|
|
|
-class GetInputEvent : public FSMEvent
|
|
|
-{
|
|
|
-public:
|
|
|
- GetInputEvent() : FSMEvent(USER_EVT_GETINPUT){}
|
|
|
- ~GetInputEvent(){}
|
|
|
- SpReqAnsContext<PinPadService_GetInput_Req, PinPadService_GetInput_Ans>::Pointer ctx;
|
|
|
- virtual void OnUnhandled()
|
|
|
- {
|
|
|
- if (ctx != NULL)
|
|
|
- ctx->Answer(Error_InvalidState);
|
|
|
- }
|
|
|
-};
|
|
|
-class LoadKeyEvent : public FSMEvent
|
|
|
-{
|
|
|
-public:
|
|
|
- LoadKeyEvent() : FSMEvent(USER_EVT_LOADKEY){}
|
|
|
- ~LoadKeyEvent(){}
|
|
|
- SpReqAnsContext<PinPadService_LoadKeys_Req, PinPadService_LoadKeys_Ans>::Pointer ctx;
|
|
|
- virtual void OnUnhandled()
|
|
|
- {
|
|
|
- if (ctx != NULL)
|
|
|
- ctx->Answer(Error_InvalidState);
|
|
|
- }
|
|
|
-};
|
|
|
-class EncryptEvent : public FSMEvent
|
|
|
-{
|
|
|
-public:
|
|
|
- EncryptEvent() : FSMEvent(USER_EVT_ENCRYPT){}
|
|
|
- ~EncryptEvent(){}
|
|
|
- SpReqAnsContext<PinPadService_EncryptData_Req, PinPadService_EncryptData_Ans>::Pointer ctx;
|
|
|
- virtual void OnUnhandled()
|
|
|
- {
|
|
|
- if (ctx != NULL)
|
|
|
- ctx->Answer(Error_InvalidState);
|
|
|
- }
|
|
|
-};
|
|
|
class GetInputSMEvent : public FSMEvent
|
|
|
{
|
|
|
public:
|
|
@@ -187,7 +144,7 @@ public:
|
|
|
class CPinPadFSM : public CCommDevFSM<CPinPadFSM, PinPadClass>
|
|
|
{
|
|
|
public:
|
|
|
- enum {s0,s1,s2,s3,s4,s5};
|
|
|
+ enum {s0,s1,s2,s3,s4,s5,s6};
|
|
|
BEGIN_FSM_STATE(CPinPadFSM)
|
|
|
FSM_STATE_ENTRY(s0, "Init", s0_on_entry, s0_on_exit, s0_on_event)
|
|
|
FSM_STATE_ENTRY(s1, "Initializing", s1_on_entry, s1_on_exit, s1_on_event)
|
|
@@ -195,49 +152,42 @@ public:
|
|
|
FSM_STATE_ENTRY(s3, "Input", s3_on_entry, s3_on_exit, s3_on_event)
|
|
|
FSM_STATE_ENTRY(s4, "AccessAuth", s4_on_entry, s4_on_exit, s4_on_event)
|
|
|
FSM_STATE_ENTRY(s5, "Failed", s5_on_entry, s5_on_exit, s5_on_event)
|
|
|
+ FSM_STATE_ENTRY(s6, "InitFailed", s6_on_entry, s6_on_exit, s6_on_event)
|
|
|
END_FSM_STATE()
|
|
|
|
|
|
BEGIN_FSM_RULE(CPinPadFSM, s0)
|
|
|
FSM_RULE_ENTRY(s0, s1, USER_EVT_INIT, 0)
|
|
|
FSM_RULE_ENTRY(s1, s2, USER_EVT_INITFINISHED, 0)
|
|
|
- FSM_RULE_ENTRY(s1, s5, USER_EVT_INITFINISHED, 1)
|
|
|
- FSM_RULE_ENTRY(s2, s3, USER_EVT_GETINPUT, 0)
|
|
|
+ FSM_RULE_ENTRY(s1, s6, USER_EVT_INITFINISHED, 1)
|
|
|
FSM_RULE_ENTRY(s2, s3, USER_EVT_GETINPUT_SM, 0)
|
|
|
- FSM_RULE_ENTRY(s2, s4, USER_EVT_LOADKEY, 2)
|
|
|
- FSM_RULE_ENTRY(s2, s4, USER_EVT_ENCRYPT, 2)
|
|
|
FSM_RULE_ENTRY(s2, s4, USER_EVT_LOADKEY_SM, 2)
|
|
|
FSM_RULE_ENTRY(s2, s4, USER_EVT_ENCRYPT_SM, 2)
|
|
|
- //FSM_RULE_ENTRY(s2,s2,USER_EVT_ANY_INPUT_TIMER,0)
|
|
|
- //FSM_RULE_ENTRY(s2,s4,USER_EVT_GETINPUT,0)
|
|
|
- FSM_RULE_ENTRY(s3, s2, USER_EVT_GETINPUTFINISHED, 0)
|
|
|
- FSM_RULE_ENTRY(s3, s5, USER_EVT_GETINPUTFINISHED, 1)
|
|
|
- FSM_RULE_ENTRY(s4, s2, USER_EVT_LOADKEYFINISHED, 0)
|
|
|
- FSM_RULE_ENTRY(s4, s2, USER_EVT_ENCRYPTFINISHED, 0)
|
|
|
+ FSM_RULE_ENTRY(s2, s0, USER_EVT_TODO_INIT_FINISHED, 0)
|
|
|
+ FSM_RULE_ENTRY(s3, s2, USER_EVT_GETINPUT_SM_FINISHED, 0)
|
|
|
+ FSM_RULE_ENTRY(s3, s2, USER_EVT_EXIT, 0)
|
|
|
FSM_RULE_ENTRY(s4, s2, USER_EVT_LOADKEY_SM_FINISHED, 0)
|
|
|
FSM_RULE_ENTRY(s4, s2, USER_EVT_ENCRYPT_SM_FINISHED, 0)
|
|
|
- FSM_RULE_ENTRY(s5, s0, USER_EVT_GETINPUT, 0)
|
|
|
- FSM_RULE_ENTRY(s5, s0, USER_EVT_LOADKEY, 0)
|
|
|
+ FSM_RULE_ENTRY(s5, s0, USER_EVT_TODO_INIT_FINISHED, 0)
|
|
|
+ FSM_RULE_ENTRY(s6, s0, USER_EVT_TODO_INIT_FINISHED, 0)
|
|
|
END_FSM_RULE()
|
|
|
|
|
|
- CPinPadFSM() : m_bDevInit(false), m_bFrontCancel(false),
|
|
|
- m_bWaitingMore(false), m_bExit(false), m_bPlainPin(true), m_ctx(NULL),
|
|
|
- m_bEntityExit(false), m_bPinInput(false), m_bPlainOpen(false), m_bLoadKey(false), m_bEncrypt(false)
|
|
|
+ CPinPadFSM() : m_bFrontCancel(false),
|
|
|
+ m_bWaitingMore(false), m_bExit(false), m_bPlainPin(true),
|
|
|
+ m_bEntityExit(false), m_bPinInput(false), m_bLoadKey(false), m_bEncrypt(false)
|
|
|
, m_dwDevCommFailCount(0), m_dwPinPadRunCount(0), m_eDevState(DEVICE_STATUS_NOT_READY), m_encryptkey(1)
|
|
|
- , m_bSM(false), m_b3DESLoaded(false), m_bSMLoaded(false), m_bInMainPage(true), m_szModel(""), m_szType(""), m_devSN("")
|
|
|
- , m_szVendor(""),m_csMachineType(true), m_csSite(true), m_terminalNo(true), m_bPinPadNeedless(FALSE)
|
|
|
- , m_csAlarmMsg("NO more information"), m_bRVCIL(false), m_keySN(""),m_keySNSM(""){
|
|
|
+ , m_bSM(false), m_b3DESLoaded(false), m_bSMLoaded(false), m_iInWhatPage(PageType_Other), m_szModel(""), m_szType("")
|
|
|
+ , m_szVendor(""),m_csMachineType(true), m_csSite(true), m_terminalNo(true), m_port(true), m_Baudrate(true)
|
|
|
+ , m_devSN(""){
|
|
|
HARDWARE_ENTITY_RESET_ENTITYID(m_entCode, 0x206);
|
|
|
- m_FirstStart = TRUE;
|
|
|
ZeroMemory(&m_adapterInfo, sizeof(m_adapterInfo));
|
|
|
}
|
|
|
~CPinPadFSM(){
|
|
|
m_bEntityExit = true;
|
|
|
- m_hInputConVar.Broadcast();
|
|
|
}
|
|
|
virtual ErrorCodeEnum OnInit();
|
|
|
virtual ErrorCodeEnum OnExit();
|
|
|
|
|
|
- void DoWork();
|
|
|
+ //void DoWork();
|
|
|
|
|
|
|
|
|
void s0_on_entry();
|
|
@@ -258,63 +208,37 @@ public:
|
|
|
void s5_on_entry();
|
|
|
void s5_on_exit();
|
|
|
unsigned int s5_on_event(FSMEvent* event);
|
|
|
+ void s6_on_entry();
|
|
|
+ void s6_on_exit();
|
|
|
+ unsigned int s6_on_event(FSMEvent* event);
|
|
|
|
|
|
int Initial();
|
|
|
- int GetInput(SpReqAnsContext<PinPadService_GetInput_Req, PinPadService_GetInput_Ans>::Pointer ctx
|
|
|
- ,SpReqAnsContext<PinPadService_GetInputSM_Req, PinPadService_GetInputSM_Ans>::Pointer ctxSM,bool bSM=false);
|
|
|
void push_char(char *buf, int *len, int c);
|
|
|
void PushInputChar(char *buf, int c);
|
|
|
void pop_char(char *buf, int *len,bool bClear=true);
|
|
|
void clear_char(char *buf, int *len);
|
|
|
bool Get12Account(char *szAcc);
|
|
|
- void OpenInputText(void *pUserdata);
|
|
|
- ErrorCodeEnum GetText(SpReqAnsContext<PinPadService_GetInput_Req, PinPadService_GetInput_Ans>::Pointer ctx
|
|
|
- ,SpReqAnsContext<PinPadService_GetInputSM_Req, PinPadService_GetInputSM_Ans>::Pointer ctxSM,bool bSM=false);
|
|
|
- ErrorCodeEnum GetEncryptText(SpReqAnsContext<PinPadService_GetInput_Req, PinPadService_GetInput_Ans>::Pointer ctx
|
|
|
- ,SpReqAnsContext<PinPadService_GetInputSM_Req, PinPadService_GetInputSM_Ans>::Pointer ctxSM,bool bSM=false);
|
|
|
- bool GetDevInitFlag(){ return m_bDevInit;}
|
|
|
- bool IsRVCIL() { /*return m_bRVCIL; */ return false;}//oilyang@20190123 方案改了,这里暂时不需要了
|
|
|
+ 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; }
|
|
|
void SetExitFlag(){m_bExit = true;}
|
|
|
bool GetEntityExit() { return m_bEntityExit;}
|
|
|
- void SetCtx(SpReqAnsContext<PinPadService_GetInput_Req, PinPadService_GetInput_Ans>::Pointer ctx
|
|
|
- ,SpReqAnsContext<PinPadService_GetInputSM_Req, PinPadService_GetInputSM_Ans>::Pointer ctxSM,bool bSMCtx=false)
|
|
|
+ void SetCtx(SpReqAnsContext<PinPadService_GetInputSM_Req, PinPadService_GetInputSM_Ans>::Pointer ctxSM)
|
|
|
{
|
|
|
- LOG_FUNCTION();
|
|
|
- if (!bSMCtx)
|
|
|
- {
|
|
|
- m_inputSMCtx = NULL;
|
|
|
- m_ctx = ctx;
|
|
|
- if (!ctx->Req.encrypt)
|
|
|
- m_inputCtx = ctx;
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("confirm,encrypt,len,timeout:%d,%d,%d,%d", m_ctx->Req.confirm, m_ctx->Req.encrypt, m_ctx->Req.length, m_ctx->Req.timeout);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- m_ctx = NULL;
|
|
|
- m_inputSMCtx = ctxSM;
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("sm ctx,confirm,encrypt,len,timeout:%d,%d,%d,%d", m_inputSMCtx->Req.confirm, m_inputSMCtx->Req.encrypt, m_inputSMCtx->Req.length, m_inputSMCtx->Req.timeout);
|
|
|
- }
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("setpininput true");
|
|
|
+ m_inputSMCtx = ctxSM;
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("sm ctx,confirm,encrypt,len,timeout:%d,%d,%d,%d,smflag:%d", ctxSM->Req.confirm
|
|
|
+ , ctxSM->Req.encrypt, ctxSM->Req.length, ctxSM->Req.timeout, ctxSM->Req.smflag);
|
|
|
m_bPinInput = true;
|
|
|
}
|
|
|
- bool GetCtx(SpReqAnsContext<PinPadService_GetInput_Req, PinPadService_GetInput_Ans>::Pointer &ctx
|
|
|
- ,SpReqAnsContext<PinPadService_GetInputSM_Req, PinPadService_GetInputSM_Ans>::Pointer &ctxSM,bool &smFlag)
|
|
|
+ bool GetCtx(SpReqAnsContext<PinPadService_GetInputSM_Req, PinPadService_GetInputSM_Ans>::Pointer& ctxSM)
|
|
|
{
|
|
|
- if (m_ctx == NULL && m_inputSMCtx == NULL)
|
|
|
+ if (m_inputSMCtx == NULL)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("both ctx is null");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("ctxSM is null");
|
|
|
return false;
|
|
|
}
|
|
|
- if (m_inputSMCtx != NULL)
|
|
|
- {
|
|
|
- ctxSM = m_inputSMCtx;
|
|
|
- smFlag = true;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- ctx = m_ctx;
|
|
|
- smFlag = false;
|
|
|
- }
|
|
|
+ ctxSM = m_inputSMCtx;
|
|
|
return true;
|
|
|
}
|
|
|
template <class TReq, class TAns>
|
|
@@ -329,14 +253,10 @@ public:
|
|
|
else
|
|
|
return NULL;
|
|
|
}
|
|
|
- //HANDLE GetInputEvtHandle(){return m_hInputEvt;}
|
|
|
-
|
|
|
bool GetDevInfo(DevCategoryInfo &devInfo);
|
|
|
- int LoadKey(SpReqAnsContext<PinPadService_LoadKeys_Req, PinPadService_LoadKeys_Ans>::Pointer ctx);
|
|
|
- int Encrypt(SpReqAnsContext<PinPadService_EncryptData_Req, PinPadService_EncryptData_Ans>::Pointer ctx);
|
|
|
int LoadKeySM(SpReqAnsContext<PinPadService_LoadKeysSM_Req, PinPadService_LoadKeysSM_Ans>::Pointer ctx);
|
|
|
int EncryptSM(SpReqAnsContext<PinPadService_EncryptDataSM_Req, PinPadService_EncryptDataSM_Ans>::Pointer ctx);
|
|
|
- int GetCheckCode(SpReqAnsContext<PinPadService_GetCheckCode_Req, PinPadService_GetCheckCode_Ans>::Pointer ctx);
|
|
|
+ ErrorCodeEnum GetCheckCode(SpReqAnsContext<PinPadService_GetCheckCode_Req, PinPadService_GetCheckCode_Ans>::Pointer ctx);
|
|
|
int GetEncryptKey(int &devFunc,int &loadFunc)
|
|
|
{
|
|
|
devFunc = loadFunc = 0;
|
|
@@ -346,47 +266,43 @@ public:
|
|
|
tmp = 1;
|
|
|
if (m_bSMLoaded)
|
|
|
tmp += 2;
|
|
|
- loadFunc = tmp;
|
|
|
+
|
|
|
+ if (m_bSMLoaded)
|
|
|
+ loadFunc = 2;
|
|
|
+ else
|
|
|
+ loadFunc = tmp;
|
|
|
//20161216 oilyang add 为了兼容密钥更新有问题的设备
|
|
|
if (loadFunc == 0)
|
|
|
loadFunc = 1;
|
|
|
return 0;
|
|
|
}
|
|
|
- BOOL IsNeedPinPad()
|
|
|
- {
|
|
|
- return (!m_bPinPadNeedless);
|
|
|
- }
|
|
|
- void SetEnterMainPage(bool bValue);
|
|
|
- int LocalCallHeartBeat(int method, CBlob &bbSend, bool bTwoWay=false);
|
|
|
- void CrossTermCall(SpReqAnsContext<PinPadService_CrossTermCall_Req, PinPadService_CrossTermCall_Ans>::Pointer ctx);
|
|
|
- void CrossTermInvokeInfo(SpOnewayCallContext<PinPadService_CrossTermInvokeInfo_Info>::Pointer ctx);
|
|
|
+
|
|
|
+ void SetInWhatPage(int iPageType);
|
|
|
void SelfTest(EntityTestEnum eTestType,CSmartPointer<ITransactionContext> pTransactionContext);
|
|
|
+ void ToLogWarnInfoAboutTermCustom();
|
|
|
+ int ProcFWBReConn();
|
|
|
public:
|
|
|
SP::Toolkit::CConditionVarPlus m_hInputConVar;
|
|
|
SP::Toolkit::CConditionVarPlus m_hInitConVar;
|
|
|
private:
|
|
|
|
|
|
- SpReqAnsContext<PinPadService_GetInput_Req, PinPadService_GetInput_Ans>::Pointer m_ctx;
|
|
|
- SpReqAnsContext<PinPadService_GetInput_Req, PinPadService_GetInput_Ans>::Pointer m_inputCtx;
|
|
|
SpReqAnsContext<PinPadService_GetInputSM_Req, PinPadService_GetInputSM_Ans>::Pointer m_inputSMCtx;
|
|
|
char m_szAccount[MAX_ACCOUNT_LEN];
|
|
|
- bool m_bDevInit,m_bFrontCancel,m_bWaitingMore,m_bExit,m_bPlainPin,m_bEntityExit
|
|
|
- ,m_bPinInput,m_bPlainOpen,m_bLoadKey,m_bEncrypt,m_bSM,m_b3DESLoaded,m_bSMLoaded,m_bInMainPage
|
|
|
- , m_bRVCIL;
|
|
|
-
|
|
|
- CSimpleStringA m_deviceNo,m_devCheckData,m_keySN,m_keySNSM,m_szModel,m_szType,m_szVendor, m_devSN;
|
|
|
+ bool m_bFrontCancel,m_bWaitingMore,m_bExit,m_bPlainPin,m_bEntityExit
|
|
|
+ ,m_bPinInput,m_bLoadKey,m_bEncrypt,m_bSM,m_b3DESLoaded,m_bSMLoaded;
|
|
|
+ ULLINT m_ullBeginTime, m_ullEndTime;
|
|
|
+ CSimpleStringA m_deviceNo, m_port, m_Baudrate, m_devCheckData,m_keySN,m_keySNSM,m_szModel,m_szType,m_szVendor,m_devSN/*fwb SN*/;
|
|
|
char m_buf[4];
|
|
|
ErrorCodeEnum m_testResult;
|
|
|
DWORD m_dwDevCommFailCount,m_dwPinPadRunCount;
|
|
|
DevStateEnum m_eDevState;
|
|
|
int m_encryptkey;
|
|
|
- CSimpleStringA m_csMachineType, m_csSite, m_terminalNo;
|
|
|
- BOOL m_bPinPadNeedless;
|
|
|
+ int m_iInWhatPage/*在哪个页面,区分首页,用户桌面,其他页*/;
|
|
|
+ CSimpleStringA m_csMachineType, m_csSite, m_terminalNo,m_lastCheckCode;
|
|
|
|
|
|
CSimpleStringA m_csAlarmMsg;
|
|
|
map<int, CtxInfo> m_mapCtx;
|
|
|
-
|
|
|
- bool GetAttachedTerminal(CSimpleStringA &csTerm);
|
|
|
+ bool IsInBusiness() { return (m_iInWhatPage == PageType_Other); }
|
|
|
};
|
|
|
|
|
|
struct InitTask : public ITaskSp
|
|
@@ -402,58 +318,7 @@ struct InitTask : public ITaskSp
|
|
|
fsm->PostEventFIFO(e);
|
|
|
}
|
|
|
};
|
|
|
-//struct GetInputTask : public ITaskSp
|
|
|
-//{
|
|
|
-// CPinPadFSM* fsm;
|
|
|
-// SpReqAnsContext<PinPadService_GetInput_Req, PinPadService_GetInput_Ans>::Pointer ctx;
|
|
|
-// GetInputTask(CPinPadFSM* f) : fsm(f) {}
|
|
|
-// void Process()
|
|
|
-// {
|
|
|
-// LOG_FUNCTION();
|
|
|
-// FSMEvent *e = new FSMEvent(USER_EVT_GETINPUTFINISHED);
|
|
|
-// e->param1 = fsm->GetInput(ctx);
|
|
|
-// fsm->PostEventFIFO(e);
|
|
|
-// }
|
|
|
-//};
|
|
|
-struct LoadKeyTask : public ITaskSp
|
|
|
-{
|
|
|
- CPinPadFSM* fsm;
|
|
|
- SpReqAnsContext<PinPadService_LoadKeys_Req, PinPadService_LoadKeys_Ans>::Pointer ctx;
|
|
|
- LoadKeyTask(CPinPadFSM* f) : fsm(f) {}
|
|
|
- void Process()
|
|
|
- {
|
|
|
- LOG_FUNCTION();
|
|
|
- FSMEvent *e = new FSMEvent(USER_EVT_LOADKEYFINISHED);
|
|
|
- e->param1 = fsm->LoadKey(ctx);
|
|
|
- fsm->PostEventFIFO(e);
|
|
|
- }
|
|
|
-};
|
|
|
-struct EncryptTask : public ITaskSp
|
|
|
-{
|
|
|
- CPinPadFSM* fsm;
|
|
|
- SpReqAnsContext<PinPadService_EncryptData_Req, PinPadService_EncryptData_Ans>::Pointer ctx;
|
|
|
- EncryptTask(CPinPadFSM* f) : fsm(f) {}
|
|
|
- void Process()
|
|
|
- {
|
|
|
- LOG_FUNCTION();
|
|
|
- FSMEvent *e = new FSMEvent(USER_EVT_ENCRYPTFINISHED);
|
|
|
- e->param1 = fsm->Encrypt(ctx);
|
|
|
- fsm->PostEventFIFO(e);
|
|
|
- }
|
|
|
-};
|
|
|
-//struct GetInputSMTask : public ITaskSp
|
|
|
-//{
|
|
|
-// CPinPadFSM* fsm;
|
|
|
-// SpReqAnsContext<PinPadService_GetInputSM_Req, PinPadService_GetInputSM_Ans>::Pointer ctx;
|
|
|
-// GetInputSMTask(CPinPadFSM* f) : fsm(f) {}
|
|
|
-// void Process()
|
|
|
-// {
|
|
|
-// LOG_FUNCTION();
|
|
|
-// FSMEvent *e = new FSMEvent(USER_EVT_GETINPUT_SM_FINISHED);
|
|
|
-// e->param1 = fsm->GetInput(ctx);
|
|
|
-// fsm->PostEventFIFO(e);
|
|
|
-// }
|
|
|
-//};
|
|
|
+
|
|
|
struct LoadKeySMTask : public ITaskSp
|
|
|
{
|
|
|
CPinPadFSM* fsm;
|
|
@@ -487,12 +352,22 @@ struct GetCheckCodeTask : public ITaskSp
|
|
|
GetCheckCodeTask(CPinPadFSM* f) : fsm(f) {}
|
|
|
void Process()
|
|
|
{
|
|
|
- LOG_FUNCTION();
|
|
|
FSMEvent *e = new FSMEvent(USER_EVT_GET_CHECKCODE_FINISHED);
|
|
|
e->param1 = fsm->GetCheckCode(ctx);
|
|
|
fsm->PostEventFIFO(e);
|
|
|
}
|
|
|
};
|
|
|
+struct ProcFWBReConnTask : public ITaskSp
|
|
|
+{
|
|
|
+ CPinPadFSM* fsm;
|
|
|
+ ProcFWBReConnTask(CPinPadFSM* f) : fsm(f) {}
|
|
|
+ void Process()
|
|
|
+ {
|
|
|
+ FSMEvent* e = new FSMEvent(USER_EVT_TODO_INIT_FINISHED);
|
|
|
+ e->param1 = fsm->ProcFWBReConn();
|
|
|
+ fsm->PostEventFIFO(e);
|
|
|
+ }
|
|
|
+};
|
|
|
template<class T>
|
|
|
class TimerOutHelper : public ITimerListener
|
|
|
{
|