|
@@ -43,7 +43,7 @@ void CCustMngrAuthFSM::s0_on_exit()
|
|
|
unsigned int CCustMngrAuthFSM::s0_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
LOG_FUNCTION();
|
|
|
- Dbg("s0 evt %d", pEvt->iEvt);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("s0 evt %d", pEvt->iEvt);
|
|
|
|
|
|
switch (pEvt->iEvt)
|
|
|
{
|
|
@@ -74,7 +74,7 @@ void CCustMngrAuthFSM::s1_on_exit()
|
|
|
unsigned int CCustMngrAuthFSM::s1_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
LOG_FUNCTION();
|
|
|
- Dbg("s1 evt %d", pEvt->iEvt);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("s1 evt %d", pEvt->iEvt);
|
|
|
|
|
|
switch (pEvt->iEvt)
|
|
|
{
|
|
@@ -100,7 +100,7 @@ void CCustMngrAuthFSM::s2_on_exit()
|
|
|
unsigned int CCustMngrAuthFSM::s2_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
LOG_FUNCTION();
|
|
|
- Dbg("s2 evt(%d)", pEvt->iEvt);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("s2 evt(%d)", pEvt->iEvt);
|
|
|
|
|
|
switch (pEvt->iEvt)
|
|
|
{
|
|
@@ -120,14 +120,6 @@ unsigned int CCustMngrAuthFSM::s2_on_event(FSMEvent* pEvt)
|
|
|
m_TimeLimit = (authorEvt->ctx->Req.TimeLimit - 3) * 1000;
|
|
|
m_bCancelAuthorize = false;
|
|
|
|
|
|
- /*ErrorCodeEnum errCode = SwitchUSB(true);
|
|
|
- if (errCode != Error_Succeed)
|
|
|
- Dbg("open usb failed with eErr(%s)", SpStrError(errCode));
|
|
|
- else {
|
|
|
- Dbg("open usb successfully.");
|
|
|
- m_ctx = authorEvt->ctx;
|
|
|
- }*/
|
|
|
-
|
|
|
MatchFingerPrintTask* matchTask = new MatchFingerPrintTask(this);
|
|
|
matchTask->ctx = authorEvt->ctx;
|
|
|
GetEntityBase()->GetFunction()->PostThreadPoolTask(matchTask);
|
|
@@ -137,9 +129,9 @@ unsigned int CCustMngrAuthFSM::s2_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
pEvt->SetHandled();
|
|
|
QueryAuthorInfoEvent* queryEvt = dynamic_cast<QueryAuthorInfoEvent*>(pEvt);
|
|
|
- Dbg("time = %d", queryEvt->ctx->Req.TimeLimit);
|
|
|
- Dbg("wayOfKey = %d", queryEvt->ctx->Req.WayofKey);
|
|
|
- Dbg("wayOfFinger = %d", queryEvt->ctx->Req.WayofFinger);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER)("time = %d", queryEvt->ctx->Req.TimeLimit);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER)("wayOfKey = %d", queryEvt->ctx->Req.WayofKey);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER)("wayOfFinger = %d", queryEvt->ctx->Req.WayofFinger);
|
|
|
if (queryEvt->ctx->Req.TimeLimit <= 0)
|
|
|
{
|
|
|
LOG_TRACE("ERROR: receive timelimit lessequal than zero. ctx->Answer(error_Param)");
|
|
@@ -153,17 +145,10 @@ unsigned int CCustMngrAuthFSM::s2_on_event(FSMEvent* pEvt)
|
|
|
|
|
|
ErrorCodeEnum eErr;
|
|
|
m_bCancelAuthorize = false;
|
|
|
- Dbg("WayOfKey = %d, WayOfFinger = %d", queryEvt->ctx->Req.WayofKey, queryEvt->ctx->Req.WayofFinger);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER)("WayOfKey = %d, WayOfFinger = %d", queryEvt->ctx->Req.WayofKey, queryEvt->ctx->Req.WayofFinger);
|
|
|
if (queryEvt->ctx->Req.WayofKey == 1)
|
|
|
{
|
|
|
//打开USB
|
|
|
- /*eErr = SwitchUSB(true);
|
|
|
- if (eErr != Error_Succeed)
|
|
|
- Dbg("open usb failed with eErr(0x%x)", eErr);
|
|
|
- else {
|
|
|
- Dbg("open usb successfully.");
|
|
|
- qaInfoCtx = queryEvt->ctx;
|
|
|
- }*/
|
|
|
}
|
|
|
|
|
|
if (queryEvt->ctx->Req.WayofFinger == 1)
|
|
@@ -209,7 +194,7 @@ unsigned int CCustMngrAuthFSM::s2_on_event(FSMEvent* pEvt)
|
|
|
GenerateTemplateTask* gtTask = new GenerateTemplateTask(this);
|
|
|
gtTask->ctx = gtEvt->ctx;
|
|
|
GetEntityBase()->GetFunction()->PostThreadPoolTask(gtTask);
|
|
|
- Dbg("Generate Template task posted");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Generate Template task posted");
|
|
|
}
|
|
|
break;
|
|
|
case USER_EVT_SAVEFINGERPRINT_START:
|
|
@@ -237,20 +222,20 @@ void CCustMngrAuthFSM::s3_on_entry()
|
|
|
{
|
|
|
LOG_FUNCTION();
|
|
|
ScheduleTimer(1, m_TimeLimit);
|
|
|
- Dbg("set timer when match, %dms", m_TimeLimit);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("set timer when match, %dms", m_TimeLimit);
|
|
|
}
|
|
|
|
|
|
void CCustMngrAuthFSM::s3_on_exit()
|
|
|
{
|
|
|
LOG_FUNCTION();
|
|
|
CancelTimer(1);
|
|
|
- Dbg("exit match event, timer canceled");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("exit match event, timer canceled");
|
|
|
}
|
|
|
|
|
|
unsigned int CCustMngrAuthFSM::s3_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
LOG_FUNCTION();
|
|
|
- Dbg("s3 evt %d, %d", pEvt->iEvt, pEvt->param1);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("s3 evt %d, %d", pEvt->iEvt, pEvt->param1);
|
|
|
|
|
|
switch (pEvt->iEvt)
|
|
|
{
|
|
@@ -260,8 +245,8 @@ unsigned int CCustMngrAuthFSM::s3_on_event(FSMEvent* pEvt)
|
|
|
CancelTimer(1);
|
|
|
HoldOnEvent* holdEvt = dynamic_cast<HoldOnEvent*>(pEvt);
|
|
|
if (holdEvt->ctx == NULL)
|
|
|
- Dbg("HoldOnEvent->ctx is NULL");
|
|
|
- Dbg("HoldOn with MoreTime: %d second", holdEvt->ctx->Req.MoreTime);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("HoldOnEvent->ctx is NULL");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER)("HoldOn with MoreTime: %d second", holdEvt->ctx->Req.MoreTime);
|
|
|
int moreTime = holdEvt->ctx->Req.MoreTime * 1000;
|
|
|
ScheduleTimer(1, (moreTime > 0) ? moreTime : m_TimeLimit);
|
|
|
}
|
|
@@ -269,7 +254,7 @@ unsigned int CCustMngrAuthFSM::s3_on_event(FSMEvent* pEvt)
|
|
|
case EVT_TIMER:
|
|
|
{
|
|
|
pEvt->SetHandled();
|
|
|
- Dbg("Hit Timer");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Hit Timer");
|
|
|
m_bAuthorizeTimeout = true;
|
|
|
m_bCancelAuthorize = true;
|
|
|
CancelAuthorize();
|
|
@@ -279,17 +264,15 @@ unsigned int CCustMngrAuthFSM::s3_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
pEvt->SetHandled();
|
|
|
AuthorizeFinishedEvent* authorEvt = dynamic_cast<AuthorizeFinishedEvent*>(pEvt);
|
|
|
- Dbg("Checking m_authCtx and answer ctx");
|
|
|
- //SwitchUSB(false);
|
|
|
-
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Checking m_authCtx and answer ctx");
|
|
|
if (authorEvt->param1 == 0)
|
|
|
{
|
|
|
if (m_authCtx.eAuthByWhich == AuthByUkey)
|
|
|
{
|
|
|
- Dbg("m_authCtx.eAuthByWhich == AuthByUkey");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("m_authCtx.eAuthByWhich == AuthByUkey");
|
|
|
if (m_pFingerPrint != NULL && !m_pFingerPrint->QuerySessionClosed())
|
|
|
{
|
|
|
- Dbg("Invoke cancel match.");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Invoke cancel match.");
|
|
|
m_pFingerPrint->CancelMatch();
|
|
|
}
|
|
|
authorEvt->ctx->Ans.WayofAuth = AuthByUkey;
|
|
@@ -298,7 +281,7 @@ unsigned int CCustMngrAuthFSM::s3_on_event(FSMEvent* pEvt)
|
|
|
}
|
|
|
else if (m_authCtx.eAuthByWhich == AuthByFngPrnt)
|
|
|
{
|
|
|
- Dbg("m_authCtx.eAuthByWhich == AuthByFngPrnt");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("m_authCtx.eAuthByWhich == AuthByFngPrnt");
|
|
|
authorEvt->ctx->Ans.WayofAuth = AuthByFngPrnt;
|
|
|
authorEvt->ctx->Ans.CustomerID = m_authCtx.CustomerID;
|
|
|
authorEvt->ctx->Answer(Error_Succeed);
|
|
@@ -306,7 +289,7 @@ unsigned int CCustMngrAuthFSM::s3_on_event(FSMEvent* pEvt)
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- Dbg("authorize finished with param1 as %d", authorEvt->param1);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("authorize finished with param1 as %d", authorEvt->param1);
|
|
|
authorEvt->ctx->Answer((ErrorCodeEnum)authorEvt->param1);
|
|
|
}
|
|
|
|
|
@@ -327,19 +310,16 @@ unsigned int CCustMngrAuthFSM::s3_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
pEvt->SetHandled();
|
|
|
QueryAuthorInfoFinishedEvent* qafEvt = dynamic_cast<QueryAuthorInfoFinishedEvent*>(pEvt);
|
|
|
- Dbg("Checking m_authCtx and answer qaInfoCtx");
|
|
|
- //SwitchUSB(false);
|
|
|
-
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Checking m_authCtx and answer qaInfoCtx");
|
|
|
if (qafEvt->param1 == 0)
|
|
|
{
|
|
|
- Dbg("authorize finished with param1 as 0"); //Error_Succeed
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER)("authorize finished with param1 as 0"); //Error_Succeed
|
|
|
if (m_authCtx.eAuthByWhich == AuthByUkey)
|
|
|
{
|
|
|
- Dbg("m_authCtx.eAuthByWhich == AuthByUkey");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("m_authCtx.eAuthByWhich == AuthByUkey");
|
|
|
if (m_pFingerPrint != NULL && !m_pFingerPrint->QuerySessionClosed())
|
|
|
{
|
|
|
- Dbg("Invoke cancel collect.");
|
|
|
- //m_pFingerPrint->CancelMatch();
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Invoke cancel collect.");
|
|
|
m_pFingerPrint->CancelRegister();
|
|
|
}
|
|
|
qafEvt->ctx->Ans.WayofAuth = AuthByUkey;
|
|
@@ -348,17 +328,16 @@ unsigned int CCustMngrAuthFSM::s3_on_event(FSMEvent* pEvt)
|
|
|
}
|
|
|
else if (m_authCtx.eAuthByWhich == AuthByFngPrnt)
|
|
|
{
|
|
|
- Dbg("m_authCtx.eAuthByWhich == AuthByFngPrnt");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("m_authCtx.eAuthByWhich == AuthByFngPrnt");
|
|
|
qafEvt->ctx->Ans.WayofAuth = AuthByFngPrnt;
|
|
|
qafEvt->ctx->Ans.Feature = m_authCtx.Feature;
|
|
|
qafEvt->ctx->Ans.FingerImg = m_authCtx.FingerImg;
|
|
|
- //afe->ctx->Ans.CustomerID = m_authCtx.CustomerID;
|
|
|
qafEvt->ctx->Answer(Error_Succeed);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- Dbg("authorize finished with param1 as %d", qafEvt->param1);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("authorize finished with param1 as %d", qafEvt->param1);
|
|
|
qafEvt->ctx->Answer((ErrorCodeEnum)qafEvt->param1, qafEvt->param2);
|
|
|
}
|
|
|
|
|
@@ -366,9 +345,8 @@ unsigned int CCustMngrAuthFSM::s3_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
m_bCancelAuthorize = true;
|
|
|
m_pFingerPrint->GetFunction()->CloseSession();
|
|
|
- //m_pFingerPrint->SafeDelete();
|
|
|
m_pFingerPrint = NULL;
|
|
|
- Dbg("M_pFingerPrint disconnected.");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("M_pFingerPrint disconnected.");
|
|
|
}
|
|
|
|
|
|
m_authCtx.eAuthByWhich = AuthByNone;
|
|
@@ -392,7 +370,6 @@ unsigned int CCustMngrAuthFSM::s3_on_event(FSMEvent* pEvt)
|
|
|
pEvt->SetHandled();
|
|
|
m_bCancelAuthorize = true;
|
|
|
CancelCollect();
|
|
|
- //SwitchUSB(false);
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
@@ -414,7 +391,7 @@ void CCustMngrAuthFSM::s4_on_exit()
|
|
|
unsigned int CCustMngrAuthFSM::s4_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
LOG_FUNCTION();
|
|
|
- Dbg("s4 evt %d, %d", pEvt->iEvt, pEvt->param1);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("s4 evt %d, %d", pEvt->iEvt, pEvt->param1);
|
|
|
|
|
|
switch (pEvt->iEvt)
|
|
|
{
|
|
@@ -443,7 +420,6 @@ unsigned int CCustMngrAuthFSM::s4_on_event(FSMEvent* pEvt)
|
|
|
case USER_EVT_CHECKUKEY_FINISHED:
|
|
|
{
|
|
|
pEvt->SetHandled();
|
|
|
- //SwitchUSB(false);
|
|
|
}
|
|
|
break;
|
|
|
default:
|
|
@@ -465,7 +441,7 @@ void CCustMngrAuthFSM::s5_on_exit()
|
|
|
unsigned int CCustMngrAuthFSM::s5_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
LOG_FUNCTION();
|
|
|
- Dbg("s5 evt %d, %d", pEvt->iEvt, pEvt->param1);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("s5 evt %d, %d", pEvt->iEvt, pEvt->param1);
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -496,14 +472,14 @@ ErrorCodeEnum CCustMngrAuthFSM::WaitForUkey(ErrorCodeEnum eErr)
|
|
|
|
|
|
void CCustMngrAuthFSM::CancelAuthorize()
|
|
|
{
|
|
|
- Dbg("Invoke m_pFingerPrint->CancelMatch()");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Invoke m_pFingerPrint->CancelMatch()");
|
|
|
if (m_pFingerPrint != NULL && !m_pFingerPrint->QuerySessionClosed())
|
|
|
m_pFingerPrint->CancelMatch();
|
|
|
}
|
|
|
|
|
|
void CCustMngrAuthFSM::CancelCollect()
|
|
|
{
|
|
|
- Dbg("Invoke m_pFingerPrint->CancelRegister()");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Invoke m_pFingerPrint->CancelRegister()");
|
|
|
if (m_pFingerPrint != NULL && !m_pFingerPrint->QuerySessionClosed())
|
|
|
m_pFingerPrint->CancelRegister();
|
|
|
}
|
|
@@ -512,7 +488,7 @@ ErrorCodeEnum CCustMngrAuthFSM::SwitchUSB(bool bOpen)
|
|
|
{
|
|
|
LOG_FUNCTION();
|
|
|
|
|
|
- Dbg("connecting DeviceControl");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("connecting DeviceControl");
|
|
|
ErrorCodeEnum errCode;
|
|
|
m_pDeviceControl = new DeviceControlService_ClientBase(GetEntityBase());
|
|
|
|
|
@@ -521,22 +497,22 @@ ErrorCodeEnum CCustMngrAuthFSM::SwitchUSB(bool bOpen)
|
|
|
errCode = m_pDeviceControl->Connect();
|
|
|
if (errCode != Error_Succeed)
|
|
|
{
|
|
|
- Dbg("m_pDeviceControl connect failed with errCode(%s)", SpStrError(errCode));
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("m_pDeviceControl connect failed with errCode(%s)", SpStrError(errCode));
|
|
|
m_pDeviceControl->SafeDelete();
|
|
|
}else {
|
|
|
if (bOpen)
|
|
|
- Dbg("Open USB");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Open USB");
|
|
|
else
|
|
|
- Dbg("Close USB");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Close USB");
|
|
|
|
|
|
DeviceControlService_USB_Req usbReq;
|
|
|
DeviceControlService_USB_Ans usbAns;
|
|
|
usbReq.open = bOpen;//open or close usb
|
|
|
errCode = m_pDeviceControl->USB(usbReq, usbAns, 2000);
|
|
|
if (errCode != Error_Succeed)
|
|
|
- Dbg("Open/Close usb failed.");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Open/Close usb failed.");
|
|
|
else
|
|
|
- Dbg("Open/Close usb success.");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Open/Close usb success.");
|
|
|
|
|
|
m_pDeviceControl->GetFunction()->CloseSession();
|
|
|
}
|
|
@@ -544,7 +520,7 @@ ErrorCodeEnum CCustMngrAuthFSM::SwitchUSB(bool bOpen)
|
|
|
return errCode;
|
|
|
}
|
|
|
else {
|
|
|
- Dbg("DeviceControl is null.");
|
|
|
+ DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("DeviceControl is null.");
|
|
|
return Error_Unexpect;
|
|
|
}
|
|
|
}
|
|
@@ -573,9 +549,6 @@ int CCustMngrAuthFSM::Initial()
|
|
|
if (errCode != Error_Succeed)
|
|
|
return 1;
|
|
|
|
|
|
- //FeatureUpdateTask* pTask = new FeatureUpdateTask(this);
|
|
|
- //GetEntityBase()->GetFunction()->PostThreadPoolTask(pTask);
|
|
|
-
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -590,7 +563,7 @@ ErrorCodeEnum CCustMngrAuthFSM::OpenRunInfoFile()
|
|
|
, "get runinfo path failed while init");
|
|
|
errCode = Error_Unexpect;
|
|
|
}
|
|
|
- Dbg("runinfo path: %s", m_RunInfoPath.GetData());
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("runinfo path: %s", m_RunInfoPath.GetData());
|
|
|
|
|
|
return errCode;
|
|
|
}
|
|
@@ -652,7 +625,7 @@ void CCustMngrAuthFSM::FeatureUpdate()
|
|
|
break;
|
|
|
}else {
|
|
|
connectFailedTimes++;
|
|
|
- Dbg("connect branchserver failed for %d times, try again in %d ms."
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("connect branchserver failed for %d times, try again in %d ms."
|
|
|
, connectFailedTimes, CONNECT_INTERNAL);
|
|
|
|
|
|
if (connectFailedTimes >= 60)
|
|
@@ -673,7 +646,7 @@ void CCustMngrAuthFSM::FeatureUpdate()
|
|
|
m_pConnection->DecRefCount();
|
|
|
m_pConnection = NULL;
|
|
|
}
|
|
|
- Dbg("Feature-update processed, wait until next");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Feature-update processed, wait until next");
|
|
|
//wait for next query
|
|
|
if (WaitForSingleObject(hStopUpdate, waitInternal) == WAIT_OBJECT_0)
|
|
|
break;
|
|
@@ -689,13 +662,13 @@ void CCustMngrAuthFSM::InitBeforeUpdateData()
|
|
|
bool bReadResult = ReadDataIntoMemory(bHasData);
|
|
|
if (bReadResult && bHasData)
|
|
|
{
|
|
|
- Dbg("Read feature data into memory success.");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Read feature data into memory success.");
|
|
|
}
|
|
|
else if (bReadResult && !bHasData) {
|
|
|
- Dbg("Has no data in local file.");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Has no data in local file.");
|
|
|
}
|
|
|
else {
|
|
|
- Dbg("Read feature data into memory failed, wait next read.");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Read feature data into memory failed, wait next read.");
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -762,7 +735,7 @@ bool CCustMngrAuthFSM::ReadDataIntoMemory(bool& bHasData)
|
|
|
m_featureData[CSimpleStringA(keys.c_str())] = fd;
|
|
|
}
|
|
|
else {
|
|
|
- Dbg("Error: parse jsonFingerInfo failed.");
|
|
|
+ DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("Error: parse jsonFingerInfo failed.");
|
|
|
LogWarn(Severity_Middle, Error_Unexpect
|
|
|
, LOG_ERR_CUSTMNGRAUTH_AUTHORIZATION_READFEAT_FAILED
|
|
|
, "Read fingerprint feature json failed.");
|
|
@@ -770,7 +743,7 @@ bool CCustMngrAuthFSM::ReadDataIntoMemory(bool& bHasData)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- Dbg("Total CustomerNum:%d in local file.", customerNum);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Total CustomerNum:%d in local file.", customerNum);
|
|
|
|
|
|
endReadFile = RVCGetTickCount();
|
|
|
ULLINT duration = endReadFile - startReadFile;
|
|
@@ -832,7 +805,7 @@ ErrorCodeEnum CCustMngrAuthFSM::LoadRunConfig(CSmartPointer<IConfigInfo>& spConf
|
|
|
|
|
|
if (errCode != Error_Succeed)
|
|
|
{
|
|
|
- Dbg("Open runcfg file failed before query data.");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Open runcfg file failed before query data.");
|
|
|
LogError(Severity_High, Error_Unexpect
|
|
|
, LOG_ERR_CUSTMNGRAUTH_OPEN_RUNINFO_FAILED_UPDATE
|
|
|
, "open runcfg failed before query data.");
|
|
@@ -880,6 +853,7 @@ CSimpleStringA CCustMngrAuthFSM::GetCurrentDate()
|
|
|
return curDate;
|
|
|
}
|
|
|
|
|
|
+///**TODO(Gifur@9/23/2022): param */
|
|
|
int CCustMngrAuthFSM::CompareTime(CSimpleStringA time1, CSimpleStringA time2)
|
|
|
{
|
|
|
if (time1.GetLength() > 0 && time2.GetLength() > 0)
|
|
@@ -934,35 +908,35 @@ ErrorCodeEnum CCustMngrAuthFSM::ReceiveDataFromServer(CAutoArray<CSimpleStringA>
|
|
|
switch (dw)
|
|
|
{
|
|
|
case WAIT_FAILED:
|
|
|
- Dbg("WAIT_FAILED!");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("WAIT_FAILED!");
|
|
|
break;
|
|
|
case WAIT_TIMEOUT:
|
|
|
- Dbg("WAIT_TIMEOUT");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("WAIT_TIMEOUT");
|
|
|
case WAIT_OBJECT_0:
|
|
|
- Dbg("WAIT_OBJECT_0");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("WAIT_OBJECT_0");
|
|
|
break;
|
|
|
}
|
|
|
ResetEvent(m_pConnection->m_hPkgAnswer);
|
|
|
|
|
|
if (m_pConnection->m_reply == NULL)
|
|
|
{
|
|
|
- Dbg("m_reply still null after m_hPkgAnswer handled");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("m_reply still null after m_hPkgAnswer handled");
|
|
|
break;
|
|
|
}
|
|
|
if (m_pConnection->m_GetErrMsg)
|
|
|
{
|
|
|
- Dbg("get error message, check dbg log");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("get error message, check dbg log");
|
|
|
break;
|
|
|
}
|
|
|
if (m_pConnection->m_reply->ResultCode == 2)
|
|
|
{
|
|
|
- Dbg("remote server uninitialized yet, unable to excute query");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("remote server uninitialized yet, unable to excute query");
|
|
|
break;
|
|
|
}
|
|
|
else {
|
|
|
if (m_pConnection->m_reply->ResultCode == 0)
|
|
|
{
|
|
|
- Dbg("All package downloaded from branch server.");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("All package downloaded from branch server.");
|
|
|
bResumeTrans = false;
|
|
|
errCode = Error_Succeed;
|
|
|
}
|
|
@@ -974,10 +948,10 @@ ErrorCodeEnum CCustMngrAuthFSM::ReceiveDataFromServer(CAutoArray<CSimpleStringA>
|
|
|
}
|
|
|
|
|
|
if (bResumeTrans)
|
|
|
- Dbg("some errors happened, check the related log");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("some errors happened, check the related log");
|
|
|
|
|
|
if (dataArray.GetCount() <= 0)
|
|
|
- Dbg("query no data from branchServer.");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("query no data from branchServer.");
|
|
|
|
|
|
return errCode;
|
|
|
}
|
|
@@ -1000,7 +974,7 @@ ErrorCodeEnum CCustMngrAuthFSM::BackupBeforeWriteData(RunInfoParams& runInfoPara
|
|
|
|
|
|
EnterCriticalSection(&m_cs);
|
|
|
if (!BackupFile(runInfoParam.SrcFile, runInfoParam.BackupFile))
|
|
|
- Dbg("Backup runinfo file failed.");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Backup runinfo file failed.");
|
|
|
|
|
|
if (runInfoParam.IsFirstTimeQueryData)
|
|
|
{
|
|
@@ -1012,7 +986,7 @@ ErrorCodeEnum CCustMngrAuthFSM::BackupBeforeWriteData(RunInfoParams& runInfoPara
|
|
|
errCode = GetEntityBase()->GetFunction()->OpenConfig(Config_Run, spConfig);
|
|
|
if (errCode != Error_Succeed)
|
|
|
{
|
|
|
- Dbg("error: open runcfg failed with errCode(%s)", SpStrError(errCode));
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("error: open runcfg failed with errCode(%s)", SpStrError(errCode));
|
|
|
BackupFile(runInfoParam.BackupFile, runInfoParam.SrcFile);// if backup fail, recover
|
|
|
LeaveCriticalSection(&m_cs);
|
|
|
}
|
|
@@ -1076,7 +1050,7 @@ ErrorCodeEnum CCustMngrAuthFSM::WriteData(RunInfoParams& runInfoParam
|
|
|
if (bExitLoop)
|
|
|
break;
|
|
|
}else {
|
|
|
- Dbg("fail to parse transArray[%d]!", transTime);
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("fail to parse transArray[%d]!", transTime);
|
|
|
LeaveCriticalSection(&m_cs);
|
|
|
bExitLoop = true;
|
|
|
break;
|
|
@@ -1090,7 +1064,7 @@ ErrorCodeEnum CCustMngrAuthFSM::WriteData(RunInfoParams& runInfoParam
|
|
|
spConfig->WriteConfigValue("LatestTime", "LatestTime"
|
|
|
, tmpFeatureData.MaxUpdateTime.GetData());
|
|
|
}
|
|
|
- Dbg("updateNum=%d", tmpFeatureData.tmpFeatureMap.size());
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("updateNum=%d", tmpFeatureData.tmpFeatureMap.size());
|
|
|
|
|
|
UpdateDataIntoMemory(tmpFeatureData.tmpFeatureMap, runInfoParam.IsFirstTimeQueryData);
|
|
|
LeaveCriticalSection(&m_cs);
|
|
@@ -1170,10 +1144,10 @@ ErrorCodeEnum CCustMngrAuthFSM::ProcessFeatureData(JsonParams& jsonParam, TempFe
|
|
|
}
|
|
|
}else if (fingerDataState == 2)
|
|
|
{
|
|
|
- Dbg("state(2): customer %s is currently unavailable.", customerID.GetData());
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("state(2): customer %s is currently unavailable.", customerID.GetData());
|
|
|
spConfig->WriteConfigValue((const char*)m_FingerSection, customerID.GetData(), "");
|
|
|
}else {
|
|
|
- Dbg("unexpected customer(%s)'s state is either 0 or 2", customerID.GetData());
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("unexpected customer(%s)'s state is either 0 or 2", customerID.GetData());
|
|
|
}
|
|
|
|
|
|
return errCode;
|
|
@@ -1262,11 +1236,11 @@ ErrorCodeEnum CCustMngrAuthFSM::CollectFingerPrint(SpReqAnsContext<CustMngrAuthS
|
|
|
|
|
|
if (errCode == Error_Succeed)
|
|
|
{
|
|
|
- Dbg("Register FingerPrint successfully.");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Register FingerPrint successfully.");
|
|
|
return Error_Succeed;
|
|
|
}
|
|
|
else {
|
|
|
- Dbg("Register FingerPrint failed!");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Register FingerPrint failed! %s", SpStrError(errCode));
|
|
|
return errCode;
|
|
|
}
|
|
|
}
|
|
@@ -1277,7 +1251,7 @@ ErrorCodeEnum CCustMngrAuthFSM::CollectFingerPrintInfo(SpReqAnsContext<CustMngrA
|
|
|
|
|
|
if (ctx == NULL || !(ctx->Req.FingerId > 0 && ctx->Req.FingerId < 10))
|
|
|
{
|
|
|
- Dbg("CollectFingerPrintInfo, Invalid inParam, FingerId:%d", ctx->Req.FingerId);
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("CollectFingerPrintInfo, Invalid inParam, FingerId:%d", ctx->Req.FingerId);
|
|
|
return Error_Param;
|
|
|
}
|
|
|
CSimpleStringA tmpParam = CSimpleStringA::Format("web invoke CollectFingerPrintInfo with inParam FingerId:%d", ctx->Req.FingerId);
|
|
@@ -1296,7 +1270,7 @@ ErrorCodeEnum CCustMngrAuthFSM::CollectFingerPrintInfo(SpReqAnsContext<CustMngrA
|
|
|
|
|
|
if (m_pFingerPrint == NULL || m_pFingerPrint->QuerySessionClosed())
|
|
|
{
|
|
|
- Dbg("m_pFingerPrint is NULL or connection closed.");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("m_pFingerPrint is NULL or connection closed.");
|
|
|
return Error_Hardware;
|
|
|
}
|
|
|
|
|
@@ -1304,7 +1278,7 @@ ErrorCodeEnum CCustMngrAuthFSM::CollectFingerPrintInfo(SpReqAnsContext<CustMngrA
|
|
|
|
|
|
if (errCode == Error_NotInit)
|
|
|
{
|
|
|
- Dbg("FingerPrintEntity not ready or failed.");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("FingerPrintEntity not ready or failed.");
|
|
|
return Error_DevNotAvailable;
|
|
|
}
|
|
|
|
|
@@ -1335,11 +1309,11 @@ ErrorCodeEnum CCustMngrAuthFSM::CollectFingerPrintInfo(SpReqAnsContext<CustMngrA
|
|
|
ErrorCodeEnum imgErrCode = GetImgBlob(data, imgFullPath);
|
|
|
if (imgErrCode != Error_Succeed)
|
|
|
{
|
|
|
- Dbg("Failed to load image(%s)", imgFullPath.GetData());
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Failed to load image(%s)", imgFullPath.GetData());
|
|
|
return Error_Unexpect;
|
|
|
}
|
|
|
ctx->Ans.fingerImg = data;
|
|
|
- Dbg("CollectFingerPrintInfo return success.");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("CollectFingerPrintInfo return success.");
|
|
|
}
|
|
|
}
|
|
|
else
|
|
@@ -1356,7 +1330,7 @@ ErrorCodeEnum CCustMngrAuthFSM::GenerateTemplate(SpReqAnsContext<CustMngrAuthSer
|
|
|
int fingerNum = ctx->Req.FingerIDList.GetCount();
|
|
|
if (fingerNum != IMAGE_NUM)
|
|
|
{
|
|
|
- Dbg("GenerateTemplate, Invalid inParam, fingerNum:%d", fingerNum);
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("GenerateTemplate, Invalid inParam, fingerNum:%d", fingerNum);
|
|
|
return Error_Param;
|
|
|
}
|
|
|
|
|
@@ -1365,7 +1339,7 @@ ErrorCodeEnum CCustMngrAuthFSM::GenerateTemplate(SpReqAnsContext<CustMngrAuthSer
|
|
|
errCode = m_pFingerPrint->Connect();
|
|
|
if (errCode != Error_Succeed)
|
|
|
{
|
|
|
- Dbg("ERROR: connect to fingerprint entity failed while GenerateTemplate");
|
|
|
+ DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("ERROR: connect to fingerprint entity failed while GenerateTemplate: %s", SpStrError(errCode));
|
|
|
m_pFingerPrint->SafeDelete();
|
|
|
m_pFingerPrint = NULL;
|
|
|
return Error_DevNotAvailable; //TODO::give one other errCode
|
|
@@ -1380,12 +1354,12 @@ ErrorCodeEnum CCustMngrAuthFSM::GenerateTemplate(SpReqAnsContext<CustMngrAuthSer
|
|
|
for (int i = 0; i < generateReq.FingerIDList.GetCount(); ++i)
|
|
|
{
|
|
|
generateReq.FingerIDList[i] = ctx->Req.FingerIDList[i];
|
|
|
- Dbg("fingerIDList = %d", generateReq.FingerIDList[i]);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("fingerIDList = %d", generateReq.FingerIDList[i]);
|
|
|
}
|
|
|
|
|
|
if (m_pFingerPrint == NULL || m_pFingerPrint->QuerySessionClosed())
|
|
|
{
|
|
|
- Dbg("m_pFingerPrint is NULL or connection closed.");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("m_pFingerPrint is NULL or connection closed.");
|
|
|
return Error_DevNotAvailable;
|
|
|
}
|
|
|
|
|
@@ -1393,17 +1367,17 @@ ErrorCodeEnum CCustMngrAuthFSM::GenerateTemplate(SpReqAnsContext<CustMngrAuthSer
|
|
|
|
|
|
if (errCode == Error_NotInit)
|
|
|
{
|
|
|
- Dbg("FingerPrintEntity not ready or failed.");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER)("FingerPrintEntity not ready or failed.");
|
|
|
return Error_DevNotAvailable;
|
|
|
}
|
|
|
|
|
|
if (errCode == Error_Succeed)
|
|
|
{
|
|
|
ctx->Ans.templateFeature = generateAns.templateFeature;
|
|
|
- Dbg("GenerateTemplate return success.");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("GenerateTemplate return success.");
|
|
|
}
|
|
|
else {
|
|
|
- Dbg("Invoke GenerateTemplate returned %d", errCode);
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER)("Invoke GenerateTemplate returned %d", errCode);
|
|
|
errCode = Error_Unexpect;
|
|
|
}
|
|
|
|
|
@@ -1423,11 +1397,11 @@ ErrorCodeEnum CCustMngrAuthFSM::CollectFingerPrintEx(SpReqAnsContext<CustMngrAut
|
|
|
|
|
|
if (errCode == Error_Succeed)
|
|
|
{
|
|
|
- Dbg("Register FingerPrint successfully.");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Register FingerPrint successfully.");
|
|
|
return Error_Succeed;
|
|
|
}
|
|
|
else {
|
|
|
- Dbg("Register FingerPrint failed!");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Register FingerPrint failed: %s !", SpStrError(errCode));
|
|
|
return errCode;
|
|
|
}
|
|
|
}
|
|
@@ -1447,7 +1421,7 @@ ErrorCodeEnum CCustMngrAuthFSM::CollectProcess(SpReqAnsContext<CustMngrAuthServi
|
|
|
|
|
|
if (m_pFingerPrint == NULL || m_pFingerPrint->QuerySessionClosed())
|
|
|
{
|
|
|
- Dbg("m_pFingerPrint is NULL or connection closed.");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("m_pFingerPrint is NULL or connection closed.");
|
|
|
return Error_NoTarget;
|
|
|
}
|
|
|
|
|
@@ -1470,7 +1444,7 @@ ErrorCodeEnum CCustMngrAuthFSM::CollectProcess(SpReqAnsContext<CustMngrAuthServi
|
|
|
|
|
|
if (errCode != Error_Succeed)
|
|
|
{
|
|
|
- Dbg("Failed to load finger image, %s", imgFullPath.GetData());
|
|
|
+ DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_USER)("Failed to load finger image, %s", imgFullPath.GetData());
|
|
|
errCode = Error_Unexpect;
|
|
|
break;
|
|
|
}
|
|
@@ -1490,11 +1464,11 @@ ErrorCodeEnum CCustMngrAuthFSM::CollectProcess(SpReqAnsContext<CustMngrAuthServi
|
|
|
|
|
|
if (i == (COLLECT_TIMES - 1)) {
|
|
|
ctx->Ans.feature = collecetAns.feature;
|
|
|
- Dbg("feature = %s", ctx->Ans.feature.GetData());
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("feature = %s", ctx->Ans.feature.GetData());
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
- Dbg("invoke GetImageAndFeature failed in %dth time, errCode(%s)", i + 1, SpStrError(errCode));
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER)("invoke GetImageAndFeature failed in %dth time, errCode(%s)", i + 1, SpStrError(errCode));
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
@@ -1521,16 +1495,16 @@ ErrorCodeEnum CCustMngrAuthFSM::CollectProcessEx(SpReqAnsContext<CustMngrAuthSer
|
|
|
|
|
|
if (m_pFingerPrint == NULL || m_pFingerPrint->QuerySessionClosed())
|
|
|
{
|
|
|
- Dbg("m_pFingerPrint is NULL or connection closed.");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("m_pFingerPrint is NULL or connection closed.");
|
|
|
return Error_NoTarget;
|
|
|
}
|
|
|
|
|
|
- Dbg("Start %dth scan fingerprint", collectExReq.times);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Start %dth scan fingerprint", collectExReq.times);
|
|
|
errCode = m_pFingerPrint->GetImageAndFeatureEx(collectExReq, collectExAns, 30000, dwUserErrCode);//fingerprint entity loop duration is 15s
|
|
|
|
|
|
- Dbg("reserverd1[0] = %d", collectExAns.reserved1[0]);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("reserverd1[0] = %d", collectExAns.reserved1[0]);
|
|
|
if (errCode == Error_NotExist) {
|
|
|
- Dbg("cannot find finger img in dep!");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("cannot find finger img in dep!");
|
|
|
return Error_NotExist;
|
|
|
}
|
|
|
if (errCode == Error_Succeed && collectExAns.reserved1[0] == 3) {
|
|
@@ -1546,7 +1520,7 @@ ErrorCodeEnum CCustMngrAuthFSM::CollectProcessEx(SpReqAnsContext<CustMngrAuthSer
|
|
|
ErrorCodeEnum imgErrCode = GetImgBlob(data, imgFullPath);
|
|
|
if (imgErrCode != Error_Succeed)
|
|
|
{
|
|
|
- Dbg("Failed to load image(%s)", imgFullPath.GetData());
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER)("Failed to load image(%s)", imgFullPath.GetData());
|
|
|
return Error_NotExist;
|
|
|
}
|
|
|
|
|
@@ -1588,10 +1562,10 @@ ErrorCodeEnum CCustMngrAuthFSM::CollectProcessEx(SpReqAnsContext<CustMngrAuthSer
|
|
|
}
|
|
|
|
|
|
if (errCode == Error_Succeed) {
|
|
|
- Dbg("Register FingerPrint successfully.");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Register FingerPrint successfully.");
|
|
|
}
|
|
|
else {
|
|
|
- Dbg("Register FingerPrint failed!");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER)("Register FingerPrint failed! %s", SpStrError(errCode));
|
|
|
}
|
|
|
return errCode;
|
|
|
}
|
|
@@ -1617,12 +1591,12 @@ void CCustMngrAuthFSM::BroadcastPressFinger(int times, bool bPressFinger)
|
|
|
|
|
|
ErrorCodeEnum CCustMngrAuthFSM::GetImgBlob(CBlob& data, CSimpleStringA imgPath)
|
|
|
{
|
|
|
- Dbg("image full path: %s", imgPath.GetData());
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("image full path: %s", imgPath.GetData());
|
|
|
|
|
|
FILE* fp = fopen(imgPath, "rb");
|
|
|
if (fp)
|
|
|
{
|
|
|
- Dbg("fopen succeed.");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("fopen succeed.");
|
|
|
fseek(fp, 0, SEEK_END);
|
|
|
long flen = ftell(fp);
|
|
|
fseek(fp, 0, SEEK_SET);
|
|
@@ -1632,7 +1606,7 @@ ErrorCodeEnum CCustMngrAuthFSM::GetImgBlob(CBlob& data, CSimpleStringA imgPath)
|
|
|
return Error_Succeed;
|
|
|
}
|
|
|
else {
|
|
|
- Dbg("fopen %s failed!", imgPath.GetData());
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("fopen %s failed!", imgPath.GetData());
|
|
|
return Error_IO;
|
|
|
}
|
|
|
}
|
|
@@ -1659,7 +1633,7 @@ ErrorCodeEnum CCustMngrAuthFSM::SaveFingerPrint(SpReqAnsContext<CustMngrAuthServ
|
|
|
if (ctx->Req.FPFeatureList == nullptr)
|
|
|
return Error_Param;
|
|
|
int fingerIDNum = ctx->Req.FingerIdList.GetCount();
|
|
|
- Dbg("FingerIDNum=%d", fingerIDNum);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("FingerIDNum=%d", fingerIDNum);
|
|
|
|
|
|
FeatureData* fd = new FeatureData();
|
|
|
fd->FingerIDArray.Init(fingerIDNum);
|
|
@@ -1678,7 +1652,7 @@ ErrorCodeEnum CCustMngrAuthFSM::SaveFingerPrint(SpReqAnsContext<CustMngrAuthServ
|
|
|
snprintf(fingerID, 10, "FingerID%d", ctx->Req.FingerIdList[i]);
|
|
|
#endif // RVC_OS_WIN
|
|
|
|
|
|
- Dbg("writing %s", fingerID);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("writing %s", fingerID);
|
|
|
fingerInfo[fingerID] = ctx->Req.FPFeatureList[i].GetData();
|
|
|
fd->FingerIDArray[i] = ctx->Req.FPFeatureList[i];
|
|
|
fd->FingerIDLenArray[i] = fd->FingerIDArray[i].GetLength();
|
|
@@ -1705,7 +1679,7 @@ ErrorCodeEnum CCustMngrAuthFSM::SaveFingerPrint(SpReqAnsContext<CustMngrAuthServ
|
|
|
LeaveCriticalSection(&m_cs);
|
|
|
return Error_Unexpect;
|
|
|
}
|
|
|
- Dbg("write data into runinfo success when commit.");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("write data into runinfo success when commit.");
|
|
|
LeaveCriticalSection(&m_cs);
|
|
|
return errCode;
|
|
|
}
|
|
@@ -1740,7 +1714,7 @@ ErrorCodeEnum CCustMngrAuthFSM::ConnectFingerPrintEntity()
|
|
|
errCode = m_pFingerPrint->Connect();
|
|
|
if (errCode != Error_Succeed)
|
|
|
{
|
|
|
- Dbg("ERROR: connect to fingerprint entity failed!");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("ERROR: connect to fingerprint entity failed! %s", SpStrError(errCode));
|
|
|
m_pFingerPrint->SafeDelete();
|
|
|
|
|
|
errCode = Error_NoTarget; //TODO::give one other errCode
|
|
@@ -1761,14 +1735,14 @@ ErrorCodeEnum CCustMngrAuthFSM::PrepareDataBeforeMatch(MatchParams* matchParam)
|
|
|
|
|
|
if (totalCustomerID <= 0)
|
|
|
{
|
|
|
- Dbg("No FingerPrint data in local file or read local file failed.");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("No FingerPrint data in local file or read local file failed.");
|
|
|
LeaveCriticalSection(&m_cs);
|
|
|
if (matchParam != NULL)
|
|
|
delete matchParam;
|
|
|
return Error_NoTarget;
|
|
|
}
|
|
|
|
|
|
- Dbg("begin copy feature to reqParams");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("begin copy feature to reqParams");
|
|
|
for (auto it = m_featureData.begin(); it != m_featureData.end(); ++it)
|
|
|
{
|
|
|
TemplateInfo ti;
|
|
@@ -1794,7 +1768,7 @@ ErrorCodeEnum CCustMngrAuthFSM::PrepareDataBeforeMatch(MatchParams* matchParam)
|
|
|
matchParam->sFingerCount.push_back(ti);
|
|
|
}
|
|
|
LeaveCriticalSection(&m_cs);
|
|
|
- Dbg("num of template not empty:%d", matchParam->sTotalNumOfTemplate);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("num of template not empty:%d", matchParam->sTotalNumOfTemplate);
|
|
|
|
|
|
matchParam->sMatchReq.templateNum = matchParam->sTotalNumOfTemplate;
|
|
|
matchParam->sMatchReq.templates.Init(matchParam->sTotalNumOfTemplate);
|
|
@@ -1806,8 +1780,8 @@ ErrorCodeEnum CCustMngrAuthFSM::PrepareDataBeforeMatch(MatchParams* matchParam)
|
|
|
matchParam->sMatchReq.templateLen[i] = tempFeatureLenArray[i];
|
|
|
}
|
|
|
|
|
|
- Dbg("end copy feature to reqParams");
|
|
|
- Dbg("templateNum: %d", matchParam->sMatchReq.templateNum);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("end copy feature to reqParams");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("templateNum: %d", matchParam->sMatchReq.templateNum);
|
|
|
|
|
|
return Error_Succeed;
|
|
|
}
|
|
@@ -1820,18 +1794,18 @@ ErrorCodeEnum CCustMngrAuthFSM::MatchProcess(MatchParams* matchParam, bool& bSto
|
|
|
{
|
|
|
if (m_pFingerPrint == NULL || m_pFingerPrint->QuerySessionClosed())
|
|
|
{
|
|
|
- Dbg("m_pFingerPrint is NULL or connection closed.");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("m_pFingerPrint is NULL or connection closed.");
|
|
|
return Error_Unexpect;
|
|
|
}
|
|
|
//fingerprint entity may not return immediately
|
|
|
SLEEP(100);
|
|
|
|
|
|
- Dbg("begin next invoke match.");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("begin next invoke match.");
|
|
|
errCode = m_pFingerPrint->Match(matchParam->sMatchReq, matchParam->sMatchAns, 20000);
|
|
|
|
|
|
if (m_bCancelAuthorize || errCode == Error_Cancel)
|
|
|
{
|
|
|
- Dbg("cancel authorize task.");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("cancel authorize task.");
|
|
|
bStopAuthorize = true;
|
|
|
m_bCancelAuthorize = false;
|
|
|
if (m_bAuthorizeTimeout)
|
|
@@ -1843,18 +1817,18 @@ ErrorCodeEnum CCustMngrAuthFSM::MatchProcess(MatchParams* matchParam, bool& bSto
|
|
|
}
|
|
|
else if (errCode == Error_Unexpect || errCode == Error_TimeOut)
|
|
|
{
|
|
|
- Dbg("invoke match error with errCode(%s)", SpStrError(errCode));
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("invoke match error with errCode(%s)", SpStrError(errCode));
|
|
|
BroadcastGetFinger(2);
|
|
|
}
|
|
|
else if (errCode == Error_Succeed)
|
|
|
{
|
|
|
- Dbg("invoke match success, start analyze result.");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("invoke match success, start analyze result.");
|
|
|
errCode = AnalyzeMatchResult(matchParam, bStopAuthorize);
|
|
|
if (errCode == Error_Succeed)
|
|
|
return Error_Succeed; //continue if other errCode
|
|
|
}
|
|
|
else {
|
|
|
- Dbg("invole match error(%s), stop authorize", SpStrError(errCode));
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("invole match error(%s), stop authorize", SpStrError(errCode));
|
|
|
return Error_Unexpect;
|
|
|
}
|
|
|
}
|
|
@@ -1874,7 +1848,7 @@ ErrorCodeEnum CCustMngrAuthFSM::AnalyzeMatchResult(MatchParams* matchParam, bool
|
|
|
int resTemplateNum = matchParam->sMatchAns.result.GetCount();
|
|
|
if (resTemplateNum != matchParam->sTotalNumOfTemplate)
|
|
|
{
|
|
|
- Dbg("result templateNum(%d) is not equale to the Req's(%d)."
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("result templateNum(%d) is not equale to the Req's(%d)."
|
|
|
, resTemplateNum, matchParam->sTotalNumOfTemplate);
|
|
|
return Error_Unexpect;
|
|
|
}
|
|
@@ -1907,14 +1881,14 @@ ErrorCodeEnum CCustMngrAuthFSM::AnalyzeMatchResult(MatchParams* matchParam, bool
|
|
|
{
|
|
|
case 0:
|
|
|
{
|
|
|
- Dbg("MatchResult: 0| no match");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("MatchResult: 0| no match");
|
|
|
BroadcastGetFinger(0);
|
|
|
}
|
|
|
break;
|
|
|
case 1:
|
|
|
{
|
|
|
- Dbg("MatchResult: 1| one and only one match, authorize done.");
|
|
|
- Dbg("Match Finger(CustomerID=%s)", (const char*)tmpFingerCountInfo[matchIndex].CustomerID);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("MatchResult: 1| one and only one match, authorize done.");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Match Finger(CustomerID=%s)", (const char*)tmpFingerCountInfo[matchIndex].CustomerID);
|
|
|
m_authCtx.eAuthByWhich = AuthByFngPrnt;
|
|
|
m_authCtx.CustomerID = tmpFingerCountInfo[matchIndex].CustomerID;
|
|
|
bStopAuthorize = true;
|
|
@@ -1923,7 +1897,7 @@ ErrorCodeEnum CCustMngrAuthFSM::AnalyzeMatchResult(MatchParams* matchParam, bool
|
|
|
break;
|
|
|
case 2:
|
|
|
{
|
|
|
- Dbg("MatchResult: 2 | two and more matches. be alerted");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("MatchResult: 2 | two and more matches. be alerted");
|
|
|
BroadcastGetFinger(1);
|
|
|
}
|
|
|
break;
|
|
@@ -1942,7 +1916,7 @@ ErrorCodeEnum CCustMngrAuthFSM::MatchFingerPrintEx(SpReqAnsContext<CustMngrAuthS
|
|
|
errCode = m_pFingerPrint->Connect();
|
|
|
if (errCode != Error_Succeed)
|
|
|
{
|
|
|
- Dbg("ERROR: connect to fingerprint entity failed while match");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("ERROR: connect to fingerprint entity failed while match %s", SpStrError(errCode));
|
|
|
m_pFingerPrint->SafeDelete();
|
|
|
m_pFingerPrint = NULL;
|
|
|
return Error_Hardware; //TODO::give one other errCode
|
|
@@ -1957,7 +1931,7 @@ ErrorCodeEnum CCustMngrAuthFSM::MatchFingerPrintEx(SpReqAnsContext<CustMngrAuthS
|
|
|
|
|
|
if (m_pFingerPrint == NULL || m_pFingerPrint->QuerySessionClosed())
|
|
|
{
|
|
|
- Dbg("m_pFingerPrint is NULL or connection closed.");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("m_pFingerPrint is NULL or connection closed.");
|
|
|
return Error_Hardware;
|
|
|
}
|
|
|
|
|
@@ -1965,13 +1939,13 @@ ErrorCodeEnum CCustMngrAuthFSM::MatchFingerPrintEx(SpReqAnsContext<CustMngrAuthS
|
|
|
|
|
|
if (errCode == Error_NotInit)
|
|
|
{
|
|
|
- Dbg("FingerPrintEntity not ready or failed.");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER)("FingerPrintEntity not ready or failed.");
|
|
|
return Error_Hardware;
|
|
|
}
|
|
|
|
|
|
bStopAuthorize = true;
|
|
|
if (m_bCancelAuthorize || GetFingerAns.reserved1[0] == 3) {
|
|
|
- Dbg("GetFingerPrint is canceled while match.");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("GetFingerPrint is canceled while match.");
|
|
|
m_bCancelAuthorize = false;
|
|
|
if (m_bAuthorizeTimeout) {
|
|
|
m_bAuthorizeTimeout = false;
|
|
@@ -2008,7 +1982,7 @@ ErrorCodeEnum CCustMngrAuthFSM::MatchFingerPrintEx(SpReqAnsContext<CustMngrAuthS
|
|
|
ErrorCodeEnum imgErrCode = GetImgBlob(data, imgFullPath);
|
|
|
if (imgErrCode != Error_Succeed)
|
|
|
{
|
|
|
- Dbg("Failed to load image(%s)", imgFullPath.GetData());
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Failed to load image(%s)", imgFullPath.GetData());
|
|
|
return Error_Unexpect;
|
|
|
}
|
|
|
ctx->Ans.FingerImg = data;
|
|
@@ -2027,7 +2001,7 @@ void CCustMngrAuthFSM::DeleteBmp(int type)
|
|
|
{
|
|
|
if ((type & BmpImage) == BmpImage)
|
|
|
{
|
|
|
- Dbg("to delete fingerprint images...");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("to delete fingerprint images...");
|
|
|
CSimpleStringA imageName;
|
|
|
DeleteFileIfExisted("finger.bmp");
|
|
|
for (int i = 1; i <= 10; ++i) {
|
|
@@ -2045,7 +2019,7 @@ ErrorCodeEnum CCustMngrAuthFSM::DeleteFileIfExisted(const char* fileName)
|
|
|
{
|
|
|
if (strlen(fileName) == 0 || strchr(fileName, (int)'*') != NULL)
|
|
|
{
|
|
|
- Dbg("Invalid or empty filename(%s)", fileName);
|
|
|
+ DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("Invalid or empty filename(%s)", fileName);
|
|
|
return Error_Param;
|
|
|
}
|
|
|
CSimpleStringA strPath, strObjPath;
|
|
@@ -2057,16 +2031,16 @@ ErrorCodeEnum CCustMngrAuthFSM::DeleteFileIfExisted(const char* fileName)
|
|
|
{
|
|
|
if (RemoveFileA(strObjPath))
|
|
|
{
|
|
|
- Dbg("DeleteFile(%s) success.", strObjPath.GetData());
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("DeleteFile(%s) success.", strObjPath.GetData());
|
|
|
return Error_Succeed;
|
|
|
}
|
|
|
else {
|
|
|
- Dbg("DeleteFile(%s) failed LastError(%s).", strObjPath.GetData(), GetLastError());
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("DeleteFile(%s) failed LastError(%s).", strObjPath.GetData(), GetLastError());
|
|
|
return Error_Unexpect;
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
- Dbg("file %s not exist.", fileName);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("file %s not exist.", fileName);
|
|
|
return Error_Succeed;
|
|
|
}
|
|
|
}
|