|
@@ -1,50 +1,51 @@
|
|
|
#ifndef FINGERPRINT_FSM_H
|
|
|
#define FINGERPRINT_FSM_H
|
|
|
|
|
|
-#include "CommEntityUtil.hpp"
|
|
|
+
|
|
|
+#include "SpFSM.h"
|
|
|
#include "DevFSMCommBase.hpp"
|
|
|
#include "FingerPrintClass.h"
|
|
|
#include "FingerPrint_UserErrorCode.h"
|
|
|
|
|
|
-#include "DeviceBaseHelper.h"
|
|
|
-
|
|
|
-#include "fileutil.h"
|
|
|
-#include <ctime>
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-struct ScanParam
|
|
|
-{
|
|
|
- CSimpleStringA m_DepPath;
|
|
|
- CSimpleStringA m_FullFilePath;
|
|
|
- CSimpleStringA m_BmpFileName;
|
|
|
-
|
|
|
- ULLINT m_TimeStart;
|
|
|
- ULLINT m_TimeEnd;
|
|
|
- ULLINT m_TimeLeft;
|
|
|
-
|
|
|
- LPBYTE m_Feature;
|
|
|
- LPBYTE m_Template;
|
|
|
- int m_FeatureLen;
|
|
|
-
|
|
|
- bool m_ScanSuc;
|
|
|
- bool m_GetTemplateSuc;
|
|
|
- bool m_NotFindImage;
|
|
|
- bool m_FeatureIsNull;
|
|
|
- bool m_bLenIsNotRight;
|
|
|
- bool m_bGetFingerPrintSuc;
|
|
|
- bool m_Quit;
|
|
|
-};
|
|
|
-
|
|
|
-enum OperateType
|
|
|
-{
|
|
|
- RegisterType = 1,
|
|
|
- MatchType
|
|
|
-};
|
|
|
+#include "CommEntityUtil.hpp"
|
|
|
+//#include "DeviceBaseHelper.h"
|
|
|
+
|
|
|
+using namespace std;
|
|
|
+
|
|
|
+//struct ScanParam
|
|
|
+//{
|
|
|
+// CSimpleStringA m_DepPath;
|
|
|
+// CSimpleStringA m_FullFilePath;
|
|
|
+// CSimpleStringA m_BmpFileName;
|
|
|
+//
|
|
|
+// ULLINT m_TimeStart;
|
|
|
+// ULLINT m_TimeEnd;
|
|
|
+// ULLINT m_TimeLeft;
|
|
|
+//
|
|
|
+// LPBYTE m_Feature;
|
|
|
+// LPBYTE m_Template;
|
|
|
+// int m_FeatureLen;
|
|
|
+//
|
|
|
+// bool m_ScanSuc;
|
|
|
+// bool m_GetTemplateSuc;
|
|
|
+// bool m_NotFindImage;
|
|
|
+// bool m_FeatureIsNull;
|
|
|
+// bool m_bLenIsNotRight;
|
|
|
+// bool m_bGetFingerPrintSuc;
|
|
|
+// bool m_Quit;
|
|
|
+//};
|
|
|
+//
|
|
|
+//enum OperateType
|
|
|
+//{
|
|
|
+// RegisterType = 1,
|
|
|
+// MatchType
|
|
|
+//};
|
|
|
|
|
|
enum EvtType
|
|
|
{
|
|
|
USER_EVT_TEST = EVT_USER + 1,
|
|
|
+ USER_EVT_INIT,
|
|
|
+ USER_EVT_INIT_FINISHED,
|
|
|
USER_EVT_GET_DEVINFO,
|
|
|
USER_EVT_SCAN,
|
|
|
USER_EVT_SCAN_FINISHED,
|
|
@@ -56,12 +57,16 @@ enum EvtType
|
|
|
USER_EVT_GETFINGER_FINISHED,
|
|
|
USER_EVT_GENERATE_TEMPLATE,
|
|
|
USER_EVT_GENERATE_TEMPLATE_FINISHED,
|
|
|
+ USER_EVT_MATCH_FINGERPRINT,
|
|
|
+ USER_EVT_MATCH_FINGERPRINT_FINISHED,
|
|
|
USER_EVT_CANCEL_SCAN,
|
|
|
USER_EVT_CANCEL_MATCH,
|
|
|
USER_EVT_CANCEL_SCAN_FINISHED,
|
|
|
USER_EVT_QUIT,
|
|
|
USER_EVT_ERROR,
|
|
|
- USER_EVT_EXIT
|
|
|
+ USER_EVT_EXIT,
|
|
|
+ USER_EVT_FWB_OPEN_SUC,
|
|
|
+ USER_EVT_FWB_OPEN_SUC_FINISHED,
|
|
|
};
|
|
|
|
|
|
enum BmpType
|
|
@@ -228,16 +233,19 @@ public:
|
|
|
FSM_STATE_ENTRY(s1, "Scan", s1_on_entry,s1_on_exit,s1_on_event)
|
|
|
FSM_STATE_ENTRY(s2, "Fail", s2_on_entry,s2_on_exit,s2_on_event)
|
|
|
FSM_STATE_ENTRY(s3, "Match", s3_on_entry,s3_on_exit,s3_on_event)//废弃的状态
|
|
|
+ FSM_STATE_ENTRY(s4, "Init", s4_on_entry,s4_on_exit,s4_on_event)
|
|
|
END_FSM_STATE()
|
|
|
|
|
|
- BEGIN_FSM_RULE(CFingerPrintFSM, s0)
|
|
|
+ BEGIN_FSM_RULE(CFingerPrintFSM, s4)
|
|
|
FSM_RULE_ENTRY(s0, FSM_STATE_EXIT, USER_EVT_QUIT, 0)
|
|
|
FSM_RULE_ENTRY(s0, s1, USER_EVT_SCAN, 0)
|
|
|
FSM_RULE_ENTRY(s0, s1, USER_EVT_SCANEX, 0)
|
|
|
FSM_RULE_ENTRY(s0, s1, USER_EVT_GETFINGER, 0)
|
|
|
FSM_RULE_ENTRY(s0, s1, USER_EVT_GENERATE_TEMPLATE, 0)
|
|
|
+ FSM_RULE_ENTRY(s0, s1, USER_EVT_SCANEX, 0)
|
|
|
FSM_RULE_ENTRY(s0, s2, USER_EVT_ERROR, 0)
|
|
|
FSM_RULE_ENTRY(s0, s3, USER_EVT_MATCH, 0)
|
|
|
+ FSM_RULE_ENTRY(s0, s4, USER_EVT_FWB_OPEN_SUC_FINISHED, 0)
|
|
|
FSM_RULE_ENTRY(s1, FSM_STATE_EXIT, USER_EVT_QUIT, 0)
|
|
|
FSM_RULE_ENTRY(s1, s0, USER_EVT_SCAN_FINISHED, 0)
|
|
|
FSM_RULE_ENTRY(s1, s2, USER_EVT_SCAN_FINISHED, 2)
|
|
@@ -247,18 +255,22 @@ public:
|
|
|
FSM_RULE_ENTRY(s1, s2, USER_EVT_GETFINGER_FINISHED, 2)
|
|
|
FSM_RULE_ENTRY(s1, s0, USER_EVT_GENERATE_TEMPLATE_FINISHED, 0)
|
|
|
FSM_RULE_ENTRY(s1, s2, USER_EVT_GENERATE_TEMPLATE_FINISHED, 2)
|
|
|
+ FSM_RULE_ENTRY(s2, s4, USER_EVT_FWB_OPEN_SUC_FINISHED, 0)
|
|
|
FSM_RULE_ENTRY(s3, FSM_STATE_EXIT, USER_EVT_QUIT, 0)
|
|
|
FSM_RULE_ENTRY(s3, s0, USER_EVT_MATCH_FINISHED, 0)
|
|
|
FSM_RULE_ENTRY(s3, s2, USER_EVT_MATCH_FINISHED, 2)
|
|
|
+ FSM_RULE_ENTRY(s4, s0, USER_EVT_INIT_FINISHED, 0)
|
|
|
+ FSM_RULE_ENTRY(s4, s2, USER_EVT_INIT_FINISHED, 2)
|
|
|
END_FSM_RULE()
|
|
|
|
|
|
CFingerPrintFSM(): m_bCancelRegister(false), m_bCancelMatch(false), m_bExit(false),
|
|
|
- m_testResult(Error_Succeed), m_csDevSN(""), m_devInit(false)
|
|
|
- {
|
|
|
- HARDWARE_ENTITY_RESET_ENTITYID(m_entCode, 0x204);
|
|
|
- m_FirstStart = TRUE;
|
|
|
- ZeroMemory(&m_adapterInfo, sizeof(m_adapterInfo));
|
|
|
- };
|
|
|
+ m_testResult(Error_Succeed), m_csDevSN(""), m_iInWhatPage(PageType_Other),
|
|
|
+ m_csMachineType(""), m_terminalNo(""),m_fwbSN(""), m_version(""), m_machineVersion("")
|
|
|
+ {
|
|
|
+ HARDWARE_ENTITY_RESET_ENTITYID(m_entCode, 0x204);
|
|
|
+ //m_FirstStart = TRUE;
|
|
|
+ //ZeroMemory(&m_adapterInfo, sizeof(m_adapterInfo));
|
|
|
+ }
|
|
|
|
|
|
virtual ErrorCodeEnum OnInit();
|
|
|
virtual ErrorCodeEnum OnExit();
|
|
@@ -267,6 +279,10 @@ public:
|
|
|
void s0_on_exit();
|
|
|
unsigned int s0_on_event(FSMEvent* e);
|
|
|
|
|
|
+ void s4_on_entry();
|
|
|
+ void s4_on_exit();
|
|
|
+ unsigned int s4_on_event(FSMEvent* e);
|
|
|
+
|
|
|
void s1_on_entry();
|
|
|
void s1_on_exit();
|
|
|
unsigned int s1_on_event(FSMEvent* e);
|
|
@@ -281,37 +297,29 @@ public:
|
|
|
|
|
|
int GetFingerPrint(SpReqAnsContext<FingerPrintService_GetFingerPrint_Req, FingerPrintService_GetFingerPrint_Ans>::Pointer ctx);
|
|
|
int GenerateTemplate(SpReqAnsContext<FingerPrintService_GenerateTemplate_Req, FingerPrintService_GenerateTemplate_Ans>::Pointer ctx);
|
|
|
- void CollectProcess(ScanParam* pScanParam, SpReqAnsContext<FingerPrintService_GetFingerPrint_Req, FingerPrintService_GetFingerPrint_Ans>::Pointer& ctx);
|
|
|
- void ProcessAfterCollect(ScanParam* pScanParam, SpReqAnsContext<FingerPrintService_GetFingerPrint_Req, FingerPrintService_GetFingerPrint_Ans>::Pointer& ctx);
|
|
|
+ //void CollectProcess(ScanParam* pScanParam, SpReqAnsContext<FingerPrintService_GetFingerPrint_Req, FingerPrintService_GetFingerPrint_Ans>::Pointer& ctx);
|
|
|
+ //void ProcessAfterCollect(ScanParam* pScanParam, SpReqAnsContext<FingerPrintService_GetFingerPrint_Req, FingerPrintService_GetFingerPrint_Ans>::Pointer& ctx);
|
|
|
|
|
|
void DeleteBmp(int type);
|
|
|
ErrorCodeEnum DeleteFileIfExisted(const char* fileName);
|
|
|
|
|
|
- int GetImageAndFeature(SpReqAnsContext<FingerPrintService_GetImageAndFeature_Req, FingerPrintService_GetImageAndFeature_Ans>::Pointer ctx);//废弃
|
|
|
- int GetImageAndFeatureEx(SpReqAnsContext<FingerPrintService_GetImageAndFeatureEx_Req, FingerPrintService_GetImageAndFeatureEx_Ans>::Pointer ctx);//废弃
|
|
|
- ErrorCodeEnum Match(SpReqAnsContext<FingerPrintService_Match_Req, FingerPrintService_Match_Ans>::Pointer ctx);//废弃
|
|
|
ErrorCodeEnum GetDevCatInfo(DevCategoryInfo& devInfo);//废弃
|
|
|
ErrorCodeEnum GetDevState(int &state);//废弃
|
|
|
|
|
|
+ int Initial();
|
|
|
+ //ErrorCodeEnum DoDevOpen(CSmartPointer<IConfigInfo> spConfig);
|
|
|
+ //ErrorCodeEnum DoGetDevInfo();
|
|
|
+ //ErrorCodeEnum QueryRootConfigObj(CSmartPointer<IConfigInfo>& spConfig);
|
|
|
+ //ErrorCodeEnum InitCommParam(ScanParam* initParam, int type, int scanTime, int templateNum = -1);
|
|
|
+ //ErrorCodeEnum ExtractVendorLib(CSimpleStringA& strLibFullPath);
|
|
|
+ int ProcFWBReConn();
|
|
|
+ bool GetDevInitFlag() { return m_bOpened; }
|
|
|
+ void ResetDevInitFlag() { m_bOpened = false; }//蓝牙多合一使用
|
|
|
+// bool GetDevInitFlag() { return m_devInit; }
|
|
|
+ void SetInWhatPage(int bValue) { m_iInWhatPage = bValue; }
|
|
|
+// bool IsFWBDevice(CSimpleString& vendorName);//废弃 蓝牙多合一判断
|
|
|
+
|
|
|
|
|
|
- ErrorCodeEnum DoDevOpen(CSmartPointer<IConfigInfo> spConfig);
|
|
|
- ErrorCodeEnum DoGetDevInfo();
|
|
|
- ErrorCodeEnum QueryRootConfigObj(CSmartPointer<IConfigInfo> &spConfig);
|
|
|
- ErrorCodeEnum InitCommParam(ScanParam* initParam, int type, int scanTime, int templateNum = -1);
|
|
|
- ErrorCodeEnum ExtractVendorLib(CSimpleStringA& strLibFullPath);
|
|
|
-// CSimpleString GenerateAlarmJson(CSimpleString entityName, int cost);
|
|
|
-
|
|
|
- bool GetDevInitFlag() { return m_devInit; }
|
|
|
- bool IsFWBDevice(CSimpleString& vendorName);//废弃 蓝牙多合一判断
|
|
|
- ErrorCodeEnum InitParamBeforeScan(ScanParam *initParam, int scanTime);//废弃 GetImageAndFeature和GetImageAndFeatureEx引用
|
|
|
- void ScanProcess(ScanParam* pScanParam, SpReqAnsContext<FingerPrintService_GetImageAndFeature_Req, FingerPrintService_GetImageAndFeature_Ans>::Pointer &ctx);//废弃 GetImageAndFeature引用
|
|
|
- void ScanProcessEx(ScanParam* pScanParam, SpReqAnsContext<FingerPrintService_GetImageAndFeatureEx_Req, FingerPrintService_GetImageAndFeatureEx_Ans>::Pointer& ctx);//废弃 GetImageAndFeatureEx引用
|
|
|
- void ProcessAfterScan(ScanParam* pScanParam, SpReqAnsContext<FingerPrintService_GetImageAndFeature_Req, FingerPrintService_GetImageAndFeature_Ans>::Pointer& ctx);//废弃 GetImageAndFeature引用
|
|
|
- void ProcessAfterScanEx(ScanParam* pScanParam, SpReqAnsContext<FingerPrintService_GetImageAndFeatureEx_Req, FingerPrintService_GetImageAndFeatureEx_Ans>::Pointer& ctx);//废弃 GetImageAndFeatureEx引用
|
|
|
- ErrorCodeEnum InitParamBeforeMatch(ScanParam* initParam, int templateNum);//废弃 Match引用
|
|
|
- void ScanBeforeMatch(ScanParam* initParam);//废弃 Match引用
|
|
|
- ErrorCodeEnum MatchProcess(ScanParam* initParam, SpReqAnsContext<FingerPrintService_Match_Req, FingerPrintService_Match_Ans>::Pointer& ctx);//废弃 Match引用
|
|
|
-
|
|
|
void SelfTest(EntityTestEnum eTestType,CSmartPointer<ITransactionContext> pTransactionContext);
|
|
|
|
|
|
private:
|
|
@@ -322,13 +330,14 @@ private:
|
|
|
bool m_bCancelRegister;
|
|
|
bool m_bCancelMatch;
|
|
|
bool m_bExit;
|
|
|
+ int m_iInWhatPage/*在哪个页面,区分首页,用户桌面,其他页*/;
|
|
|
|
|
|
CSimpleStringA m_csDevSN;//蓝牙多合一设备sn
|
|
|
- bool m_devInit;//和DevFSMCommBase 里面的m_bOpened变量一致
|
|
|
- CSimpleStringA m_BmpFileFullPath1;//废弃
|
|
|
- CSimpleStringA m_BmpFileFullPath2;//废弃
|
|
|
- CSimpleStringA m_BmpFileFullPath3;//废弃
|
|
|
-
|
|
|
+// bool m_devInit;//和DevFSMCommBase 里面的m_bOpened变量一致
|
|
|
+ CSimpleStringA m_csMachineType,m_terminalNo;//site,terminalNo只是临时使用,可以去除
|
|
|
+ CSimpleStringA m_fwbSN;//FWBDevSN值
|
|
|
+ CSimpleStringA m_version;//蓝牙多合一pinpad版本
|
|
|
+ CSimpleStringA m_machineVersion;//终端大版本
|
|
|
};
|
|
|
//废弃
|
|
|
struct ScanTask : public ITaskSp
|
|
@@ -338,10 +347,10 @@ struct ScanTask : public ITaskSp
|
|
|
ScanTask(CFingerPrintFSM* f) : fsm(f){}
|
|
|
void Process()
|
|
|
{
|
|
|
- LOG_FUNCTION();
|
|
|
- FSMEvent* e = new FSMEvent(USER_EVT_SCAN_FINISHED);
|
|
|
- e->param1 = fsm->GetImageAndFeature(ctx);
|
|
|
- fsm->PostEventFIFO(e);
|
|
|
+ //LOG_FUNCTION();
|
|
|
+ //FSMEvent* e = new FSMEvent(USER_EVT_SCAN_FINISHED);
|
|
|
+ //e->param1 = fsm->GetImageAndFeature(ctx);
|
|
|
+ //fsm->PostEventFIFO(e);
|
|
|
}
|
|
|
};
|
|
|
//废弃
|
|
@@ -352,10 +361,10 @@ struct ScanExTask : public ITaskSp
|
|
|
ScanExTask(CFingerPrintFSM* f) : fsm(f) {}
|
|
|
void Process()
|
|
|
{
|
|
|
- LOG_FUNCTION();
|
|
|
- FSMEvent* e = new FSMEvent(USER_EVT_SCANEX_FINISHED);
|
|
|
- e->param1 = fsm->GetImageAndFeatureEx(ctx);
|
|
|
- fsm->PostEventFIFO(e);
|
|
|
+ //LOG_FUNCTION();
|
|
|
+ //FSMEvent* e = new FSMEvent(USER_EVT_SCANEX_FINISHED);
|
|
|
+ //e->param1 = fsm->GetImageAndFeatureEx(ctx);
|
|
|
+ //fsm->PostEventFIFO(e);
|
|
|
}
|
|
|
};
|
|
|
//有用
|
|
@@ -394,10 +403,35 @@ struct MatchTask : public ITaskSp
|
|
|
MatchTask(CFingerPrintFSM* f) : fsm(f){}
|
|
|
void Process()
|
|
|
{
|
|
|
- LOG_FUNCTION();
|
|
|
- MatchFinishedEvent* e = new MatchFinishedEvent();
|
|
|
- e->param1 = fsm->Match(ctx);
|
|
|
- e->ctx = ctx;
|
|
|
+ //LOG_FUNCTION();
|
|
|
+ //MatchFinishedEvent* e = new MatchFinishedEvent();
|
|
|
+ //e->param1 = fsm->Match(ctx);
|
|
|
+ //e->ctx = ctx;
|
|
|
+ //fsm->PostEventFIFO(e);
|
|
|
+ }
|
|
|
+};
|
|
|
+//有用
|
|
|
+struct InitTask : public ITaskSp
|
|
|
+{
|
|
|
+ CFingerPrintFSM* fsm;
|
|
|
+ InitTask(CFingerPrintFSM* f) : fsm(f) {}
|
|
|
+
|
|
|
+ void Process()
|
|
|
+ {
|
|
|
+ FSMEvent* e = new FSMEvent(USER_EVT_INIT_FINISHED);
|
|
|
+ e->param1 = fsm->Initial();
|
|
|
+ fsm->PostEventFIFO(e);
|
|
|
+ }
|
|
|
+};
|
|
|
+//有用
|
|
|
+struct ProcFWBReConnTask : public ITaskSp
|
|
|
+{
|
|
|
+ CFingerPrintFSM* fsm;
|
|
|
+ ProcFWBReConnTask(CFingerPrintFSM* f) : fsm(f) {}
|
|
|
+ void Process()
|
|
|
+ {
|
|
|
+ FSMEvent* e = new FSMEvent(USER_EVT_FWB_OPEN_SUC_FINISHED);
|
|
|
+ e->param1 = fsm->ProcFWBReConn();
|
|
|
fsm->PostEventFIFO(e);
|
|
|
}
|
|
|
};
|