Преглед на файлове

Z991239-4473 #comment 调整指纹仪方法位置和去除cardswiper引用

Signed-Off-By: commit-hook
刘文涛80174520 преди 2 години
родител
ревизия
90b03d4a09
променени са 3 файла, в които са добавени 74 реда и са изтрити 106 реда
  1. 14 58
      Module/mod_FingerPrint/FingerPrintFSM.cpp
  2. 50 37
      Module/mod_FingerPrint/FingerPrintFSM.h
  3. 10 11
      Module/mod_FingerPrint/mod_FingerPrint.h

+ 14 - 58
Module/mod_FingerPrint/FingerPrintFSM.cpp

@@ -377,19 +377,20 @@ ErrorCodeEnum CFingerPrintFSM::DoDevOpen(CSmartPointer<IConfigInfo> spConfig)
 		spConfig->ReadConfigValueInt("Device.FingerPrint", "Baudrate", baudrate);
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("port: %d, baudrate: %d", tmpPort, baudrate);
 
-		if (IsFWBDevice(tmpVendor))
-		{
-			errDev = CheckCardSwiperStatus();
-			if (Error_Succeed != errDev)
-			{
-				DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("this is FWB, device status is not normal now.(%s)", SpStrError(errDev));
-				errDev = Error_DevCommFailed;
-				break;
-			}
-			else {
-				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("this is FWB, device status is normal now.");
-			}
-		}
+		//È¥³ýÀ¶ÑÀ¶àºÏÒ»µÄÅжÏ
+		//if (IsFWBDevice(tmpVendor))
+		//{
+		//	errDev = CheckCardSwiperStatus();
+		//	if (Error_Succeed != errDev)
+		//	{
+		//		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("this is FWB, device status is not normal now.(%s)", SpStrError(errDev));
+		//		errDev = Error_DevCommFailed;
+		//		break;
+		//	}
+		//	else {
+		//		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("this is FWB, device status is normal now.");
+		//	}
+		//}
 
 		errDev = m_hDevHelper->DevOpen(tmpPort, baudrate);
 		if (errDev != Error_Succeed)
@@ -1435,51 +1436,6 @@ bool CFingerPrintFSM::IsFWBDevice(CSimpleString& vendorName)
 	return isFWB;
 }
 
-ErrorCodeEnum CFingerPrintFSM::CheckCardSwiperStatus()
-{
-	ErrorCodeEnum errCode = Error_Unexpect;
-	CardSwiperService_ClientBase* pCardSwiperClient = new CardSwiperService_ClientBase(this->GetEntityBase());
-	errCode = pCardSwiperClient->Connect();
-	if (errCode != Error_Succeed)
-	{
-		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("connect CardSwiper fail %s.", SpStrError(errCode));
-		pCardSwiperClient->SafeDelete();
-	}
-	else {
-		CardSwiperService_GetDevInfo_Req req = {};
-		CardSwiperService_GetDevInfo_Ans ans = {};
-		errCode = pCardSwiperClient->GetDevInfo(req, ans, 3000);
-
-		if (errCode != Error_Succeed)
-		{
-			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("CardSwiper::GetDevInfo() fail: 0x%x", errCode);
-		}
-		else {
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("CardSwiper::GetDevInfo() return state: %d", ans.state);
-			if (ans.state == DEVICE_STATUS_NOT_READY)
-			{
-				SLEEP(500);
-				CardSwiperService_GetDevInfo_Req req2 = {};
-				CardSwiperService_GetDevInfo_Ans ans2 = {};
-				errCode = pCardSwiperClient->GetDevInfo(req2, ans2, 3000);
-				if (errCode != Error_Succeed)
-				{
-					DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("CardSwiper::GetDevInfo() again fail with err(%s)", SpStrError(errCode));
-				}
-				else {
-					DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER)("CardSwiper::GetDevInfo() again return state: %d", ans2.state);
-					if (ans2.state != DEVICE_STATUS_NORMAL)
-						errCode = Error_DevNotAvailable;
-				}
-			}
-			else if (ans.state != DEVICE_STATUS_NORMAL)
-				errCode = Error_DevNotAvailable;
-		}
-		pCardSwiperClient->GetFunction()->CloseSession();
-	}
-
-	return errCode;
-}
 
 void CFingerPrintFSM::DeleteBmp(int type)
 {

+ 50 - 37
Module/mod_FingerPrint/FingerPrintFSM.h

@@ -3,13 +3,15 @@
 
 #include "CommEntityUtil.hpp"
 #include "DevFSMCommBase.hpp"
-#include "DeviceBaseHelper.h"
 #include "FingerPrintClass.h"
-#include "CardSwiper_client_g.h"
+#include "FingerPrint_UserErrorCode.h"
+
+#include "DeviceBaseHelper.h"
+
 #include "fileutil.h"
 #include <ctime>
 
-using namespace CardSwiper;
+
 
 struct ScanParam
 {
@@ -103,7 +105,7 @@ public:
 	}
 };
 
-class  GetFingerEvent : public FSMEvent
+class GetFingerEvent : public FSMEvent
 {
 public:
 	GetFingerEvent() : FSMEvent(USER_EVT_GETFINGER) {}
@@ -142,7 +144,7 @@ public:
 	virtual ~CancelRegisterEvent(){}
 	virtual void OnUnhandled()
 	{
-		LOG_TRACE("Cancel scan not handled");
+		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Cancel scan not handled");
 	}
 };
 
@@ -157,7 +159,7 @@ public:
 		if (ctx != NULL)
 		{
 			ctx->Answer(Error_InvalidState);
-			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("match unhandled.");
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Match unhandled.");
 		}
 	}
 };
@@ -170,7 +172,10 @@ public:
 	SpReqAnsContext<FingerPrintService_Match_Req, FingerPrintService_Match_Ans>::Pointer ctx;
 	virtual void OnUnhandled()
 	{
-		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Match finished unhandled.");
+		if (ctx != NULL)
+		{
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Match finished unhandled.");
+		}
 	}
 };
 
@@ -183,7 +188,9 @@ public:
 	virtual void OnUnhandled()
 	{
 		if (ctx != NULL)
+		{
 			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("GetFingerFinished unhandled.");
+		}
 	}
 };
 
@@ -220,7 +227,7 @@ public:
 		FSM_STATE_ENTRY(s0, "Normal", s0_on_entry,s0_on_exit,s0_on_event)
 		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(s3, "Match", s3_on_entry,s3_on_exit,s3_on_event)//废弃的状态
 	END_FSM_STATE()
 
 	BEGIN_FSM_RULE(CFingerPrintFSM, s0)
@@ -272,50 +279,56 @@ public:
 	void s3_on_exit();
 	unsigned int s3_on_event(FSMEvent* e);
 
-	int GetImageAndFeature(SpReqAnsContext<FingerPrintService_GetImageAndFeature_Req, FingerPrintService_GetImageAndFeature_Ans>::Pointer ctx);
-	int GetImageAndFeatureEx(SpReqAnsContext<FingerPrintService_GetImageAndFeatureEx_Req, FingerPrintService_GetImageAndFeatureEx_Ans>::Pointer ctx);
 	int GetFingerPrint(SpReqAnsContext<FingerPrintService_GetFingerPrint_Req, FingerPrintService_GetFingerPrint_Ans>::Pointer ctx);
 	int GenerateTemplate(SpReqAnsContext<FingerPrintService_GenerateTemplate_Req, FingerPrintService_GenerateTemplate_Ans>::Pointer ctx);
-	ErrorCodeEnum Match(SpReqAnsContext<FingerPrintService_Match_Req, FingerPrintService_Match_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);
-	ErrorCodeEnum GetDevCatInfo(DevCategoryInfo& devInfo);
-	ErrorCodeEnum GetDevState(int& state);
-	ErrorCodeEnum CheckCardSwiperStatus();
+
+	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);//废弃
+
 	CSimpleString GenerateAlarmJson(CSimpleString entityName, int cost);
 	ErrorCodeEnum DoDevOpen(CSmartPointer<IConfigInfo> spConfig);
 	ErrorCodeEnum DoGetDevInfo();
 	ErrorCodeEnum QueryRootConfigObj(CSmartPointer<IConfigInfo> &spConfig);
-	bool IsFWBDevice(CSimpleString& vendorName);
 	ErrorCodeEnum InitCommParam(ScanParam* initParam, int type, int scanTime, int templateNum = -1);
-	ErrorCodeEnum InitParamBeforeScan(ScanParam *initParam, int scanTime);
-	void ScanProcess(ScanParam* pScanParam, SpReqAnsContext<FingerPrintService_GetImageAndFeature_Req, FingerPrintService_GetImageAndFeature_Ans>::Pointer &ctx);
-	void ScanProcessEx(ScanParam* pScanParam, SpReqAnsContext<FingerPrintService_GetImageAndFeatureEx_Req, FingerPrintService_GetImageAndFeatureEx_Ans>::Pointer& ctx);
-	void ProcessAfterScan(ScanParam* pScanParam, SpReqAnsContext<FingerPrintService_GetImageAndFeature_Req, FingerPrintService_GetImageAndFeature_Ans>::Pointer& ctx);
-	void ProcessAfterScanEx(ScanParam* pScanParam, SpReqAnsContext<FingerPrintService_GetImageAndFeatureEx_Req, FingerPrintService_GetImageAndFeatureEx_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);
-	ErrorCodeEnum InitParamBeforeMatch(ScanParam* initParam, int templateNum);
-	void ScanBeforeMatch(ScanParam* initParam);
-	ErrorCodeEnum MatchProcess(ScanParam* initParam, SpReqAnsContext<FingerPrintService_Match_Req, FingerPrintService_Match_Ans>::Pointer& ctx);
 	ErrorCodeEnum ExtractVendorLib(CSimpleStringA& strLibFullPath);
 
+	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:
 	ErrorCodeEnum m_testResult;
 	DevCategoryInfo m_devCatInfo;
 	DevStateEnum m_devState;
-	CSimpleStringA m_BmpFileFullPath1;
-	CSimpleStringA m_BmpFileFullPath2;
-	CSimpleStringA m_BmpFileFullPath3;
-	CSimpleStringA m_csDevSN;
+	
 	bool m_bCancelRegister;
 	bool m_bCancelMatch;
-	bool m_devInit;
 	bool m_bExit;
-};
 
+	CSimpleStringA m_csDevSN;//蓝牙多合一设备sn
+	bool m_devInit;
+	CSimpleStringA m_BmpFileFullPath1;
+	CSimpleStringA m_BmpFileFullPath2;
+	CSimpleStringA m_BmpFileFullPath3;
+	
+};
+//废弃
 struct ScanTask : public ITaskSp   
 {
 	CFingerPrintFSM* fsm;
@@ -329,8 +342,8 @@ struct ScanTask : public ITaskSp
 		fsm->PostEventFIFO(e);
 	}
 };
-
-struct ScanExTask : public ITaskSp
+//废弃
+struct ScanExTask : public ITaskSp   
 {
 	CFingerPrintFSM* fsm;
 	SpReqAnsContext<FingerPrintService_GetImageAndFeatureEx_Req, FingerPrintService_GetImageAndFeatureEx_Ans>::Pointer ctx;
@@ -343,8 +356,8 @@ struct ScanExTask : public ITaskSp
 		fsm->PostEventFIFO(e);
 	}
 };
-
-struct GetFingerTask : public ITaskSp
+//有用
+struct GetFingerTask : public ITaskSp   
 {
 	CFingerPrintFSM* fsm;
 	SpReqAnsContext<FingerPrintService_GetFingerPrint_Req, FingerPrintService_GetFingerPrint_Ans>::Pointer ctx;
@@ -357,7 +370,7 @@ struct GetFingerTask : public ITaskSp
 		fsm->PostEventFIFO(e);
 	}
 };
-
+//有用
 struct GenerateTemplateTask : public ITaskSp
 {
 	CFingerPrintFSM* fsm;
@@ -371,7 +384,7 @@ struct GenerateTemplateTask : public ITaskSp
 		fsm->PostEventFIFO(e);
 	}
 };
-
+//废弃
 struct MatchTask : public ITaskSp
 {
 	CFingerPrintFSM* fsm;

+ 10 - 11
Module/mod_FingerPrint/mod_FingerPrint.h

@@ -49,7 +49,6 @@ public:
 	virtual void OnPrePause(CSmartPointer<ITransactionContext> pTransactionContext)
 	{
 		LOG_FUNCTION();
-
 		pTransactionContext->SendAnswer(Error_Succeed);
 	}
 
@@ -78,54 +77,54 @@ public:
 		m_bNewSessionInit = true;
 		return new FingerPrintServerSession(this);
 	}
-
+	//废弃
 	void GetImageAndFeature(SpReqAnsContext<FingerPrintService_GetImageAndFeature_Req, FingerPrintService_GetImageAndFeature_Ans>::Pointer ctx)
 	{
 		ScanEvent* e = new ScanEvent();
 		e->ctx = ctx;
 		m_fsm.PostEventFIFO(e);
 	}
-
+	//废弃
 	void GetImageAndFeatureEx(SpReqAnsContext<FingerPrintService_GetImageAndFeatureEx_Req, FingerPrintService_GetImageAndFeatureEx_Ans>::Pointer ctx)
 	{
 		ScanExEvent* e = new ScanExEvent();
 		e->ctx = ctx;
 		m_fsm.PostEventFIFO(e);
 	}
-
+	//有用:扫描指纹(73294)
 	void GetFingerPrint(SpReqAnsContext<FingerPrintService_GetFingerPrint_Req, FingerPrintService_GetFingerPrint_Ans>::Pointer ctx)
 	{
 		GetFingerEvent* e = new GetFingerEvent();
 		e->ctx = ctx;
 		m_fsm.PostEventFIFO(e);
 	}
-
+	//有用:生成指纹模板(161)
 	void GenerateTemplate(SpReqAnsContext<FingerPrintService_GenerateTemplate_Req, FingerPrintService_GenerateTemplate_Ans>::Pointer ctx)
 	{
 		GenerateTemplateEvent* e = new GenerateTemplateEvent();
 		e->ctx = ctx;
 		m_fsm.PostEventFIFO(e);
 	}
-
+	//有用:取消注册(7066)
 	void CancelRegister(SpOnewayCallContext<FingerPrintService_CancelRegister_Info>::Pointer ctx)
 	{
 		CancelRegisterEvent* e = new CancelRegisterEvent();
 		m_fsm.PostEventFIFO(e);
 	}
-
+	//有用:取消对比(56)
 	void CancelMatch(SpOnewayCallContext<FingerPrintService_CancelMatch_Info>::Pointer ctx)
 	{
 		CancelMatchEvent* e = new CancelMatchEvent();
 		m_fsm.PostEventFIFO(e);
 	}
-
+	//废弃
 	void CheckAndMatch(SpReqAnsContext<FingerPrintService_Match_Req, FingerPrintService_Match_Ans>::Pointer ctx)
 	{
 		MatchEvent* e = new MatchEvent();
 		e->ctx = ctx;
 		m_fsm.PostEventFIFO(e);
 	}
-
+	//废弃
 	void GetDevInfo(SpReqAnsContext<FingerPrintService_GetDevInfo_Req, FingerPrintService_GetDevInfo_Ans>::Pointer ctx)
 	{
 		DevCategoryInfo devCatInfo;
@@ -134,7 +133,7 @@ public:
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("GetDevInfo model is:%s", (const char*)ctx->Ans.model);
 		ctx->Answer(Error_Succeed);
 	}
-
+	//废弃
 	void GetDevStatus(SpReqAnsContext<FingerPrintService_GetDevStatus_Req, FingerPrintService_GetDevStatus_Ans>::Pointer ctx)
 	{
 		int status = 0;
@@ -143,7 +142,7 @@ public:
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("FingerPrint state is:%d", status);
 		ctx->Answer(Error_Succeed);
 	}
-
+	//废弃
 	void Exit(SpOnewayCallContext<FingerPrintService_Exit_Info>::Pointer ctx)
 	{
 		FSMEvent* e = new FSMEvent(USER_EVT_EXIT);