|
@@ -7,6 +7,7 @@
|
|
|
#include "GetDevInfoHelper.h"
|
|
|
#include "EventCode.h"
|
|
|
#include "RVCComm.h"
|
|
|
+#include "publicFunExport.h"
|
|
|
//oilyang@20200522 go on using
|
|
|
// deprecated!! [4/17/2020 16:15 @Gifur]
|
|
|
#include "CommDevEntityErrorCode.h"
|
|
@@ -191,11 +192,7 @@ unsigned int CCardIssuerFSM::s1_on_event(FSMEvent* event)
|
|
|
void CCardIssuerFSM::s2_on_entry()
|
|
|
{
|
|
|
LOG_FUNCTION();
|
|
|
- m_currentFSMState = 2;
|
|
|
- if (m_FirstStart) {
|
|
|
- m_FirstStart = FALSE;
|
|
|
- ToLogWarnInfoAboutTerm(this, m_adapterInfo);
|
|
|
- }
|
|
|
+ m_currentFSMState = 2;
|
|
|
GetEntityBase()->GetFunction()->SetUserDefineState(USER_CARDISSUER_IDLE);
|
|
|
SetDevStateAndSendMsg(DEVICE_STATUS_NORMAL, false);
|
|
|
|
|
@@ -213,6 +210,10 @@ void CCardIssuerFSM::s2_on_entry()
|
|
|
{
|
|
|
m_bBTChecking = 1;
|
|
|
}
|
|
|
+ if (m_FirstStart) {
|
|
|
+ m_FirstStart = FALSE;
|
|
|
+ ToLogWarnInfoAboutTerm(this, m_adapterInfo);
|
|
|
+ }
|
|
|
}
|
|
|
void CCardIssuerFSM::s2_on_exit()
|
|
|
{
|
|
@@ -1882,7 +1883,7 @@ bool CCardIssuerFSM::LoadCMBPrint(CSimpleStringA csBinPath)
|
|
|
if (cmdDecodeEx == NULL) {
|
|
|
CSimpleStringA csCMBPrint("");
|
|
|
#ifdef RVC_OS_LINUX
|
|
|
- csCMBPrint = "CMBPrint.so";
|
|
|
+ csCMBPrint = "libCMBPrint.so";
|
|
|
csCMBPrint = csBinPath + "/" + csCMBPrint;
|
|
|
Dbg("cmbpath %s", (const char*)csCMBPrint);
|
|
|
void* hr = NULL;
|
|
@@ -2221,13 +2222,15 @@ ErrorCodeEnum CCardIssuerFSM::OpenDevice(BYTE btOpenType, const char *pDevSN)
|
|
|
|
|
|
if (cis.eRetainBin == CI_RETAINBIN_FULL)
|
|
|
{
|
|
|
- LogWarn(Severity_Middle, Error_Unexpect, LOG_ERR_CARDISSUER_RETAIN_BIN_IS_FULL_SENSOR, "硬件检测:回收箱满了,请及时清理!");
|
|
|
+ LogWarn(Severity_Middle, Error_Unexpect, CardIssuer_UserErrorCode_RETAIN_BIN_IS_FULL_SENSOR, "硬件检测:回收箱满了,请及时清理!");
|
|
|
}
|
|
|
}
|
|
|
+ LogWarn(Severity_Low, Error_Unexpect, CardIssuer_UserErrorCode_Open_Success, "CardIssuer Open Success.");
|
|
|
return Error_Succeed;
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
+ LogWarn(Severity_Middle, Error_Unexpect, CardIssuer_UserErrorCode_Open_Failed, "CardIssuer Open Failed.");
|
|
|
return Error_Unexpect;
|
|
|
}
|
|
|
}
|
|
@@ -2737,7 +2740,7 @@ int CCardIssuerFSM::IssueCard(SpReqAnsContext<CardIssuerService_Issue_Req, CardI
|
|
|
&& (!m_bHasHopper[1] || m_CardPercentEx[1] == 0 || m_CardInitEx[1] == 0 || (100 * m_remainsEx[1] < m_CardPercentEx[1] * m_CardInitEx[1]))
|
|
|
&& (!m_bHasHopper[2] || m_CardPercentEx[2] == 0 || m_CardInitEx[2] == 0 || (100 * m_remainsEx[2] < m_CardPercentEx[2] * m_CardInitEx[2])))
|
|
|
{
|
|
|
- LogWarn(Severity_Low, Error_Unexpect, LOG_ERR_CARDISSUER_FEW_CARD_REMAINS, "Few card remains.");
|
|
|
+ LogWarn(Severity_Low, Error_Unexpect, CardIssuer_UserErrorCode_FEW_CARD_REMAINS, "Few card remains.");
|
|
|
}
|
|
|
m_bSettingMaterial = true;//oilyang 借用于延迟同步,紧接着设置remains时更新到后台数据库
|
|
|
if (!SetCardIssued(m_issuedEx[m_currentHopper - 1], m_currentHopper))
|
|
@@ -3279,6 +3282,7 @@ int CCardIssuerFSM::ReadCard(SpReqAnsContext<CardIssuerService_Read_Req,CardIssu
|
|
|
ctx->Ans.t2CardSerial = track2Data.t2CardSerial;
|
|
|
ctx->Ans.t2CVC = track2Data.t2CVC;
|
|
|
ctx->Ans.t2ExpireDate = track2Data.t2ExpireDate;
|
|
|
+
|
|
|
Dbg("done.");
|
|
|
bReadCardInfo = true;
|
|
|
if (m_issueStatus)
|
|
@@ -3300,15 +3304,16 @@ int CCardIssuerFSM::ReadCard(SpReqAnsContext<CardIssuerService_Read_Req,CardIssu
|
|
|
ctx->Ans.t2ExpireDate = "";
|
|
|
bReadCardInfo = true;
|
|
|
delete []ddd;
|
|
|
-
|
|
|
}
|
|
|
if (tmpMag2 != NULL)
|
|
|
{
|
|
|
delete[]tmpMag2;
|
|
|
tmpMag2 = NULL;
|
|
|
}
|
|
|
- Dbg(CSimpleStringA::Format("<ReadCard::MagRead>, t2Account len:%d, %s****%s", ctx->Ans.t2Account.GetLength(),
|
|
|
- (LPCTSTR)ctx->Ans.t2Account.SubString(0, 6), (LPCTSTR)ctx->Ans.t2Account.SubString(ctx->Ans.t2Account.GetLength() - 4, 4)));
|
|
|
+ Dbg(CSimpleStringA::Format("<ReadCard::MagRead>, t2Account len:%d, %s****%s, status:%d, t2CardSerial:%s, t2CVC:%s",
|
|
|
+ ctx->Ans.t2Account.GetLength(), (LPCTSTR)ctx->Ans.t2Account.SubString(0, 6),
|
|
|
+ (LPCTSTR)ctx->Ans.t2Account.SubString(ctx->Ans.t2Account.GetLength() - 4, 4),
|
|
|
+ ctx->Ans.status, ctx->Ans.t2CardSerial.GetData(), ctx->Ans.t2CVC.GetData()));
|
|
|
|
|
|
CSimpleStringA cardInfo(true);
|
|
|
if (!ctx->Ans.track2.IsNullOrEmpty() && (pos + 8) < magTracks.track[1].dwSize)
|
|
@@ -6933,7 +6938,8 @@ int CCardIssuerFSM::QueryCardInfoOnStore(SpReqAnsContext<CardIssuerService_Query
|
|
|
}
|
|
|
|
|
|
//开始盘库
|
|
|
- Dbg("<QueryCardInfoOnStore>, req.reserved[0]:%d", ctx->Req.reserved1[0]);
|
|
|
+ CSimpleStringA errMsg = CSimpleStringA::Format("<QueryCardInfoOnStore>, req.reserved[0]:%d", ctx->Req.reserved1[0]);
|
|
|
+ LogWarn(Severity_Low, Error_Unexpect, CardIssuer_UserErrorCode_QueryCardInfoOnStore_Inparam, errMsg.GetData());
|
|
|
if(ctx->Req.reserved1[0] == 1)
|
|
|
{
|
|
|
//检查是否有旧的盘库记录,若有,则返回给业务确定继续盘库or终止盘库;若无,则进行正常盘库
|
|
@@ -6958,17 +6964,9 @@ int CCardIssuerFSM::QueryCardInfoOnStore(SpReqAnsContext<CardIssuerService_Query
|
|
|
spConfigRun->WriteConfigValueInt("OperateCardStore", "OperationFlag", 1);//设置盘库标志
|
|
|
int i = 0;
|
|
|
int status = 0;
|
|
|
- char* slotFlag = new char[m_maxSlot + 1];
|
|
|
- char tempBuff[5];
|
|
|
|
|
|
for (; i < m_maxSlot; ++i)
|
|
|
{
|
|
|
- memset(tempBuff, 0, sizeof(tempBuff));
|
|
|
- _itoa(slotstatus.status[i], tempBuff, 10);
|
|
|
- if (i == 0)
|
|
|
- strcpy(slotFlag, tempBuff);
|
|
|
- else
|
|
|
- strcat(slotFlag, tempBuff);
|
|
|
if (slotstatus.status[i] == 1)
|
|
|
{
|
|
|
bRet = OperateCardStore(spConfigRun, i, status);
|
|
@@ -6982,9 +6980,6 @@ int CCardIssuerFSM::QueryCardInfoOnStore(SpReqAnsContext<CardIssuerService_Query
|
|
|
}
|
|
|
}
|
|
|
//将卡信息返回给业务端
|
|
|
- Dbg("slot has card flag:%s", slotFlag);
|
|
|
- if (slotFlag != NULL)
|
|
|
- delete[]slotFlag;
|
|
|
ReturnCardInfo(i, status, spConfigRun, ctx);
|
|
|
}
|
|
|
else if(ctx->Req.reserved1[0] == 2)
|
|
@@ -6998,18 +6993,9 @@ int CCardIssuerFSM::QueryCardInfoOnStore(SpReqAnsContext<CardIssuerService_Query
|
|
|
{
|
|
|
int status = 0;
|
|
|
int i = slotNum;
|
|
|
- char* slotFlag = new char[m_maxSlot + 1];
|
|
|
- char tempBuff[5];
|
|
|
|
|
|
for(; i < m_maxSlot; ++i)
|
|
|
{
|
|
|
- memset(tempBuff, 0, sizeof(tempBuff));
|
|
|
- _itoa(slotstatus.status[i], tempBuff, 10);
|
|
|
- if (i == 0)
|
|
|
- strcpy(slotFlag, tempBuff);
|
|
|
- else
|
|
|
- strcat(slotFlag, tempBuff);
|
|
|
-
|
|
|
if(slotstatus.status[i] == 1)
|
|
|
{
|
|
|
bRet = OperateCardStore(spConfigRun, i, status);
|
|
@@ -7023,9 +7009,6 @@ int CCardIssuerFSM::QueryCardInfoOnStore(SpReqAnsContext<CardIssuerService_Query
|
|
|
}
|
|
|
}
|
|
|
//将卡信息返回给业务端
|
|
|
- Dbg("slot has card flag:%s", slotFlag);
|
|
|
- if (slotFlag != NULL)
|
|
|
- delete[]slotFlag;
|
|
|
ReturnCardInfo(i, status, spConfigRun, ctx);
|
|
|
}
|
|
|
else
|