|
@@ -77,8 +77,8 @@ void CCardIssuerFSM::s0_on_exit()
|
|
|
|
|
|
unsigned int CCardIssuerFSM::s0_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
- LOG_FUNCTION();
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("s0 evt (%d,%d)", pEvt->iEvt, pEvt->param1);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s evt (%d,%d)", GetCurrStateName(), pEvt->iEvt, pEvt->param1);
|
|
|
+
|
|
|
switch (pEvt->iEvt)
|
|
|
{
|
|
|
case USER_EVT_INIT:
|
|
@@ -107,21 +107,20 @@ void CCardIssuerFSM::s1_on_exit()
|
|
|
{
|
|
|
LOG_FUNCTION();
|
|
|
}
|
|
|
-unsigned int CCardIssuerFSM::s1_on_event(FSMEvent* event)
|
|
|
+unsigned int CCardIssuerFSM::s1_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
- LOG_FUNCTION();
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)(CSimpleStringA::Format("s1 evt (%d,%d)", event->iEvt, event->param1));
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s evt (%d,%d)", GetCurrStateName(), pEvt->iEvt, pEvt->param1);
|
|
|
|
|
|
- if (event->iEvt == USER_EVT_INITFINISHED) {
|
|
|
- event->SetHandled();
|
|
|
- int err = event->param1;
|
|
|
+ if (pEvt->iEvt == USER_EVT_INITFINISHED) {
|
|
|
+ pEvt->SetHandled();
|
|
|
+ int err = pEvt->param1;
|
|
|
if (err == 0) {
|
|
|
return 0;
|
|
|
} else {
|
|
|
return 1;
|
|
|
}
|
|
|
- }else if (event->iEvt == USER_EVT_QUIT) {
|
|
|
- event->SetHandled();
|
|
|
+ }else if (pEvt->iEvt == USER_EVT_QUIT) {
|
|
|
+ pEvt->SetHandled();
|
|
|
return 0;
|
|
|
}
|
|
|
return 0;
|
|
@@ -143,7 +142,7 @@ void CCardIssuerFSM::s2_on_exit()
|
|
|
|
|
|
unsigned int CCardIssuerFSM::s2_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)(CSimpleStringA::Format("s2 evt (%d,%d)", pEvt->iEvt, pEvt->param1));
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s evt (%d,%d)", GetCurrStateName(), pEvt->iEvt, pEvt->param1);
|
|
|
|
|
|
int ret = 0;
|
|
|
switch (pEvt->iEvt)
|
|
@@ -341,7 +340,7 @@ void CCardIssuerFSM::s3_on_exit()
|
|
|
}
|
|
|
unsigned int CCardIssuerFSM::s3_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("s3 evt(%d,%d)", pEvt->iEvt, pEvt->param1);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s evt (%d,%d)", GetCurrStateName(), pEvt->iEvt, pEvt->param1);
|
|
|
int ret = 0;
|
|
|
switch(pEvt->iEvt)
|
|
|
{
|
|
@@ -426,7 +425,7 @@ void CCardIssuerFSM::s4_on_exit()
|
|
|
}
|
|
|
unsigned int CCardIssuerFSM::s4_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)(CSimpleStringA::Format("s4 evt (%d,%d)", pEvt->iEvt, pEvt->param1));
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s evt (%d,%d)", GetCurrStateName(), pEvt->iEvt, pEvt->param1);
|
|
|
|
|
|
switch(pEvt->iEvt){
|
|
|
case USER_EVT_JS_READ:
|
|
@@ -708,7 +707,7 @@ void CCardIssuerFSM::s5_on_exit()
|
|
|
}
|
|
|
unsigned int CCardIssuerFSM::s5_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("s5 evt (%d,%d)", pEvt->iEvt, pEvt->param1);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s evt (%d,%d)", GetCurrStateName(), pEvt->iEvt, pEvt->param1);
|
|
|
int ret = 0;
|
|
|
switch(pEvt->iEvt)
|
|
|
{
|
|
@@ -747,6 +746,10 @@ unsigned int CCardIssuerFSM::s5_on_event(FSMEvent* pEvt)
|
|
|
pEvt->SetHandled();
|
|
|
ret = 0;
|
|
|
}
|
|
|
+ case USER_EVT_PREONLINEFINISHED:
|
|
|
+ pEvt->SetHandled();
|
|
|
+ ret = 0;
|
|
|
+ break;
|
|
|
default:
|
|
|
FSMEventDefaultProcess(pEvt, CardIssuer_UserErrorCode_PROCESS_READ);
|
|
|
break;
|
|
@@ -764,7 +767,7 @@ void CCardIssuerFSM::s6_on_exit()
|
|
|
}
|
|
|
unsigned int CCardIssuerFSM::s6_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)(CSimpleStringA::Format("s6 evt (%d,%d)", pEvt->iEvt, pEvt->param1));
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s evt (%d,%d)", GetCurrStateName(), pEvt->iEvt, pEvt->param1);
|
|
|
switch (pEvt->iEvt)
|
|
|
{
|
|
|
case USER_EVT_EJECTFINISHED:
|
|
@@ -813,7 +816,7 @@ void CCardIssuerFSM::s7_on_exit()
|
|
|
}
|
|
|
unsigned int CCardIssuerFSM::s7_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("s7 evt (%d, %d)", pEvt->iEvt, pEvt->param1);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s evt (%d,%d)", GetCurrStateName(), pEvt->iEvt, pEvt->param1);
|
|
|
switch (pEvt->iEvt)
|
|
|
{
|
|
|
case USER_EVT_WAITFINISHED:
|
|
@@ -1000,7 +1003,7 @@ void CCardIssuerFSM::s8_on_exit()
|
|
|
}
|
|
|
unsigned int CCardIssuerFSM::s8_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)(CSimpleStringA::Format("s8 evt (%d,%d)", pEvt->iEvt, pEvt->param1));
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s evt (%d,%d)", GetCurrStateName(), pEvt->iEvt, pEvt->param1);
|
|
|
switch (pEvt->iEvt)
|
|
|
{
|
|
|
case USER_EVT_CAPTUREFINISHED:
|
|
@@ -1052,7 +1055,7 @@ void CCardIssuerFSM::s9_on_exit()
|
|
|
}
|
|
|
unsigned int CCardIssuerFSM::s9_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)(CSimpleStringA::Format("s9 evt (%d,%d)", pEvt->iEvt, pEvt->param1));
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s evt (%d,%d)", GetCurrStateName(), pEvt->iEvt, pEvt->param1);
|
|
|
switch(pEvt->iEvt)
|
|
|
{
|
|
|
case USER_EVT_QUIT:
|
|
@@ -1083,7 +1086,7 @@ void CCardIssuerFSM::s10_on_exit()
|
|
|
}
|
|
|
unsigned int CCardIssuerFSM::s10_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)(CSimpleStringA::Format("s10 evt (%d,%d)", pEvt->iEvt, pEvt->param1));
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s evt (%d,%d)", GetCurrStateName(), pEvt->iEvt, pEvt->param1);
|
|
|
int ret = 0;
|
|
|
switch(pEvt->iEvt)
|
|
|
{
|
|
@@ -1117,7 +1120,7 @@ void CCardIssuerFSM::s11_on_exit()
|
|
|
}
|
|
|
unsigned int CCardIssuerFSM::s11_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("evt (%d,%d)", pEvt->iEvt, pEvt->param1);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s evt (%d,%d)", GetCurrStateName(), pEvt->iEvt, pEvt->param1);
|
|
|
int ret = 0;
|
|
|
switch (pEvt->iEvt)
|
|
|
{
|
|
@@ -1165,7 +1168,7 @@ void CCardIssuerFSM::s12_on_exit()
|
|
|
}
|
|
|
unsigned int CCardIssuerFSM::s12_on_event(FSMEvent* pEvt)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)(CSimpleStringA::Format("evt (%d,%d)", pEvt->iEvt, pEvt->param1));
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s evt (%d,%d)", GetCurrStateName(), pEvt->iEvt, pEvt->param1);
|
|
|
int ret = 0;
|
|
|
switch (pEvt->iEvt)
|
|
|
{
|
|
@@ -1359,7 +1362,6 @@ ErrorCodeEnum CCardIssuerFSM::OpenDevice(BYTE btOpenType, const char* pDevSN)
|
|
|
ErrorCodeEnum eErrDev;
|
|
|
CSimpleString errMsg(true);
|
|
|
|
|
|
- int initTries = 0;
|
|
|
CSimpleStringA dllName;
|
|
|
GetVendorDllName(dllName);
|
|
|
|
|
@@ -1386,7 +1388,7 @@ ErrorCodeEnum CCardIssuerFSM::OpenDevice(BYTE btOpenType, const char* pDevSN)
|
|
|
GetEntityBase()->GetFunction()->ShowFatalError("加载厂商适配器失败!请检查root.ini配置是否正确。");
|
|
|
return Error_DevLoadFileFailed;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
for (int i = 0; i < HOPPER_NUM; ++i)
|
|
|
{
|
|
|
m_CardBoxNoEx[i] = "";
|
|
@@ -1401,186 +1403,169 @@ ErrorCodeEnum CCardIssuerFSM::OpenDevice(BYTE btOpenType, const char* pDevSN)
|
|
|
m_csMaintainTimeEx[i] = "";
|
|
|
m_MaintainTimeEx[i] = 0;
|
|
|
}
|
|
|
- long l_beginTime,l_endTime;
|
|
|
- do {
|
|
|
+ long l_beginTime, l_endTime;
|
|
|
+ l_beginTime = GetTickCountRVC();
|
|
|
+ eErrDev = m_hDevHelper->DevOpenEx(m_adapterInfo.GetPortInt(), m_adapterInfo.GetBaudrateInt(), btOpenType, pDevSN, m_connectType);
|
|
|
+ l_endTime = GetTickCountRVC();
|
|
|
+
|
|
|
+ if (eErrDev == Error_Succeed)
|
|
|
+ {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::DevOpenEx").setCostTime(l_endTime - l_beginTime)("OpenDevice::DevOpenEx succ, port:%d, baudRate:%d, openType:%d, connectType:%d", m_adapterInfo.GetPortInt(), m_adapterInfo.GetBaudrateInt(), btOpenType, m_connectType);
|
|
|
+ m_devOpenFailedCount = 0;
|
|
|
+ ZeroMemory(m_devCat.szModel, sizeof(m_devCat.szModel));
|
|
|
+ ZeroMemory(m_devCat.szType, sizeof(m_devCat.szType));
|
|
|
+ ZeroMemory(m_devCat.szVendor, sizeof(m_devCat.szVendor));
|
|
|
l_beginTime = GetTickCountRVC();
|
|
|
- eErrDev = m_hDevHelper->DevOpenEx(m_adapterInfo.GetPortInt(), m_adapterInfo.GetBaudrateInt(), btOpenType, pDevSN, m_connectType);
|
|
|
+ eErrDev = m_hDevHelper->GetDevCategory(m_devCat);
|
|
|
l_endTime = GetTickCountRVC();
|
|
|
-
|
|
|
+
|
|
|
if (eErrDev == Error_Succeed)
|
|
|
{
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::DevOpenEx").setCostTime(l_endTime - l_beginTime)("OpenDevice::DevOpenEx succ, port:%d, baudRate:%d, openType:%d, connectType:%d", m_adapterInfo.GetPortInt(), m_adapterInfo.GetBaudrateInt(),btOpenType, m_connectType);
|
|
|
- m_devOpenFailedCount = 0;
|
|
|
- ZeroMemory(m_devCat.szModel, sizeof(m_devCat.szModel));
|
|
|
- ZeroMemory(m_devCat.szType, sizeof(m_devCat.szType));
|
|
|
- ZeroMemory(m_devCat.szVendor, sizeof(m_devCat.szVendor));
|
|
|
- l_beginTime = GetTickCountRVC();
|
|
|
- eErrDev = m_hDevHelper->GetDevCategory(m_devCat);
|
|
|
- l_endTime = GetTickCountRVC();
|
|
|
-
|
|
|
- if (eErrDev == Error_Succeed)
|
|
|
- {
|
|
|
- int ret = SplitDevModelInfo();
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::GetDevCategory").setCostTime(l_endTime - l_beginTime)("OpenDevice::GetDevCategory SplitDevModelInfo=%d",ret);
|
|
|
- m_adapterInfo.FulfillCategoryInfo(m_devCat);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- SetErrorAndLog(eErrDev, MEC_DEVAPI_CARDISSUER_GetDevCategory, "DevAdapter::GetDevCategory", __FUNCTION__, false, l_endTime - l_beginTime, "", "");
|
|
|
- return Error_Unexpect;
|
|
|
- }
|
|
|
-
|
|
|
- if (!LoadCMBPrint(csBinPath))
|
|
|
- {
|
|
|
- errMsg = CSimpleStringA::Format("CardIssuerStand启动失败:Load CMBPrint failed.");
|
|
|
- LogWarn(Severity_Middle, Error_Unexpect, CardIssuer_UserErrorCode_LoadLibraryA_CMBPrint_Failed, errMsg.GetData());
|
|
|
- return Error_DevLoadFileFailed;
|
|
|
- }
|
|
|
- initTries = 0;
|
|
|
- break;
|
|
|
+ int ret = SplitDevModelInfo();
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::GetDevCategory").setCostTime(l_endTime - l_beginTime)("OpenDevice::GetDevCategory SplitDevModelInfo=%d", ret);
|
|
|
+ m_adapterInfo.FulfillCategoryInfo(m_devCat);
|
|
|
}
|
|
|
- else {
|
|
|
- //DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("OpenDevice::DevOpenEx err, port:%d, baudRate:%d, openType:%d, connectType:%d", m_adapterInfo.GetPortInt(), m_adapterInfo.GetBaudrateInt(), btOpenType, m_connectType);
|
|
|
- errMsg = CSimpleStringA::Format("OpenDevice::DevOpenEx err, port:%d, baudRate:%d, openType:%d, connectType:%d", m_adapterInfo.GetPortInt(), m_adapterInfo.GetBaudrateInt(), btOpenType, m_connectType);
|
|
|
- SetErrorAndLog(eErrDev, MEC_DEVAPI_CARDISSUER_DevOpenEx, "DevAdapter::DevOpenEx", __FUNCTION__, false, l_endTime - l_beginTime, "", errMsg.GetData());
|
|
|
-
|
|
|
- //DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("CardIssuerStand启动失败:DevOpenEx failed.重试:%d", initTries);
|
|
|
- Sleep(200);
|
|
|
- initTries++;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ SetErrorAndLog(eErrDev, MEC_DEVAPI_CARDISSUER_GetDevCategory, "DevAdapter::GetDevCategory", __FUNCTION__, false, l_endTime - l_beginTime, "", "");
|
|
|
+ return Error_Unexpect;
|
|
|
}
|
|
|
- } while (initTries < INIT_TRY_NUM);
|
|
|
|
|
|
- if (initTries != 0)
|
|
|
- {
|
|
|
- errMsg = CSimpleStringA::Format("CardIssuerStand启动失败,have tried %d times!!!", initTries);
|
|
|
- LogWarn(Severity_Middle, Error_Unexpect, CardIssuer_UserErrorCode_DevOpen_Failed, errMsg.GetData());
|
|
|
+ if (!LoadCMBPrint(csBinPath))
|
|
|
+ {
|
|
|
+ errMsg = CSimpleStringA::Format("CardIssuerStand启动失败:Load CMBPrint failed.");
|
|
|
+ LogWarn(Severity_Middle, Error_Unexpect, CardIssuer_UserErrorCode_LoadLibraryA_CMBPrint_Failed, errMsg.GetData());
|
|
|
+ return Error_DevLoadFileFailed;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ errMsg = CSimpleStringA::Format("OpenDevice::DevOpenEx err, port:%d, baudRate:%d, openType:%d, connectType:%d", m_adapterInfo.GetPortInt(), m_adapterInfo.GetBaudrateInt(), btOpenType, m_connectType);
|
|
|
+ SetErrorAndLog(eErrDev, MEC_DEVAPI_CARDISSUER_DevOpenEx, "DevAdapter::DevOpenEx", __FUNCTION__, false, l_endTime - l_beginTime, "", errMsg.GetData());
|
|
|
return Error_DevCommFailed;
|
|
|
}
|
|
|
- else
|
|
|
- {
|
|
|
- eErrDev = spEntityFunction->OpenConfig(Config_Run, spConfig);
|
|
|
- if (eErrDev != Error_Succeed) {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)(CSimpleStringA::Format("CardIssuerStand启动失败:open run cfg file failed in OpenDevice."));
|
|
|
- CloseAndClearDevObj(false);
|
|
|
- return eErrDev;
|
|
|
- }
|
|
|
- int ret = 0;
|
|
|
- spConfig->ReadConfigValueInt("all", "HopperNum", m_hopperNum);
|
|
|
- spConfig->ReadConfigValueInt("all", "CardCaptured", m_CardCaptured);
|
|
|
|
|
|
- if (btOpenType == DEV_OPEN_TYPE_COM)
|
|
|
+ eErrDev = spEntityFunction->OpenConfig(Config_Run, spConfig);
|
|
|
+ if (eErrDev != Error_Succeed) {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)(CSimpleStringA::Format("CardIssuerStand启动失败:open run cfg file failed in OpenDevice."));
|
|
|
+ CloseAndClearDevObj(false);
|
|
|
+ return eErrDev;
|
|
|
+ }
|
|
|
+ int ret = 0;
|
|
|
+ spConfig->ReadConfigValueInt("all", "HopperNum", m_hopperNum);
|
|
|
+ spConfig->ReadConfigValueInt("all", "CardCaptured", m_CardCaptured);
|
|
|
+
|
|
|
+ if (btOpenType == DEV_OPEN_TYPE_COM)
|
|
|
+ {
|
|
|
+ //oiltest@20201118 for songrui
|
|
|
+ if (m_csMachineType.Compare("RVC.CardPrinter") == 0)
|
|
|
+ m_hopperNum = 5;
|
|
|
+ else
|
|
|
{
|
|
|
- //oiltest@20201118 for songrui
|
|
|
- if (m_csMachineType.Compare("RVC.CardPrinter") == 0)
|
|
|
- m_hopperNum = 5;
|
|
|
+ if (m_connectType >= 1 && m_connectType <= 3)
|
|
|
+ m_hopperNum = m_connectType;
|
|
|
else
|
|
|
{
|
|
|
- if (m_connectType >= 1 && m_connectType <= 3)
|
|
|
- m_hopperNum = m_connectType;
|
|
|
+ //oiltmp if "RVC.CardPrinter" the m_hopperNum is 6,where can this num come from?
|
|
|
+ if (m_csMachineType.Compare("RVC.CardPrinter") == 0)
|
|
|
+ m_hopperNum = 5;
|
|
|
else
|
|
|
- {
|
|
|
- //oiltmp if "RVC.CardPrinter" the m_hopperNum is 6,where can this num come from?
|
|
|
- if (m_csMachineType.Compare("RVC.CardPrinter") == 0)
|
|
|
- m_hopperNum = 5;
|
|
|
- else
|
|
|
- m_hopperNum = 3;
|
|
|
- }
|
|
|
+ m_hopperNum = 3;
|
|
|
}
|
|
|
- for (int i = 0; i < m_hopperNum; ++i)
|
|
|
- m_bHasHopper[i] = true;
|
|
|
}
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)(CSimpleStringA::Format("has %d hopper.", m_hopperNum));
|
|
|
- char sec[2];
|
|
|
for (int i = 0; i < m_hopperNum; ++i)
|
|
|
- {
|
|
|
- ZeroMemory(sec, 2);
|
|
|
- _itoa(i + 1, (char*)sec, 10);
|
|
|
- spConfig->ReadConfigValue(sec, "CardBoxNo", m_CardBoxNoEx[i]);
|
|
|
- spConfig->ReadConfigValue(sec, "PsbCode", m_PsbCodeEx[i]);
|
|
|
- spConfig->ReadConfigValue(sec, "PsbName", m_PsbNameEx[i]);
|
|
|
- spConfig->ReadConfigValueInt(sec, "CardInit", m_CardInitEx[i]);
|
|
|
- spConfig->ReadConfigValueInt(sec, "CardRemains", m_remainsEx[i]);
|
|
|
- spConfig->ReadConfigValueInt(sec, "CardIssued", m_issuedEx[i]);
|
|
|
- spConfig->ReadConfigValueInt(sec, "CardMixed", m_mixedEx[i]);
|
|
|
- spConfig->ReadConfigValueInt(sec, "CardPercent", m_CardPercentEx[i]);
|
|
|
- spConfig->ReadConfigValue(sec, "Maintainer", m_MaintainerEx[i]);
|
|
|
- spConfig->ReadConfigValue(sec, "MaintainTime", m_csMaintainTimeEx[i]);
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)(CSimpleStringA::Format("init cardbox, CardBoxNo:%s, PsbCodeEx:%s, PsbNameEx:%s, CardInit:%d, CardRemains:%d, CardIssued:%d, CardMixed:%d",
|
|
|
- m_CardBoxNoEx[i].GetData(),
|
|
|
- m_PsbCodeEx[i].GetData(),
|
|
|
- m_PsbNameEx[i].GetData(),
|
|
|
- m_CardInitEx[i],
|
|
|
- m_remainsEx[i],
|
|
|
- m_issuedEx[i],
|
|
|
- m_mixedEx[i]));
|
|
|
- }
|
|
|
- if (m_hopperNum == 1 && btOpenType == DEV_OPEN_TYPE_COM)//oilyang 如果没有配置,使用原来的配置
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)(CSimpleStringA::Format("use new hopper cfg record"));
|
|
|
- }
|
|
|
- //oilyang 回写卡机配置
|
|
|
- spConfig->WriteConfigValueInt("all", "HopperNum", m_hopperNum);
|
|
|
- spConfig->WriteConfigValueInt("1", "CardPercent", m_CardPercentEx[0]);
|
|
|
- spEntityFunction->OpenConfig(Config_CenterSetting, spConfigCS);
|
|
|
+ m_bHasHopper[i] = true;
|
|
|
+ }
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)(CSimpleStringA::Format("has %d hopper.", m_hopperNum));
|
|
|
+ char sec[2];
|
|
|
+ for (int i = 0; i < m_hopperNum; ++i)
|
|
|
+ {
|
|
|
+ ZeroMemory(sec, 2);
|
|
|
+ _itoa(i + 1, (char*)sec, 10);
|
|
|
+ spConfig->ReadConfigValue(sec, "CardBoxNo", m_CardBoxNoEx[i]);
|
|
|
+ spConfig->ReadConfigValue(sec, "PsbCode", m_PsbCodeEx[i]);
|
|
|
+ spConfig->ReadConfigValue(sec, "PsbName", m_PsbNameEx[i]);
|
|
|
+ spConfig->ReadConfigValueInt(sec, "CardInit", m_CardInitEx[i]);
|
|
|
+ spConfig->ReadConfigValueInt(sec, "CardRemains", m_remainsEx[i]);
|
|
|
+ spConfig->ReadConfigValueInt(sec, "CardIssued", m_issuedEx[i]);
|
|
|
+ spConfig->ReadConfigValueInt(sec, "CardMixed", m_mixedEx[i]);
|
|
|
+ spConfig->ReadConfigValueInt(sec, "CardPercent", m_CardPercentEx[i]);
|
|
|
+ spConfig->ReadConfigValue(sec, "Maintainer", m_MaintainerEx[i]);
|
|
|
+ spConfig->ReadConfigValue(sec, "MaintainTime", m_csMaintainTimeEx[i]);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)(CSimpleStringA::Format("init cardbox, CardBoxNo:%s, PsbCodeEx:%s, PsbNameEx:%s, CardInit:%d, CardRemains:%d, CardIssued:%d, CardMixed:%d",
|
|
|
+ m_CardBoxNoEx[i].GetData(),
|
|
|
+ m_PsbCodeEx[i].GetData(),
|
|
|
+ m_PsbNameEx[i].GetData(),
|
|
|
+ m_CardInitEx[i],
|
|
|
+ m_remainsEx[i],
|
|
|
+ m_issuedEx[i],
|
|
|
+ m_mixedEx[i]));
|
|
|
+ }
|
|
|
+ if (m_hopperNum == 1 && btOpenType == DEV_OPEN_TYPE_COM)//oilyang 如果没有配置,使用原来的配置
|
|
|
+ {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)(CSimpleStringA::Format("use new hopper cfg record"));
|
|
|
+ }
|
|
|
+ //oilyang 回写卡机配置
|
|
|
+ spConfig->WriteConfigValueInt("all", "HopperNum", m_hopperNum);
|
|
|
+ spConfig->WriteConfigValueInt("1", "CardPercent", m_CardPercentEx[0]);
|
|
|
+ spEntityFunction->OpenConfig(Config_CenterSetting, spConfigCS);
|
|
|
|
|
|
- int tmpCardnoMismatch = 0, tmpICRetryTimes = 1, tmpStopUseRF = 0, tmpCheckInterval = 200;
|
|
|
+ int tmpCardnoMismatch = 0, tmpICRetryTimes = 1, tmpStopUseRF = 0, tmpCheckInterval = 200;
|
|
|
|
|
|
- spConfigCS->ReadConfigValueInt(GetEntityBase()->GetEntityName(), "EacQueryFlag", m_eacQueryFlag);
|
|
|
- spConfigCS->ReadConfigValueInt(GetEntityBase()->GetEntityName(), "UseCardnoMismatch", tmpCardnoMismatch);
|
|
|
- spConfigCS->ReadConfigValueInt(GetEntityBase()->GetEntityName(), "ICRetryTimes", tmpICRetryTimes);
|
|
|
- spConfigCS->ReadConfigValueInt(GetEntityBase()->GetEntityName(), "StopUseRF", tmpStopUseRF);
|
|
|
- spConfigCS->ReadConfigValueInt(GetEntityBase()->GetEntityName(), "CheckCardInInterval", tmpCheckInterval);
|
|
|
- spConfigCS->ReadConfigValue(GetEntityBase()->GetEntityName(), "RFVendorList", m_rfVendorList);
|
|
|
- spConfigCS->ReadConfigValue(GetEntityBase()->GetEntityName(), "SwallowCardUrl", m_csSwallowCardUrl);
|
|
|
- spConfigCS->ReadConfigValue(GetEntityBase()->GetEntityName(), "SyncMaterialUrl", m_csSyncMaterialUrl);
|
|
|
- spConfigCS->ReadConfigValue("Common", "EacQueryHost", m_EacQueryHost);
|
|
|
+ spConfigCS->ReadConfigValueInt(GetEntityBase()->GetEntityName(), "EacQueryFlag", m_eacQueryFlag);
|
|
|
+ spConfigCS->ReadConfigValueInt(GetEntityBase()->GetEntityName(), "UseCardnoMismatch", tmpCardnoMismatch);
|
|
|
+ spConfigCS->ReadConfigValueInt(GetEntityBase()->GetEntityName(), "ICRetryTimes", tmpICRetryTimes);
|
|
|
+ spConfigCS->ReadConfigValueInt(GetEntityBase()->GetEntityName(), "StopUseRF", tmpStopUseRF);
|
|
|
+ spConfigCS->ReadConfigValueInt(GetEntityBase()->GetEntityName(), "CheckCardInInterval", tmpCheckInterval);
|
|
|
+ spConfigCS->ReadConfigValue(GetEntityBase()->GetEntityName(), "RFVendorList", m_rfVendorList);
|
|
|
+ spConfigCS->ReadConfigValue(GetEntityBase()->GetEntityName(), "SwallowCardUrl", m_csSwallowCardUrl);
|
|
|
+ spConfigCS->ReadConfigValue(GetEntityBase()->GetEntityName(), "SyncMaterialUrl", m_csSyncMaterialUrl);
|
|
|
+ spConfigCS->ReadConfigValue("Common", "EacQueryHost", m_EacQueryHost);
|
|
|
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("EacQueryFlag:%d,EacQueryHost:%s,UseCardnoMismatch:%d,ICRetryTimes:%d,StopUseRF:%d"
|
|
|
- , m_eacQueryFlag, m_EacQueryHost.GetData(), tmpCardnoMismatch, tmpICRetryTimes, tmpStopUseRF);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("EacQueryFlag:%d,EacQueryHost:%s,UseCardnoMismatch:%d,ICRetryTimes:%d,StopUseRF:%d"
|
|
|
+ , m_eacQueryFlag, m_EacQueryHost.GetData(), tmpCardnoMismatch, tmpICRetryTimes, tmpStopUseRF);
|
|
|
|
|
|
- if (tmpCardnoMismatch == 1)
|
|
|
- m_bUseCardnoMismatch = true;
|
|
|
- if (tmpICRetryTimes > 0 && tmpICRetryTimes < 4)
|
|
|
- m_ICRetryTimes = tmpICRetryTimes;
|
|
|
- if (tmpStopUseRF == 1)
|
|
|
- m_bStopUseRF = true;
|
|
|
- if (tmpCheckInterval >= 100 && tmpCheckInterval <= 1000)
|
|
|
- m_iCheckCardInInterval = tmpCheckInterval;
|
|
|
+ if (tmpCardnoMismatch == 1)
|
|
|
+ m_bUseCardnoMismatch = true;
|
|
|
+ if (tmpICRetryTimes > 0 && tmpICRetryTimes < 4)
|
|
|
+ m_ICRetryTimes = tmpICRetryTimes;
|
|
|
+ if (tmpStopUseRF == 1)
|
|
|
+ m_bStopUseRF = true;
|
|
|
+ if (tmpCheckInterval >= 100 && tmpCheckInterval <= 1000)
|
|
|
+ m_iCheckCardInInterval = tmpCheckInterval;
|
|
|
|
|
|
|
|
|
- ret = CheckIfHasCardOnCase(CheckCard_OnOpen);
|
|
|
+ ret = CheckIfHasCardOnCase(CheckCard_OnOpen);
|
|
|
|
|
|
- if (ret == 0)
|
|
|
- {
|
|
|
- //oilyang@20191219 获取吞卡箱容量,目前有便携卡机,大机
|
|
|
- //超过5,认为是脏数据,用默认值3
|
|
|
- CardIssuerStatus cis;
|
|
|
- l_beginTime = GetTickCountRVC();
|
|
|
- eErrDev = m_hDevHelper->GetDevStatus(cis);
|
|
|
- l_endTime = GetTickCountRVC();
|
|
|
+ if (ret == 0)
|
|
|
+ {
|
|
|
+ //oilyang@20191219 获取吞卡箱容量,目前有便携卡机,大机
|
|
|
+ //超过5,认为是脏数据,用默认值3
|
|
|
+ CardIssuerStatus cis;
|
|
|
+ l_beginTime = GetTickCountRVC();
|
|
|
+ eErrDev = m_hDevHelper->GetDevStatus(cis);
|
|
|
+ l_endTime = GetTickCountRVC();
|
|
|
|
|
|
- if (eErrDev != Error_Succeed) {
|
|
|
- SetErrorAndLog(eErrDev, MEC_DEVAPI_CARDISSUER_GetDevStatus, "DevAdapter::GetDevStatus", __FUNCTION__, false, l_endTime - l_beginTime, "", "");
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::GetDevStatus").setCostTime(l_endTime - l_beginTime)("OpenDevice::GetDevStatus device max retain count:%d, cis.eRetainBin:%d", cis.dwRetainCount, cis.eRetainBin);
|
|
|
- if (cis.dwRetainCount > 0 && cis.dwRetainCount <= 5)
|
|
|
- m_maxRetainCount = cis.dwRetainCount;
|
|
|
- else
|
|
|
- m_maxRetainCount = 3;
|
|
|
- if (cis.eRetainBin == CI_RETAINBIN_FULL)
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA23B8")("sensor say:retain bin is full!回收箱满了,请及时清理!");
|
|
|
- }
|
|
|
- }
|
|
|
- return Error_Succeed;
|
|
|
+ if (eErrDev != Error_Succeed) {
|
|
|
+ SetErrorAndLog(eErrDev, MEC_DEVAPI_CARDISSUER_GetDevStatus, "DevAdapter::GetDevStatus", __FUNCTION__, false, l_endTime - l_beginTime, "", "");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- LogWarn(Severity_Middle, Error_Unexpect, CardIssuer_UserErrorCode_Open_Failed, "启动后检查是否有卡或处理吞卡失败");
|
|
|
- return Error_Unexpect;
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::GetDevStatus").setCostTime(l_endTime - l_beginTime)("OpenDevice::GetDevStatus device max retain count:%d, cis.eRetainBin:%d", cis.dwRetainCount, cis.eRetainBin);
|
|
|
+ if (cis.dwRetainCount > 0 && cis.dwRetainCount <= 5)
|
|
|
+ m_maxRetainCount = cis.dwRetainCount;
|
|
|
+ else
|
|
|
+ m_maxRetainCount = 3;
|
|
|
+ if (cis.eRetainBin == CI_RETAINBIN_FULL)
|
|
|
+ {
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setResultCode("RTA23B8")("sensor say:retain bin is full!回收箱满了,请及时清理!");
|
|
|
+ }
|
|
|
}
|
|
|
+ return Error_Succeed;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ LogWarn(Severity_Middle, Error_Unexpect, CardIssuer_UserErrorCode_Open_Failed, "启动后检查是否有卡或处理吞卡失败");
|
|
|
+ return Error_Unexpect;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -2448,7 +2433,7 @@ int CCardIssuerFSM::ReadCard_Contact(SpReqAnsContext<CardIssuerStandService_Read
|
|
|
{
|
|
|
bReadCardInfo = true;
|
|
|
ctx->Ans.ICType = 3;
|
|
|
- LogWarn(Severity_Middle, Error_Unexpect, CardIssuer_UserErrorCode_MaybeIC_Only, "<ReadCard>, maybe ic only.");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("maybe ic only.");
|
|
|
}
|
|
|
else
|
|
|
{
|
|
@@ -2722,7 +2707,7 @@ int CCardIssuerFSM::ReadCard_RF(SpReqAnsContext<CardIssuerStandService_Read_Req,
|
|
|
{
|
|
|
bReadCardInfo = true;
|
|
|
ctx->Ans.ICType = 3;
|
|
|
- LogWarn(Severity_Middle, Error_Unexpect, CardIssuer_UserErrorCode_MaybeIC_Only, "<ReadCard>, maybe ic only.");
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("maybe ic only.");
|
|
|
}
|
|
|
else
|
|
|
{
|