123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601 |
- #ifndef __CUSTMNGRAUTH_FSM_H
- #define __CUSTMNGRAUTH_FSM_H
- #pragma once
- #include "SpFSM.h"
- #include "SpSecureClient.h"
- #include "json/json.h"
- #include "CustMngrAuth_server_g.h"
- #include "CustMngrAuth_msg_g.h"
- using namespace CustMngrAuth;
- #include "FingerPrint_client_g.h"
- #include "MaintainWatcher_client_g.h"
- #include "MaintainWatcher_msg_g.h"
- #include "DeviceControl_client_g.h"
- //#include "DeviceCrossHelper.h"
- //#include <map>
- using namespace std;
- using namespace MaintainWatcher;
- using namespace DeviceControl;
- using namespace FingerPrint;
- //下载特征库所调用的分行服务接口
- #pragma pack(1)
- // [StructName("FETQYREQ")]
- struct FeatReq
- {
- char TerminalID[16];
- char BranchID[16];
- char CurrentAgent[16];
- char UpdateTime[20];
- };
- // [StructName("FETQYANS")]
- struct FeatReply
- {
- int ResultCode;
- char BranchID[16];
- char CurrentAgent[16];
- char Data[0];//no more than 45k
- };
- struct FeatureData{
- CAutoArray<CSimpleStringA> FingerIDArray;
- CAutoArray<int> FingerIDLenArray;
- };
- struct TemplateInfo{
- CSimpleStringA CustomerID;
- int TemplateNum;
- };
- #pragma pack()
- enum EvtType{
- USER_EVT_TEST = EVT_USER + 1,
- USER_EVT_QUIT,
- USER_EVT_INIT,
- USER_EVT_INIT_FINISHED,
- USER_EVT_AUTHORIZE_START,
- USER_EVT_AUTHORIZE_FINISHED,
- USER_EVT_AUTHORIZE_CANCEL,
- USER_EVT_COLLECTFINGERPRINT_START,
- USER_EVT_COLLECTFINGERPRINT_FINISHED,
- USER_EVT_COLLECTFINGERPRINT_CANCEL,
- USER_EVT_SAVEFINGERPRINT_START,
- USER_EVT_SAVEFINGERPRINT_FINISHED,
- USER_EVT_CHECKUKEY,
- USER_EVT_CHECKUKEY_FINISHED,
- USER_EVT_HOLDON,
- USER_EVT_EXIT,
- };
- enum AuthByWhich//授权结果
- {
- AuthByNone = 0,
- AuthByFngPrnt = 1,
- AuthByUkey = 2,
- };
- struct AuthContext
- {
- AuthByWhich eAuthByWhich;
- CSimpleStringA UkeyID;
- CSimpleStringA CustomerID;
- };
- class CCustMngrAuthEntity;
- class CCustMngrAuthFSM;
- class AuthorizeStartEvent : public FSMEvent
- {
- public:
- AuthorizeStartEvent() : FSMEvent(USER_EVT_AUTHORIZE_START){}
- ~AuthorizeStartEvent(){}
- SpReqAnsContext<CustMngrAuthService_StartAuthorize_Req, CustMngrAuthService_StartAuthorize_Ans>::Pointer ctx;
- virtual void OnUnhandled()
- {
- Dbg("authorize_start unhandled");
- }
- protected:
- private:
- };
- class AuthorizeFinishedEvent : public FSMEvent
- {
- public:
- AuthorizeFinishedEvent() : FSMEvent(USER_EVT_AUTHORIZE_FINISHED){}
- ~AuthorizeFinishedEvent(){}
- SpReqAnsContext<CustMngrAuthService_StartAuthorize_Req, CustMngrAuthService_StartAuthorize_Ans>::Pointer ctx;
- virtual void OnUnhandled()
- {
- Dbg("authorize_finished unhandled");
- }
- protected:
- private:
- };
- class AuthorizeCancelEvent : public FSMEvent
- {
- public:
- AuthorizeCancelEvent() : FSMEvent(USER_EVT_AUTHORIZE_CANCEL){}
- ~AuthorizeCancelEvent(){}
- SpReqAnsContext<CustMngrAuthService_StopAuthorize_Req, CustMngrAuthService_StopAuthorize_Ans>::Pointer ctx;
- virtual void OnUnhandled()
- {
- if (ctx!=NULL)
- {
- Dbg("authorize_cancel unhandled");
- ctx->Answer(Error_InvalidState);
- }
- Dbg("authorize_cancel unhandled");
- }
- protected:
- private:
- };
- class CollectFingerPrintStartEvent : public FSMEvent
- {
- public:
- CollectFingerPrintStartEvent() : FSMEvent(USER_EVT_COLLECTFINGERPRINT_START){}
- ~CollectFingerPrintStartEvent(){}
- SpReqAnsContext<CustMngrAuthService_CollectFingerPrint_Req, CustMngrAuthService_CollectFingerPrint_Ans>::Pointer ctx;
- virtual void OnUnhandled()
- {
- if (ctx!=NULL)
- {
- Dbg("collect_finger_print unhandled");
- ctx->Answer(Error_InvalidState);
- }
- }
- protected:
- private:
- };
- class CollectFingerPrintFinishedEvent : public FSMEvent
- {
- public:
- CollectFingerPrintFinishedEvent() : FSMEvent(USER_EVT_COLLECTFINGERPRINT_FINISHED){}
- ~CollectFingerPrintFinishedEvent(){}
- SpReqAnsContext<CustMngrAuthService_CollectFingerPrint_Req, CustMngrAuthService_CollectFingerPrint_Ans>::Pointer ctx;
- virtual void OnUnhandled()
- {
- if (ctx!=NULL)
- {
- Dbg("collect_finger_print_finished unhandled");
- ctx->Answer(Error_InvalidState);
- }
- }
- protected:
- private:
- };
- class CancelCollectFingerPrintEvent : public FSMEvent
- {
- public:
- CancelCollectFingerPrintEvent() : FSMEvent(USER_EVT_COLLECTFINGERPRINT_CANCEL){}
- ~CancelCollectFingerPrintEvent(){}
- virtual void OnUnhandled()
- {
- Dbg("cancel collect fingerprint unhandled");
- }
- };
- class SaveFingerPrintStartEvent : public FSMEvent
- {
- public:
- SaveFingerPrintStartEvent() : FSMEvent(USER_EVT_SAVEFINGERPRINT_START){}
- ~SaveFingerPrintStartEvent(){}
- SpReqAnsContext<CustMngrAuthService_SaveFingerPrint_Req, CustMngrAuthService_SaveFingerPrint_Ans>::Pointer ctx;
- virtual void OnUnhandled(){
- if (ctx!=NULL)
- {
- Dbg("save_finger_print_start unhandled");
- ctx->Answer(Error_InvalidState);
- }
- }
- };
- class SaveFingerPrintFinishedEvent : public FSMEvent
- {
- public:
- SaveFingerPrintFinishedEvent() : FSMEvent(USER_EVT_SAVEFINGERPRINT_FINISHED){}
- ~SaveFingerPrintFinishedEvent(){}
- SpReqAnsContext<CustMngrAuthService_SaveFingerPrint_Req, CustMngrAuthService_SaveFingerPrint_Ans>::Pointer ctx;
- virtual void OnUnhandled(){
- if (ctx!=NULL)
- {
- Dbg("save_finger_print_finished unhandled");
- ctx->Answer(Error_InvalidState);
- }
- }
- };
- class CheckUkeyEvent : public FSMEvent
- {
- public:
- CheckUkeyEvent() : FSMEvent(USER_EVT_CHECKUKEY){}
- ~CheckUkeyEvent(){}
- virtual void OnUnhandled()
- {
- Dbg("check_ukey unhandled");
- }
- };
- class CheckUkeyFinishedEvent : public FSMEvent
- {
- public:
- CheckUkeyFinishedEvent() : FSMEvent(USER_EVT_CHECKUKEY_FINISHED){}
- ~CheckUkeyFinishedEvent(){}
- virtual void OnUnhandled()
- {
- Dbg("check_ukey_finished unhandled");
- }
- };
- class HoldOnEvent : public FSMEvent
- {
- public:
- HoldOnEvent() : FSMEvent(USER_EVT_HOLDON){}
- ~HoldOnEvent(){}
- SpReqAnsContext<CustMngrAuthService_HoldOn_Req, CustMngrAuthService_HoldOn_Ans>::Pointer ctx;
- virtual void OnUnhandled(){
- if (ctx!=NULL)
- {
- Dbg("holdon unhandled");
- ctx->Answer(Error_InvalidState);
- }
- }
- };
- class FeatureUpdateConn;
- class CCustMngrAuthFSM : public FSMImpl<CCustMngrAuthFSM>
- {
- public:
- enum { s0, s1, s2, s3, s4, s5};
- BEGIN_FSM_STATE(CCustMngrAuthFSM)
- 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)
- FSM_STATE_ENTRY(s2, "Idle", s2_on_entry, s2_on_exit, s2_on_event)
- FSM_STATE_ENTRY(s3, "Authorizing", s3_on_entry, s3_on_exit, s3_on_event)
- FSM_STATE_ENTRY(s4, "Registering", s4_on_entry, s4_on_exit, s4_on_event)
- FSM_STATE_ENTRY(s5, "Failed", s5_on_entry, s5_on_exit, s5_on_event)
- END_FSM_STATE()
- BEGIN_FSM_RULE(CCustMngrAuthFSM, s0)
- FSM_RULE_ENTRY(s0, s2, USER_EVT_TEST, 0)//oiltest?
- FSM_RULE_ENTRY(s0, s1, USER_EVT_INIT, 0)
- FSM_RULE_ENTRY(s0, FSM_STATE_EXIT, USER_EVT_QUIT, 0)
- FSM_RULE_ENTRY(s1, s2, USER_EVT_INIT_FINISHED, 0)
- FSM_RULE_ENTRY(s1, s5, USER_EVT_INIT_FINISHED, 1)
- FSM_RULE_ENTRY(s1, FSM_STATE_EXIT, USER_EVT_QUIT, 0)
- FSM_RULE_ENTRY(s2, s3, USER_EVT_AUTHORIZE_START, 0)
- FSM_RULE_ENTRY(s2, s4, USER_EVT_COLLECTFINGERPRINT_START, 0)
- FSM_RULE_ENTRY(s2, s4, USER_EVT_CHECKUKEY, 0)
- FSM_RULE_ENTRY(s2, s4, USER_EVT_SAVEFINGERPRINT_START, 0)
- FSM_RULE_ENTRY(s2, FSM_STATE_EXIT, USER_EVT_QUIT, 0)
- FSM_RULE_ENTRY(s3, s2, USER_EVT_EXIT, 0)
- FSM_RULE_ENTRY(s3, s2, USER_EVT_AUTHORIZE_FINISHED, 0)
- //FSM_RULE_ENTRY(s3, s2, USER_EVT_AUTHORIZE_CANCEL, 0)
- FSM_RULE_ENTRY(s4, s2, USER_EVT_COLLECTFINGERPRINT_START, 0)
- FSM_RULE_ENTRY(s4, s2, USER_EVT_COLLECTFINGERPRINT_FINISHED, 0)
- //FSM_RULE_ENTRY(s4, s2, USER_EVT_COLLECTFINGERPRINT_CANCEL, 0)
- FSM_RULE_ENTRY(s4, s2, USER_EVT_SAVEFINGERPRINT_FINISHED, 0)
- FSM_RULE_ENTRY(s4, s2, USER_EVT_CHECKUKEY_FINISHED, 0)
- FSM_RULE_ENTRY(s3, FSM_STATE_EXIT, USER_EVT_QUIT, 0)
- FSM_RULE_ENTRY(s5, FSM_STATE_EXIT, USER_EVT_QUIT, 0)
- END_FSM_RULE()
- CCustMngrAuthFSM(): m_pMaintainWatcher(NULL), m_pFingerPrint(NULL), m_pDeviceControl(NULL), m_bCancelCollectFP(false)
- , m_bCancelAuthorize(false), m_bAuthorizeTimeout(false) {
- hStopUpdate = ::CreateEventA(NULL, TRUE, FALSE, NULL);
- m_TimeLimit = 55;//默认授权超时秒数
- m_ctx = NULL;
- InitializeCriticalSection(&m_cs);
- }
- ~CCustMngrAuthFSM(){
- DeleteCriticalSection(&m_cs);
- }
- virtual ErrorCodeEnum OnInit();
- virtual ErrorCodeEnum OnExit();
- void s0_on_entry();
- void s0_on_exit();
- unsigned int s0_on_event(FSMEvent* event);
- void s1_on_entry();
- void s1_on_exit();
- unsigned int s1_on_event(FSMEvent* event);
- void s2_on_entry();
- void s2_on_exit();
- unsigned int s2_on_event(FSMEvent* event);
- void s3_on_entry();
- void s3_on_exit();
- unsigned int s3_on_event(FSMEvent* event);
- void s4_on_entry();
- void s4_on_exit();
- unsigned int s4_on_event(FSMEvent* event);
- void s5_on_entry();
- void s5_on_exit();
- unsigned int s5_on_event(FSMEvent* event);
- HANDLE hStopUpdate;
- int Initial();
- SpReqAnsContext<CustMngrAuthService_StartAuthorize_Req, CustMngrAuthService_StartAuthorize_Ans>::Pointer m_ctx;
- AuthContext m_authCtx;
- CSimpleStringA m_TerminalID;
- CSimpleStringA m_csMachineType;
- ErrorCodeEnum MatchFingerPrint(SpReqAnsContext<CustMngrAuthService_StartAuthorize_Req, CustMngrAuthService_StartAuthorize_Ans>::Pointer ctx, bool& bStopAuthorize);
- ErrorCodeEnum WaitForUkey(ErrorCodeEnum eErr);
- int OneFingerRecognitionEvaluate();
- void CancelAuthorize();
- void FeatureUpdate();
- ErrorCodeEnum CollectFingerPrint(SpReqAnsContext<CustMngrAuthService_CollectFingerPrint_Req, CustMngrAuthService_CollectFingerPrint_Ans>::Pointer ctx, DWORD& dwUserErrCode);
- ErrorCodeEnum GetImgBlob(CBlob &data, CSimpleStringA imgPath);
- void BroadcastPressFinger(int times, bool bPressFinger);
- ErrorCodeEnum SwitchUSB(bool bOpen);
- ErrorCodeEnum SaveFingerPrint(SpReqAnsContext<CustMngrAuthService_SaveFingerPrint_Req, CustMngrAuthService_SaveFingerPrint_Ans>::Pointer ctx);
- int CompareTime(CSimpleStringA time1, CSimpleStringA time2);
- int CompareUpdateTime(const char* time1, const char* time2);
- int RecoverFile(CSimpleStringA nowFileName, CSimpleStringA backupFileName);
- bool ReadDataIntoMemory(bool& bHasData);
- void UpdateDataIntoMemory(map<CSimpleStringA, FeatureData*> tempFeature, bool bIsFirstTimeQueryData);
- string ClearStringSpaceHeadTail(string& line);
- CSimpleStringA GetCurrentDate();
- void TransDataFromServer(CAutoArray<CSimpleStringA> &dataArray, CSimpleStringA latestTime, bool& bResumeTrans, bool bIsFirstTimeQueryData);
- bool BackupFile(CSimpleStringA srcFile, CSimpleStringA dstFile);
- CSimpleStringA GetMaxTime(CSimpleStringA maxTime, CSimpleStringA tempTime);
- CSimpleString GenerateAlarmJson(CSimpleString entityName, int cost);
- void BroadcastGetFinger(int status);
- protected:
- private:
- DeviceControlService_ClientBase *m_pDeviceControl;
- //FaceRecognitionService_ClientBase *m_pFaceRecognition;
- FingerPrintService_ClientBase *m_pFingerPrint;
- MaintainCertificate_ClientBase *m_pMaintainWatcher;
- FeatureUpdateConn *m_pConnection;//中台连接
- CSimpleStringA m_FaceFeaturePath;//人脸特征路径
- const char *STR_FINGERINFO;
- CSimpleStringA m_runInfoPath;
- bool m_bCancelCollectFP, m_bCancelAuthorize, m_bAuthorizeTimeout;
- int m_TimeLimit;
- map<CSimpleStringA, FeatureData*> m_featureData;
- CRITICAL_SECTION m_cs;//临界区变量
- };
- //特征更新连接
- class FeatureUpdateConn : public SpSecureClient
- {
- public:
- FeatureUpdateConn(CEntityBase *pEntity, CCustMngrAuthFSM *pFSM): SpSecureClient(pEntity), m_pFSM(pFSM), m_jsonLen(0), getErrMsg(false)
- {
- hPkgAnswer = ::CreateEventA(NULL, TRUE, FALSE, NULL);
- m_reply = NULL;
- }
- void SendFeatReq(const char* currAgent, const char* branchID, const char* lastTime = NULL)
- {
- //LOG_FUNCTION();
- ErrorCodeEnum eErr;
- //请求参数
- FeatReq req = {0};
- memcpy(req.BranchID, branchID, 16);
- memcpy(req.CurrentAgent, currAgent, 16);//续传标志(代表已查到的最后一个客户经理
- if (lastTime != NULL)
- {
- memcpy(req.UpdateTime, lastTime, 20);//本地指纹数据最新时间
- Dbg("req.UpdateTime:%s", req.UpdateTime);
- }
- strncpy_s(req.TerminalID, sizeof(req.TerminalID), m_pFSM->m_TerminalID, _TRUNCATE);
- CSmartPointer<IPackage> pkt = CreateNewPackage("FETQYREQ");
- pkt->AddStruct("FETQYREQ", false, false, (LPBYTE)&req, sizeof(FeatReq));
- m_reply = NULL;
- m_jsonLen = 0;
- SendPackage(pkt);
- }
- HANDLE hPkgAnswer;
- bool getErrMsg;
- FeatReply *m_reply;
- int m_jsonLen;
- protected:
- virtual ~FeatureUpdateConn() {}
-
- virtual void OnDisconnect()
- {
- Dbg("FeatureUpdateConnection disconnected");
- }
- virtual void OnPkgAnswer(const CSmartPointer<IPackage> &pRecvPkg)
- {
- //LOG_FUNCTION();
- DWORD dwSysCode, dwUserCode;
- string strErrMsg;
- ErrorCodeEnum rc = Error_Succeed;
- if (pRecvPkg->GetErrMsg(dwSysCode, dwUserCode, strErrMsg))
- {
- //错误处理
- Dbg("ERROR: package GetErrMsg!");
- rc = (ErrorCodeEnum)dwSysCode;
- string serviceCode = pRecvPkg->GetServiceCode();
- Dbg("receive %s ans packet is error, errormsg is %s", serviceCode.c_str(), strErrMsg.c_str());
- getErrMsg = true;
- SetEvent(hPkgAnswer);
- }
- else
- {
- //判断result接受buff,resultcode判断,
- Dbg("pRecvPkg get no errormessage.");
- string serviceCode = pRecvPkg->GetServiceCode();
- if (serviceCode == "FETQYREQ")
- {
- //Dbg("dealing with FETQYREQ package.");
- int nLen = pRecvPkg->GetStructLen("FETQYANS");
- //Dbg("GetStructLen structlen: %d", nLen);
- if ( nLen > 0 )
- {
- BYTE *pBuf = new BYTE[nLen];
- memset(pBuf, 0, nLen);
- Dbg("memeset done");
- int ArrayNum = 0;
- if (pRecvPkg->GetStructData("FETQYANS", pBuf, &nLen, &ArrayNum))
- {
- Dbg("GetStructData structlen: %d", nLen);
- //初始化
- LPBYTE pData = new BYTE[nLen+1];
- memcpy(pData, pBuf, nLen);
- Dbg("memcpy done");
- m_reply = (FeatReply*)pData;
- if (m_reply != NULL)
- {
- //Dbg("m_reply transformed successfully.");
- //Dbg("Resultcode: %d", m_reply->ResultCode);
- //Dbg("BranchID: %s", m_reply->BranchID);
- //Dbg("CurrentAgent: %s", m_reply->CurrentAgent);
- pData[nLen] = 0;
- m_jsonLen = nLen - sizeof(FeatReply);
- //Dbg("m_jsonLen:%d",m_jsonLen);
- }
- else
- {
- Dbg("ERROR: m_reply is null!");
- }
- }
- else
- {
- Dbg("ERROR: getstructdata(FETQYANS) failed!");
- }
- delete pBuf;
- }
- else
- {
- Dbg("ERROR: getstructlen(FETQYANS) = 0!");
- }
- //设m_pEvt为已通知,使下载线程从挂起中恢复,再设为未通知
- //isTimeOut = false;
- SetEvent(hPkgAnswer);
- }
- else
- {
- Dbg("ERROR: wrong service code!");
- }
- }
- }
-
- private:
- CCustMngrAuthFSM *m_pFSM;
- };
- //初始化:检查、配置路径、起特征更新任务
- struct InitTask : public ITaskSp
- {
- CCustMngrAuthFSM *fsm;
- InitTask(CCustMngrAuthFSM *f) : fsm(f) {}
- void Process()
- {
- LOG_FUNCTION();
- FSMEvent *e = new FSMEvent(USER_EVT_INIT_FINISHED);
- e->param1 = fsm->Initial();
- fsm->PostEventFIFO(e);
- }
- };
- //特征定期更新
- struct FeatureUpdateTask : public ITaskSp
- {
- CCustMngrAuthFSM *fsm;
- FeatureUpdateTask(CCustMngrAuthFSM *f) : fsm(f) {}
- void Process()
- {
- LOG_FUNCTION();
- fsm->FeatureUpdate();
- }
- };
- //调用指纹匹配服务,阻塞等待返回
- struct MatchFingerPrintTask : public ITaskSp
- {
- CCustMngrAuthFSM *fsm;
- MatchFingerPrintTask(CCustMngrAuthFSM *f) : fsm(f) {}
- SpReqAnsContext<CustMngrAuthService_StartAuthorize_Req, CustMngrAuthService_StartAuthorize_Ans>::Pointer ctx;
- void Process()
- {
- bool bStopAuthorize = false;
- ErrorCodeEnum eErr = fsm->MatchFingerPrint(ctx, bStopAuthorize);
- if (bStopAuthorize)
- {
- AuthorizeFinishedEvent *e = new AuthorizeFinishedEvent();
- e->ctx = ctx;
- e->param1 = eErr;
- fsm->PostEventFIFO(e);//指纹匹配结束,结束授权
- }
- else
- {
- AuthorizeFinishedEvent *e = new AuthorizeFinishedEvent();
- e->ctx = ctx;
- e->param1 = fsm->WaitForUkey(eErr);
- fsm->PostEventFIFO(e);//指纹匹配异常停止,继续等到超时或ukey插入结束授权,如果是ukey插入,这个event就不会被处理
- }
- }
- };
- //采集指纹
- struct CollectFingerPrintTask : public ITaskSp
- {
- CCustMngrAuthFSM *fsm;
- SpReqAnsContext<CustMngrAuthService_CollectFingerPrint_Req, CustMngrAuthService_CollectFingerPrint_Ans>::Pointer ctx;
- CollectFingerPrintTask(CCustMngrAuthFSM *f) : fsm(f){}
- void Process()
- {
- LOG_FUNCTION();
- CollectFingerPrintFinishedEvent *e = new CollectFingerPrintFinishedEvent();
- e->ctx = ctx;
- DWORD dwUserErrorCode = 0;
- ErrorCodeEnum eErr = fsm->CollectFingerPrint(ctx, dwUserErrorCode);
- if(eErr == Error_Unexpect && dwUserErrorCode > 0)
- ctx->Answer(eErr, dwUserErrorCode);
- else
- ctx->Answer(eErr);
- fsm->PostEventFIFO(e);
- }
- };
- struct SaveFingerPrintTask : public ITaskSp
- {
- CCustMngrAuthFSM *fsm;
- SpReqAnsContext<CustMngrAuthService_SaveFingerPrint_Req, CustMngrAuthService_SaveFingerPrint_Ans>::Pointer ctx;
- SaveFingerPrintTask(CCustMngrAuthFSM *f) : fsm(f) {}
- void Process()
- {
- LOG_FUNCTION();
- SaveFingerPrintFinishedEvent *e = new SaveFingerPrintFinishedEvent();
- e->ctx = ctx;
- ErrorCodeEnum eErr = fsm->SaveFingerPrint(ctx);
- ctx->Answer(eErr);
- fsm->PostEventFIFO(e);
- }
- };
- #endif //__CUSTMNGRAUTH_FSM_H
|