|
@@ -30,6 +30,18 @@ using namespace SP::Module::Comm;
|
|
|
#define IDCER_READ_TIMEOUT 10000
|
|
|
#define IDCER_AUTH_INTERVAL 300
|
|
|
|
|
|
+#ifdef DEVOPS_ON_ST /*DevOps流水线编译,ST环境*/
|
|
|
+#define IMAGE_DETECT_URL "https://carddetect.paasst.cmbchina.cn/api/card/image-detect";
|
|
|
+#elif defined(DEVOPS_ON_UAT)/*DevOps流水线编译,UAT环境*/
|
|
|
+#define IMAGE_DETECT_URL "https://carddetect.paasuat.cmbchina.cn/api/card/image-detect";
|
|
|
+#elif defined(DEVOPS_ON_PRD)/*DevOps流水线编译,PRD环境*/
|
|
|
+#define IMAGE_DETECT_URL "https://carddetect.paas.cmbchina.cn/api/card/image-detect";
|
|
|
+#elif defined(DEVOPS_ON_DEV)/*DevOps流水线编译,Dev&生产环境*/
|
|
|
+#define IMAGE_DETECT_URL "https://carddetect.paas.cmbchina.cn/api/card/image-detect";
|
|
|
+#else/*本地编译等非DevOps环境编译的版本*/
|
|
|
+#define IMAGE_DETECT_URL "https://carddetect.paasst.cmbchina.cn/api/card/image-detect";
|
|
|
+#endif
|
|
|
+
|
|
|
#ifdef RVC_OS_WIN
|
|
|
static const std::string base64_chars =
|
|
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
|
@@ -115,29 +127,7 @@ struct ImgChekTask : ITaskSp
|
|
|
//string encodeIn;
|
|
|
//Encode(imgIn, encodeIn); //传给服务端应base64编码
|
|
|
imgCheckReq.imageBase64 = encodeIn;
|
|
|
-
|
|
|
- CSmartPointer<IConfigInfo> spCtSettingConfig;
|
|
|
- m_fsm->GetEntityBase()->GetFunction()->OpenConfig(Config_CenterSetting, spCtSettingConfig);
|
|
|
- CSimpleStringA tUrl;
|
|
|
- spCtSettingConfig->ReadConfigValue("IDCertificate", "CardDetectUrl", tUrl);
|
|
|
-
|
|
|
- string m_url = tUrl.GetData();
|
|
|
- if (m_url.size() == 0)
|
|
|
- {
|
|
|
-#ifdef DEVOPS_ON_ST /*DevOps流水线编译,ST环境*/
|
|
|
- m_url = "https://carddetect.paasst.cmbchina.cn/api/card/image-detect";
|
|
|
-#elif defined(DEVOPS_ON_UAT)/*DevOps流水线编译,UAT环境*/
|
|
|
- m_url = "https://carddetect.paasuat.cmbchina.cn/api/card/image-detect";
|
|
|
-#elif defined(DEVOPS_ON_PRD)/*DevOps流水线编译,PRD环境*/
|
|
|
- m_url = "https://carddetect.paas.cmbchina.cn/api/card/image-detect";
|
|
|
-#elif defined(DEVOPS_ON_DEV)/*DevOps流水线编译,Dev&生产环境*/
|
|
|
- m_url = "https://carddetect.paas.cmbchina.cn/api/card/image-detect";
|
|
|
-#else/*本地编译等非DevOps环境编译的版本*/
|
|
|
- m_url = "https://carddetect.paasst.cmbchina.cn/api/card/image-detect";
|
|
|
-#endif
|
|
|
- }
|
|
|
-
|
|
|
- imgCheckReq.m_url = m_url;
|
|
|
+ imgCheckReq.m_url = m_fsm->checkImgURL;
|
|
|
long beg = GetTickCount();
|
|
|
bool ret = client->Post(imgCheckReq, imgCheckRet);
|
|
|
long end = GetTickCount();
|
|
@@ -167,8 +157,6 @@ void CIDCertFSM::s0_on_entry()
|
|
|
LOG_FUNCTION();
|
|
|
#ifdef RVC_OS_LINUX
|
|
|
m_devState = DEVICE_STATUS_NORMAL;
|
|
|
- //GetEntityBase()->GetFunction()->SetUserDefineState(IDCertificate_UserErrorCode_Status_Idle);
|
|
|
-
|
|
|
if (m_FirstStart) {
|
|
|
m_FirstStart = FALSE;
|
|
|
ToLogWarnInfoAboutTerm();
|
|
@@ -179,7 +167,6 @@ void CIDCertFSM::s0_on_entry()
|
|
|
m_logBefore = true;
|
|
|
}
|
|
|
m_devState = DEVICE_STATUS_NORMAL;
|
|
|
- //GetEntityBase()->GetFunction()->SetUserDefineState(IDCertificate_UserErrorCode_Status_Idle);
|
|
|
#endif
|
|
|
}
|
|
|
void CIDCertFSM::s0_on_exit()
|
|
@@ -188,7 +175,6 @@ void CIDCertFSM::s0_on_exit()
|
|
|
}
|
|
|
unsigned int CIDCertFSM::s0_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
- LOG_FUNCTION();
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("s0 evt %d",pEvt->iEvt);
|
|
|
switch (pEvt->iEvt)
|
|
|
{
|
|
@@ -227,7 +213,6 @@ unsigned int CIDCertFSM::s0_on_event(FSMEvent* pEvt)
|
|
|
void CIDCertFSM::s1_on_entry()
|
|
|
{
|
|
|
LOG_FUNCTION();
|
|
|
- //GetEntityBase()->GetFunction()->SetUserDefineState(IDCertificate_UserErrorCode_Status_Reading);
|
|
|
}
|
|
|
void CIDCertFSM::s1_on_exit()
|
|
|
{
|
|
@@ -235,7 +220,6 @@ void CIDCertFSM::s1_on_exit()
|
|
|
}
|
|
|
unsigned int CIDCertFSM::s1_on_event(FSMEvent *pEvt)
|
|
|
{
|
|
|
- LOG_FUNCTION();
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("s1 evt %d", pEvt->iEvt);
|
|
|
int ret = 0;
|
|
|
switch(pEvt->iEvt)
|
|
@@ -282,7 +266,6 @@ void CIDCertFSM::s2_on_entry()
|
|
|
{
|
|
|
LOG_FUNCTION();
|
|
|
m_devState = DEVICE_STATUS_FAULT;
|
|
|
- //GetEntityBase()->GetFunction()->SetUserDefineState(IDCertificate_UserErrorCode_Status_Failed);
|
|
|
m_testResult = Error_InvalidState;
|
|
|
}
|
|
|
void CIDCertFSM::s2_on_exit()
|
|
@@ -352,7 +335,6 @@ void CIDCertFSM::s5_on_exit()
|
|
|
}
|
|
|
unsigned int CIDCertFSM::s5_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
- LOG_FUNCTION();
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("s5 evt %d", pEvt->iEvt);
|
|
|
int ret = 0;
|
|
|
switch (pEvt->iEvt)
|
|
@@ -389,25 +371,8 @@ ErrorCodeEnum CIDCertFSM::GetVendorDllPath(CSimpleStringA &strPath)
|
|
|
{
|
|
|
strPath = "termb.dll";
|
|
|
return Error_Succeed;//oiltest
|
|
|
- CSimpleStringA strDepPath;
|
|
|
- ErrorCodeEnum Error = m_pEntity->GetFunction()->GetPath("Dep", strDepPath);
|
|
|
- if (Error == Error_Succeed) {
|
|
|
- strPath = "termb.dll";//CSimpleStringA::Format("%s\\mod_IDCertificate\\termb.dll", (LPCSTR)strDepPath);
|
|
|
- }
|
|
|
- return Error;
|
|
|
-}
|
|
|
-bool isnostr(const char *str)
|
|
|
-{
|
|
|
- int len = strlen(str);
|
|
|
- if (len == 0)
|
|
|
- return true;
|
|
|
- for (int i = 0; i < len; ++i)
|
|
|
- {
|
|
|
- if (*(str+i) != ' ')
|
|
|
- return false;
|
|
|
- }
|
|
|
- return true;
|
|
|
}
|
|
|
+
|
|
|
ErrorCodeEnum CIDCertFSM::OnInit()
|
|
|
{
|
|
|
ZeroMemory(m_devCatInfo.szModel, MAX_DEV_MODEL_LEN);
|
|
@@ -546,6 +511,10 @@ ErrorCodeEnum CIDCertFSM::OnInit()
|
|
|
{
|
|
|
closeImgCheck = TRUE;
|
|
|
}
|
|
|
+ checkImgURL = IMAGE_DETECT_URL;
|
|
|
+ CSimpleStringA tUrl;
|
|
|
+ spCtSettingConfig->ReadConfigValue("IDCertificate", "CardDetectUrl", tUrl);
|
|
|
+ if (!tUrl.IsNullOrEmpty()) { checkImgURL = tUrl.GetData(); }
|
|
|
|
|
|
return Error_Succeed;
|
|
|
}
|
|
@@ -608,7 +577,7 @@ void CIDCertFSM::LogDate(IDCerInfo idInfo)
|
|
|
CSimpleStringA errMsg;
|
|
|
if(Error_Succeed != eErrCode)
|
|
|
{
|
|
|
- errMsg = CSimpleStringA::Format("Invalid startDate");
|
|
|
+ errMsg = "Invalid startDate";
|
|
|
LogWarn(Severity_Middle, eErrCode, IDCertificate_UserErrorCode_InvalidStartDate, (const char*)errMsg);
|
|
|
DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)(errMsg);
|
|
|
}
|
|
@@ -616,7 +585,7 @@ void CIDCertFSM::LogDate(IDCerInfo idInfo)
|
|
|
eErrCode = CheckDate(idInfo.endDate.data);
|
|
|
if(Error_Succeed != eErrCode)
|
|
|
{
|
|
|
- CSimpleStringA errMsg = CSimpleStringA::Format("Invalid endDate");
|
|
|
+ errMsg = "Invalid endDate";
|
|
|
LogWarn(Severity_Middle, eErrCode, IDCertificate_UserErrorCode_InvalidEndDate, (const char*)errMsg);
|
|
|
DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)(errMsg);
|
|
|
}
|
|
@@ -624,19 +593,20 @@ void CIDCertFSM::LogDate(IDCerInfo idInfo)
|
|
|
eErrCode = CheckDate(idInfo.birthday.data);
|
|
|
if(Error_Succeed != eErrCode)
|
|
|
{
|
|
|
- CSimpleStringA errMsg = CSimpleStringA::Format("Invalid birthDate");
|
|
|
+ errMsg = "Invalid birthDate";
|
|
|
LogWarn(Severity_Middle, eErrCode, IDCertificate_UserErrorCode_InvalidBirthDate, (const char*)errMsg);
|
|
|
DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)(errMsg);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+//TODO: 上下两个函数重复程度太高,需要合并 [Gifur@2024925]
|
|
|
void CIDCertFSM::LogDateEx(IDCerInfoEx idInfo)
|
|
|
{
|
|
|
ErrorCodeEnum eErrCode = CheckDate(idInfo.startDate.data);
|
|
|
CSimpleStringA errMsg;
|
|
|
if(Error_Succeed != eErrCode)
|
|
|
{
|
|
|
- errMsg = CSimpleStringA::Format("Invalid startDate");
|
|
|
+ errMsg = "Invalid startDate";
|
|
|
LogWarn(Severity_Middle, eErrCode, IDCertificate_UserErrorCode_InvalidStartDate, (const char*)errMsg);
|
|
|
DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)(errMsg);
|
|
|
}
|
|
@@ -644,7 +614,7 @@ void CIDCertFSM::LogDateEx(IDCerInfoEx idInfo)
|
|
|
eErrCode = CheckDate(idInfo.endDate.data);
|
|
|
if(Error_Succeed != eErrCode)
|
|
|
{
|
|
|
- CSimpleStringA errMsg = CSimpleStringA::Format("Invalid endDate");
|
|
|
+ errMsg = "Invalid endDate";
|
|
|
LogWarn(Severity_Middle, eErrCode, IDCertificate_UserErrorCode_InvalidEndDate, (const char*)errMsg);
|
|
|
DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)(errMsg);
|
|
|
}
|
|
@@ -652,7 +622,7 @@ void CIDCertFSM::LogDateEx(IDCerInfoEx idInfo)
|
|
|
eErrCode = CheckDate(idInfo.birthday.data);
|
|
|
if(Error_Succeed != eErrCode)
|
|
|
{
|
|
|
- CSimpleStringA errMsg = CSimpleStringA::Format("Invalid birthDate");
|
|
|
+ errMsg = "Invalid birthDate";
|
|
|
LogWarn(Severity_Middle, eErrCode, IDCertificate_UserErrorCode_InvalidBirthDate, (const char*)errMsg);
|
|
|
DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)(errMsg);
|
|
|
}
|
|
@@ -1296,6 +1266,7 @@ ErrorCodeEnum CIDCertFSM::DeleteFileIfExisted(LPCTSTR fileName)
|
|
|
}
|
|
|
CSimpleStringA strPath, strAimPath;
|
|
|
ErrorCodeEnum erroCode = m_pEntity->GetFunction()->GetPath("Dep", strPath);
|
|
|
+ //TODO: 删除文件逻辑屏蔽系统差异 [Gifur@2024925]
|
|
|
#ifdef RVC_OS_LINUX
|
|
|
strAimPath = strPath + SPLIT_SLASH_STR + fileName;
|
|
|
if (ExistsFileA((LPCTSTR)strAimPath))
|
|
@@ -1344,11 +1315,10 @@ ErrorCodeEnum CIDCertFSM::GetDevCatInfo(DevCategoryInfo &devInfo, CSimpleStringA
|
|
|
if (m_getDevCategory != Error_Succeed)
|
|
|
return m_getDevCategory;
|
|
|
|
|
|
- LOG_FUNCTION();
|
|
|
strncpy(devInfo.szModel, m_devCatInfo.szModel, (MAX_DEV_MODEL_LEN > strlen(m_devCatInfo.szModel)) ? strlen(m_devCatInfo.szModel) + 1 : MAX_DEV_MODEL_LEN);
|
|
|
strncpy(devInfo.szType, m_devCatInfo.szType, (MAX_DEV_TYPE_LEN > strlen(m_devCatInfo.szType)) ? strlen(m_devCatInfo.szType) + 1 : MAX_DEV_TYPE_LEN);
|
|
|
strncpy(devInfo.szVendor, m_devCatInfo.szVendor, (MAX_DEV_VENDOR_LEN > strlen(m_devCatInfo.szVendor)) ? strlen(m_devCatInfo.szVendor) + 1 : MAX_DEV_VENDOR_LEN);
|
|
|
- devType = m_devVer;//适配器版本号
|
|
|
+ devType = m_adapterInfo.strVersion;//适配器版本号
|
|
|
return Error_Succeed;
|
|
|
}
|
|
|
|
|
@@ -1421,10 +1391,7 @@ int CIDCertFSM::Initial()
|
|
|
auto pEntity = GET_DEV_ENTITY_BASE_POINTER();
|
|
|
|
|
|
//to do device init
|
|
|
- ErrorCodeEnum err;
|
|
|
ErrorCodeEnum eErrDev;
|
|
|
- CSimpleStringA tmpVendor(""), tmpDevSN(""), tmpDLLVersion, csDepPath(""), csBackslash("\\");
|
|
|
-
|
|
|
CSmartPointer<IEntityFunction> spEntityFunction = GetEntityBase()->GetFunction();
|
|
|
CSmartPointer<IConfigInfo> spConfig;
|
|
|
eErrDev = spEntityFunction->OpenConfig(Config_Root, spConfig);
|
|
@@ -1435,7 +1402,6 @@ int CIDCertFSM::Initial()
|
|
|
return 2;
|
|
|
}
|
|
|
|
|
|
- m_devSN = "";
|
|
|
eErrDev = pEntity->LoadVendorLibName();
|
|
|
if (eErrDev != Error_Succeed) {
|
|
|
DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("get vendor dll(%s)name failed.", pEntity->GetVendorLibName().GetData());
|
|
@@ -1447,24 +1413,19 @@ int CIDCertFSM::Initial()
|
|
|
HARDWARE_ENTITY_SET_VENDOR_NAME(m_entCode, m_adapterInfo.strVendor);
|
|
|
|
|
|
pEntity->InitializeVendorLogSwitch();
|
|
|
-
|
|
|
- spConfig->ReadConfigValue("Device.IDCertificate", "Vendor", m_devVendor);
|
|
|
- spConfig->ReadConfigValue("Device.IDCertificate", "Version", m_devVer);
|
|
|
- spConfig->ReadConfigValue("Device.IDCertificate", "Batch", m_devBatch);
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)
|
|
|
- ("Vendor=%s#Version=%s#Batch=%s", (const char*)m_devVendor, (const char*)m_devVer, (const char*)m_devBatch);
|
|
|
-
|
|
|
+ ("Vendor=%s#Version=%s#Batch=%s", (const char*)m_adapterInfo.strVendor, (const char*)m_adapterInfo.strVersion, (const char*)m_adapterInfo.strBatch);
|
|
|
eErrDev = m_hDevHelper.LoadUp(m_adapterInfo.adapterFilePath);
|
|
|
if (!IS_SUCCEED(eErrDev)) {
|
|
|
LogWarn(Severity_Middle, Error_Unexpect, IDCertificate_UserErrorCode_DllLoadFailed,
|
|
|
- CSimpleStringA::Format("身份证加载厂商适配器失败!GLE=%d.", GetLastError()).GetData());
|
|
|
+ CSimpleStringA::Format("身份证加载厂商适配器失败!GLE=%d.", GetLastError()));
|
|
|
m_bOpening = false;
|
|
|
return 2;
|
|
|
}
|
|
|
|
|
|
DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("IDCer open with port %d", m_adapterInfo.GetPortInt());
|
|
|
m_ullBeginTime = SP::Module::Comm::RVCGetTickCount();
|
|
|
- err = m_hDevHelper->DevOpen(m_adapterInfo.GetPortInt());
|
|
|
+ ErrorCodeEnum err = m_hDevHelper->DevOpen(m_adapterInfo.GetPortInt());
|
|
|
m_ullEndTime = SP::Module::Comm::RVCGetTickCount();
|
|
|
m_bOpening = false;
|
|
|
if (err == Error_Succeed)
|