|
@@ -63,6 +63,7 @@ void CContactlessCardFSM::s1_on_entry()
|
|
|
void CContactlessCardFSM::s1_on_exit()
|
|
|
{
|
|
|
LOG_FUNCTION();
|
|
|
+
|
|
|
}
|
|
|
unsigned int CContactlessCardFSM::s1_on_event(FSMEvent* event)
|
|
|
{
|
|
@@ -96,7 +97,7 @@ void CContactlessCardFSM::s2_on_exit()
|
|
|
}
|
|
|
unsigned int CContactlessCardFSM::s2_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("s2 evt(%d)",pEvt->iEvt);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("s2 evt(%d)",pEvt->iEvt);
|
|
|
int ret = 0;
|
|
|
switch(pEvt->iEvt)
|
|
|
{
|
|
@@ -195,7 +196,7 @@ void CContactlessCardFSM::s3_on_exit()
|
|
|
}
|
|
|
unsigned int CContactlessCardFSM::s3_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("s3 evt (%d)(%d)",pEvt->iEvt,pEvt->param1);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("s3 evt (%d,%d)",pEvt->iEvt,pEvt->param1);
|
|
|
int ret = 0;
|
|
|
switch(pEvt->iEvt)
|
|
|
{
|
|
@@ -255,7 +256,7 @@ void CContactlessCardFSM::s4_on_exit()
|
|
|
}
|
|
|
unsigned int CContactlessCardFSM::s4_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("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){
|
|
|
case USER_EVT_ACCEPT:
|
|
|
{
|
|
@@ -343,7 +344,7 @@ void CContactlessCardFSM::s5_on_exit()
|
|
|
}
|
|
|
unsigned int CContactlessCardFSM::s5_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("s5 event(%d)",pEvt->iEvt);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("s5 event(%d)",pEvt->iEvt);
|
|
|
switch(pEvt->iEvt)
|
|
|
{
|
|
|
|
|
@@ -378,7 +379,7 @@ void CContactlessCardFSM::s6_on_exit()
|
|
|
}
|
|
|
unsigned int CContactlessCardFSM::s6_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("s6 evt(%d,%d)",pEvt->iEvt,pEvt->param1);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("s6 evt(%d,%d)",pEvt->iEvt,pEvt->param1);
|
|
|
int ret = 0;
|
|
|
switch(pEvt->iEvt)
|
|
|
{
|
|
@@ -408,7 +409,7 @@ void CContactlessCardFSM::s7_on_exit()
|
|
|
}
|
|
|
unsigned int CContactlessCardFSM::s7_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("s7 evt(%d)",pEvt->iEvt);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("s7 evt(%d)",pEvt->iEvt);
|
|
|
switch(pEvt->iEvt)
|
|
|
{
|
|
|
case USER_EVT_WAITFINISHED:
|
|
@@ -418,7 +419,7 @@ unsigned int CContactlessCardFSM::s7_on_event(FSMEvent* pEvt)
|
|
|
FetchCard evt;
|
|
|
evt.status = 0;
|
|
|
SpSendBroadcast(m_pEntity->GetFunction(),SP_MSG_OF(FetchCard),SP_MSG_SIG_OF(FetchCard),evt);
|
|
|
- LogEvent(Severity_Middle,LOG_EVT_CONTACTLESS_CARD_OP,"CardIssuer op.");
|
|
|
+ LogEvent(Severity_Middle,LOG_EVT_CONTACTLESS_CARD_OP,"ContactlessCard op.");
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("客户取走卡片msg发送");
|
|
|
return 0;
|
|
|
} else if (pEvt->param1 == 1) {
|
|
@@ -467,7 +468,7 @@ void CContactlessCardFSM::s8_on_exit()
|
|
|
}
|
|
|
unsigned int CContactlessCardFSM::s8_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("s8 evt(%d)",pEvt->iEvt);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("s8 evt(%d)",pEvt->iEvt);
|
|
|
if (pEvt->iEvt == USER_EVT_CAPTUREFINISHED){
|
|
|
pEvt->SetHandled();
|
|
|
int err = pEvt->param1;
|
|
@@ -492,7 +493,7 @@ void CContactlessCardFSM::s9_on_entry()
|
|
|
}
|
|
|
else {
|
|
|
m_testResult = Error_InvalidState;
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("device is fault, wait for restart entity");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("device is fault, wait for restart entity");
|
|
|
}
|
|
|
}
|
|
|
void CContactlessCardFSM::s9_on_exit()
|
|
@@ -501,7 +502,7 @@ void CContactlessCardFSM::s9_on_exit()
|
|
|
}
|
|
|
unsigned int CContactlessCardFSM::s9_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("s9 evt(%d)(%d)",pEvt->iEvt, pEvt->param1);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("s9 evt(%d)(%d)",pEvt->iEvt, pEvt->param1);
|
|
|
switch(pEvt->iEvt)
|
|
|
{
|
|
|
case USER_EVT_RESET:
|
|
@@ -563,7 +564,7 @@ void CContactlessCardFSM::s10_on_exit()
|
|
|
|
|
|
unsigned int CContactlessCardFSM::s10_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("s10 event(%d)", pEvt->iEvt);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("s10 event(%d)", pEvt->iEvt);
|
|
|
int ret = 0;
|
|
|
switch (pEvt->iEvt)
|
|
|
{
|
|
@@ -613,7 +614,7 @@ void CContactlessCardFSM::s11_on_exit()
|
|
|
|
|
|
unsigned int CContactlessCardFSM::s11_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("s11 event(%d)", pEvt->iEvt);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("s11 event(%d)", pEvt->iEvt);
|
|
|
int ret = 0;
|
|
|
switch (pEvt->iEvt)
|
|
|
{
|
|
@@ -640,6 +641,7 @@ unsigned int CContactlessCardFSM::s11_on_event(FSMEvent* pEvt)
|
|
|
ErrorCodeEnum CContactlessCardFSM::OnInit()
|
|
|
{
|
|
|
LOG_FUNCTION();
|
|
|
+ AddStateHooker(this);
|
|
|
|
|
|
auto pEntity = GET_DEV_ENTITY_BASE_POINTER();
|
|
|
pEntity->InitializeVendorLogSwitch();
|
|
@@ -648,7 +650,7 @@ ErrorCodeEnum CContactlessCardFSM::OnInit()
|
|
|
m_pCardProcess = new CCardProcess();
|
|
|
if (m_pCardProcess == NULL)//almost no use...
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("create card process failed.");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA2J19")("create card process failed.");
|
|
|
return Error_Resource;
|
|
|
}
|
|
|
|
|
@@ -662,7 +664,7 @@ ErrorCodeEnum CContactlessCardFSM::OnInit()
|
|
|
|
|
|
if (errCode != Error_Succeed)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Load failed(%d).",errCode);
|
|
|
+ //DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Load failed(%d).",errCode);
|
|
|
SetDevInitFlag(false);//打开失败
|
|
|
}
|
|
|
devStatus.eMediaPos = CI_MEDIA_NOTPRESENT;
|
|
@@ -679,7 +681,7 @@ ErrorCodeEnum CContactlessCardFSM::OnExit()
|
|
|
l_beginTime = SP::Module::Comm::RVCGetTickCount();
|
|
|
eExit = m_hDevHelper->GetDevStatus(devStatus);
|
|
|
l_endTime = SP::Module::Comm::RVCGetTickCount();
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("OnExit::GetDevStatus eMedia:%d, eErr:%d", devStatus.eMediaPos, eExit);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("OnExit::GetDevStatus eMedia:%d, eErr:%d", devStatus.eMediaPos, eExit);
|
|
|
if (eExit == Error_Succeed)
|
|
|
{
|
|
|
if (devStatus.eMediaPos == CI_MEDIA_PRESENT){
|
|
@@ -692,8 +694,7 @@ ErrorCodeEnum CContactlessCardFSM::OnExit()
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::DevClose").setCostTime(l_endTime - l_beginTime)("读卡器关闭成功");
|
|
|
}
|
|
|
else{
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("读卡器关闭失败");
|
|
|
- SetErrorAndLog(eExit, MEC_DEVAPI_RF_DevClose, "DevAdapter::DevClose", __FUNCTION__, false, l_endTime - l_beginTime, "", "");
|
|
|
+ SetErrorAndLog(eExit, MEC_DEVAPI_RF_DevClose, "DevAdapter::DevClose", __FUNCTION__, false, l_endTime - l_beginTime, "", "读卡器关闭失败");
|
|
|
}
|
|
|
}
|
|
|
FSMImpl<CContactlessCardFSM>::OnExit();
|
|
@@ -715,7 +716,7 @@ ErrorCodeEnum CContactlessCardFSM::Load()
|
|
|
ErrorCodeEnum eErrPath = GetEntityBase()->GetFunction()->GetPath("Bin", csBinPath);
|
|
|
if (eErrPath != Error_Succeed)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Load, GetBasePath failed (%d).",eErrPath);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Load, GetBasePath failed (%d).",eErrPath);
|
|
|
return Error_Param;
|
|
|
}
|
|
|
LogWarn(Severity_Low, Error_Unexpect, ContactlessCard_UserErrorCode_RootInfo, m_adapterInfo.adapterFilePath.GetData());
|
|
@@ -726,12 +727,10 @@ ErrorCodeEnum CContactlessCardFSM::Load()
|
|
|
}
|
|
|
|
|
|
do{
|
|
|
-
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("open card issuer, port:%d, baudRate:%d", m_adapterInfo.GetPortInt(), m_adapterInfo.GetBaudrateInt());
|
|
|
+
|
|
|
l_beginTime = SP::Module::Comm::RVCGetTickCount();
|
|
|
hr = m_hDevHelper->DevOpen(m_adapterInfo.GetPortInt(), m_adapterInfo.GetBaudrateInt());
|
|
|
l_endTime = SP::Module::Comm::RVCGetTickCount();
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("port:%d, baudRate:%d, hr:%d",m_adapterInfo.GetPortInt(), m_adapterInfo.GetBaudrateInt(), hr);
|
|
|
|
|
|
if (hr == Error_Succeed)
|
|
|
{
|
|
@@ -747,7 +746,7 @@ ErrorCodeEnum CContactlessCardFSM::Load()
|
|
|
|
|
|
if(eErrDev == Error_Succeed)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::GetDevCategory").setCostTime(l_endTime - l_beginTime)("OpenDevice, szVendor:%s, szType:%s, szModel:%s",m_devCatInfo.szVendor, m_devCatInfo.szType, m_devCatInfo.szModel);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::GetDevCategory").setCostTime(l_endTime - l_beginTime)("OpenDevice::GetDevCategory");
|
|
|
m_adapterInfo.FulfillCategoryInfo(m_devCatInfo);
|
|
|
}
|
|
|
else
|
|
@@ -755,69 +754,21 @@ ErrorCodeEnum CContactlessCardFSM::Load()
|
|
|
SetErrorAndLog(eErrDev, MEC_DEVAPI_RF_GetDevCategory, "DevAdapter::GetDevCategory", __FUNCTION__, false, l_endTime - l_beginTime, "", "");
|
|
|
return Error_DevCommFailed;
|
|
|
}
|
|
|
-//#ifdef RVC_OS_WIN
|
|
|
-// CSimpleStringA csCMBPrint("CMBPrint.dll");
|
|
|
-// csCMBPrint = csBinPath + csBackslash + csCMBPrint;
|
|
|
-// DbgInfo(CSimpleStringA::Format("cmbpath %s", (LPCTSTR)csCMBPrint));
|
|
|
-// HMODULE hr = LoadLibraryA(csCMBPrint);
|
|
|
-// if (hr == NULL)
|
|
|
-// {
|
|
|
-// DbgWarn(CSimpleStringA::Format("Load CMBPrint failed(%d).", hr));
|
|
|
-// return Error_DevLoadFileFailed;
|
|
|
-// }
|
|
|
-// if ((cmdDecodeMag2 = (lpCMBdecodeMag2)GetProcAddress(hr, "CMBdecodeMag2")) == NULL)
|
|
|
-// {
|
|
|
-// DbgWarn("Get Mag2 address failed.");
|
|
|
-// return Error_DevLoadFileFailed;
|
|
|
-// }
|
|
|
-// if ((cmdDecodeEx = (lpCMBdecodeEx)GetProcAddress(hr, "CMBdecodeEx")) == NULL)
|
|
|
-// {
|
|
|
-// DbgWarn("Get Mag23Ex address failed.");
|
|
|
-// return Error_DevLoadFileFailed;
|
|
|
-// }
|
|
|
-// initTries = 0;
|
|
|
-// break;
|
|
|
-//#else
|
|
|
-// CSimpleStringA csCMBPrint("libCMBPrint.so");
|
|
|
-// csCMBPrint = CSimpleStringA::Format("%s" SPLIT_SLASH_STR "%s",
|
|
|
-// csBinPath.GetData(), csCMBPrint.GetData());
|
|
|
-// DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("cmbpath %s", csCMBPrint.GetData());
|
|
|
-//
|
|
|
-// toolkit_lib_t dlOpen;
|
|
|
-// int res = toolkit_dlopen(csCMBPrint, &dlOpen);
|
|
|
-// if (res != 0) {
|
|
|
-// DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("Load CMBPrint failed with error %s.", toolkit_dlerror(&dlOpen));
|
|
|
-// return Error_DevLoadFileFailed;
|
|
|
-// }
|
|
|
-//
|
|
|
-// if ((res = toolkit_dlsym(&dlOpen, "CMBdecodeMag2", (void**)&cmdDecodeMag2)) != 0) {
|
|
|
-// DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("Get Mag2 address failed.");
|
|
|
-// return Error_DevLoadFileFailed;
|
|
|
-// }
|
|
|
-//
|
|
|
-// if ((res = toolkit_dlsym(&dlOpen, "CMBdecodeEx", (void**)&cmdDecodeEx)) != 0) {
|
|
|
-// DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("Get Mag23Ex address failed.");
|
|
|
-// return Error_DevLoadFileFailed;
|
|
|
-// }
|
|
|
-//
|
|
|
-// initTries = 0;
|
|
|
-// break;
|
|
|
-//#endif // RVC_OS_WIN
|
|
|
|
|
|
if (!LoadCMBPrint(csBinPath))
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Contactless 启动失败:Load CMBPrint failed.");
|
|
|
- //LogWarn(Severity_Middle, Error_Unexpect, CardIssuer_UserErrorCode_LoadLibraryA_CMBPrint_Failed, errMsg.GetData());
|
|
|
+ errMsg = CSimpleStringA::Format("Contactless 启动失败:Load CMBPrint failed.");
|
|
|
+ LogWarn(Severity_Middle, Error_Unexpect, ContactlessCard_UserErrorCode_DllLoadFailed, errMsg.GetData());
|
|
|
return Error_DevLoadFileFailed;
|
|
|
}
|
|
|
initTries = 0;
|
|
|
break;
|
|
|
|
|
|
} else {
|
|
|
-
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("ContactlessCard DevOpen failed , dwPort:%d, dwBaudRate:%d", m_adapterInfo.GetPortInt(), m_adapterInfo.GetBaudrateInt());
|
|
|
- SetErrorAndLog(hr, MEC_DEVAPI_RF_DevOpen, "DevAdapter::DevOpen", __FUNCTION__, false, l_endTime - l_beginTime, "", "");
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("ContactlessCard 启动失败:DevOpen failed.重试:%d", initTries);
|
|
|
+ //DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("ContactlessCard DevOpen failed ,重试:%d, dwPort:%d, dwBaudRate:%d", initTries, m_adapterInfo.GetPortInt(), m_adapterInfo.GetBaudrateInt());
|
|
|
+ CSimpleStringA errmsg = CSimpleStringA::Format("ContactlessCard DevOpen failed ,重试:%d, dwPort:%d, dwBaudRate:%d", initTries, m_adapterInfo.GetPortInt(), m_adapterInfo.GetBaudrateInt());
|
|
|
+ SetErrorAndLog(hr, MEC_DEVAPI_RF_DevOpen, "DevAdapter::DevOpen", __FUNCTION__, false, l_endTime - l_beginTime, "", errmsg.GetData());
|
|
|
+ //DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("ContactlessCard 启动失败:DevOpen failed.重试:%d", initTries);
|
|
|
initTries++;
|
|
|
}
|
|
|
} while (initTries < INIT_TRY_NUM);
|
|
@@ -834,47 +785,17 @@ ErrorCodeEnum CContactlessCardFSM::Load()
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- eErrDev = spEntityFunction->OpenConfig(Config_Run, spConfig);
|
|
|
- if (eErrDev != Error_Succeed) {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Load, open run cfg file failed!");
|
|
|
- return eErrDev;
|
|
|
- }
|
|
|
- int ret = 0,isIssue = 0;
|
|
|
- if ((spConfig->ReadConfigValueInt("RunInfo","CardRemains",m_CardRemains) == Error_Succeed)
|
|
|
- && (spConfig->ReadConfigValueInt("RunInfo","CardIssued",m_CardIssued) == Error_Succeed)
|
|
|
- && (spConfig->ReadConfigValueInt("RunInfo","CardCaptured",m_CardCaptured) == Error_Succeed)
|
|
|
- && (spConfig->ReadConfigValueInt("RunInfo","IsIssue",isIssue) == Error_Succeed)
|
|
|
- && (spConfig->ReadConfigValueInt("RunInfo","CardMixed",m_CardMixed) == Error_Succeed)
|
|
|
- && (spConfig->ReadConfigValueInt("RunInfo","CardInit",m_CardInit) == Error_Succeed)
|
|
|
- && (spConfig->ReadConfigValueInt("RunInfo","CardPercent",m_CardPercent) == Error_Succeed))
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("CardRemains:%d, m_CardIssued:%d, CardCaptured:%d, isIssue:%d, CardMixed:%d, CardInit:%d",
|
|
|
- m_CardRemains, m_CardIssued, m_CardCaptured, isIssue, m_CardMixed, m_CardInit);
|
|
|
- m_bIssued = !!(isIssue);
|
|
|
- //ret = UnAcceptCard();
|
|
|
- }
|
|
|
- else
|
|
|
- return Error_IO;
|
|
|
- if (ret == 0)
|
|
|
- {
|
|
|
- m_devInit = true;
|
|
|
- LogWarn(Severity_Low, Error_Unexpect, ContactlessCard_UserErrorCode_DevOpen_Success, "非接读卡器打开成功");
|
|
|
- return Error_Succeed;
|
|
|
- }
|
|
|
- else{
|
|
|
- LogWarn(Severity_Middle, Error_Unexpect, ContactlessCard_UserErrorCode_DevOpen_Failed, "非接读卡器打开失败1");
|
|
|
- return Error_Unexpect;
|
|
|
- }
|
|
|
+ m_devInit = true;
|
|
|
+ LogWarn(Severity_Low, Error_Unexpect, ContactlessCard_UserErrorCode_DevOpen_Success, "非接读卡器打开成功");
|
|
|
+ return Error_Succeed;
|
|
|
}
|
|
|
}
|
|
|
int CContactlessCardFSM::Initial()
|
|
|
{
|
|
|
if (!m_bOpened) {
|
|
|
m_bNeedReset = false;
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Initial,ret = 1");
|
|
|
return 1;//故障模式
|
|
|
}
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Initial,ret = 0");
|
|
|
return 0;
|
|
|
}
|
|
|
bool CContactlessCardFSM::GetDevStatus(bool bPrint)
|
|
@@ -886,22 +807,28 @@ bool CContactlessCardFSM::GetDevStatus(bool bPrint)
|
|
|
l_beginTime = SP::Module::Comm::RVCGetTickCount();
|
|
|
eErr = m_hDevHelper->GetDevStatus(devStatus);
|
|
|
l_endTime = SP::Module::Comm::RVCGetTickCount();
|
|
|
- if (bPrint)
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("GetDevStatus eMedia:%d, eErr:%d", devStatus.eMediaPos, eErr);
|
|
|
+ //if (bPrint)
|
|
|
+ // DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("GetDevStatus eMedia:%d, eErr:%d", devStatus.eMediaPos, eErr);
|
|
|
if (Error_Succeed == eErr) {
|
|
|
+ if (bPrint) {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::GetDevStatus").setCostTime(l_endTime - l_beginTime)("GetDevStatus eMedia:%d", devStatus.eMediaPos);
|
|
|
+ }
|
|
|
return true;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- DevErrorInfo devErrInfo;
|
|
|
- m_hDevHelper->GetLastErr(devErrInfo);
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("GetDevStatus, errMsg:%s",devErrInfo.szErrMsg);
|
|
|
+ //DevErrorInfo devErrInfo;
|
|
|
+ //m_hDevHelper->GetLastErr(devErrInfo);
|
|
|
+ //DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("GetDevStatus, errMsg:%s",devErrInfo.szErrMsg);
|
|
|
+ if (bPrint) {
|
|
|
+ SetErrorAndLog(eErr, MEC_DEVAPI_RF_GetDevStatus, "DevAdapter::GetDevStatus", __FUNCTION__, false, l_endTime - l_beginTime, "", "");
|
|
|
+ }
|
|
|
getDevInfoCount++;
|
|
|
Sleep(3000);
|
|
|
}
|
|
|
} while (getDevInfoCount < GET_DEV_STATUS_COUNT);
|
|
|
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("getdevstatus to reset");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("get devstatus to reset");
|
|
|
eErr = m_hDevHelper->Reset();
|
|
|
Sleep(MAX_RESET_TIMEROUT);
|
|
|
if (eErr == Error_Succeed)
|
|
@@ -1038,15 +965,14 @@ int CContactlessCardFSM::AcceptCard(SpReqAnsContext<ContactlessCardService_Inser
|
|
|
LogEvent(Severity_Middle,LOG_EVT_CONTACTLESS_CARD_GREEN_ON,"ContactCard green on");
|
|
|
m_bWaitAccepteMore = false;
|
|
|
int rc = InternalAcceptCard();
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("InternalAcceptCard ret:%d", rc);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("InternalAcceptCard ret:%d", rc);
|
|
|
LogEvent(Severity_Middle,LOG_EVT_CONTACTLESS_CARD_GREEN_OFF,"ContactCard green off");
|
|
|
if (rc == 0) {
|
|
|
- //FSMSetIssueFlag(false);
|
|
|
if (ctx != NULL)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("insert error_succeed");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("insert error_succeed");
|
|
|
//FetchCard evt;
|
|
|
- //evt.status = 3;//oilyang@20181210 用于通知CardIssuer取消插卡
|
|
|
+ //evt.status = 3;//oilyang@20181210 用于通知卡机取消插卡
|
|
|
//SpSendBroadcast(m_pEntity->GetFunction(), SP_MSG_OF(FetchCard), SP_MSG_SIG_OF(FetchCard), evt);
|
|
|
|
|
|
ctx->Ans.ICData = "";
|
|
@@ -1056,7 +982,7 @@ int CContactlessCardFSM::AcceptCard(SpReqAnsContext<ContactlessCardService_Inser
|
|
|
int retDetectAndRead = -1;
|
|
|
if (!ctx->Req.aid.IsNullOrEmpty())
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("front business provide aid:[%s]",(const char*)ctx->Req.aid);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("front business provide aid:[%s]",(const char*)ctx->Req.aid);
|
|
|
CAutoArray<CSimpleStringA> aidReq;
|
|
|
aidReq.Init(1);
|
|
|
aidReq[0] = ctx->Req.aid;
|
|
@@ -1100,7 +1026,7 @@ int CContactlessCardFSM::AcceptCard(SpReqAnsContext<ContactlessCardService_Inser
|
|
|
string t2ICAccount(""),t2ICCardSerial(""),t2ICCVC(""),t2ICTrack2(""),cardType;
|
|
|
if (m_pCardProcess->FindTagValue(TAG_VECTOR_IC,track2,false,0) == -1)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("no track2 data in ic");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("no track2 data in ic");
|
|
|
|
|
|
l_beginTime = SP::Module::Comm::RVCGetTickCount();
|
|
|
eErr = m_hDevHelper->HaltCard();
|
|
@@ -1140,21 +1066,23 @@ int CContactlessCardFSM::AcceptCard(SpReqAnsContext<ContactlessCardService_Inser
|
|
|
}
|
|
|
else if(rc == 2)
|
|
|
{
|
|
|
- if (ctx != NULL)
|
|
|
+ if (ctx != NULL) {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("AcceptCard, insert timeout");
|
|
|
ctx->Answer(Error_TimeOut);
|
|
|
+ }
|
|
|
}
|
|
|
else if(rc == 3 || rc == 4)
|
|
|
{
|
|
|
if (ctx != NULL)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("insert cancel (%d)",rc);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("AcceptCard, insert cancel");
|
|
|
ctx->Answer(Error_Cancel);
|
|
|
}
|
|
|
}else
|
|
|
{
|
|
|
//oilyang@20221212
|
|
|
//actully,we reach here only when calling GetDevStatus failed
|
|
|
- //we have ContactlessCard AND CardIssuer,no need to throw Error_Unexpect here
|
|
|
+ //we have ContactlessCard AND 卡机,no need to throw Error_Unexpect here
|
|
|
if (ctx != NULL)
|
|
|
ctx->Answer(Error_DevNotAvailable);
|
|
|
}
|
|
@@ -1180,9 +1108,16 @@ static CSimpleStringA GetStrData(TrackInfo trackInfo)
|
|
|
|
|
|
int CContactlessCardFSM::SplitTrack2(CSimpleStringA pTrack2,Track2Data &decodeData)
|
|
|
{
|
|
|
- if (pTrack2.GetLength() == 0)
|
|
|
- return -1;
|
|
|
+ LOG_FUNCTION();
|
|
|
+
|
|
|
int dataLen = strlen(pTrack2);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("<SplitTrack2>, pTrack2.len:%d", dataLen);
|
|
|
+
|
|
|
+ if (pTrack2.GetLength() == 0) {
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA2J1A")("<SplitTrack2>, pTrack2.len=0");
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
+
|
|
|
switch(dataLen)
|
|
|
{
|
|
|
case 28:
|
|
@@ -1207,8 +1142,10 @@ int CContactlessCardFSM::SplitTrack2(CSimpleStringA pTrack2,Track2Data &decodeDa
|
|
|
decodeData.t2Region = "";
|
|
|
break;
|
|
|
case 38:
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("<SplitTrack2>, pTrack2.len=38 Not implemented ");
|
|
|
break;
|
|
|
default:
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("<SplitTrack2>, pTrack2.len=%d Not implemented ", dataLen);
|
|
|
return -1;
|
|
|
}
|
|
|
decodeData.status = 0;
|
|
@@ -1219,7 +1156,6 @@ int CContactlessCardFSM::PreOnline(SpReqAnsContext<ContactlessCardService_PreOnl
|
|
|
LOG_FUNCTION();
|
|
|
long l_beginTime, l_endTime;
|
|
|
m_pCardProcess->DataInit();
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("<PreOnline>, bus data[%s]", ctx->Req.businessData.GetData());
|
|
|
m_pCardProcess->SplitBusinessData(ctx->Req.businessData,ctx->Req.businessData.GetLength());
|
|
|
m_pCardProcess->SplitBusinessData("DF690101",strlen("DF690101"));
|
|
|
int activeCardType;
|
|
@@ -1228,7 +1164,7 @@ int CContactlessCardFSM::PreOnline(SpReqAnsContext<ContactlessCardService_PreOnl
|
|
|
ICData aidFromBus(false, 0x4f, 0x00);
|
|
|
if (m_pCardProcess->FindTagValue(TAG_VECTOR_BUS, aidFromBus, false, 0) == -1)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("the front BusinessData han't provide aid data.");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("the front BusinessData han't provide aid data.");
|
|
|
retDetectAndRead = m_pCardProcess->DetectAndReadICData(CARD_MACHINE_RFIC, m_hDevHelper, m_aidList, activeCardType);
|
|
|
|
|
|
}
|
|
@@ -1277,7 +1213,9 @@ int CContactlessCardFSM::PreOnline(SpReqAnsContext<ContactlessCardService_PreOnl
|
|
|
CSimpleStringA taaResult;
|
|
|
BYTE bt9f27 = 0;
|
|
|
int retTAA = m_pCardProcess->TermActionAnalyze(CARD_MACHINE_RFIC,m_hDevHelper,taaResult,true,m_bCDA,bt9f27);
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("TermActionAnalyze %d",retTAA);
|
|
|
+ if (retTAA != 0) {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("<PreOnline>, TermActionAnalyze , retTAA:%d, taaResult:%s", retTAA, taaResult.GetData());
|
|
|
+ }
|
|
|
switch(retTAA)
|
|
|
{//to be added oiltest 20140929
|
|
|
case -1: //some data may be wrong
|
|
@@ -1290,19 +1228,15 @@ int CContactlessCardFSM::PreOnline(SpReqAnsContext<ContactlessCardService_PreOnl
|
|
|
break;
|
|
|
}
|
|
|
ctx->Ans.result = taaResult;
|
|
|
- // Dbg("[%d,%d,%d,%d]",m_TVR[0],m_TVR[1],m_TVR[2],m_TVR[3]);
|
|
|
- //}
|
|
|
+
|
|
|
if (ctx->Ans.result.GetLength() == 0)
|
|
|
{
|
|
|
ctx->Answer(Error_Succeed);
|
|
|
return 0;
|
|
|
}
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("<PreOnline>, term action analyze result[%s]",(const char*)ctx->Ans.result);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("<PreOnline>, term action analyze result[%s]",(const char*)ctx->Ans.result);
|
|
|
+
|
|
|
|
|
|
- //char tmpResult[1024,]result[1024];
|
|
|
- //ZeroMemory(tmpResult,sizeof(tmpResult));
|
|
|
- //ZeroMemory(result,sizeof(result));
|
|
|
- //memcpy(tmpResult,ctx->Ans.result,ctx->Ans.result.GetLength());
|
|
|
string tmpResult, actionType, result = "", baseICData = "";
|
|
|
tmpResult = ctx->Ans.result;
|
|
|
char *pSomeICData = new char[1024];
|
|
@@ -1322,7 +1256,7 @@ int CContactlessCardFSM::PreOnline(SpReqAnsContext<ContactlessCardService_PreOnl
|
|
|
ICData appExpiryDate(false,0x5f,0x24);
|
|
|
if (m_pCardProcess->FindTagValue(TAG_VECTOR_IC,appExpiryDate,false,0) == -1)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("can't find expire date");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA2J1B")("can't find expire date");
|
|
|
return 0;
|
|
|
}
|
|
|
char *pExpireDate = new char[12];
|
|
@@ -1335,7 +1269,7 @@ int CContactlessCardFSM::PreOnline(SpReqAnsContext<ContactlessCardService_PreOnl
|
|
|
ZeroMemory(pICCardSerial,4);
|
|
|
if (m_pCardProcess->FindTagValue(TAG_VECTOR_IC,ICCardSerial,false) == -1)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("can't find card serial.");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA2J1B")("can't find card serial.");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -1343,7 +1277,7 @@ int CContactlessCardFSM::PreOnline(SpReqAnsContext<ContactlessCardService_PreOnl
|
|
|
}
|
|
|
if (m_pCardProcess->FindTagValue(TAG_VECTOR_IC,track2,false,0) == -1)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("no track2 data in ic");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("no track2 data in ic");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -1352,7 +1286,7 @@ int CContactlessCardFSM::PreOnline(SpReqAnsContext<ContactlessCardService_PreOnl
|
|
|
ZeroMemory(pICTrack2,128);
|
|
|
HexBuf2StrBuf(track2.value,&pICTrack2,track2.lenth);
|
|
|
pICTrack2[37] = '\0';
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("<PreOnline>, split pos:%d", pos);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("<PreOnline>, split pos:%d", pos);
|
|
|
char *ddd = new char[40];
|
|
|
ZeroMemory(ddd,40);
|
|
|
memcpy(ddd,pICTrack2,pos-1);
|
|
@@ -1371,7 +1305,7 @@ int CContactlessCardFSM::PreOnline(SpReqAnsContext<ContactlessCardService_PreOnl
|
|
|
//t2ICCardSerial = track2Data.t2CardSerial;
|
|
|
t2ICCVC = track2Data.t2CVC;
|
|
|
t2ICTrack2 = pICTrack2;
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("done(ic).");
|
|
|
+
|
|
|
}
|
|
|
//}
|
|
|
if (strnicmp(track2Data.t2Account,ddd,strlen(ddd)))
|
|
@@ -1386,10 +1320,12 @@ int CContactlessCardFSM::PreOnline(SpReqAnsContext<ContactlessCardService_PreOnl
|
|
|
delete []pICTrack2;
|
|
|
}
|
|
|
//80 1e 80 0008 328ab54bfc986b85 07010103a0b000010a010000000000754048769000
|
|
|
- if (m_pCardProcess->GetP1() == 0x1)
|
|
|
+ if (m_pCardProcess->GetP1() == 0x1) {
|
|
|
actionType = "ARQC";
|
|
|
- else
|
|
|
+ }
|
|
|
+ else {
|
|
|
actionType = "";
|
|
|
+ }
|
|
|
//【55域】
|
|
|
// 基本域:
|
|
|
// 9F26 8b 应用密文AC
|
|
@@ -1434,7 +1370,7 @@ int CContactlessCardFSM::PreOnline(SpReqAnsContext<ContactlessCardService_PreOnl
|
|
|
+ "ARQCDATA," + m_pDataToARQC + "|T2ACCOUNT(F6)," + t2ICAccount.substr(0, 6) + "|T2ACCOUNT(L4)," + t2ICAccount.substr(t2ICAccount.length() - 4, 4)
|
|
|
+ "|T2CARDSERIAL(len)," + t2ICCardSerial + "|CARDCAT," + cardType;
|
|
|
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("data to host(less)[%s],baseICData length:%d", txtresult.c_str(), baseICData.length());
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("data to host(less)[%s],baseICData length:%d", txtresult.c_str(), baseICData.length());
|
|
|
|
|
|
if (m_pDataToARQC != NULL)
|
|
|
{
|
|
@@ -1491,7 +1427,7 @@ int CContactlessCardFSM::EjectCard(SpReqAnsContext<ContactlessCardService_Eject_
|
|
|
ErrorCodeEnum eErr = m_hDevHelper->GetDevStatus(devStatus);
|
|
|
if (eErr == Error_Succeed)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("EjectCard, devStatus.eMedia %d",devStatus.eMediaPos);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("EjectCard, devStatus.eMedia %d",devStatus.eMediaPos);
|
|
|
if (devStatus.eMediaPos == CI_MEDIA_RF || devStatus.eMediaPos == CI_MEDIA_NOTPRESENT)
|
|
|
{
|
|
|
if (devStatus.eMediaPos == CI_MEDIA_NOTPRESENT)
|
|
@@ -1503,7 +1439,7 @@ int CContactlessCardFSM::EjectCard(SpReqAnsContext<ContactlessCardService_Eject_
|
|
|
}
|
|
|
Sleep(100);
|
|
|
}
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("eject return.");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("eject, ret:%d",ret);
|
|
|
if (ctx != NULL)
|
|
|
ctx->Answer(Error_Succeed);
|
|
|
return ret;
|
|
@@ -1580,17 +1516,17 @@ bool CContactlessCardFSM::LoadCMBPrint(CSimpleStringA csBinPath)
|
|
|
HMODULE hr = LoadLibraryA(csCMBPrint);
|
|
|
if (hr == NULL)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Load CMBPrint failed(%d).", hr);
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA2J18")("Load CMBPrint failed(%d).", hr);
|
|
|
return false;
|
|
|
}
|
|
|
if ((cmdDecodeMag2 = (lpCMBdecodeMag2)GetProcAddress(hr, "CMBdecodeMag2")) == NULL)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Get Mag2 address failed.");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA2J18")("Get Mag2 address failed.");
|
|
|
return false;
|
|
|
}
|
|
|
if ((cmdDecodeEx = (lpCMBdecodeEx)GetProcAddress(hr, "CMBdecodeEx")) == NULL)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Get Mag23Ex address failed.");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA2J18")("Get Mag23Ex address failed.");
|
|
|
cmdDecodeMag2 = NULL;
|
|
|
return false;
|
|
|
}
|
|
@@ -1602,23 +1538,23 @@ bool CContactlessCardFSM::LoadCMBPrint(CSimpleStringA csBinPath)
|
|
|
hr = dlopen(csCMBPrint, RTLD_LAZY);
|
|
|
if (hr == NULL)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Load CMBPrint failed(%s).", dlerror());
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA2J18")("Load CMBPrint failed(%s).", dlerror());
|
|
|
return false;
|
|
|
}
|
|
|
//pfunc_unpack = (PF_unpack)dlsym(hLib, "_Z6unpackPcS_i");
|
|
|
if ((cmdDecodeMag2 = (lpCMBdecodeMag2)dlsym(hr, "CMBdecodeMag2")) == NULL)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Get Mag2 address failed.");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA2J18")("Get Mag2 address failed.");
|
|
|
return false;
|
|
|
}
|
|
|
if ((cmdDecodeEx = (lpCMBdecodeEx)dlsym(hr, "CMBdecodeEx")) == NULL)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Get Mag23Ex address failed.");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA2J18")("Get Mag23Ex address failed.");
|
|
|
cmdDecodeMag2 = NULL;
|
|
|
return false;
|
|
|
}
|
|
|
#endif
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Load %s succ.", (const char*)csCMBPrint);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Load %s succ.", (const char*)csCMBPrint);
|
|
|
}
|
|
|
|
|
|
return true;
|
|
@@ -1627,7 +1563,7 @@ bool CContactlessCardFSM::LoadCMBPrint(CSimpleStringA csBinPath)
|
|
|
void CContactlessCardFSM::GetCardProcessLastErr(ErrorCodeEnum& eErrCode, CSimpleStringA& ApiName, CSimpleStringA& alarmMsg, CSimpleStringA& csErrMsgWithReturnCode)
|
|
|
{
|
|
|
if (m_pCardProcess == NULL) {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("GetCardProcessLastErr m_pCardProcess is null");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("GetCardProcessLastErr m_pCardProcess is null");
|
|
|
eErrCode = Error_Null;
|
|
|
ApiName = "";
|
|
|
alarmMsg = "";
|
|
@@ -1734,7 +1670,7 @@ void CContactlessCardFSM::QueryHasCardJS(SpReqAnsContext<ContactlessCardService_
|
|
|
int CContactlessCardFSM::EjectJS(SpReqAnsContext<ContactlessCardService_EjectJS_Req, ContactlessCardService_EjectJS_Ans>::Pointer ctx)
|
|
|
{
|
|
|
LOG_FUNCTION();
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("吐卡开始");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("吐卡开始");
|
|
|
m_pCardProcess->DataInit();
|
|
|
int ret = 0;
|
|
|
int getDevInfoCount = 0;
|
|
@@ -1771,17 +1707,17 @@ int CContactlessCardFSM::EjectJS(SpReqAnsContext<ContactlessCardService_EjectJS_
|
|
|
}
|
|
|
}
|
|
|
else {
|
|
|
- getDevInfoCount++;
|
|
|
- if (getDevInfoCount % 10 == 0) {
|
|
|
- DevErrorInfo devErrInfo;
|
|
|
- m_hDevHelper->GetLastErr(devErrInfo);
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("GetDevStatus, errMsg:%s", devErrInfo.szErrMsg);
|
|
|
- }
|
|
|
+ //getDevInfoCount++;
|
|
|
+ //if (getDevInfoCount % 10 == 0) {
|
|
|
+ // DevErrorInfo devErrInfo;
|
|
|
+ // m_hDevHelper->GetLastErr(devErrInfo);
|
|
|
+ // DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("GetDevStatus, errMsg:%s", devErrInfo.szErrMsg);
|
|
|
+ //}
|
|
|
}
|
|
|
Sleep(WAIT_INTERVAL);
|
|
|
}
|
|
|
LogEvent(Severity_Middle, LOG_EVT_CONTACTLESS_CARD_GREEN_OFF, "ContactCard(fetch) warning off");
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("eject return.ret=%d",ret);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("eject return.ret=%d",ret);
|
|
|
if (ctx != NULL) {
|
|
|
if (ret == 0) {
|
|
|
ctx->Answer(Error_Succeed);
|
|
@@ -1796,7 +1732,7 @@ int CContactlessCardFSM::EjectJS(SpReqAnsContext<ContactlessCardService_EjectJS_
|
|
|
int CContactlessCardFSM::ReadJS(SpReqAnsContext<ContactlessCardService_ReadJS_Req, ContactlessCardService_ReadJS_Ans>::Pointer ctx)
|
|
|
{
|
|
|
LOG_FUNCTION();
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("读卡开始");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("读卡开始");
|
|
|
int ret = InternalAcceptCardJS();
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("InternalAcceptCardJS ret:%d", ret);
|
|
|
|
|
@@ -1822,7 +1758,7 @@ int CContactlessCardFSM::ReadJS(SpReqAnsContext<ContactlessCardService_ReadJS_Re
|
|
|
int CContactlessCardFSM::PostOnlineJS(SpReqAnsContext<ContactlessCardService_PostOnlineJS_Req, ContactlessCardService_PostOnlineJS_Ans>::Pointer ctx)
|
|
|
{
|
|
|
LOG_FUNCTION();
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("(PostOnlineJS) 联机后IC接触处理");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("(PostOnlineJS) 联机后IC接触处理");
|
|
|
m_pCardProcess->DataInit();
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("postOnLine data[%s]", ctx->Req.data.GetData());
|
|
|
m_pCardProcess->SplitOnlineReplyData(ctx->Req.data, strlen(ctx->Req.data));
|
|
@@ -1881,7 +1817,7 @@ int CContactlessCardFSM::InternalAcceptCardJS()
|
|
|
bool bIC = m_pCardProcess->DetectIfICCard(CARD_MACHINE_RFIC, m_hDevHelper, activeCardType);
|
|
|
l_endTime = SP::Module::Comm::RVCGetTickCount();
|
|
|
if (bIC) {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("InternalAcceptCardJS::DetectIfICCard activeCardType=%d", activeCardType);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("InternalAcceptCardJS::DetectIfICCard activeCardType=%d", activeCardType);
|
|
|
if (activeCardType == 'A' || activeCardType == 'B' || activeCardType == 'M') {
|
|
|
err = 0;//探测到IC卡
|
|
|
}
|
|
@@ -1937,7 +1873,7 @@ int CContactlessCardFSM::PreOnlineJS(SpReqAnsContext<ContactlessCardService_Read
|
|
|
LOG_FUNCTION();
|
|
|
long l_beginTime, l_endTime;
|
|
|
m_pCardProcess->DataInit();
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("<PreOnlineJS>, aid[%s], bus data[%s]", ctx->Req.aid.GetData(),ctx->Req.businessData.GetData());
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("<PreOnlineJS>, aid[%s], bus data[%s]", ctx->Req.aid.GetData(),ctx->Req.businessData.GetData());
|
|
|
m_pCardProcess->SplitBusinessData(ctx->Req.businessData, ctx->Req.businessData.GetLength());
|
|
|
m_pCardProcess->SplitBusinessData("DF690101", strlen("DF690101"));
|
|
|
int activeCardType;
|
|
@@ -1946,7 +1882,7 @@ int CContactlessCardFSM::PreOnlineJS(SpReqAnsContext<ContactlessCardService_Read
|
|
|
ICData aidFromBus(false, 0x4f, 0x00);
|
|
|
if (m_pCardProcess->FindTagValue(TAG_VECTOR_BUS, aidFromBus, false, 0) == -1)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("the front BusinessData han't provide aid data.");
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("the front BusinessData han't provide aid data.");
|
|
|
retDetectAndRead = m_pCardProcess->DetectAndReadICData(CARD_MACHINE_RFIC, m_hDevHelper, m_aidList, activeCardType);
|
|
|
|
|
|
}
|
|
@@ -1954,7 +1890,7 @@ int CContactlessCardFSM::PreOnlineJS(SpReqAnsContext<ContactlessCardService_Read
|
|
|
char* pAIDTmp = new char[64];
|
|
|
memset(pAIDTmp, 0, 64);
|
|
|
HexBuf2StrBuf(aidFromBus.value, &pAIDTmp, aidFromBus.lenth);
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("<PreOnline>, the aid is[%s],len:%d .", pAIDTmp, strlen(pAIDTmp));
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("<PreOnlineJS>, the aid is[%s],len:%d .", pAIDTmp, strlen(pAIDTmp));
|
|
|
CAutoArray<CSimpleString> preAIDs;
|
|
|
preAIDs.Init(1);
|
|
|
preAIDs[0] = (CSimpleStringA)pAIDTmp;
|
|
@@ -1989,7 +1925,9 @@ int CContactlessCardFSM::PreOnlineJS(SpReqAnsContext<ContactlessCardService_Read
|
|
|
CSimpleStringA taaResult;
|
|
|
BYTE bt9f27 = 0;
|
|
|
int retTAA = m_pCardProcess->TermActionAnalyze(CARD_MACHINE_RFIC, m_hDevHelper, taaResult, true, m_bCDA, bt9f27);
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("<PreOnlineJS>,TermActionAnalyze retTAA:%d, taaResult:%s", retTAA, taaResult.GetData());
|
|
|
+ if (retTAA != 0) {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("<PreOnlineJS>,TermActionAnalyze retTAA:%d, taaResult:%s", retTAA, taaResult.GetData());
|
|
|
+ }
|
|
|
switch (retTAA)
|
|
|
{//to be added oiltest 20140929
|
|
|
case -1: //some data may be wrong
|
|
@@ -2005,7 +1943,6 @@ int CContactlessCardFSM::PreOnlineJS(SpReqAnsContext<ContactlessCardService_Read
|
|
|
|
|
|
if (ctx->Ans.result.GetLength() == 0)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("<PreOnlineJS>,TermActionAnalyze result len = 0");
|
|
|
ctx->Ans.icState = 0;
|
|
|
ctx->Answer(Error_Succeed);
|
|
|
return 0;
|
|
@@ -2037,7 +1974,7 @@ int CContactlessCardFSM::PreOnlineJS(SpReqAnsContext<ContactlessCardService_Read
|
|
|
ZeroMemory(pExpireDate, 12);
|
|
|
if (m_pCardProcess->FindTagValue(TAG_VECTOR_IC, appExpiryDate, false, 0) == -1)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("can't find expire date");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA2J1B")("can't find expire date");
|
|
|
}
|
|
|
else {
|
|
|
HexBuf2StrBuf(appExpiryDate.value, &pExpireDate, appExpiryDate.lenth);
|
|
@@ -2049,7 +1986,7 @@ int CContactlessCardFSM::PreOnlineJS(SpReqAnsContext<ContactlessCardService_Read
|
|
|
ZeroMemory(pICCardSerial, 4);
|
|
|
if (m_pCardProcess->FindTagValue(TAG_VECTOR_IC, ICCardSerial, false) == -1)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("can't find card serial.");
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA2J1B")("can't find card serial.");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -2062,7 +1999,7 @@ int CContactlessCardFSM::PreOnlineJS(SpReqAnsContext<ContactlessCardService_Read
|
|
|
ZeroMemory(pICTrack2, 128);
|
|
|
if (m_pCardProcess->FindTagValue(TAG_VECTOR_IC, track2, false, 0) == -1)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("no track2 data in ic");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("no track2 data in ic");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -2071,7 +2008,7 @@ int CContactlessCardFSM::PreOnlineJS(SpReqAnsContext<ContactlessCardService_Read
|
|
|
|
|
|
int pos = FindHexCharPosition(track2.value, 0x0d, track2.lenth);
|
|
|
pICTrack2[37] = '\0';
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("<PreOnline>, split pos:%d", pos);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("<PreOnlineJS>, split pos:%d", pos);
|
|
|
char* ddd = new char[40];
|
|
|
ZeroMemory(ddd, 40);
|
|
|
memcpy(ddd, pICTrack2, pos - 1);
|
|
@@ -2088,7 +2025,6 @@ int CContactlessCardFSM::PreOnlineJS(SpReqAnsContext<ContactlessCardService_Read
|
|
|
t2ICAccount = track2Data.t2Account;
|
|
|
//t2ICCardSerial = track2Data.t2CardSerial;
|
|
|
t2ICCVC = track2Data.t2CVC;
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("done(ic).");
|
|
|
}
|
|
|
|
|
|
if (strnicmp(track2Data.t2Account, ddd, strlen(ddd)))
|
|
@@ -2106,10 +2042,12 @@ int CContactlessCardFSM::PreOnlineJS(SpReqAnsContext<ContactlessCardService_Read
|
|
|
|
|
|
|
|
|
//80 1e 80 0008 328ab54bfc986b85 07010103a0b000010a010000000000754048769000
|
|
|
- if (m_pCardProcess->GetP1() == 0x1)
|
|
|
+ if (m_pCardProcess->GetP1() == 0x1) {
|
|
|
actionType = "ARQC";
|
|
|
- else
|
|
|
+ }
|
|
|
+ else {
|
|
|
actionType = "";
|
|
|
+ }
|
|
|
//【55域】
|
|
|
// 基本域:
|
|
|
// 9F26 8b 应用密文AC
|
|
@@ -2199,3 +2137,9 @@ int CContactlessCardFSM::PreOnlineJS(SpReqAnsContext<ContactlessCardService_Read
|
|
|
return 0;
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+void CContactlessCardFSM::OnStateTrans(int iSrcState, int iDstState)
|
|
|
+{
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("trans from %s to %s", GetStateName(iSrcState), GetStateName(iDstState));
|
|
|
+}
|
|
|
+
|