|
|
@@ -3,56 +3,8 @@
|
|
|
#include "log4vendor.h"
|
|
|
#include "stdafx.h"
|
|
|
|
|
|
-CTraceManager g_Trace;
|
|
|
-
|
|
|
-// IDCertificate.keba.7.2.cpp : 定义 DLL 应用程序的导出函数。
|
|
|
-ErrorCodeEnum CreateDevComponent(DeviceBaseClass *&pBaseObj)
|
|
|
-{
|
|
|
- g_Trace.Register("/data/home/keba/opt/rvc/dbg/IDCertificate/keba-IDCert.log");
|
|
|
- char err_msg[VENDOR_BUFF_SIZE] = { '\0' };
|
|
|
- cmb::log4vendor::instance();
|
|
|
- cmb::log_init_config_c config_IDCer;
|
|
|
- strcpy(config_IDCer.dev_name, "IDCertificate");
|
|
|
- config_IDCer.log_type = CMB_LOG_TYPE_FILE;
|
|
|
-#if defined(_MSC_VER)
|
|
|
- //config1.log_dir = ("C:\\rvc\\dbg\\");
|
|
|
- strcpy(config_IDCer.log_dir, "C:\\rvc\\dbg\\");
|
|
|
-#else
|
|
|
- strcpy(config_IDCer.log_dir, "/data/home/keba/opt/rvc/dbg");
|
|
|
-#endif //_MSC_VER
|
|
|
-
|
|
|
- cmb::log4vendor::initp(&config_IDCer, err_msg);
|
|
|
- LOG4VTM(INFO,("IDCertificate This message would not be record with illegal dev name!"));
|
|
|
-
|
|
|
- pBaseObj = new IDCerClassImpl();
|
|
|
- if (pBaseObj == NULL)
|
|
|
- {
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "CreateDevComponent IDCerClassImpl failed!");
|
|
|
- return Error_Resource;
|
|
|
- }
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "CreateDevComponent IDCerClassImpl scessufull!");
|
|
|
- printf("pBaseObj is successfull");
|
|
|
- return Error_Succeed;
|
|
|
-}
|
|
|
-
|
|
|
-ErrorCodeEnum ReleaseDevComponent(DeviceBaseClass *&pBaseObj)
|
|
|
-{
|
|
|
- if (pBaseObj == NULL)
|
|
|
- return Error_Param;
|
|
|
- IDCerClassImpl* pTmp = (IDCerClassImpl*)(pBaseObj);
|
|
|
- delete pTmp;
|
|
|
- pTmp = NULL;
|
|
|
- pBaseObj = NULL;
|
|
|
- return Error_Succeed;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+LOG_EXTERN()
|
|
|
#define MAX_PICTURE_SIZE 3*1024*1024
|
|
|
-//------2019-09-06 V1.0.0.9---------改为与厂家DEMO相似,采用NEW方式申请数组空间;
|
|
|
-//char cFrontImgBuf[MAX_PICTURE_SIZE];
|
|
|
-//char cRearImgBuf[MAX_PICTURE_SIZE];
|
|
|
#define MAX_FILE_PATH 260
|
|
|
CHAR CurrendPath[MAX_FILE_PATH] = {0};
|
|
|
CHAR PhotoPath[MAX_FILE_PATH] = {0};
|
|
|
@@ -90,13 +42,10 @@ char* strcat_s(char* dest, size_t size, const char* src)
|
|
|
unsigned long GetTickCount()
|
|
|
{
|
|
|
struct timespec ts;
|
|
|
-
|
|
|
clock_gettime(CLOCK_MONOTONIC, &ts);
|
|
|
-
|
|
|
return (ts.tv_sec * 1000 + ts.tv_nsec / 1000000);
|
|
|
}
|
|
|
|
|
|
-//2019-06-03 增加一个获取当前DLL(IDCertificate.keba.1.1.dll)路径的函数,路径结尾有'\'。
|
|
|
int GetDllPathLocal(std::string& dllPath)
|
|
|
{
|
|
|
Dl_info path_info;
|
|
|
@@ -106,7 +55,6 @@ int GetDllPathLocal(std::string& dllPath)
|
|
|
printf("first_str_FilePath=%s\n",str_FilePath);
|
|
|
char *pLastSlath=strrchr(str_FilePath,'/');
|
|
|
*(pLastSlath + 1)=0;
|
|
|
-
|
|
|
std::string a(str_FilePath);
|
|
|
dllPath = a;
|
|
|
return 0;
|
|
|
@@ -114,25 +62,18 @@ int GetDllPathLocal(std::string& dllPath)
|
|
|
|
|
|
IDCerClassImpl::IDCerClassImpl():
|
|
|
m_bDevOpen(false)
|
|
|
- //,m_pLog(NULL)
|
|
|
- //,m_pIniFile(NULL)
|
|
|
- //,m_pLevelLog(NULL)
|
|
|
- //,m_lpCVR100U(NULL)
|
|
|
,m_bAuthed(false)
|
|
|
,m_iCardType(-1)
|
|
|
-// ,m_bFirst(false)
|
|
|
{
|
|
|
+ LOG_FUNCTION();
|
|
|
SecDeviceNum = 0;
|
|
|
}
|
|
|
IDCerClassImpl::~IDCerClassImpl()
|
|
|
{
|
|
|
+ LOG_FUNCTION();
|
|
|
m_bDevOpen = false;
|
|
|
-
|
|
|
- //m_handDev有效,则关闭Dev
|
|
|
DevClose();
|
|
|
SecDeviceNum = 0;
|
|
|
-
|
|
|
- //2019-06-03 增加删除拷贝到dep目录的zp.bmp
|
|
|
std::string tmpPath = "";
|
|
|
if( GetDllPathLocal(tmpPath) == Error_Succeed )
|
|
|
{
|
|
|
@@ -144,60 +85,52 @@ IDCerClassImpl::~IDCerClassImpl()
|
|
|
std::string strFile = tmpPath + "zp.bmp";
|
|
|
if(access(strFile.c_str(), 0) != -1)
|
|
|
{
|
|
|
- printf("file del:%s\n", strFile.c_str());
|
|
|
- //QFile::remove(strFile.c_str());
|
|
|
+ LogM("file del:%s\n", strFile.c_str());
|
|
|
remove(strFile.c_str());
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- printf("file not found:%s\n", strFile.c_str());
|
|
|
+ LogM("file not found:%s\n", strFile.c_str());
|
|
|
}
|
|
|
- //--------------------------------
|
|
|
- // --------2019-07-0ScannerInfo6------- 增加删除扫描的正反面图像
|
|
|
strFile = tmpPath + "idback.bmp";
|
|
|
if(access(strFile.c_str(), 0) != -1)
|
|
|
{
|
|
|
- printf("file del:%s\n", strFile.c_str());
|
|
|
- //QFile::remove(strFile.c_str());
|
|
|
+ LogM("file del:%s\n", strFile.c_str());
|
|
|
remove(strFile.c_str());
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- printf("file not found:%s\n", strFile.c_str());
|
|
|
+ LogM("file not found:%s\n", strFile.c_str());
|
|
|
}
|
|
|
strFile = tmpPath + "idfront.bmp";
|
|
|
if(access(strFile.c_str(), 0) != -1)
|
|
|
{
|
|
|
- printf("file del:%s\n", strFile.c_str());
|
|
|
- //QFile::remove(strFile.c_str());
|
|
|
+ LogM("file del:%s\n", strFile.c_str());
|
|
|
remove(strFile.c_str());
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- printf("file not found:%s\n", strFile.c_str());
|
|
|
+ LogM("file not found:%s\n", strFile.c_str());
|
|
|
}
|
|
|
strFile = tmpPath + "ck.bmp";
|
|
|
if(access(strFile.c_str(), 0) != -1)
|
|
|
{
|
|
|
- printf("file del:%s\n", strFile.c_str());
|
|
|
- //QFile::remove(strFile.c_str());
|
|
|
+ LogM("file del:%s\n", strFile.c_str());
|
|
|
remove(strFile.c_str());
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- printf("file not found:%s\n", strFile.c_str());
|
|
|
+ LogM("file not found:%s\n", strFile.c_str());
|
|
|
}
|
|
|
|
|
|
}
|
|
|
ErrorCodeEnum IDCerClassImpl::GetDevCategory(DevCategoryInfo &devCategory)
|
|
|
{
|
|
|
- //g_pLog->Print("GetDevCategory() Entry.");
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "GetDevCategory() Entry.");
|
|
|
+ LOG_FUNCTION();
|
|
|
+ LogM("GetDevCategory() Entry.");
|
|
|
memset(devCategory.szType, 0, MAX_DEV_TYPE_LEN);
|
|
|
memset(devCategory.szModel, 0, MAX_DEV_MODEL_LEN);
|
|
|
memset(devCategory.szVendor, 0, MAX_DEV_VENDOR_LEN);
|
|
|
-
|
|
|
- //-----------2019-09-24-----------版本V1.0.0.10-----空白卡退卡----
|
|
|
memcpy(devCategory.szType, "Keba.IDCertificate.ID8101-V1.02.10", strlen("Keba.IDCertificate.ID8101-V1.02.10"));
|
|
|
memcpy(devCategory.szVendor, "keba", strlen("keba"));
|
|
|
devCategory.eState = DEVICE_STATUS_NORMAL;
|
|
|
@@ -205,15 +138,9 @@ ErrorCodeEnum IDCerClassImpl::GetDevCategory(DevCategoryInfo &devCategory)
|
|
|
devCategory.version.wMinor = 0;
|
|
|
devCategory.version.wRevision = 8;
|
|
|
devCategory.version.wBuild = 1;
|
|
|
- //2019-02-28 《可视化柜台设备厂商适配器开发说明文档V1.3.doc》 P8关于szModel字段改造说明
|
|
|
- //STYLE=‘CL’ 或 ‘IG’;CL为非接触式,IG为吞入式;
|
|
|
- //FUNCTION=‘I’,‘T’,‘F’的组合;身份证(I),港澳台通行证(T),外国人永久居留证(F);
|
|
|
- //以‘#’分隔多段参数;例如:支持身份证、港澳台通行证、外国人永久居留证的吞入式身份证阅读器,szModel值为"STYLE=IG#FUNCTION=ITF"
|
|
|
- //---------2019-07-16---广电库,增加支持港澳台;---------
|
|
|
+
|
|
|
memcpy(devCategory.szModel, "STYLE=IG#FUNCTION=ITF", strlen("STYLE=IG#FUNCTION=ITF"));
|
|
|
- //g_pLog->Print("GetDevCategory(), szType=%s", devCategory.szType);
|
|
|
- //g_pLog->Print("GetDevCategory(), nRet=%d", Error_Succeed);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "GetDevCategory() return:\n\
|
|
|
+ LogM("GetDevCategory() return:\n\
|
|
|
devCategory.szType = %s, \n\
|
|
|
devCategory.szVendor = %s, \n\
|
|
|
devCategory.eState = %d, \n\
|
|
|
@@ -237,13 +164,12 @@ ErrorCodeEnum IDCerClassImpl::GetDevCategory(DevCategoryInfo &devCategory)
|
|
|
// the normal condition.
|
|
|
ErrorCodeEnum IDCerClassImpl::Reset()
|
|
|
{
|
|
|
- //g_pLog->Print("Reset() Entry.");
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "Reset() Entry.");
|
|
|
+ LOG_FUNCTION();
|
|
|
+ LogM("Reset() Entry.");
|
|
|
if(!m_bDevOpen)
|
|
|
{
|
|
|
SaveErrorInfo("设备未打开", Error_DevNotAvailable);
|
|
|
- //g_pLog->Print("Reset(), 设备未打开, nRet=%d", Error_DevNotAvailable);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "Reset(), 设备未打开, nRet=%d", Error_DevNotAvailable);
|
|
|
+ LogM("Reset(), 设备未打开, nRet=%d", Error_DevNotAvailable);
|
|
|
return Error_DevNotAvailable;
|
|
|
}
|
|
|
|
|
|
@@ -251,16 +177,12 @@ ErrorCodeEnum IDCerClassImpl::Reset()
|
|
|
if (IDDIGITALCOPIER_NO_ERROR != nRet)
|
|
|
{
|
|
|
SaveErrorInfo("设备通信异常", Error_DevConnFailed);
|
|
|
- //g_pLog->Print("Reset(), 设备通信异常, nRet=%d", Error_DevConnFailed);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "Reset() 复位模式, 0-- 退卡 动作失败");
|
|
|
+ LogM("Reset() 复位模式, 0-- 退卡 动作失败");
|
|
|
return Error_DevConnFailed;
|
|
|
}
|
|
|
-
|
|
|
m_bAuthed = false;
|
|
|
m_iCardType = -1;
|
|
|
- //g_pLog->Print("Reset(), nRet=%d", Error_Succeed);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "Reset() 复位模式, 0-- 退卡 动作成功");
|
|
|
-
|
|
|
+ LogM("Reset() 复位模式, 0-- 退卡 动作成功");
|
|
|
return Error_Succeed;
|
|
|
}
|
|
|
//
|
|
|
@@ -268,22 +190,20 @@ ErrorCodeEnum IDCerClassImpl::Reset()
|
|
|
// ex. close connection,close port,release memery and so on
|
|
|
ErrorCodeEnum IDCerClassImpl::DevClose()
|
|
|
{
|
|
|
- //g_pLog->Print("DevClose() Entry.");
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "DevClose() Entry.");
|
|
|
+ LOG_FUNCTION();
|
|
|
+ LogM("DevClose() Entry.");
|
|
|
int nRet = m_cBS_ID81IDCImpl.CloseDev(SecDeviceNum);
|
|
|
if (IDDIGITALCOPIER_NO_ERROR != nRet)
|
|
|
{
|
|
|
SaveErrorInfo("设备通信异常", Error_DevConnFailed);
|
|
|
- //g_pLog->Print("DevClose(), 设备通信异常, nRet=%d", Error_DevConnFailed);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "DevClose(), 设备通信异常, nRet=%d", nRet);
|
|
|
+ LogM("DevClose(), 设备通信异常, nRet=%d", nRet);
|
|
|
return Error_DevConnFailed;
|
|
|
}
|
|
|
|
|
|
m_bDevOpen = false;
|
|
|
m_bAuthed = false;
|
|
|
m_iCardType = -1;
|
|
|
- //g_pLog->Print("DevClose(), nRet=%d", Error_Succeed);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "DevClose(), nRet=%d", nRet);
|
|
|
+ LogM("DevClose(), nRet=%d", nRet);
|
|
|
return Error_Succeed;
|
|
|
}
|
|
|
// Get last error the device issued.
|
|
|
@@ -291,15 +211,11 @@ ErrorCodeEnum IDCerClassImpl::DevClose()
|
|
|
// code and anything in favour of location problem.
|
|
|
ErrorCodeEnum IDCerClassImpl::GetLastErr(DevErrorInfo &devErrInfo)
|
|
|
{
|
|
|
- //g_pLog->Print("GetLastErr() Entry.");
|
|
|
- //return Error_NotImpl;
|
|
|
+ LOG_FUNCTION();
|
|
|
devErrInfo.dwErrMsgLen = strlen(m_szErrMsg);
|
|
|
memset(devErrInfo.szErrMsg, 0, MAX_DEV_ERROR_MSG_LEN);
|
|
|
memcpy(devErrInfo.szErrMsg, m_szErrMsg, MIN(devErrInfo.dwErrMsgLen, MAX_DEV_ERROR_MSG_LEN));
|
|
|
- //g_pLog->Print("GetLastErr(), szErrMsg=%s", devErrInfo.szErrMsg);
|
|
|
- //g_pLog->Print("GetLastErr(), nRet=%d", Error_Succeed);
|
|
|
-
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "GetLastErr() return:\n\
|
|
|
+ LogM("GetLastErr() return:\n\
|
|
|
devErrInfo.szErrMsg = %s, \n\
|
|
|
devErrInfo.dwErrMsgLen = %d", devErrInfo.szErrMsg, devErrInfo.dwErrMsgLen);
|
|
|
|
|
|
@@ -311,12 +227,10 @@ ErrorCodeEnum IDCerClassImpl::GetLastErr(DevErrorInfo &devErrInfo)
|
|
|
//
|
|
|
ErrorCodeEnum IDCerClassImpl::DevOpen(DWORD dwPort)
|
|
|
{
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "DevOpen(dwPort = %d) Entry.", dwPort);
|
|
|
- //g_pLog->Print("DevOpen() Entry.");
|
|
|
- LOG4VTM(INFO,"IDCerClassImpl::DevOpen(DWORD dwPort)");
|
|
|
- unsigned int DevNumber = 8; //统计当前设备数量
|
|
|
+ LOG_FUNCTION();
|
|
|
+ LogM("DevOpen(dwPort = %d) Entry.", dwPort);
|
|
|
+ unsigned int DevNumber = 8; //统计当前设备数量
|
|
|
ScannerInfoRec ScannerInfo[8] = {0}; //设备信息
|
|
|
-
|
|
|
m_bAuthed = false;
|
|
|
m_iCardType = -1;
|
|
|
|
|
|
@@ -328,7 +242,6 @@ ErrorCodeEnum IDCerClassImpl::DevOpen(DWORD dwPort)
|
|
|
SH_DeleteFileOrDirectory("LogModuleErrMsg.log");
|
|
|
SH_DeleteFileOrDirectory("bin\\LogModuleErrMsg.log");
|
|
|
SH_DeleteFileOrDirectory("..\\bin\\LogModuleErrMsg.log");
|
|
|
- //g_pLog->Print("DevOpen(), 未找到设备, nRet=%d", Error_DevNotAvailable);
|
|
|
return Error_DevNotAvailable;
|
|
|
}
|
|
|
|
|
|
@@ -343,8 +256,7 @@ ErrorCodeEnum IDCerClassImpl::DevOpen(DWORD dwPort)
|
|
|
SH_DeleteFileOrDirectory("LogModuleErrMsg.log");
|
|
|
SH_DeleteFileOrDirectory("bin\\LogModuleErrMsg.log");
|
|
|
SH_DeleteFileOrDirectory("..\\bin\\LogModuleErrMsg.log");
|
|
|
- //g_pLog->Print("DevOpen(), nRet=%d", Error_Succeed);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "DevOpen(), nRet=%d.", nRet);
|
|
|
+ LogM("DevOpen(), nRet=%d.", nRet);
|
|
|
return Error_Succeed;
|
|
|
}
|
|
|
}
|
|
|
@@ -353,8 +265,7 @@ ErrorCodeEnum IDCerClassImpl::DevOpen(DWORD dwPort)
|
|
|
SH_DeleteFileOrDirectory("LogModuleErrMsg.log");
|
|
|
SH_DeleteFileOrDirectory("bin\\LogModuleErrMsg.log");
|
|
|
SH_DeleteFileOrDirectory("..\\bin\\LogModuleErrMsg.log");
|
|
|
- //g_pLog->Print("DevOpen(), 设备通信异常, nRet=%d", Error_DevConnFailed);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_ERROR, "DevOpen, 设备通信异常, nRet = %d. ", nRet);
|
|
|
+ LogE("DevOpen, 设备通信异常, nRet = %d. ", nRet);
|
|
|
return Error_DevConnFailed;
|
|
|
}
|
|
|
//
|
|
|
@@ -365,14 +276,12 @@ ErrorCodeEnum IDCerClassImpl::DevOpen(DWORD dwPort)
|
|
|
//
|
|
|
ErrorCodeEnum IDCerClassImpl::IDCerRFControl(bool bControl)
|
|
|
{
|
|
|
- //g_pLog->Print("IDCerRFControl() Entry.");
|
|
|
- //g_pLog->Print("IDCerRFControl(), bControl=%d", bControl);
|
|
|
- //return Error_NotImpl;
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "IDCerRFControl(), bControl = %d", bControl);
|
|
|
+ LOG_FUNCTION();
|
|
|
+ LogM("IDCerRFControl(), bControl = %d", bControl);
|
|
|
if(!m_bDevOpen)
|
|
|
{
|
|
|
//g_pLog->Print("IDCerRFControl(), !m_bDevOpen, nRet=%d", Error_DevNotAvailable);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_ERROR, "IDCerRFControl(), !m_bDevOpen, nRet=%d", Error_DevNotAvailable);
|
|
|
+ LogE("IDCerRFControl(), !m_bDevOpen, nRet=%d", Error_DevNotAvailable);
|
|
|
return Error_DevNotAvailable;
|
|
|
}
|
|
|
if (bControl)
|
|
|
@@ -461,8 +370,7 @@ ErrorCodeEnum IDCerClassImpl::IDCerRFControl(bool bControl)
|
|
|
{
|
|
|
ForceIDEject();
|
|
|
}
|
|
|
- //g_pLog->Print("IDCerRFControl(), nRet=%d", Error_Succeed);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "IDCerRFControl(), nRet = %d", Error_Succeed);
|
|
|
+ LogM("IDCerRFControl(), nRet = %d", Error_Succeed);
|
|
|
return Error_Succeed;
|
|
|
}
|
|
|
//
|
|
|
@@ -471,13 +379,12 @@ ErrorCodeEnum IDCerClassImpl::IDCerRFControl(bool bControl)
|
|
|
//
|
|
|
ErrorCodeEnum IDCerClassImpl::IDCerAuthenticate()
|
|
|
{
|
|
|
- //g_pLog->Print("IDCerAuthenticate() Entry.");
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "IDCerAuthenticate() Entry.");
|
|
|
+ LOG_FUNCTION();
|
|
|
+ LogM("IDCerAuthenticate() Entry.");
|
|
|
if(!m_bDevOpen)
|
|
|
{
|
|
|
SaveErrorInfo("设备未打开", Error_DevNotAvailable);
|
|
|
- //g_pLog->Print("IDCerAuthenticate(), 设备未打开, nRet=%d", Error_DevNotAvailable);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_ERROR, "IDCerAuthenticate(), !m_bDevOpen, nRet=%d", Error_DevNotAvailable);
|
|
|
+ LogE("IDCerAuthenticate(), !m_bDevOpen, nRet=%d", Error_DevNotAvailable);
|
|
|
return Error_DevNotAvailable;
|
|
|
}
|
|
|
DWORD dwStart = GetTickCount();
|
|
|
@@ -496,12 +403,8 @@ ErrorCodeEnum IDCerClassImpl::IDCerAuthenticate()
|
|
|
char err[MAX_DEV_ERROR_MSG_LEN] = {0};
|
|
|
sprintf(err, "通讯异常%d", nRet);
|
|
|
SaveErrorInfo(err, Error_DevCommFailed);
|
|
|
- //m_cBS_ID81IDCImpl.ResetDev(SecDeviceNum);
|
|
|
- //g_pLog->Print("IDCerAuthenticate(), 通讯异常%d, nRet=%d", nRet, Error_DevCommFailed);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_ERROR, "IDCerAuthenticate(), 通讯异常%d, nRet=%d", nRet, Error_DevCommFailed);
|
|
|
+ LogE("IDCerAuthenticate(), 通讯异常%d, nRet=%d", nRet, Error_DevCommFailed);
|
|
|
return Error_DevCommFailed;
|
|
|
- //SaveErrorInfo("通讯异常", Error_DevCommFailed);
|
|
|
- //return Error_DevCommFailed;
|
|
|
}
|
|
|
if ((m_DeviceStatus.iStatusInputSensorHaveCard == 1) &&
|
|
|
(m_DeviceStatus.iStatusMiddleSensorHaveCard == 0) &&
|
|
|
@@ -532,8 +435,7 @@ ErrorCodeEnum IDCerClassImpl::IDCerAuthenticate()
|
|
|
if (!bCard)
|
|
|
{
|
|
|
SaveErrorInfo("未检测到卡", Error_Unexpect);
|
|
|
- //g_pLog->Print("IDCerAuthenticate(), 未检测到卡, nRet=%d", Error_Unexpect);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_ERROR, "IDCerAuthenticate(),未检测到卡, nRet=%d", Error_Unexpect);
|
|
|
+ LogE("IDCerAuthenticate(),未检测到卡, nRet=%d", Error_Unexpect);
|
|
|
return Error_Unexpect;
|
|
|
}
|
|
|
|
|
|
@@ -541,16 +443,8 @@ ErrorCodeEnum IDCerClassImpl::IDCerAuthenticate()
|
|
|
if ((IDDIGITALCOPIER_TIMEOUT_ERROR == nRet) ||
|
|
|
(IDDIGITALCOPIER_NO_CARD == nRet))
|
|
|
{
|
|
|
- //2019-02-28 《可视化柜台设备厂商适配器开发说明文档V1.3.doc》 P12关于身份证读卡器改造说明
|
|
|
- //1. 检测到有卡片插入/放置,但不是身份证时,IDCerAuthenticate返回Error_DevMedia;
|
|
|
- //2. 未检测到卡片插入/放置,IDCerAuthenticate返回Error_Unexpect;
|
|
|
- //3. 检测到身份证且认证成功(注意:部分厂商不做卡认证直接返回成功,需要根据实际情况按照步骤1和2返回对应值),IDCerAuthenticate返回Error_Succeed。
|
|
|
- //SaveErrorInfo("未检测到卡", Error_DevMedia);
|
|
|
- //printf(" SecDeviceNum=%d",SecDeviceNum);
|
|
|
- //return Error_DevMedia;
|
|
|
SaveErrorInfo("未检测到卡", Error_Unexpect);
|
|
|
- //g_pLog->Print("IDCerAuthenticate(), 未检测到卡, nRet=%d", Error_Unexpect);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_ERROR, "IDCerAuthenticate(),未检测到卡, nRet=%d", Error_Unexpect);
|
|
|
+ LogE("IDCerAuthenticate(),未检测到卡, nRet=%d", Error_Unexpect);
|
|
|
return Error_Unexpect;
|
|
|
}
|
|
|
else if (IDDIGITALCOPIER_NO_ERROR != nRet)
|
|
|
@@ -558,30 +452,22 @@ ErrorCodeEnum IDCerClassImpl::IDCerAuthenticate()
|
|
|
char err[MAX_DEV_ERROR_MSG_LEN] = {0};
|
|
|
sprintf(err, "通讯失败%d", nRet);
|
|
|
SaveErrorInfo(err, Error_DevConnFailed);
|
|
|
- //m_cBS_ID81IDCImpl.ResetDev(SecDeviceNum);
|
|
|
- //g_pLog->Print("IDCerAuthenticate(), 通讯失败%d, nRet=%d", nRet, Error_DevConnFailed);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_ERROR, "IDCerAuthenticate(),通讯失败,nRet=%d", nRet, Error_DevConnFailed);
|
|
|
+ LogE("IDCerAuthenticate(),通讯失败,nRet=%d", nRet, Error_DevConnFailed);
|
|
|
return Error_DevConnFailed;
|
|
|
}
|
|
|
-
|
|
|
- //2019-03-01 有卡情况下,增加判断是否为有效卡(身份证、外国人居留证、港澳台居住在);
|
|
|
int iCardType = -1;
|
|
|
memset(&m_IDInfoEx, 0x00, sizeof(IDInfoEx));
|
|
|
memset(&m_IDForeignInfo, 0x00, sizeof(IDInfoForeign));
|
|
|
memset(&m_IDInfoGAT, 0x00, sizeof(IDInfoGAT));
|
|
|
-
|
|
|
memset(PhotoPath, 0, MAX_FILE_PATH);
|
|
|
std::string dllPath;
|
|
|
int bRet = GetDllPathLocal(dllPath);
|
|
|
memcpy(PhotoPath, dllPath.c_str(), dllPath.length());
|
|
|
-
|
|
|
dllPath += "ck.bmp";
|
|
|
char FileName0[256]={0};
|
|
|
memcpy(FileName0, dllPath.c_str(), dllPath.length());
|
|
|
std::string strLog = "IDCerAuthenticate(),PhotoPath=[" + dllPath + "]";
|
|
|
- LOG4VTM(INFO, strLog);
|
|
|
-
|
|
|
- //--------2019-07-19 19:39--------先读身份证和外国人(大部分是身份证,先读只需一次;如果是港澳台,要先GetCardType,再GetIDInfoGAT
|
|
|
+ LogM("%s",strLog.c_str());
|
|
|
nRet = m_cBS_ID81IDCImpl.GetMyIDCardType(SecDeviceNum, &iCardType);
|
|
|
if(nRet == IDDIGITALCOPIER_NO_ERROR)
|
|
|
{
|
|
|
@@ -589,21 +475,15 @@ ErrorCodeEnum IDCerClassImpl::IDCerAuthenticate()
|
|
|
}
|
|
|
else if (nRet == IDDIGITALCOPIER_IDDATA_PROCESS_ERROR)
|
|
|
{
|
|
|
- //无效卡(这里包括港澳台居住证,因为未接到招行提出改造此接口要求;)
|
|
|
SaveErrorInfo("无效卡", Error_DevMedia);
|
|
|
- //g_pLog->Print("IDCerAuthenticate(), 无效卡, nRet=%d", Error_DevMedia);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_ERROR, "IDCerAuthenticate(),无效卡, nRet=%d", Error_DevMedia);
|
|
|
- //-----------2019-09-24-----------版本V1.0.0.10-----空白卡退卡----
|
|
|
+ LogE("IDCerAuthenticate(),无效卡, nRet=%d", Error_DevMedia);
|
|
|
m_cBS_ID81IDCImpl.BackAndHoldCard(SecDeviceNum);
|
|
|
-
|
|
|
return Error_DevMedia;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
SaveErrorInfo("通讯异常", Error_DevCommFailed);
|
|
|
- //nRet = m_cBS_ID81IDCImpl.BackAndHoldCard(SecDeviceNum);
|
|
|
- //g_pLog->Print("IDCerAuthenticate(), 通讯异常, nRet=%d", Error_DevCommFailed);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_ERROR, "IDCerAuthenticate(),通讯异常%d,nRet=%d", nRet, Error_DevCommFailed);
|
|
|
+ LogE("IDCerAuthenticate(),通讯异常%d,nRet=%d", nRet, Error_DevCommFailed);
|
|
|
return Error_DevCommFailed;
|
|
|
}
|
|
|
|
|
|
@@ -637,36 +517,27 @@ ErrorCodeEnum IDCerClassImpl::IDCerAuthenticate()
|
|
|
|
|
|
if(nRet == IDDIGITALCOPIER_NO_ERROR)
|
|
|
{
|
|
|
- //g_pLog->Print("IDCerAuthenticate(), 认证成功");
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "IDCerAuthenticate(),认证成功");
|
|
|
+ LogM("IDCerAuthenticate(),认证成功");
|
|
|
}
|
|
|
else if ((nRet == IDDIGITALCOPIER_NO_ERROR) ||
|
|
|
(nRet == IDDIGITALCOPIER_IDDATA_PROCESS_ERROR)) //身份证电子信息处理错误
|
|
|
{
|
|
|
- //无效卡(这里包括港澳台居住证,因为未接到招行提出改造此接口要求;)
|
|
|
SaveErrorInfo("无效卡", Error_DevMedia);
|
|
|
- //g_pLog->Print("IDCerAuthenticate(), 无效卡, nRet=%d", Error_DevMedia);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_ERROR, "IDCerAuthenticate(),无效卡, nRet=%d", Error_DevMedia);
|
|
|
- //-----------2019-09-24-----------版本V1.0.0.10-----空白卡退卡----
|
|
|
+ LogE("IDCerAuthenticate(),无效卡, nRet=%d", Error_DevMedia);
|
|
|
m_cBS_ID81IDCImpl.BackAndHoldCard(SecDeviceNum);
|
|
|
-
|
|
|
return Error_DevMedia;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
char err[MAX_DEV_ERROR_MSG_LEN] = {0};
|
|
|
sprintf(err, "通讯失败%d", nRet);
|
|
|
- //SaveErrorInfo("通讯失败", Error_DevConnFailed);
|
|
|
SaveErrorInfo(err, Error_DevConnFailed);
|
|
|
- //g_pLog->Print("IDCerAuthenticate(), 通讯失败%d, nRet=%d", nRet , Error_DevCommFailed);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_ERROR, "IDCerAuthenticate()通讯失败, nRet=%d", Error_DevCommFailed);
|
|
|
+ LogE("IDCerAuthenticate()通讯失败, nRet=%d", Error_DevCommFailed);
|
|
|
return Error_DevConnFailed;
|
|
|
}
|
|
|
-
|
|
|
m_bAuthed = true; // true:认证成功;
|
|
|
m_iCardType = iCardType; // 认证成功后,卡的类型;
|
|
|
- //g_pLog->Print("IDCerAuthenticate(), nRet=%d", Error_Succeed);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "IDCerAuthenticate(), nRet=%d", Error_Succeed);
|
|
|
+ LogM("IDCerAuthenticate(), nRet=%d", Error_Succeed);
|
|
|
return Error_Succeed;
|
|
|
}
|
|
|
// 获取证件信息,包括二代身份证、外国人永久居留证
|
|
|
@@ -674,51 +545,34 @@ ErrorCodeEnum IDCerClassImpl::IDCerAuthenticate()
|
|
|
//
|
|
|
ErrorCodeEnum IDCerClassImpl::IDCerGetData(IDCerInfo &idCerInfo)
|
|
|
{
|
|
|
- //g_pLog->Print("IDCerGetData() Entry.");
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "IDCerGetData() Entry.");
|
|
|
- //return Error_NotImpl;
|
|
|
+ LOG_FUNCTION();
|
|
|
+ LogM("IDCerGetData() Entry.");
|
|
|
if(!m_bDevOpen)
|
|
|
{
|
|
|
SaveErrorInfo("设备未打开", Error_DevNotAvailable);
|
|
|
- //g_pLog->Print("IDCerGetData(), 设备未打开, nRet=%d", Error_DevNotAvailable);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_ERROR, "IDCerGetData(),设备未打开, nRet=%d", Error_DevNotAvailable);
|
|
|
+ LogE("IDCerGetData(),设备未打开, nRet=%d", Error_DevNotAvailable);
|
|
|
return Error_DevNotAvailable;
|
|
|
}
|
|
|
-
|
|
|
- //int pos = -1;
|
|
|
- //ErrorCodeEnum Ret = QueryCardPos(pos);
|
|
|
- //if ((Ret == Error_Succeed) && pos == 0)
|
|
|
- //{
|
|
|
- // SaveErrorInfo("未检测到卡", Error_DevMedia);
|
|
|
- // return Error_DevMedia;
|
|
|
- //}
|
|
|
-
|
|
|
if (!m_bAuthed)
|
|
|
{
|
|
|
SaveErrorInfo("未认证成功。", Error_DevMedia);
|
|
|
- //g_pLog->Print("IDCerGetData(), 未认证成功, nRet=%d", Error_DevMedia);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_ERROR, "IDCerGetData(),未认证成功, nRet=%d", Error_DevMedia);
|
|
|
+ LogE("IDCerGetData(),未认证成功, nRet=%d", Error_DevMedia);
|
|
|
return Error_DevMedia;
|
|
|
}
|
|
|
m_bAuthed = false; //认证成功只能读一次,下次必须重新认证;
|
|
|
-
|
|
|
std::string dllPath;
|
|
|
int bRet = GetDllPathLocal(dllPath);
|
|
|
-
|
|
|
std::string ckStr = dllPath + "ck.bmp";
|
|
|
std::string zpStr = dllPath + "zp.bmp";
|
|
|
- //QFile::copy(ckStr.c_str(), zpStr.c_str()); //表示将文件A拷贝到B,如果B已经存在则覆盖(第三参数为TRUE时表示不覆盖)
|
|
|
std::string commond="cp"+std::string(" ")+ckStr+std::string(" ")+zpStr;
|
|
|
system(commond.c_str());
|
|
|
-
|
|
|
std::string strLog = "IDCerGetData(),ckStr=[" + ckStr + "],zpStr=[" + zpStr + "]";
|
|
|
- LOG4VTM(INFO, strLog);
|
|
|
-
|
|
|
+ LogM("%s",strLog.c_str());
|
|
|
memset(PhotoPath, 0, MAX_FILE_PATH);
|
|
|
memcpy(PhotoPath, zpStr.c_str(), zpStr.length());
|
|
|
|
|
|
memset(&idCerInfo, 0, sizeof(IDCerInfo));
|
|
|
- //----2019-07-19-----在IDCerAuthenticate里,对有效卡读出数据,在IDCerGetData和IDCerGetDataEx不再去读数据,否则应用会崩溃(未知原因,参考E1000的处理);
|
|
|
+ //--------在IDCerAuthenticate里,对有效卡读出数据,在IDCerGetData和IDCerGetDataEx不再去读数据,否则应用会崩溃(未知原因,参考E1000的处理);
|
|
|
if (m_iCardType == 0) //0-身份证
|
|
|
{
|
|
|
//身份证
|
|
|
@@ -793,7 +647,6 @@ ErrorCodeEnum IDCerClassImpl::IDCerGetData(IDCerInfo &idCerInfo)
|
|
|
{
|
|
|
endtime[i] = m_IDInfoEx.timeLimit[i + 9];
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
endtime[8] = '\0';
|
|
|
dataStr = endtime;
|
|
|
@@ -818,8 +671,7 @@ ErrorCodeEnum IDCerClassImpl::IDCerGetData(IDCerInfo &idCerInfo)
|
|
|
dataStr = PhotoPath;
|
|
|
strcpy_s(idCerInfo.photoPath.data, PhotoPath);
|
|
|
idCerInfo.photoPath.dwSize = dataStr.size();
|
|
|
- //g_pLog->Print("IDCerGetData(), 身份证");
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "IDCerGetData(), 身份证");
|
|
|
+ LogM("IDCerGetData(), 身份证");
|
|
|
}
|
|
|
else if (m_iCardType == 1) //1-外国人居住证
|
|
|
{
|
|
|
@@ -900,8 +752,7 @@ ErrorCodeEnum IDCerClassImpl::IDCerGetData(IDCerInfo &idCerInfo)
|
|
|
dataStr = PhotoPath;
|
|
|
strcpy_s(idCerInfo.photoPath.data, PhotoPath);
|
|
|
idCerInfo.photoPath.dwSize = dataStr.size();
|
|
|
- //g_pLog->Print("IDCerGetData(), 外国人");
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "IDCerGetData(), 外国人");
|
|
|
+ LogM("IDCerGetData(), 外国人");
|
|
|
}
|
|
|
else if (m_iCardType == 2) //2-港澳台
|
|
|
{
|
|
|
@@ -919,9 +770,6 @@ ErrorCodeEnum IDCerClassImpl::IDCerGetData(IDCerInfo &idCerInfo)
|
|
|
idCerInfo.sex.dwSize = dataStr.size();
|
|
|
|
|
|
//3民族
|
|
|
- //dataStr = m_IDInfoGAT.nation;
|
|
|
- //strcpy_s(idCerInfo.nation.data, m_IDInfoGAT.nation);
|
|
|
- //idCerInfo.nation.dwSize = dataStr.size();
|
|
|
memset(idCerInfo.nation.data, 0, MAX_IDCER_SIMPLE_INFO_SIZE);
|
|
|
idCerInfo.nation.dwSize = 0;
|
|
|
|
|
|
@@ -1002,22 +850,17 @@ ErrorCodeEnum IDCerClassImpl::IDCerGetData(IDCerInfo &idCerInfo)
|
|
|
dataStr = PhotoPath;
|
|
|
strcpy_s(idCerInfo.photoPath.data, PhotoPath);
|
|
|
idCerInfo.photoPath.dwSize = dataStr.size();
|
|
|
- //g_pLog->Print("IDCerGetData(), 港澳台");
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "IDCerGetData(), 港澳台");
|
|
|
+ LogM("IDCerGetData(), 港澳台");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
//无效卡(这里包括港澳台居住证,因为未接到招行提出改造此接口要求;)
|
|
|
SaveErrorInfo("无效卡", Error_DevMedia);
|
|
|
- //g_pLog->Print("IDCerGetData(), 无效卡, nRet=%d", Error_DevMedia);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_ERROR, "IDCerGetData(), 无效卡, nRet=%d", Error_DevMedia);
|
|
|
+ LogE("IDCerGetData(), 无效卡, nRet=%d", Error_DevMedia);
|
|
|
return Error_DevMedia;
|
|
|
}
|
|
|
-
|
|
|
- //nRet = m_cBS_ID81IDCImpl.BackAndHoldCard(SecDeviceNum);
|
|
|
- //g_pLog->Print("IDCerGetData(), nRet=%d", Error_Succeed);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "IDCerGetData(), nRet=%d", Error_Succeed);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "IDCerGetData() return:\
|
|
|
+ LogM("IDCerGetData(), nRet=%d", Error_Succeed);
|
|
|
+ LogM("IDCerGetData() return:\
|
|
|
\nName:%s\n Sex:%s\nNation: %s\nBirth: %s\nAddress:%s\nIDCode:%s\
|
|
|
\nDepart: %s\nStartDate: %s\nEndDate: %s\nNewAddress:%s\nPhotoPath:%s\n",
|
|
|
idCerInfo.name.data, idCerInfo.sex.data, idCerInfo.nation.data,
|
|
|
@@ -1032,29 +875,17 @@ ErrorCodeEnum IDCerClassImpl::IDCerGetData(IDCerInfo &idCerInfo)
|
|
|
//
|
|
|
ErrorCodeEnum IDCerClassImpl::IDCerGetDataEx(IDCerInfoEx &idCerInfoEx)
|
|
|
{
|
|
|
- //g_pLog->Print("IDCerGetDataEx() Entry.");
|
|
|
- //return Error_NotImpl;
|
|
|
+ LOG_FUNCTION();
|
|
|
if(!m_bDevOpen)
|
|
|
{
|
|
|
SaveErrorInfo("设备未打开", Error_DevNotAvailable);
|
|
|
- //g_pLog->Print("IDCerGetDataEx(), 设备未打开, nRet=%d", Error_DevNotAvailable);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_ERROR, "IDCerGetDataEx(),设备未打开, nRet=%d", Error_DevNotAvailable);
|
|
|
+ LogE("IDCerGetDataEx(),设备未打开, nRet=%d", Error_DevNotAvailable);
|
|
|
return Error_DevNotAvailable;
|
|
|
}
|
|
|
-
|
|
|
- //int pos = -1;
|
|
|
- //ErrorCodeEnum Ret = QueryCardPos(pos);
|
|
|
- //if ((Ret == Error_Succeed) && pos == 0)
|
|
|
- //{
|
|
|
- // SaveErrorInfo("未检测到卡", Error_DevMedia);
|
|
|
- // return Error_DevMedia;
|
|
|
- //}
|
|
|
-
|
|
|
if (!m_bAuthed)
|
|
|
{
|
|
|
SaveErrorInfo("未认证成功。", Error_DevMedia);
|
|
|
- //g_pLog->Print("IDCerGetDataEx(), 未认证成功, nRet=%d", Error_DevMedia);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_ERROR, "IDCerGetDataEx(),未认证成功, nRet=%d", Error_DevMedia);
|
|
|
+ LogE("IDCerGetDataEx(),未认证成功, nRet=%d", Error_DevMedia);
|
|
|
return Error_DevMedia;
|
|
|
}
|
|
|
m_bAuthed = false; //认证成功只能读一次,下次必须重新认证;
|
|
|
@@ -1064,19 +895,16 @@ ErrorCodeEnum IDCerClassImpl::IDCerGetDataEx(IDCerInfoEx &idCerInfoEx)
|
|
|
|
|
|
std::string ckStr = dllPath + "ck.bmp";
|
|
|
std::string zpStr = dllPath + "zp.bmp";
|
|
|
- //QFile::copy(ckStr.c_str(), zpStr.c_str()); //表示将文件A拷贝到B,如果B已经存在则覆盖(第三参数为TRUE时表示不覆盖)
|
|
|
-
|
|
|
std::string commond="cp"+std::string(" ")+ckStr+std::string(" ")+zpStr;
|
|
|
system(commond.c_str());
|
|
|
|
|
|
std::string strLog = "IDCerGetData(),ckStr=[" + ckStr + "],zpStr=[" + zpStr + "]";
|
|
|
- LOG4VTM(INFO, strLog);
|
|
|
-
|
|
|
+ LogM("%s",strLog.c_str());
|
|
|
memset(PhotoPath, 0, MAX_FILE_PATH);
|
|
|
memcpy(PhotoPath, zpStr.c_str(), zpStr.length());
|
|
|
|
|
|
memset(&idCerInfoEx, 0, sizeof(IDCerInfoEx));
|
|
|
- //----2019-07-19-----在IDCerAuthenticate里,对有效卡读出数据,在IDCerGetData和IDCerGetDataEx不再去读数据,否则应用会崩溃(未知原因,参考E1000的处理);
|
|
|
+
|
|
|
if (m_iCardType == 0) //0-身份证
|
|
|
{
|
|
|
//身份证
|
|
|
@@ -1234,8 +1062,7 @@ ErrorCodeEnum IDCerClassImpl::IDCerGetDataEx(IDCerInfoEx &idCerInfoEx)
|
|
|
//22备用5
|
|
|
memset(idCerInfoEx.reserved5.data, 0, MAX_IDCER_SIMPLE_INFO_SIZE);
|
|
|
idCerInfoEx.reserved5.dwSize = 0;
|
|
|
- //g_pLog->Print("IDCerGetDataEx(), 身份证");
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "IDCerGetDataEx(), 身份证");
|
|
|
+ LogM("IDCerGetDataEx(), 身份证");
|
|
|
}
|
|
|
else if (m_iCardType == 1) //1-外国人居住证
|
|
|
{
|
|
|
@@ -1256,12 +1083,6 @@ ErrorCodeEnum IDCerClassImpl::IDCerGetDataEx(IDCerInfoEx &idCerInfoEx)
|
|
|
|
|
|
//2019-06-11
|
|
|
//3国籍 ID81开发包没有中文国籍,先用英文代码;
|
|
|
- //2019-08-23 改为去掉
|
|
|
- //dataStr = m_IDForeignInfo.Nation;
|
|
|
- //dataStr = trim(dataStr);
|
|
|
- //memset(idCerInfoEx.nation.data, 0, MAX_IDCER_SIMPLE_INFO_SIZE);
|
|
|
- //strcpy_s(idCerInfoEx.nation.data, m_IDForeignInfo.Nation);
|
|
|
- //idCerInfoEx.nation.dwSize = dataStr.size();
|
|
|
memset(idCerInfoEx.nation.data, 0, MAX_IDCER_SIMPLE_INFO_SIZE);
|
|
|
idCerInfoEx.nation.dwSize = 0;
|
|
|
|
|
|
@@ -1277,9 +1098,6 @@ ErrorCodeEnum IDCerClassImpl::IDCerGetDataEx(IDCerInfoEx &idCerInfoEx)
|
|
|
idCerInfoEx.birthday.dwSize = dataStr.size();
|
|
|
|
|
|
//5地址
|
|
|
- //dataStr = m_IDForeignInfo.address;
|
|
|
- //strcpy(idCerInfoEx.address.data,m_IDForeignInfo.address);
|
|
|
- //idCerInfoEx.address.dwSize = dataStr.size();
|
|
|
memset(idCerInfoEx.address.data, 0, MAX_IDCER_INFO_SIZE);
|
|
|
idCerInfoEx.address.dwSize = 0;
|
|
|
|
|
|
@@ -1386,8 +1204,7 @@ ErrorCodeEnum IDCerClassImpl::IDCerGetDataEx(IDCerInfoEx &idCerInfoEx)
|
|
|
//22备用5
|
|
|
memset(idCerInfoEx.reserved5.data, 0, MAX_IDCER_SIMPLE_INFO_SIZE);
|
|
|
idCerInfoEx.reserved5.dwSize = 0;
|
|
|
- //g_pLog->Print("IDCerGetDataEx(), 外国人");
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "IDCerGetDataEx(), 外国人");
|
|
|
+ LogM("IDCerGetDataEx(), 外国人");
|
|
|
}
|
|
|
else if (m_iCardType == 2) //2-港澳台
|
|
|
{
|
|
|
@@ -1407,10 +1224,6 @@ ErrorCodeEnum IDCerClassImpl::IDCerGetDataEx(IDCerInfoEx &idCerInfoEx)
|
|
|
idCerInfoEx.sex.dwSize = dataStr.size();
|
|
|
|
|
|
//3民族
|
|
|
- //dataStr = m_IDInfoGAT.nation;
|
|
|
- //dataStr = trim(dataStr);
|
|
|
- //strcpy_s(idCerInfoEx.nation.data, m_IDInfoGAT.nation);
|
|
|
- //idCerInfoEx.nation.dwSize = dataStr.size();
|
|
|
memset(idCerInfoEx.nation.data, 0, MAX_IDCER_SIMPLE_INFO_SIZE);
|
|
|
idCerInfoEx.nation.dwSize = 0;
|
|
|
|
|
|
@@ -1554,7 +1367,7 @@ ErrorCodeEnum IDCerClassImpl::IDCerGetDataEx(IDCerInfoEx &idCerInfoEx)
|
|
|
memset(idCerInfoEx.reserved5.data, 0, MAX_IDCER_SIMPLE_INFO_SIZE);
|
|
|
idCerInfoEx.reserved5.dwSize = 0;
|
|
|
//g_pLog->Print("IDCerGetDataEx(), 港澳台");
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "IDCerGetDataEx(), 港澳台");
|
|
|
+ LogM("IDCerGetDataEx(), 港澳台");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -1563,11 +1376,8 @@ ErrorCodeEnum IDCerClassImpl::IDCerGetDataEx(IDCerInfoEx &idCerInfoEx)
|
|
|
//g_pLog->Print("IDCerGetDataEx(), 无效卡, nRet=%d", Error_DevMedia);
|
|
|
return Error_DevMedia;
|
|
|
}
|
|
|
-
|
|
|
- //nRet = m_cBS_ID81IDCImpl.BackAndHoldCard(SecDeviceNum);
|
|
|
- //g_pLog->Print("IDCerGetDataEx(), nRet=%d", Error_Succeed);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "IDCerGetDataEx(), nRet=%d", Error_Succeed);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "IDCerGetDataEx() return:\
|
|
|
+ LogM("IDCerGetDataEx(), nRet=%d", Error_Succeed);
|
|
|
+ LogM("IDCerGetDataEx() return:\
|
|
|
\nName:%s\n Sex:%s\nNation: %s\nBirth: %s\nAddress:%s\nIDCode:%s\nDepart: %s\nStartDate: %s\nEndDate: %s\
|
|
|
\nNewAddress: %s\nphotoPath: %s\nEnglishName: %s\nNationality: %s\nIdVersin: %s\nIdType: %s\nreserved: %s\nissuedSN: %s\
|
|
|
\nzCotxde: %s\nreserved2: %s\nreserved3: %s\nreserved4: %s\nreserved5: %s",
|
|
|
@@ -1583,14 +1393,13 @@ ErrorCodeEnum IDCerClassImpl::IDCerGetDataEx(IDCerInfoEx &idCerInfoEx)
|
|
|
|
|
|
ErrorCodeEnum IDCerClassImpl::ForceIDEject()
|
|
|
{
|
|
|
- //g_pLog->Print("ForceIDEject() Entry.");
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "ForceIDEject() Entry.");
|
|
|
- //return Error_NotImpl;
|
|
|
+ LOG_FUNCTION();
|
|
|
+ LogM("ForceIDEject() Entry.");
|
|
|
if(!m_bDevOpen)
|
|
|
{
|
|
|
SaveErrorInfo("设备未打开", Error_DevNotAvailable);
|
|
|
//g_pLog->Print("ForceIDEject(), 设备未打开, nRet=%d", Error_DevNotAvailable);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "ForceIDEject(), 设备未打开, nRet=%d", Error_DevNotAvailable);
|
|
|
+ LogM("ForceIDEject(), 设备未打开, nRet=%d", Error_DevNotAvailable);
|
|
|
return Error_DevNotAvailable;
|
|
|
}
|
|
|
int pos = -1;
|
|
|
@@ -1598,65 +1407,49 @@ ErrorCodeEnum IDCerClassImpl::ForceIDEject()
|
|
|
if ((nRet == Error_Succeed) && pos == 0)
|
|
|
{
|
|
|
SaveErrorInfo("未检测到卡", Error_DevMedia);
|
|
|
- //g_pLog->Print("ForceIDEject(), 未检测到卡, nRet=%d", Error_DevMedia);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "ForceIDEject(), 未检测到卡, nRet=%d", Error_DevMedia);
|
|
|
+ LogM("ForceIDEject(), 未检测到卡, nRet=%d", Error_DevMedia);
|
|
|
return Error_DevMedia;
|
|
|
}
|
|
|
int bRet = m_cBS_ID81IDCImpl.EjectIdCard(SecDeviceNum);
|
|
|
if (bRet != IDDIGITALCOPIER_NO_ERROR)
|
|
|
{
|
|
|
SaveErrorInfo("通讯异常", Error_DevCommFailed);
|
|
|
- //g_pLog->Print("ForceIDEject(), 通讯异常, nRet=%d", Error_DevCommFailed);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "ForceIDEject(), 通讯异常, nRet=%d", Error_DevCommFailed);
|
|
|
+ LogM("ForceIDEject(), 通讯异常, nRet=%d", Error_DevCommFailed);
|
|
|
return Error_DevCommFailed;
|
|
|
}
|
|
|
- //g_pLog->Print("ForceIDEject(), nRet=%d", Error_Succeed);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "ForceIDEject(), nRet=%d", Error_Succeed);
|
|
|
+ LogM("ForceIDEject(), nRet=%d", Error_Succeed);
|
|
|
return Error_Succeed;
|
|
|
}
|
|
|
|
|
|
ErrorCodeEnum IDCerClassImpl::ScanIDAndSaveImage()
|
|
|
{
|
|
|
- //g_pLog->Print("ScanIDAndSaveImage() Entry.");
|
|
|
- //return Error_NotImpl;
|
|
|
+ LOG_FUNCTION();
|
|
|
if(!m_bDevOpen)
|
|
|
{
|
|
|
SaveErrorInfo("设备未打开", Error_DevNotAvailable);
|
|
|
- //g_pLog->Print("ScanIDAndSaveImage(), 设备未打开, nRet=%d", Error_DevNotAvailable);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "ScanIDAndSaveImage(), 设备未打开, nRet=%d", Error_DevNotAvailable);
|
|
|
+ LogM("ScanIDAndSaveImage(), 设备未打开, nRet=%d", Error_DevNotAvailable);
|
|
|
return Error_DevNotAvailable;
|
|
|
}
|
|
|
-
|
|
|
memset(PhotoPath, 0, MAX_FILE_PATH);
|
|
|
std::string dllPath;
|
|
|
GetDllPathLocal(dllPath);
|
|
|
memcpy(PhotoPath, dllPath.c_str(), dllPath.length());
|
|
|
-
|
|
|
char FileNamefront[256] = {0};
|
|
|
char FileNameback[256] = {0};
|
|
|
-
|
|
|
strcpy_s(FileNamefront, PhotoPath);
|
|
|
strcat_s(FileNamefront, "idfront.bmp");
|
|
|
strcpy_s(FileNameback, PhotoPath);
|
|
|
strcat_s(FileNameback, "idback.bmp");
|
|
|
-
|
|
|
-
|
|
|
int nRet = m_cBS_ID81IDCImpl.StartScan(SecDeviceNum);
|
|
|
if (nRet != IDDIGITALCOPIER_NO_ERROR)
|
|
|
{
|
|
|
- ////////log
|
|
|
- /*fprintf(fp,"StartScan nRet = %d\n",nRet);
|
|
|
- fclose(fp);*/
|
|
|
- //////////////
|
|
|
SaveErrorInfo("通讯异常", Error_DevCommFailed);
|
|
|
- //g_pLog->Print("ScanIDAndSaveImage(), 通讯异常, nRet=%d", Error_DevCommFailed);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "ScanIDAndSaveImage(), 通讯异常, nRet=%d", Error_DevCommFailed);
|
|
|
+ LogM("ScanIDAndSaveImage(), 通讯异常, nRet=%d", Error_DevCommFailed);
|
|
|
return Error_DevCommFailed;
|
|
|
}
|
|
|
-
|
|
|
int iFrontLen;
|
|
|
int iRearLen;
|
|
|
- //------2019-09-06 V1.0.0.9---------改为与厂家DEMO相似,采用NEW方式申请数组空间;
|
|
|
+ //--------------改为与厂家DEMO相似,采用NEW方式申请数组空间;
|
|
|
char* cFrontImgBuf = new char[MAX_PICTURE_SIZE];
|
|
|
char* cRearImgBuf = new char[MAX_PICTURE_SIZE];
|
|
|
nRet=m_cBS_ID81IDCImpl.ReadCard(SecDeviceNum, cFrontImgBuf, cRearImgBuf, &iFrontLen, &iRearLen);
|
|
|
@@ -1665,15 +1458,9 @@ ErrorCodeEnum IDCerClassImpl::ScanIDAndSaveImage()
|
|
|
nRet = m_cBS_ID81IDCImpl.SaveToFile(SecDeviceNum, cFrontImgBuf, iFrontLen, FileNamefront, 1);
|
|
|
if (nRet != IDDIGITALCOPIER_NO_ERROR)
|
|
|
{
|
|
|
- ////////log
|
|
|
- /*fprintf(fp,"ReadCard nRet = %d\n",nRet);
|
|
|
- fclose(fp);*/
|
|
|
- //////////////
|
|
|
SaveErrorInfo("通讯异常", Error_DevCommFailed);
|
|
|
nRet = m_cBS_ID81IDCImpl.BackAndHoldCard(SecDeviceNum);
|
|
|
- //g_pLog->Print("ScanIDAndSaveImage(), 通讯异常, nRet=%d", Error_DevCommFailed);
|
|
|
- //------2019-09-06 V1.0.0.9---------改为与厂家DEMO相似,采用NEW方式申请数组空间;
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "ScanIDAndSaveImage(), 通讯异常, nRet=%d", Error_DevCommFailed);
|
|
|
+ LogM("ScanIDAndSaveImage(), 通讯异常, nRet=%d", Error_DevCommFailed);
|
|
|
delete []cFrontImgBuf;
|
|
|
delete []cRearImgBuf;
|
|
|
return Error_DevCommFailed;
|
|
|
@@ -1684,24 +1471,16 @@ ErrorCodeEnum IDCerClassImpl::ScanIDAndSaveImage()
|
|
|
nRet = m_cBS_ID81IDCImpl.SaveToFile(SecDeviceNum,cRearImgBuf,iRearLen,FileNameback,1);
|
|
|
if (nRet != IDDIGITALCOPIER_NO_ERROR)
|
|
|
{
|
|
|
- ////////log
|
|
|
- /*fprintf(fp,"SaveToFile nRet = %d\n",nRet);
|
|
|
- fclose(fp);*/
|
|
|
- //////////////
|
|
|
SaveErrorInfo("通讯异常", Error_DevCommFailed);
|
|
|
nRet = m_cBS_ID81IDCImpl.BackAndHoldCard(SecDeviceNum);
|
|
|
- //g_pLog->Print("ScanIDAndSaveImage(), 通讯异常, nRet=%d", Error_DevCommFailed);
|
|
|
- //------2019-09-06 V1.0.0.9---------改为与厂家DEMO相似,采用NEW方式申请数组空间;
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "ScanIDAndSaveImage(), 通讯异常, nRet=%d", Error_DevCommFailed);
|
|
|
+ LogM("ScanIDAndSaveImage(), 通讯异常, nRet=%d", Error_DevCommFailed);
|
|
|
delete []cFrontImgBuf;
|
|
|
delete []cRearImgBuf;
|
|
|
return Error_DevCommFailed;
|
|
|
}
|
|
|
}
|
|
|
nRet = m_cBS_ID81IDCImpl.BackAndHoldCard(SecDeviceNum);
|
|
|
- //g_pLog->Print("ScanIDAndSaveImage(), nRet=%d", Error_Succeed);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "ScanIDAndSaveImage(), nRet=%d", Error_Succeed);
|
|
|
- //------2019-09-06 V1.0.0.9---------改为与厂家DEMO相似,采用NEW方式申请数组空间;
|
|
|
+ LogM("ScanIDAndSaveImage(), nRet=%d", Error_Succeed);
|
|
|
delete []cFrontImgBuf;
|
|
|
delete []cRearImgBuf;
|
|
|
return Error_Succeed;
|
|
|
@@ -1709,14 +1488,12 @@ ErrorCodeEnum IDCerClassImpl::ScanIDAndSaveImage()
|
|
|
|
|
|
ErrorCodeEnum IDCerClassImpl::QueryCardPos(int &pos)
|
|
|
{
|
|
|
- //g_pLog->Print("QueryCardPos() Entry.");
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "QueryCardPos() Entry.");
|
|
|
- //return Error_NotImpl;
|
|
|
+ LOG_FUNCTION();
|
|
|
+ LogM("QueryCardPos() Entry.");
|
|
|
if(!m_bDevOpen)
|
|
|
{
|
|
|
SaveErrorInfo("设备未打开", Error_DevNotAvailable);
|
|
|
- //g_pLog->Print("QueryCardPos(), 设备未打开, nRet=%d", Error_DevNotAvailable);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "QueryCardPos(), 设备未打开, nRet=%d", Error_DevNotAvailable);
|
|
|
+ LogM("QueryCardPos(), 设备未打开, nRet=%d", Error_DevNotAvailable);
|
|
|
return Error_DevNotAvailable;
|
|
|
}
|
|
|
|
|
|
@@ -1727,8 +1504,7 @@ ErrorCodeEnum IDCerClassImpl::QueryCardPos(int &pos)
|
|
|
if (nRet != IDDIGITALCOPIER_NO_ERROR)
|
|
|
{
|
|
|
SaveErrorInfo("通讯异常", Error_DevCommFailed);
|
|
|
- //g_pLog->Print("QueryCardPos(), 通讯异常, nRet=%d", Error_DevCommFailed);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "QueryCardPos(), 通讯异常, nRet=%d", Error_DevCommFailed);
|
|
|
+ LogM("QueryCardPos(), 通讯异常, nRet=%d", Error_DevCommFailed);
|
|
|
return Error_DevCommFailed;
|
|
|
}
|
|
|
|
|
|
@@ -1737,26 +1513,22 @@ ErrorCodeEnum IDCerClassImpl::QueryCardPos(int &pos)
|
|
|
(m_DeviceStatus.iStatusScanSensorHaveCard ==0))
|
|
|
{
|
|
|
pos = 2;
|
|
|
- //g_pLog->Print("QueryCardPos(), pos=2, 证件在进卡口");
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "QueryCardPos(), pos=2, 证件在进卡口");
|
|
|
+ LogM("QueryCardPos(), pos=2, 证件在进卡口");
|
|
|
}
|
|
|
if ((m_DeviceStatus.iStatusMiddleSensorHaveCard == 1) ||
|
|
|
(m_DeviceStatus.iStatusScanSensorHaveCard ==1))
|
|
|
{
|
|
|
pos = 1;
|
|
|
- //g_pLog->Print("QueryCardPos(), pos=1, 证件在读卡器内部");
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "QueryCardPos(), pos=1, 证件在读卡器内部");
|
|
|
+ LogM("QueryCardPos(), pos=1, 证件在读卡器内部");
|
|
|
}
|
|
|
if ((m_DeviceStatus.iStatusInputSensorHaveCard == 0) &&
|
|
|
(m_DeviceStatus.iStatusMiddleSensorHaveCard == 0) &&
|
|
|
(m_DeviceStatus.iStatusScanSensorHaveCard ==0))
|
|
|
{
|
|
|
pos = 0;
|
|
|
- //g_pLog->Print("QueryCardPos(), pos=0, 未检测到任何证件");
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "QueryCardPos(), pos=0, 未检测到任何证件");
|
|
|
+ LogM("QueryCardPos(), pos=0, 未检测到任何证件");
|
|
|
}
|
|
|
- //g_pLog->Print("QueryCardPos(), nRet=%d", Error_Succeed);
|
|
|
- g_Trace.TraceInFormat(TRM_INT, TRM_LV_COMMN, "QueryCardPos(), nRet=%d", Error_Succeed);
|
|
|
+ LogM("QueryCardPos(), nRet=%d", Error_Succeed);
|
|
|
return Error_Succeed;
|
|
|
}
|
|
|
|
|
|
@@ -1764,6 +1536,7 @@ ErrorCodeEnum IDCerClassImpl::QueryCardPos(int &pos)
|
|
|
//Private
|
|
|
void IDCerClassImpl::SaveErrorInfo(CHAR* errMsg, int errCode)
|
|
|
{
|
|
|
+ LOG_FUNCTION();
|
|
|
memset(m_szErrMsg, 0, MAX_DEV_ERROR_MSG_LEN);
|
|
|
sprintf(m_szErrMsg, "%s[%d]", errMsg, errCode);
|
|
|
}
|
|
|
@@ -1799,10 +1572,6 @@ bool IDCerClassImpl::SH_DeleteFileOrDirectory(char *strFileName)
|
|
|
strcpy_s(strSrc, nLength+1, strFileName);
|
|
|
strSrc[nLength+1] = '\0';
|
|
|
|
|
|
- //QString trash_path = "/root/.local/share/Trash/files/%1"; //回收站路径
|
|
|
- //QFile file(strSrc);
|
|
|
- //bool ret = file.copy(trash_path.arg(strSrc)); // 复制文件到回收站
|
|
|
-
|
|
|
std::string trash_path="/root/.local/share/Trash/";
|
|
|
trash_path=trash_path+std::string(strSrc);
|
|
|
std::string commond="cp"+std::string(" ")+std::string(strSrc)+std::string(" ")+trash_path;
|