|
@@ -68,7 +68,7 @@ unsigned int CFingerPrintFSM::s0_on_event(FSMEvent* e)
|
|
|
CancelScanJSEvent* pCSE = dynamic_cast<CancelScanJSEvent*>(e);
|
|
|
//清理遗留的指纹文件
|
|
|
if (m_fingerPrintFileSet.size() > 0) {
|
|
|
- DeleteRegisterFingerBmp(m_fingerPrintFileSet);
|
|
|
+ DeleteRegisterFingerBmp();
|
|
|
}
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER)("扫描取消成功");
|
|
|
pCSE->ctx->Answer(Error_Succeed);
|
|
@@ -79,7 +79,7 @@ unsigned int CFingerPrintFSM::s0_on_event(FSMEvent* e)
|
|
|
e->SetHandled();
|
|
|
//清理遗留的指纹文件
|
|
|
if (m_fingerPrintFileSet.size() > 0) {
|
|
|
- DeleteRegisterFingerBmp(m_fingerPrintFileSet);
|
|
|
+ DeleteRegisterFingerBmp();
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
@@ -627,12 +627,12 @@ int CFingerPrintFSM::GetFingerPrintJS(SpReqAnsContext<FingerPrintService_GetFing
|
|
|
}
|
|
|
else {
|
|
|
//临时注册的文件进行缓存
|
|
|
- m_fingerPrintFileSet.insert(strPath);
|
|
|
+ insertRegisterFingerBmp(strPath);
|
|
|
}
|
|
|
|
|
|
//主动和异常退出清理之前的缓存指纹文件
|
|
|
if (m_bCancelScan || bExit) {
|
|
|
- DeleteRegisterFingerBmp(m_fingerPrintFileSet);
|
|
|
+ DeleteRegisterFingerBmp();
|
|
|
}
|
|
|
|
|
|
delete[] lpbFeature;
|
|
@@ -653,14 +653,14 @@ int CFingerPrintFSM::GenerateTemplateJS(SpReqAnsContext<FingerPrintService_Gener
|
|
|
if (m_bCancelScan || m_bExit) {
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode(FingerPrint_Generate_Template_ID).setResultCode(getRTACode(FingerPrint_UserErrorCode_CANCEL_GETTEMPLATE))("指纹模版生成失败,已取消");
|
|
|
ctx->Answer(Error_Unexpect, FingerPrint_UserErrorCode_CANCEL_GETTEMPLATE);//RTA2427
|
|
|
- DeleteRegisterFingerBmp(m_fingerPrintFileSet);
|
|
|
+ DeleteRegisterFingerBmp();
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
|
if (ctx->Req.fingerSNList.GetCount() != 3) {
|
|
|
DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setLogCode(FingerPrint_Generate_Template_ID).setResultCode(getRTACode(FingerPrint_UserErrorCode_GETTEMPLATE_PARAM_FAIL))("指纹模版生成失败,输入参数错误");
|
|
|
ctx->Answer(Error_Unexpect, FingerPrint_UserErrorCode_GETTEMPLATE_PARAM_FAIL);//RTA242B
|
|
|
- DeleteRegisterFingerBmp(m_fingerPrintFileSet);
|
|
|
+ DeleteRegisterFingerBmp();
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -670,17 +670,20 @@ int CFingerPrintFSM::GenerateTemplateJS(SpReqAnsContext<FingerPrintService_Gener
|
|
|
|
|
|
UpdateAndWarnFileFindInDepBak(tempStr, CSimpleStringA::Format("finger%d.bmp", ctx->Req.fingerSNList[i]), FingerPrint_UserErrorCode_FindFile_in_DepBak);
|
|
|
|
|
|
- imagePaths.push_back(tempStr);
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("<GenerateTemplateJS>,imagePaths[%d]=%s", i, tempStr.GetData());
|
|
|
- if (!ExistsFileA(imagePaths[i]))
|
|
|
+ if (!ExistsFileA(tempStr.GetData()))
|
|
|
{
|
|
|
- CSimpleStringA errMsg = CSimpleStringA::Format("<GenerateTemplateJS>, image <%s> not exist.", imagePaths[i].GetData());
|
|
|
+ CSimpleStringA errMsg = CSimpleStringA::Format("<GenerateTemplateJS>, image <%s> not exist.", tempStr.GetData());
|
|
|
LogWarn(Severity_Middle, Error_Hardware, FingerPrint_UserErrorCode_GETTEMPLATE_NO_FILE, errMsg.GetData());
|
|
|
DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setLogCode(FingerPrint_Generate_Template_ID).setResultCode(getRTACode(FingerPrint_UserErrorCode_GETTEMPLATE_NO_FILE))("指纹模版生成失败,指纹图片不存在");
|
|
|
ctx->Answer(Error_Unexpect, FingerPrint_UserErrorCode_GETTEMPLATE_NO_FILE);//RTA242C
|
|
|
- DeleteRegisterFingerBmp(m_fingerPrintFileSet);
|
|
|
+ DeleteRegisterFingerBmp();
|
|
|
return 0;
|
|
|
}
|
|
|
+ else {
|
|
|
+ imagePaths.push_back(tempStr);
|
|
|
+ insertRegisterFingerBmp(tempStr);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("<GenerateTemplateJS>,imagePaths[%d]=%s", i, tempStr.GetData());
|
|
|
+ }
|
|
|
|
|
|
}
|
|
|
|
|
@@ -715,7 +718,7 @@ int CFingerPrintFSM::GenerateTemplateJS(SpReqAnsContext<FingerPrintService_Gener
|
|
|
errCode = Error_Unexpect;
|
|
|
}
|
|
|
|
|
|
- DeleteRegisterFingerBmp(m_fingerPrintFileSet);
|
|
|
+ DeleteRegisterFingerBmp();
|
|
|
|
|
|
if (errCode == Error_Succeed) {
|
|
|
ctx->Answer(Error_Succeed);
|
|
@@ -1159,34 +1162,44 @@ ErrorCodeEnum CFingerPrintFSM::DeleteFingerBmp(CSimpleStringA imgPath)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-ErrorCodeEnum CFingerPrintFSM::DeleteRegisterFingerBmp(set<CSimpleStringA> imgPathSet)
|
|
|
+ErrorCodeEnum CFingerPrintFSM::DeleteRegisterFingerBmp()
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("execute DeleteRegisterFinger begin,imgPathSet count: %d", imgPathSet.size());
|
|
|
- auto it = imgPathSet.begin();
|
|
|
- while (it != imgPathSet.end()) {
|
|
|
+ m_fingerfileMtx.lock();
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("execute DeleteRegisterFinger begin,imgPathSet count: %d", m_fingerPrintFileSet.size());
|
|
|
+ auto it = m_fingerPrintFileSet.begin();
|
|
|
+ while (it != m_fingerPrintFileSet.end()) {
|
|
|
CSimpleStringA imgPath = *it;
|
|
|
if (ExistsFileA(imgPath))
|
|
|
{
|
|
|
if (RemoveFileA(imgPath))
|
|
|
{
|
|
|
DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("DeleteFile(%s) success.", imgPath.GetData());
|
|
|
- it = imgPathSet.erase(it);
|
|
|
+ it = m_fingerPrintFileSet.erase(it);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("DeleteFile(%s) failed LastError(%d).", imgPath.GetData(), errno);
|
|
|
+ m_fingerfileMtx.unlock();
|
|
|
return Error_Unexpect;
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
//DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("file %s not exist.", imgPath);
|
|
|
- it = imgPathSet.erase(it);
|
|
|
+ it = m_fingerPrintFileSet.erase(it);
|
|
|
}
|
|
|
}
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("execute DeleteRegisterFinger after,imgPathSet count: %d", imgPathSet.size());
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("execute DeleteRegisterFinger after,imgPathSet count: %d", m_fingerPrintFileSet.size());
|
|
|
+ m_fingerfileMtx.unlock();
|
|
|
return Error_Succeed;
|
|
|
}
|
|
|
|
|
|
+void CFingerPrintFSM::insertRegisterFingerBmp(CSimpleStringA bmpPath)
|
|
|
+{
|
|
|
+ m_fingerfileMtx.lock();
|
|
|
+ m_fingerPrintFileSet.insert(bmpPath);
|
|
|
+ m_fingerfileMtx.unlock();
|
|
|
+}
|
|
|
+
|
|
|
DWORD CFingerPrintFSM::GetFsmStateErrCode()
|
|
|
{
|
|
|
CSimpleStringA currStateName = GetCurrStateName();
|