|
@@ -685,6 +685,11 @@ int CIDCertFSM::ReadAndScan(SpReqAnsContext<IDCert_ReadAndScan_Req, IDCert_ReadA
|
|
|
m_bWaitReadMore = false;
|
|
|
m_bReading = true;
|
|
|
m_bExit = false;
|
|
|
+
|
|
|
+ ErrorCodeEnum ecForIDCerRFControl(Error_Succeed);
|
|
|
+ ErrorCodeEnum ecForIDCerAuthenticate(Error_Succeed);
|
|
|
+
|
|
|
+
|
|
|
while (elapsed < IDCER_READ_TIMEOUT && !bGetIDCert && !m_bCancelRead)
|
|
|
{
|
|
|
if (m_bExit)
|
|
@@ -700,6 +705,7 @@ int CIDCertFSM::ReadAndScan(SpReqAnsContext<IDCert_ReadAndScan_Req, IDCert_ReadA
|
|
|
if (!bOpenRF)
|
|
|
{
|
|
|
eErr = m_hDevHelper->IDCerRFControl(true);
|
|
|
+ ecForIDCerRFControl = eErr;
|
|
|
if (Error_Succeed == eErr)
|
|
|
{
|
|
|
Dbg("open rf succeed.");
|
|
@@ -722,9 +728,10 @@ int CIDCertFSM::ReadAndScan(SpReqAnsContext<IDCert_ReadAndScan_Req, IDCert_ReadA
|
|
|
bOpenRF = true;
|
|
|
Sleep(IDCER_AUTH_INTERVAL);
|
|
|
eErr = m_hDevHelper->IDCerAuthenticate();
|
|
|
+ ecForIDCerAuthenticate = eErr;
|
|
|
if (Error_Succeed != eErr)
|
|
|
{
|
|
|
- LOG_IDCER_ERROR_MSG_MACRO(eErr, IDCerAuthenticate);
|
|
|
+ Dbg("IDCerAuthenticate failed: %s", SpStrError(ecForIDCerAuthenticate));
|
|
|
dwEnd = RVCGetTickCount();
|
|
|
elapsed = dwEnd - dwStart;
|
|
|
if (eErr == Error_DevMedia)
|
|
@@ -891,7 +898,7 @@ int CIDCertFSM::ReadAndScan(SpReqAnsContext<IDCert_ReadAndScan_Req, IDCert_ReadA
|
|
|
Dbg("after close light");
|
|
|
Dbg("ans size:%d",sizeof(ctx->Ans));
|
|
|
Dbg("%d",FIELD_OFFSET(IDCertificate::IDCertService_ReadAndScan_Ans, reserved));
|
|
|
-
|
|
|
+
|
|
|
int pos = 99;
|
|
|
ErrorCodeEnum eErr1 = m_hDevHelper->QueryCardPos(pos);
|
|
|
if (eErr1 == Error_NotImpl)
|
|
@@ -939,12 +946,28 @@ int CIDCertFSM::ReadAndScan(SpReqAnsContext<IDCert_ReadAndScan_Req, IDCert_ReadA
|
|
|
ctx->Answer(Error_Succeed);
|
|
|
else if (m_bCancelRead)
|
|
|
ctx->Answer(Error_Cancel);
|
|
|
- else if (elapsed >= IDCER_READ_TIMEOUT)
|
|
|
+ else if (elapsed >= IDCER_READ_TIMEOUT) {
|
|
|
ctx->Answer(Error_TimeOut);
|
|
|
+
|
|
|
+ if (ecForIDCerRFControl != Error_Succeed) {
|
|
|
+ LOG_IDCER_ERROR_MSG_MACRO(eErr, IDCerRFControl);
|
|
|
+ }
|
|
|
+ if (ecForIDCerAuthenticate != Error_Succeed) {
|
|
|
+ LOG_IDCER_ERROR_MSG_MACRO(eErr, IDCerAuthenticate);
|
|
|
+ }
|
|
|
+ }
|
|
|
else if (eErr == Error_DevMedia)
|
|
|
ctx->Answer(Error_DevMedia);
|
|
|
- else
|
|
|
+ else {
|
|
|
ctx->Answer(Error_Unexpect);
|
|
|
+
|
|
|
+ if (ecForIDCerRFControl != Error_Succeed) {
|
|
|
+ LOG_IDCER_ERROR_MSG_MACRO(eErr, IDCerRFControl);
|
|
|
+ }
|
|
|
+ if (ecForIDCerAuthenticate != Error_Succeed) {
|
|
|
+ LOG_IDCER_ERROR_MSG_MACRO(eErr, IDCerAuthenticate);
|
|
|
+ }
|
|
|
+ }
|
|
|
if (eErr1 == Error_Succeed && pos == 2)
|
|
|
{
|
|
|
return 4;
|