|
|
@@ -1565,7 +1565,7 @@ int CCardIssuerFSM::IssueCard(SpReqAnsContext<CardIssuerStandService_IssueEx_Req
|
|
|
ctxEx->Ans.reserved1.Init(2);
|
|
|
|
|
|
//param Req.hopper is wrong
|
|
|
- if (ctxEx->Req.hopper < 1 || ctxEx->Req.hopper > 6){
|
|
|
+ if (ctxEx->Req.hopper < 1 || ctxEx->Req.hopper > 3){
|
|
|
errMsg = CSimpleStringA::Format("Issuer Card, the hopperNo(%d) is wrong!!!", ctxEx->Req.hopper);
|
|
|
LogWarn(Severity_Middle, Error_Unexpect, CardIssuer_UserErrorCode_Invalid_Hopper, errMsg.GetData());
|
|
|
return Error_Param;
|
|
|
@@ -2246,19 +2246,19 @@ int CCardIssuerFSM::ReadCard_Contact(SpReqAnsContext<CardIssuerStandService_Read
|
|
|
else
|
|
|
{
|
|
|
l_beginTime = GetTickCountRVC();
|
|
|
- bIC = m_pCardProcess->DetectIfICCard(CARD_MACHINE_ISSUER, m_hDevHelper, activeCardType);
|
|
|
+ int retDetect = m_pCardProcess->DetectIfICCard(CARD_MACHINE_ISSUER, m_hDevHelper, activeCardType);
|
|
|
l_endTime = GetTickCountRVC();
|
|
|
-
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("<ReadCard::DetectIfICCard>, bIC:%d", bIC);
|
|
|
- if (!bIC) {
|
|
|
- ErrorCodeEnum eErrCode = Error_Unexpect;
|
|
|
- CSimpleStringA ApiName = "";
|
|
|
- CSimpleStringA alarmMsg = "";
|
|
|
- CSimpleStringA csErrMsgWithReturnCode = "";
|
|
|
- GetCardProcessLastErr(eErrCode, ApiName, alarmMsg, csErrMsgWithReturnCode);
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(ApiName.GetData()).setCostTime(l_endTime - l_beginTime).setResultCode("RTA23CT")(csErrMsgWithReturnCode.GetData());
|
|
|
- LogWarn(Severity_Middle, Error_Unexpect, 0x2030000a, alarmMsg.GetData());
|
|
|
+ if (retDetect == 0)//oiltmp for simple to not change bIC
|
|
|
+ bIC = true;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ bIC = false;
|
|
|
+ CSimpleStringA csDevApi("");
|
|
|
+ DWORD dwDevApi = 0;
|
|
|
+ GetDevApiCodeAndName(retDetect, dwDevApi, csDevApi);
|
|
|
+ SetErrorAndLog(Error_Unexpect, dwDevApi, csDevApi, __FUNCTION__, bContinue && IsInBusiness(), l_endTime - l_beginTime);
|
|
|
}
|
|
|
+
|
|
|
if (Error_Succeed == eMagReadErr && magTracks.track[1].eStatus == CI_DATA_OK)
|
|
|
{
|
|
|
if (bIC)
|
|
|
@@ -2504,18 +2504,18 @@ int CCardIssuerFSM::ReadCard_RF(SpReqAnsContext<CardIssuerStandService_Read_Req,
|
|
|
else
|
|
|
{
|
|
|
l_beginTime = GetTickCountRVC();
|
|
|
- bIC = m_pCardProcess->DetectIfICCard(CARD_MACHINE_ISSUER_RF, m_hDevHelper, activeCardType);
|
|
|
+ int retDetect = m_pCardProcess->DetectIfICCard(CARD_MACHINE_ISSUER_RF, m_hDevHelper, activeCardType);
|
|
|
l_endTime = GetTickCountRVC();
|
|
|
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("<ReadCard::DetectIfICCard>, bIC:%d", bIC);
|
|
|
- if (!bIC) {
|
|
|
- ErrorCodeEnum eErrCode = Error_Unexpect;
|
|
|
- CSimpleStringA ApiName = "";
|
|
|
- CSimpleStringA alarmMsg = "";
|
|
|
- CSimpleStringA csErrMsgWithReturnCode = "";
|
|
|
- GetCardProcessLastErr(eErrCode, ApiName, alarmMsg, csErrMsgWithReturnCode);
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(ApiName.GetData()).setCostTime(l_endTime - l_beginTime).setResultCode("RTA23C6")(csErrMsgWithReturnCode.GetData());
|
|
|
- LogWarn(Severity_Middle, Error_Unexpect, 0x20300017, alarmMsg.GetData());
|
|
|
+ if (retDetect == 0)//oiltmp for simple to not change bIC
|
|
|
+ bIC = true;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ bIC = false;
|
|
|
+ CSimpleStringA csDevApi("");
|
|
|
+ DWORD dwDevApi = 0;
|
|
|
+ GetDevApiCodeAndName(retDetect, dwDevApi, csDevApi);
|
|
|
+ SetErrorAndLog(Error_Unexpect, dwDevApi, csDevApi, __FUNCTION__, IsInBusiness(), l_endTime - l_beginTime);
|
|
|
}
|
|
|
if (!(bIC && activeCardType == 'A'))
|
|
|
bIC = false;
|
|
|
@@ -2629,105 +2629,20 @@ int CCardIssuerFSM::PreOnline_Contact(SpReqAnsContext<CardIssuerStandService_Pre
|
|
|
DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("<PreOnline>, After invoke DetectAndReadICData, retDetectAndRead:%d, activeCardType:%d", retDetectAndRead, activeCardType);
|
|
|
if (retDetectAndRead < 0)
|
|
|
{
|
|
|
- CSimpleStringA xCardName("");
|
|
|
- if (m_issueStatus && m_currentHopper - 1 >= 0)
|
|
|
- xCardName = m_PsbNameEx[m_currentHopper - 1];
|
|
|
- if (retDetectAndRead == -1)
|
|
|
+ DWORD dwDevApiCode = 0;
|
|
|
+ CSimpleStringA csDevApiName(""), csLogCode("");
|
|
|
+ CSimpleStringA csIssueContext = CSimpleStringA::Format("{\"InIssue\":%d}", m_issueStatus);//oiltmp
|
|
|
+ GetDevApiCodeAndName(retDetectAndRead, dwDevApiCode, csDevApiName);
|
|
|
+ if (m_issueStatus)
|
|
|
+ csLogCode = CardIssuerStandService_LogCode_IssueEx;
|
|
|
+ else
|
|
|
+ csLogCode = CardIssuerStandService_LogCode_Read;
|
|
|
+ if (m_bSupportRF) //support RF, to continue read by RF
|
|
|
+ SetErrorAndLog(Error_Unexpect, dwDevApiCode, csDevApiName, __FUNCTION__, false, m_ullEndTime - m_ullBeginTime, csLogCode, csIssueContext);
|
|
|
+ else
|
|
|
{
|
|
|
- ErrorCodeEnum eErrCode = Error_Unexpect;
|
|
|
- CSimpleStringA ApiName = "";
|
|
|
- CSimpleStringA alarmMsg = "";
|
|
|
- CSimpleStringA csErrMsgWithReturnCode = "";
|
|
|
- GetCardProcessLastErr(eErrCode, ApiName, alarmMsg, csErrMsgWithReturnCode);
|
|
|
-
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("检测卡片类型时上电失败");
|
|
|
- if (!m_bSupportRF)
|
|
|
- {
|
|
|
- if (IsInBusiness())
|
|
|
- {
|
|
|
- if (m_issueStatus)
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_USER).setAPI(ApiName.GetData()).setCostTime(l_endTime - l_beginTime).setLogCode("QLR040220320").setResultCode("RTA230V")(csErrMsgWithReturnCode.GetData());
|
|
|
- LogError(Severity_Middle, Error_Unexpect, CardIssuer_UserErrorCode_IssueCard_ActiveICCard_Failed, alarmMsg.GetData());
|
|
|
- ctx->Answer(Error_Unexpect, CardIssuer_UserErrorCode_IssueCard_ActiveICCard_Failed);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_USER).setAPI(ApiName.GetData()).setCostTime(l_endTime - l_beginTime).setLogCode("QLR040220303").setResultCode("RTA230M")(csErrMsgWithReturnCode.GetData());
|
|
|
- LogError(Severity_Middle, Error_Unexpect, CardIssuer_UserErrorCode_ActiveICCard_Failed, alarmMsg.GetData());
|
|
|
- ctx->Answer(Error_Unexpect, CardIssuer_UserErrorCode_ActiveICCard_Failed);
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (m_issueStatus)
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setAPI(ApiName.GetData()).setCostTime(l_endTime - l_beginTime).setLogCode("QLR040220320").setResultCode("RTA230V")(csErrMsgWithReturnCode.GetData());
|
|
|
- LogWarn(Severity_Middle, Error_Unexpect, CardIssuer_UserErrorCode_IssueCard_ActiveICCard_Failed, alarmMsg.GetData());
|
|
|
- ctx->Answer(Error_Unexpect, CardIssuer_UserErrorCode_IssueCard_ActiveICCard_Failed);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setAPI(ApiName.GetData()).setCostTime(l_endTime - l_beginTime).setLogCode("QLR040220303").setResultCode("RTA230M")(csErrMsgWithReturnCode.GetData());
|
|
|
- LogWarn(Severity_Middle, Error_Unexpect, CardIssuer_UserErrorCode_ActiveICCard_Failed, alarmMsg.GetData());
|
|
|
- ctx->Answer(Error_Unexpect, CardIssuer_UserErrorCode_ActiveICCard_Failed);
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
- else //非终态,还有非接兜底
|
|
|
- {
|
|
|
- if (m_issueStatus)
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setAPI(ApiName.GetData()).setCostTime(l_endTime - l_beginTime).setLogCode("QLR040220320").setResultCode("RTA230V")(csErrMsgWithReturnCode.GetData());
|
|
|
- else
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setAPI(ApiName.GetData()).setCostTime(l_endTime - l_beginTime).setLogCode("QLR040220303").setResultCode("RTA230M")(csErrMsgWithReturnCode.GetData());
|
|
|
- }
|
|
|
- }
|
|
|
- else if (retDetectAndRead == -2){
|
|
|
- if (!m_bSupportRF)
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("读取IC数据失败");
|
|
|
- if (m_issueStatus) {
|
|
|
- SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_ICCommand, "DevAdapter::ICCommand", __FUNCTION__, IsInBusiness(), l_endTime - l_beginTime, "QLR040220320", "");
|
|
|
- }
|
|
|
- else {
|
|
|
- SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_ICCommand, "DevAdapter::ICCommand", __FUNCTION__, IsInBusiness(), l_endTime - l_beginTime, "QLR040220303", "");
|
|
|
- }
|
|
|
- ctx->Answer(Error_Unexpect, GetAlarmDEC());
|
|
|
- }
|
|
|
- else //非终态,还有非接兜底
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("读取IC数据失败");
|
|
|
- if (m_issueStatus) {
|
|
|
- SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_ICCommand, "DevAdapter::ICCommand", __FUNCTION__, false, l_endTime - l_beginTime, "QLR040220320", "");
|
|
|
- }
|
|
|
- else {
|
|
|
- SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_ICCommand, "DevAdapter::ICCommand", __FUNCTION__, false, l_endTime - l_beginTime, "QLR040220303", "");
|
|
|
- }
|
|
|
- }
|
|
|
- }else if (retDetectAndRead == -3){
|
|
|
- if (!m_bSupportRF)
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("IC卡建立应用列表失败");
|
|
|
- if (m_issueStatus) {
|
|
|
- SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_ICCommand, "DevAdapter::ICCommand", __FUNCTION__, IsInBusiness(), l_endTime - l_beginTime, "QLR040220320", "");
|
|
|
- }
|
|
|
- else {
|
|
|
- SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_ICCommand, "DevAdapter::ICCommand", __FUNCTION__, IsInBusiness(), l_endTime - l_beginTime, "QLR040220303", "");
|
|
|
- }
|
|
|
- ctx->Answer(Error_Unexpect, GetAlarmDEC());
|
|
|
-
|
|
|
- }
|
|
|
- else //非终态,还有非接兜底
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("IC卡建立应用列表失败");
|
|
|
- if (m_issueStatus) {
|
|
|
- SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_ICCommand, "DevAdapter::ICCommand", __FUNCTION__, false, l_endTime - l_beginTime, "QLR040220320", "");
|
|
|
- }
|
|
|
- else {
|
|
|
- SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_ICCommand, "DevAdapter::ICCommand", __FUNCTION__, false, l_endTime - l_beginTime, "QLR040220303", "");
|
|
|
- }
|
|
|
- }
|
|
|
+ DWORD dwCode = SetErrorAndLog(Error_Unexpect, dwDevApiCode, csDevApiName, __FUNCTION__, IsInBusiness(), m_ullEndTime - m_ullBeginTime, csLogCode, csIssueContext);
|
|
|
+ ctx->Answer(Error_Unexpect, dwCode);
|
|
|
}
|
|
|
bICOK = false;
|
|
|
return 0;
|
|
|
@@ -2986,73 +2901,20 @@ int CCardIssuerFSM::PreOnline_RF(SpReqAnsContext<CardIssuerStandService_PreOnlin
|
|
|
DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("<PreOnline_RF>, After invoke DetectAndReadICData, retDetectAndRead:%d, activeCardType:%d", retDetectAndRead, activeCardType);
|
|
|
if (retDetectAndRead < 0)
|
|
|
{
|
|
|
- CSimpleStringA xCardName("");
|
|
|
- if (m_issueStatus && m_currentHopper - 1 >= 0)
|
|
|
- xCardName = m_PsbNameEx[m_currentHopper - 1];
|
|
|
- if (retDetectAndRead == -1) {
|
|
|
- ErrorCodeEnum eErrCode = Error_Unexpect;
|
|
|
- CSimpleStringA ApiName = "";
|
|
|
- CSimpleStringA alarmMsg = "";
|
|
|
- CSimpleStringA csErrMsgWithReturnCode = "";
|
|
|
- GetCardProcessLastErr(eErrCode, ApiName, alarmMsg, csErrMsgWithReturnCode);
|
|
|
-
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("检测卡片类型时上电失败(非接)");
|
|
|
-
|
|
|
- if (m_issueStatus)
|
|
|
- {
|
|
|
- if (IsInBusiness())
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_USER).setAPI(ApiName.GetData()).setCostTime(l_endTime - l_beginTime).setLogCode("QLR040220320").setResultCode("RTA2327")(csErrMsgWithReturnCode.GetData());
|
|
|
- LogError(Severity_Middle, Error_Unexpect, CardIssuer_UserErrorCode_IssueCard_ActiveRF_Failed, alarmMsg.GetData());
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setAPI(ApiName.GetData()).setCostTime(l_endTime - l_beginTime).setLogCode("QLR040220320").setResultCode("RTA2327")(csErrMsgWithReturnCode.GetData());
|
|
|
- LogWarn(Severity_Middle, Error_Unexpect, CardIssuer_UserErrorCode_IssueCard_ActiveRF_Failed, alarmMsg.GetData());
|
|
|
- }
|
|
|
- ctx->Answer(Error_Unexpect, CardIssuer_UserErrorCode_IssueCard_ActiveRF_Failed);
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if (IsInBusiness())
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_USER).setAPI(ApiName.GetData()).setCostTime(l_endTime - l_beginTime).setLogCode("QLR040220303").setResultCode("RTA2326")(csErrMsgWithReturnCode.GetData());
|
|
|
- LogError(Severity_Middle, Error_Unexpect, CardIssuer_UserErrorCode_ActiveContactlessICCard_Failed, alarmMsg.GetData());
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setAPI(ApiName.GetData()).setCostTime(l_endTime - l_beginTime).setLogCode("QLR040220303").setResultCode("RTA2326")(csErrMsgWithReturnCode.GetData());
|
|
|
- LogWarn(Severity_Middle, Error_Unexpect, CardIssuer_UserErrorCode_ActiveContactlessICCard_Failed, alarmMsg.GetData());
|
|
|
- }
|
|
|
- ctx->Answer(Error_Unexpect, CardIssuer_UserErrorCode_ActiveContactlessICCard_Failed);
|
|
|
- }
|
|
|
- }
|
|
|
- else if (retDetectAndRead == -2) {
|
|
|
-
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("读取IC数据失败");
|
|
|
- if (m_issueStatus) {
|
|
|
- SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_RFTypeABCommand, "DevAdapter::RFTypeABCommand", __FUNCTION__, IsInBusiness(), l_endTime - l_beginTime, "QLR040220320", "");
|
|
|
- }
|
|
|
- else {
|
|
|
- SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_RFTypeABCommand, "DevAdapter::RFTypeABCommand", __FUNCTION__, IsInBusiness(), l_endTime - l_beginTime, "QLR040220303", "");
|
|
|
- }
|
|
|
- ctx->Answer(Error_Unexpect, GetAlarmDEC());
|
|
|
-
|
|
|
- }
|
|
|
- else if (retDetectAndRead == -3) {
|
|
|
+ DWORD dwDevApiCode = 0;
|
|
|
+ CSimpleStringA csDevApiName(""), csLogCode("");
|
|
|
+ CSimpleStringA csIssueContext = CSimpleStringA::Format("{\"InIssue\":%d}", m_issueStatus);//oiltmp
|
|
|
+ GetDevApiCodeAndName(retDetectAndRead, dwDevApiCode, csDevApiName);
|
|
|
+ if (m_issueStatus)
|
|
|
+ csLogCode = CardIssuerStandService_LogCode_IssueEx;
|
|
|
+ else
|
|
|
+ csLogCode = CardIssuerStandService_LogCode_Read;
|
|
|
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("IC卡建立应用列表失败");
|
|
|
- if (m_issueStatus) {
|
|
|
- SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_RFTypeABCommand, "DevAdapter::RFTypeABCommand", __FUNCTION__, IsInBusiness(), l_endTime - l_beginTime, "QLR040220320", "");
|
|
|
- }
|
|
|
- else {
|
|
|
- SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_RFTypeABCommand, "DevAdapter::RFTypeABCommand", __FUNCTION__, IsInBusiness(), l_endTime - l_beginTime, "QLR040220303", "");
|
|
|
- }
|
|
|
- ctx->Answer(Error_Unexpect, GetAlarmDEC());
|
|
|
- }
|
|
|
+ DWORD dwCode = SetErrorAndLog(Error_Unexpect, dwDevApiCode, csDevApiName, __FUNCTION__, IsInBusiness(), m_ullEndTime - m_ullBeginTime, csLogCode, csIssueContext);
|
|
|
+ ctx->Answer(Error_Unexpect, dwCode);
|
|
|
return 0;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
m_pCardProcess->TermRiskManage();
|
|
|
CSimpleStringA taaResult;
|
|
|
BYTE bt9f27 = 0;
|
|
|
@@ -3699,18 +3561,15 @@ bool CCardIssuerFSM::JustReadCardNo()
|
|
|
bool bHasAccount = false;
|
|
|
int activeCardType;
|
|
|
l_beginTime = GetTickCountRVC();
|
|
|
- bool bIC = m_pCardProcess->DetectIfICCard(CARD_MACHINE_ISSUER, m_hDevHelper, activeCardType);
|
|
|
+ int retDetect = m_pCardProcess->DetectIfICCard(CARD_MACHINE_ISSUER, m_hDevHelper, activeCardType);
|
|
|
l_endTime = GetTickCountRVC();
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)(CSimpleStringA::Format("DetectIfICCard, bIC:%d, activeCardType:%d", bIC, activeCardType));
|
|
|
-
|
|
|
- if (bIC)
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("retDetect:%d, activeCardType:%d", retDetect, activeCardType);
|
|
|
+ if (retDetect == 0)//oiltmp for simple to not change bIC
|
|
|
{
|
|
|
//oilyang@20201014 add emv support
|
|
|
- int bGetICData = m_pCardProcess->GetICDataFromCard(CARD_MACHINE_ISSUER, m_hDevHelper, m_aidList);
|
|
|
- if(bGetICData != 0)
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)(CSimpleStringA::Format("<JustReadCardNo::GetICDataFromCard> faile(%d)", bGetICData));
|
|
|
- }
|
|
|
+ bool bGetICData = m_pCardProcess->GetICDataFromCard(CARD_MACHINE_ISSUER, m_hDevHelper, m_aidList);
|
|
|
+ if (bGetICData != 0)
|
|
|
+ SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_ICCommand, "DevAdapter::ICCommand", __FUNCTION__, false, l_endTime - l_beginTime);
|
|
|
ICData track2(false, 0x57, 0x00);
|
|
|
string t2ICAccount(""), t2ICCardSerial(""), t2ICCVC(""), t2ICTrack2(""), cardType;
|
|
|
if (m_pCardProcess->FindTagValue(TAG_VECTOR_IC, track2, false, 0) == -1)
|
|
|
@@ -3720,19 +3579,19 @@ bool CCardIssuerFSM::JustReadCardNo()
|
|
|
else
|
|
|
{
|
|
|
int pos = FindHexCharPosition(track2.value, 0x0d, track2.lenth);
|
|
|
- char *pICTrack2 = new char[128];
|
|
|
+ char* pICTrack2 = new char[128];
|
|
|
ZeroMemory(pICTrack2, 128);
|
|
|
HexBuf2StrBuf(track2.value, &pICTrack2, track2.lenth);
|
|
|
pICTrack2[37] = '\0';
|
|
|
|
|
|
- char *ddd = new char[128];
|
|
|
+ char* ddd = new char[128];
|
|
|
memset(ddd, 0, 128);
|
|
|
memcpy(ddd, pICTrack2, pos - 1);
|
|
|
m_currCardNo = ddd;
|
|
|
if (m_currCardNo.GetLength() > 1)
|
|
|
bHasAccount = true;
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)(CSimpleStringA::Format("<JustReadCardNo>, FindHexCharPosition, pos:%d, track2.lenth:%d, m_currCardNo.Len:%d",
|
|
|
- pos, track2.lenth, m_currCardNo.GetLength()));
|
|
|
+ pos, track2.lenth, m_currCardNo.GetLength()));
|
|
|
|
|
|
delete[]ddd;
|
|
|
delete[]pICTrack2;
|
|
|
@@ -3741,8 +3600,8 @@ bool CCardIssuerFSM::JustReadCardNo()
|
|
|
l_beginTime = GetTickCountRVC();
|
|
|
eErr = m_hDevHelper->DeactivateICCard();
|
|
|
l_endTime = GetTickCountRVC();
|
|
|
-
|
|
|
- if (eErr != Error_Succeed){
|
|
|
+
|
|
|
+ if (eErr != Error_Succeed) {
|
|
|
SetErrorAndLog(eErr, MEC_DEVAPI_CARDISSUER_DeactivateICCard, "DevAdapter::DeactivateICCard", __FUNCTION__, false, l_endTime - l_beginTime, "", "");
|
|
|
}
|
|
|
else {
|
|
|
@@ -3752,24 +3611,23 @@ bool CCardIssuerFSM::JustReadCardNo()
|
|
|
l_beginTime = GetTickCountRVC();
|
|
|
eErr = m_hDevHelper->ReleaseIC();
|
|
|
l_endTime = GetTickCountRVC();
|
|
|
-
|
|
|
|
|
|
- if (eErr != Error_Succeed){
|
|
|
+
|
|
|
+ if (eErr != Error_Succeed) {
|
|
|
SetErrorAndLog(eErr, MEC_DEVAPI_CARDISSUER_ReleaseIC, "DevAdapter::ReleaseIC", __FUNCTION__, false, l_endTime - l_beginTime, "", "");
|
|
|
}
|
|
|
else {
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::ReleaseIC").setCostTime(l_endTime - l_beginTime)("JustReadCardNo::ReleaseIC");
|
|
|
}
|
|
|
}
|
|
|
- else {
|
|
|
- ErrorCodeEnum eErrCode = Error_Unexpect;
|
|
|
- CSimpleStringA ApiName = "";
|
|
|
- CSimpleStringA alarmMsg = "";
|
|
|
- CSimpleStringA csErrMsgWithReturnCode = "";
|
|
|
- GetCardProcessLastErr(eErrCode, ApiName, alarmMsg, csErrMsgWithReturnCode);
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(ApiName.GetData()).setCostTime(l_endTime - l_beginTime).setResultCode("RTA23CT")(csErrMsgWithReturnCode.GetData());
|
|
|
- LogWarn(Severity_Middle, Error_Unexpect, 0x2030000a, alarmMsg.GetData());
|
|
|
+ else
|
|
|
+ {
|
|
|
+ CSimpleStringA csDevApi("");
|
|
|
+ DWORD dwDevApi = 0;
|
|
|
+ GetDevApiCodeAndName(retDetect, dwDevApi, csDevApi);
|
|
|
+ SetErrorAndLog(Error_Unexpect, dwDevApi, csDevApi, __FUNCTION__, false, l_endTime - l_beginTime);
|
|
|
}
|
|
|
+
|
|
|
if (!bHasAccount)
|
|
|
{
|
|
|
MagTracks magTracks;
|
|
|
@@ -4301,35 +4159,8 @@ int CCardIssuerFSM::CaptureJS(SpReqAnsContext<CardIssuerStandService_CaptureJS_R
|
|
|
}
|
|
|
m_pCardProcess->DataInit();
|
|
|
|
|
|
- //判断是否无卡
|
|
|
l_beginTime = GetTickCountRVC();
|
|
|
- ErrorCodeEnum eErr = m_hDevHelper->GetDevStatus(m_devStatus);
|
|
|
- l_endTime = GetTickCountRVC();
|
|
|
-
|
|
|
- if (eErr == Error_Succeed) {
|
|
|
-
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("DevAdapter::GetDevStatus").setCostTime(l_endTime - l_beginTime)("CaptureJS::GetDevStatus succ,m_devStatus.eMedia=%d", (int)m_devStatus.eMedia);
|
|
|
- if (m_devStatus.eMedia == CI_MEDIA_NOTPRESENT) {
|
|
|
- if (ctx != NULL) {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setLogCode("QLR040220343").setResultCode("RTA23CS")
|
|
|
- ("CaptureJS::GetDevStatus succ, No card found in cardReader");
|
|
|
- LogWarn(Severity_Low, Error_Unexpect, CardIssuer_UserErrorCode_Capture_NoCard_Failed, "Capture card, No card found in cardReader");
|
|
|
- ctx->Answer(Error_Unexpect, CardIssuer_UserErrorCode_Capture_NoCard_Failed);//读卡器无卡
|
|
|
- }
|
|
|
- else {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setLogCode("QLR040220343").setResultCode("RTA23CS")("CaptureJS::GetDevStatus succ, No card found in cardReader");
|
|
|
- }
|
|
|
- return 0;//回到无卡状态
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- dwTmpUserErrCode = SetErrorAndLog(eErr, MEC_DEVAPI_CARDISSUER_GetDevStatus, "DevAdapter::GetDevStatus", __FUNCTION__, IsInBusiness(), l_endTime - l_beginTime, "QLR040220343", "");
|
|
|
- ctx->Answer(Error_Unexpect, dwTmpUserErrCode);
|
|
|
- return 1;
|
|
|
- }
|
|
|
-
|
|
|
- l_beginTime = GetTickCountRVC();
|
|
|
- eErr = m_hDevHelper->MoveCard(CI_MOVECARD_BACK_NOT_HOLD);
|
|
|
+ ErrorCodeEnum eErr = m_hDevHelper->MoveCard(CI_MOVECARD_BACK_NOT_HOLD);
|
|
|
l_endTime = GetTickCountRVC();
|
|
|
|
|
|
if (eErr == Error_Succeed) {
|
|
|
@@ -4689,119 +4520,24 @@ int CCardIssuerFSM::PreOnlineJS_ReadViaContact(SpReqAnsContext<CardIssuerStandSe
|
|
|
|
|
|
if (retDetectAndRead < 0)
|
|
|
{
|
|
|
- ErrorCodeEnum eErrCode = Error_Unexpect;
|
|
|
- CSimpleStringA ApiName = "";
|
|
|
- CSimpleStringA alarmMsg = "";
|
|
|
- CSimpleStringA csErrMsgWithReturnCode = "";
|
|
|
-
|
|
|
- if (bContinue) {
|
|
|
- if (retDetectAndRead == -1) {
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("检测卡片类型时上电失败 to continue");
|
|
|
- GetCardProcessLastErr(eErrCode, ApiName, alarmMsg, csErrMsgWithReturnCode);
|
|
|
-
|
|
|
- if (m_issueStatus) {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setAPI(ApiName.GetData()).setCostTime(m_ullEndTime - m_ullBeginTime).setLogCode("QLR040220320").setResultCode("RTA230V")(csErrMsgWithReturnCode.GetData());
|
|
|
- }
|
|
|
- else {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setAPI(ApiName.GetData()).setCostTime(m_ullEndTime - m_ullBeginTime).setLogCode("QLR040220303").setResultCode("RTA230M")(csErrMsgWithReturnCode.GetData());
|
|
|
- }
|
|
|
- }
|
|
|
- else if (retDetectAndRead == -2) {
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("读取IC数据失败 to continue");
|
|
|
- if (m_issueStatus) {
|
|
|
- SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_ICCommand, "DevAdapter::ICCommand", __FUNCTION__, false, m_ullEndTime - m_ullBeginTime, "QLR040220320", "读取IC数据失败");
|
|
|
- }
|
|
|
- else {
|
|
|
- SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_ICCommand, "DevAdapter::ICCommand", __FUNCTION__, false, m_ullEndTime - m_ullBeginTime, "QLR040220303", "读取IC数据失败");
|
|
|
- }
|
|
|
- }
|
|
|
- else if (retDetectAndRead == -3) {
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("IC卡建立应用列表失败 to continue");
|
|
|
- if (m_issueStatus) {
|
|
|
- SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_ICCommand, "DevAdapter::ICCommand", __FUNCTION__, false, m_ullEndTime - m_ullBeginTime, "QLR040220320", "retDetectAndRead = -3");
|
|
|
- }
|
|
|
- else {
|
|
|
- SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_ICCommand, "DevAdapter::ICCommand", __FUNCTION__, false, m_ullEndTime - m_ullBeginTime, "QLR040220303", "retDetectAndRead = -3");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- DWORD dwTmpUserErrCode = 0;
|
|
|
- if (retDetectAndRead == -1) {
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("检测卡片类型时上电失败");
|
|
|
- GetCardProcessLastErr(eErrCode, ApiName, alarmMsg, csErrMsgWithReturnCode);
|
|
|
-
|
|
|
- if (m_issueStatus) {
|
|
|
- if (IsInBusiness()) {
|
|
|
- DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_USER).setAPI(ApiName.GetData()).setCostTime(m_ullEndTime - m_ullBeginTime).setLogCode("QLR040220320").setResultCode("RTA230V")(csErrMsgWithReturnCode.GetData());
|
|
|
- LogError(Severity_Middle, Error_Unexpect, CardIssuer_UserErrorCode_IssueCard_ActiveICCard_Failed, alarmMsg.GetData());
|
|
|
- }
|
|
|
- else {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setAPI(ApiName.GetData()).setCostTime(m_ullEndTime - m_ullBeginTime).setLogCode("QLR040220320").setResultCode("RTA230V")(csErrMsgWithReturnCode.GetData());
|
|
|
- LogWarn(Severity_Middle, Error_Unexpect, CardIssuer_UserErrorCode_IssueCard_ActiveICCard_Failed, alarmMsg.GetData());
|
|
|
- }
|
|
|
- if (m_bSingleMagOrIC)
|
|
|
- ctx->Answer(Error_Unexpect, CardIssuer_UserErrorCode_IssueCard_ActiveICCard_Failed);
|
|
|
- else
|
|
|
- {
|
|
|
- //oilyang@20250828 return ErrorSucceed so that the caller can know the failed reason of both mag&ic
|
|
|
- ctx->Ans.icMsg = GetErrMsgByCode(CardIssuer_UserErrorCode_IssueCard_ActiveICCard_Failed);
|
|
|
- ctx->Answer(Error_Succeed);
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- if (IsInBusiness()) {
|
|
|
- DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_USER).setAPI(ApiName.GetData()).setCostTime(m_ullEndTime - m_ullBeginTime).setLogCode("QLR040220303").setResultCode("RTA230M")(csErrMsgWithReturnCode.GetData());
|
|
|
- LogError(Severity_Middle, Error_Unexpect, CardIssuer_UserErrorCode_ActiveICCard_Failed, alarmMsg.GetData());
|
|
|
- }
|
|
|
- else {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setAPI(ApiName.GetData()).setCostTime(m_ullEndTime - m_ullBeginTime).setLogCode("QLR040220303").setResultCode("RTA230M")(csErrMsgWithReturnCode.GetData());
|
|
|
- LogWarn(Severity_Middle, Error_Unexpect, CardIssuer_UserErrorCode_ActiveICCard_Failed, alarmMsg.GetData());
|
|
|
- }
|
|
|
- if (m_bSingleMagOrIC)
|
|
|
- ctx->Answer(Error_Unexpect, CardIssuer_UserErrorCode_IssueCard_ActiveICCard_Failed);
|
|
|
- else
|
|
|
- {
|
|
|
- //oilyang@20250828 return ErrorSucceed so that the caller can know the failed reason of both mag&ic
|
|
|
- ctx->Ans.icMsg = GetErrMsgByCode(CardIssuer_UserErrorCode_ActiveICCard_Failed);
|
|
|
- ctx->Answer(Error_Succeed);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else if (retDetectAndRead == -2) {
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("读取IC数据失败");
|
|
|
- if (m_issueStatus) {
|
|
|
- dwTmpUserErrCode = SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_ICCommand, "DevAdapter::ICCommand", __FUNCTION__, IsInBusiness(), m_ullEndTime - m_ullBeginTime, "QLR040220320", "读取IC数据失败");
|
|
|
- }
|
|
|
- else {
|
|
|
- dwTmpUserErrCode = SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_ICCommand, "DevAdapter::ICCommand", __FUNCTION__, IsInBusiness(), m_ullEndTime - m_ullBeginTime, "QLR040220303", "读取IC数据失败");
|
|
|
- }
|
|
|
- if (m_bSingleMagOrIC)
|
|
|
- ctx->Answer(Error_Unexpect, CardIssuer_UserErrorCode_IssueCard_ActiveICCard_Failed);
|
|
|
- else
|
|
|
- {
|
|
|
- //oilyang@20250828 return ErrorSucceed so that the caller can know the failed reason of both mag&ic
|
|
|
- ctx->Ans.icMsg = GetErrMsgByCode(dwTmpUserErrCode);
|
|
|
- ctx->Answer(Error_Succeed);
|
|
|
- }
|
|
|
- }
|
|
|
- else if (retDetectAndRead == -3) {
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("IC卡建立应用列表失败");
|
|
|
- DWORD dwTmpUserErrCode = 0;
|
|
|
- if (m_issueStatus) {
|
|
|
- dwTmpUserErrCode = SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_ICCommand, "DevAdapter::ICCommand", __FUNCTION__, IsInBusiness(), m_ullEndTime - m_ullBeginTime, "QLR040220320", "retDetectAndRead =-3");
|
|
|
- }
|
|
|
- else {
|
|
|
- dwTmpUserErrCode = SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_ICCommand, "DevAdapter::ICCommand", __FUNCTION__, IsInBusiness(), m_ullEndTime - m_ullBeginTime, "QLR040220303", "retDetectAndRead =-3");
|
|
|
- }
|
|
|
- if (m_bSingleMagOrIC)
|
|
|
- ctx->Answer(Error_Unexpect, CardIssuer_UserErrorCode_IssueCard_ActiveICCard_Failed);
|
|
|
- else
|
|
|
- {
|
|
|
- //oilyang@20250828 return ErrorSucceed so that the caller can know the failed reason of both mag&ic
|
|
|
- ctx->Ans.icMsg = GetErrMsgByCode(dwTmpUserErrCode);
|
|
|
- ctx->Answer(Error_Succeed);
|
|
|
- }
|
|
|
+ DWORD dwDevApiCode = 0;
|
|
|
+ CSimpleStringA csDevApiName(""), csLogCode("");
|
|
|
+ CSimpleStringA csIssueContext = CSimpleStringA::Format("{\"InIssue\":%d}", m_issueStatus);//oiltmp
|
|
|
+ GetDevApiCodeAndName(retDetectAndRead, dwDevApiCode, csDevApiName);
|
|
|
+ if (m_issueStatus)
|
|
|
+ csLogCode = CardIssuerStandService_LogCode_IssueEx;
|
|
|
+ else
|
|
|
+ csLogCode = CardIssuerStandService_LogCode_Read;
|
|
|
+ DWORD dwCode = SetErrorAndLog(Error_Unexpect, dwDevApiCode, csDevApiName, __FUNCTION__, !bContinue && IsInBusiness(), m_ullEndTime - m_ullBeginTime, csLogCode, csIssueContext);
|
|
|
+ if (!bContinue) //no need continue
|
|
|
+ {
|
|
|
+ if (m_bSingleMagOrIC)
|
|
|
+ ctx->Answer(Error_Unexpect, dwCode);
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //oilyang@20250828 return ErrorSucceed so that the caller can know the failed reason of both mag&ic
|
|
|
+ ctx->Ans.icMsg = GetErrMsgByCode(dwCode);
|
|
|
+ ctx->Answer(Error_Succeed);
|
|
|
}
|
|
|
}
|
|
|
return -1;
|
|
|
@@ -4889,129 +4625,27 @@ int CCardIssuerFSM::PreOnlineJS_ReadViaRF(SpReqAnsContext<CardIssuerStandService
|
|
|
|
|
|
if (retDetectAndRead < 0)
|
|
|
{
|
|
|
- ErrorCodeEnum eErrCode = Error_Unexpect;
|
|
|
- CSimpleStringA ApiName = "";
|
|
|
- CSimpleStringA alarmMsg = "";
|
|
|
- CSimpleStringA csErrMsgWithReturnCode = "";
|
|
|
- DWORD dwTmpUserErrCode = 0;
|
|
|
- if (bContinue)
|
|
|
- {
|
|
|
- if (retDetectAndRead == -1) {
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("检测卡片类型时上电失败(非接)to continue");
|
|
|
- GetCardProcessLastErr(eErrCode, ApiName, alarmMsg, csErrMsgWithReturnCode);
|
|
|
-
|
|
|
- if (m_issueStatus) {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setAPI(ApiName.GetData()).setCostTime(m_ullEndTime - m_ullBeginTime).setLogCode("QLR040220320").setResultCode("RTA2327")(csErrMsgWithReturnCode.GetData());
|
|
|
- }
|
|
|
- else {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setAPI(ApiName.GetData()).setCostTime(m_ullEndTime - m_ullBeginTime).setLogCode("QLR040220303").setResultCode("RTA2326")(csErrMsgWithReturnCode.GetData());
|
|
|
- }
|
|
|
- }
|
|
|
- else if (retDetectAndRead == -2) {
|
|
|
-
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("读取IC数据失败 to continue");
|
|
|
- if (m_issueStatus) {
|
|
|
- SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_RFTypeABCommand, "DevAdapter::RFTypeABCommand", __FUNCTION__, false, m_ullEndTime - m_ullBeginTime, "QLR040220320", "读取IC数据失败");
|
|
|
- }
|
|
|
- else {
|
|
|
- SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_RFTypeABCommand, "DevAdapter::RFTypeABCommand", __FUNCTION__, false, m_ullEndTime - m_ullBeginTime, "QLR040220303", "读取IC数据失败");
|
|
|
- }
|
|
|
- }
|
|
|
- else if (retDetectAndRead == -3) {
|
|
|
-
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("IC卡建立应用列表失败 to continue");
|
|
|
- if (m_issueStatus) {
|
|
|
- SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_RFTypeABCommand, "DevAdapter::RFTypeABCommand", __FUNCTION__, false, m_ullEndTime - m_ullBeginTime, "QLR040220320", "retDetectAndRead=-3");
|
|
|
- }
|
|
|
- else {
|
|
|
- SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_RFTypeABCommand, "DevAdapter::RFTypeABCommand", __FUNCTION__, false, m_ullEndTime - m_ullBeginTime, "QLR040220303", "retDetectAndRead=-3");
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ DWORD dwDevApiCode = 0;
|
|
|
+ CSimpleStringA csDevApiName(""), csLogCode("");
|
|
|
+ CSimpleStringA csIssueContext = CSimpleStringA::Format("{\"InIssue\":%d}", m_issueStatus);//oiltmp
|
|
|
+ GetDevApiCodeAndName(retDetectAndRead, dwDevApiCode, csDevApiName);
|
|
|
+ if (m_issueStatus)
|
|
|
+ csLogCode = CardIssuerStandService_LogCode_IssueEx;
|
|
|
else
|
|
|
+ csLogCode = CardIssuerStandService_LogCode_Read;
|
|
|
+ DWORD dwCode = SetErrorAndLog(Error_Unexpect, dwDevApiCode, csDevApiName, __FUNCTION__, !bContinue && IsInBusiness(), m_ullEndTime - m_ullBeginTime, csLogCode, csIssueContext);
|
|
|
+ if (!bContinue) //no need continue
|
|
|
{
|
|
|
- if (retDetectAndRead == -1) {
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("检测卡片类型时上电失败(非接)");
|
|
|
- GetCardProcessLastErr(eErrCode, ApiName, alarmMsg, csErrMsgWithReturnCode);
|
|
|
-
|
|
|
- if (m_issueStatus) {
|
|
|
- if (IsInBusiness())
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_USER).setAPI(ApiName.GetData()).setCostTime(m_ullEndTime - m_ullBeginTime).setLogCode("QLR040220320").setResultCode("RTA2327")(csErrMsgWithReturnCode.GetData());
|
|
|
- LogError(Severity_Middle, Error_Unexpect, CardIssuer_UserErrorCode_IssueCard_ActiveRF_Failed, alarmMsg.GetData());
|
|
|
- }
|
|
|
- else {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setAPI(ApiName.GetData()).setCostTime(m_ullEndTime - m_ullBeginTime).setLogCode("QLR040220320").setResultCode("RTA2327")(csErrMsgWithReturnCode.GetData());
|
|
|
- LogWarn(Severity_Middle, Error_Unexpect, CardIssuer_UserErrorCode_IssueCard_ActiveRF_Failed, alarmMsg.GetData());
|
|
|
- }
|
|
|
- if (m_bSingleMagOrIC)
|
|
|
- ctx->Answer(Error_Unexpect, CardIssuer_UserErrorCode_IssueCard_ActiveRF_Failed);
|
|
|
- else
|
|
|
- {
|
|
|
- //oilyang@20250828 return ErrorSucceed so that the caller can know the failed reason of both mag&ic
|
|
|
- ctx->Ans.icMsg = GetErrMsgByCode(CardIssuer_UserErrorCode_IssueCard_ActiveRF_Failed);
|
|
|
- ctx->Answer(Error_Succeed);
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- if (IsInBusiness())
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_USER).setAPI(ApiName.GetData()).setCostTime(m_ullEndTime - m_ullBeginTime).setLogCode("QLR040220303").setResultCode("RTA2326")(csErrMsgWithReturnCode.GetData());
|
|
|
- LogError(Severity_Middle, Error_Unexpect, CardIssuer_UserErrorCode_ActiveContactlessICCard_Failed, alarmMsg.GetData());
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setAPI(ApiName.GetData()).setCostTime(m_ullEndTime - m_ullBeginTime).setLogCode("QLR040220303").setResultCode("RTA2326")(csErrMsgWithReturnCode.GetData());
|
|
|
- LogWarn(Severity_Middle, Error_Unexpect, CardIssuer_UserErrorCode_ActiveContactlessICCard_Failed, alarmMsg.GetData());
|
|
|
- }
|
|
|
- if (m_bSingleMagOrIC)
|
|
|
- ctx->Answer(Error_Unexpect, CardIssuer_UserErrorCode_ActiveContactlessICCard_Failed);
|
|
|
- else
|
|
|
- {
|
|
|
- //oilyang@20250828 return ErrorSucceed so that the caller can know the failed reason of both mag&ic
|
|
|
- ctx->Ans.icMsg = GetErrMsgByCode(CardIssuer_UserErrorCode_ActiveContactlessICCard_Failed);
|
|
|
- ctx->Answer(Error_Succeed);
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- else if (retDetectAndRead == -2) {
|
|
|
-
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("读取IC数据失败");
|
|
|
- if (m_issueStatus) {
|
|
|
- dwTmpUserErrCode = SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_RFTypeABCommand, "DevAdapter::RFTypeABCommand", __FUNCTION__, IsInBusiness(), m_ullEndTime - m_ullBeginTime, "QLR040220320", "读取IC数据失败");
|
|
|
- }
|
|
|
- else {
|
|
|
- dwTmpUserErrCode = SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_RFTypeABCommand, "DevAdapter::RFTypeABCommand", __FUNCTION__, IsInBusiness(), m_ullEndTime - m_ullBeginTime, "QLR040220303", "读取IC数据失败");
|
|
|
- }
|
|
|
- if (m_bSingleMagOrIC)
|
|
|
- ctx->Answer(Error_Unexpect, dwTmpUserErrCode);
|
|
|
- else
|
|
|
- {
|
|
|
- //oilyang@20250828 return ErrorSucceed so that the caller can know the failed reason of both mag&ic
|
|
|
- ctx->Ans.icMsg = GetErrMsgByCode(dwTmpUserErrCode);
|
|
|
- ctx->Answer(Error_Succeed);
|
|
|
- }
|
|
|
- }
|
|
|
- else if (retDetectAndRead == -3) {
|
|
|
-
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("IC卡建立应用列表失败");
|
|
|
- if (m_issueStatus) {
|
|
|
- dwTmpUserErrCode = SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_RFTypeABCommand, "DevAdapter::RFTypeABCommand", __FUNCTION__, IsInBusiness(), m_ullEndTime - m_ullBeginTime, "QLR040220320", "retDetectAndRead=-3");
|
|
|
- }
|
|
|
- else {
|
|
|
- dwTmpUserErrCode = SetErrorAndLog(Error_Unexpect, MEC_DEVAPI_CARDISSUER_RFTypeABCommand, "DevAdapter::RFTypeABCommand", __FUNCTION__, IsInBusiness(), m_ullEndTime - m_ullBeginTime, "QLR040220303", "retDetectAndRead=-3");
|
|
|
- }
|
|
|
- if (m_bSingleMagOrIC)
|
|
|
- ctx->Answer(Error_Unexpect, dwTmpUserErrCode);
|
|
|
- else
|
|
|
- {
|
|
|
- //oilyang@20250828 return ErrorSucceed so that the caller can know the failed reason of both mag&ic
|
|
|
- ctx->Ans.icMsg = GetErrMsgByCode(dwTmpUserErrCode);
|
|
|
- ctx->Answer(Error_Succeed);
|
|
|
- }
|
|
|
+ if (m_bSingleMagOrIC)
|
|
|
+ ctx->Answer(Error_Unexpect, dwCode);
|
|
|
+ else
|
|
|
+ {
|
|
|
+ //oilyang@20250828 return ErrorSucceed so that the caller can know the failed reason of both mag&ic
|
|
|
+ ctx->Ans.icMsg = GetErrMsgByCode(dwCode);
|
|
|
+ ctx->Answer(Error_Succeed);
|
|
|
}
|
|
|
}
|
|
|
- return -1;//上电读卡失败
|
|
|
+ return -1;
|
|
|
}
|
|
|
|
|
|
m_pCardProcess->TermRiskManage();
|
|
|
@@ -5446,12 +5080,12 @@ int CCardIssuerFSM::InsertJS(SpReqAnsContext<CardIssuerStandService_InsertJS_Req
|
|
|
break;
|
|
|
case 2:
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("AcceptCard, insert timeout");
|
|
|
- ctx->Answer(Error_TimeOut);
|
|
|
+ ctx->Answer(Error_TimeOut, CardIssuer_UserErrorCode_Insert_Card_TimeOut);
|
|
|
break;
|
|
|
case 3:
|
|
|
case 4:
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("AcceptCard, insert cancel");
|
|
|
- ctx->Answer(Error_Cancel);
|
|
|
+ ctx->Answer(Error_Cancel, CardIssuer_UserErrorCode_Insert_Card_Cancel);
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
@@ -5481,39 +5115,6 @@ CSimpleStringA CCardIssuerFSM::MaskCardno(const char* cardno)
|
|
|
return maskCardno;
|
|
|
}
|
|
|
|
|
|
-void CCardIssuerFSM::GetCardProcessLastErr(ErrorCodeEnum& eErrCode, CSimpleStringA& ApiName, CSimpleStringA& alarmMsg, CSimpleStringA& csErrMsgWithReturnCode)
|
|
|
-{
|
|
|
- if (m_pCardProcess == NULL) {
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("GetCardProcessLastErr m_pCardProcess is null");
|
|
|
- eErrCode = Error_Null;
|
|
|
- ApiName = "";
|
|
|
- alarmMsg = "";
|
|
|
- csErrMsgWithReturnCode = "";
|
|
|
- return;
|
|
|
- }
|
|
|
-
|
|
|
- ErrorCodeEnum lastErrCode = Error_Succeed;
|
|
|
- CSimpleStringA lastErrMsg = "";
|
|
|
- CSimpleStringA lastApiName = "";
|
|
|
- m_pCardProcess->getCardAssistLastErr(lastErrCode, lastErrMsg, lastApiName);
|
|
|
-
|
|
|
- const CSimpleStringA alarmMsgStr = CSimpleStringA::Format("{\"Function\":\"%s\", \"DevApi\":\"%s\", \"ReturnCode\":\"%s\", \"Msg\":\"%s\", \"Context\":\"%s\"}"
|
|
|
- , __FUNCTION__, lastApiName.GetData(), SpStrError(lastErrCode), lastErrMsg.GetData(), "");
|
|
|
-
|
|
|
- std::map<std::string, std::string> msgInfo;
|
|
|
- msgInfo["ReturnCode"] = SpStrError(lastErrCode);
|
|
|
- msgInfo["ErrMsg"] = lastErrMsg.GetData();
|
|
|
- msgInfo["Context"] = "";
|
|
|
- std::pair<bool, std::string> strResult;
|
|
|
- strResult = generateJsonStr(msgInfo);
|
|
|
- CSimpleStringA csErrMsgWithReturnCodeStr = strResult.second.c_str();
|
|
|
-
|
|
|
- eErrCode = lastErrCode;
|
|
|
- ApiName = lastApiName;
|
|
|
- alarmMsg = alarmMsgStr.GetData();
|
|
|
- csErrMsgWithReturnCode = csErrMsgWithReturnCodeStr.GetData();
|
|
|
-}
|
|
|
-
|
|
|
void CCardIssuerFSM::OnStateTrans(int iSrcState, int iDstState)
|
|
|
{
|
|
|
DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("trans from %s to %s", GetStateName(iSrcState), GetStateName(iDstState));
|
|
|
@@ -5575,4 +5176,35 @@ CSimpleStringA CCardIssuerFSM::GetErrMsgByCode(DWORD dwCode)
|
|
|
CSimpleStringA tmpRTA(true), tmpDesc(true);
|
|
|
GetEntityBase()->GetFunction()->GetVTMErrMsg(dwCode, tmpDesc, tmpRTA);
|
|
|
return CSimpleStringA::Format("[%s]%s", tmpRTA.GetData(), tmpDesc.GetData());
|
|
|
+}
|
|
|
+void CCardIssuerFSM::GetDevApiCodeAndName(int retValue, DWORD& dwDevApiCode, CSimpleStringA& csDevApiName)
|
|
|
+{
|
|
|
+ switch (retValue)
|
|
|
+ {
|
|
|
+ case -1:
|
|
|
+ dwDevApiCode = MEC_DEVAPI_CARDISSUER_ContactIC;
|
|
|
+ csDevApiName = "DevAdapter::ContactIC";
|
|
|
+ break;
|
|
|
+ case -2:
|
|
|
+ dwDevApiCode = MEC_DEVAPI_CARDISSUER_ActiveICCard;
|
|
|
+ csDevApiName = "DevAdapter::ActiveICCard";
|
|
|
+ break;
|
|
|
+ case -3:
|
|
|
+ dwDevApiCode = MEC_DEVAPI_CARDISSUER_ActiveContactlessICCard;
|
|
|
+ csDevApiName = "DevAdapter::ActiveContactlessICCard";
|
|
|
+ break;
|
|
|
+ case -4:
|
|
|
+ dwDevApiCode = MEC_DEVAPI_CARDISSUER_ICCommand;
|
|
|
+ csDevApiName = "DevAdapter::ICCommand";
|
|
|
+ break;
|
|
|
+ case -5:
|
|
|
+ dwDevApiCode = MEC_DEVAPI_CARDISSUER_RFTypeABCommand;
|
|
|
+ csDevApiName = "DevAdapter::RFTypeABCommand";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ dwDevApiCode = DEC_NO_E_CARDISSUER_START;
|
|
|
+ csDevApiName = "DevAdapter::SthWrong";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return;
|
|
|
}
|