mod_IDCertificate.cpp 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #include "stdafx.h"
  2. #include "mod_IDCertificate.h"
  3. void IDCertServerSession::Handle_CancelRead(SpOnewayCallContext<IDCert_CancelRead_Info>::Pointer ctx)
  4. {
  5. DbgToBeidou(ctx->link, __FUNCTION__)();
  6. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI("CancelRead")("Handle_CancelRead");
  7. m_pEntity->CancelRead(ctx);
  8. }
  9. void IDCertServerSession::Handle_ReadWaitMore(SpOnewayCallContext<IDCert_ReadWaitMore_Info>::Pointer ctx)
  10. {
  11. DbgToBeidou(ctx->link, __FUNCTION__)();
  12. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI("ReadWaitMore")("Handle_ReadWaitMore");
  13. m_pEntity->ReadWaitMore(ctx);
  14. }
  15. void IDCertServerSession::Handle_GetDevInfo(SpReqAnsContext<IDCert_GetDevInfo_Req, IDCert_GetDevInfo_Ans>::Pointer ctx)
  16. {
  17. DbgToBeidou(ctx->link, __FUNCTION__)();
  18. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI("GetDevInfo")("Handle_GetDevInfo");
  19. m_pEntity->GetDevInfo(ctx);
  20. }
  21. void IDCertServerSession::Handle_Exit(SpOnewayCallContext<IDCert_Exit_Info>::Pointer ctx)
  22. {
  23. DbgToBeidou(ctx->link, __FUNCTION__)();
  24. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI("Exit")("Handle_Exit");
  25. m_pEntity->Exit(ctx);
  26. }
  27. void IDCertServerSession::Handle_Eject(SpReqAnsContext<IDCert_Eject_Req, IDCert_Eject_Ans>::Pointer ctx)
  28. {
  29. DbgToBeidou(ctx->link, __FUNCTION__)();
  30. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI("Eject")("Handle_Eject");
  31. m_pEntity->Eject(ctx);
  32. }
  33. void IDCertServerSession::Handle_ReadAndScan(SpReqAnsContext<IDCert_ReadAndScan_Req, IDCert_ReadAndScan_Ans>::Pointer ctx)
  34. {
  35. DbgToBeidou(ctx->link, __FUNCTION__)();
  36. LOG_FUNCTION();
  37. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI("ReadAndScan")("Handle_ReadAndScan");
  38. m_pEntity->ReadAndScan(ctx);
  39. }
  40. void IDCertServerSession::Handle_ReadAndScanUTF8(SpReqAnsContext<IDCert_ReadAndScanUTF8_Req, IDCert_ReadAndScanUTF8_Ans>::Pointer ctx) //ex1
  41. {
  42. DbgToBeidou(ctx->link, __FUNCTION__)();
  43. LOG_FUNCTION();
  44. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI("ReadAndScanUTF8")("Handle_ReadAndScanUTF8");
  45. m_pEntity->ReadAndScanUTF8(ctx);
  46. }
  47. #ifdef RVC_OS_WIN
  48. void CIDCertEntity::OnSysVarEvent(const char* pszKey,
  49. const char* pszValue, const char* pszOldValue, const char* pszEntityName)
  50. {
  51. if ((_strnicmp(pszKey, "FWBReConn", strlen("FWBReConn")) == 0))
  52. {
  53. DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("OnSysVarEvent FWBReConn:%s", pszValue);
  54. //"Y":open suc "U":unbind
  55. if (_strnicmp(pszValue, "Y", strlen("Y")) == 0 || _strnicmp(pszValue, "U", strlen("U")) == 0)
  56. {
  57. FSMEvent* e = new FSMEvent(USER_EVT_TODO_INIT);
  58. m_fsm.PostEventFIFO(e);
  59. }
  60. else if (_strnicmp(pszValue, "D", strlen("D")) == 0)
  61. {
  62. if (m_fsm.GetReadFlag())
  63. {
  64. DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_USER).setLogCode("QLR040220106").setResultCode("RTA2103")("FWB disconnected while reading IDCard.");
  65. CSimpleStringA xTmpDevNo("");
  66. GetFunction()->GetSysVar("FWBDevSN", xTmpDevNo);
  67. LogError(Severity_Middle, Error_Unexpect, IDCertificate_UserErrorCode_Reading_Disconnected, CSimpleStringA::Format("%s disconnected while reading IDCard.",xTmpDevNo.GetData()));
  68. }
  69. m_fsm.ResetDevInitFlag();
  70. }
  71. }
  72. }
  73. #endif // !RVC_OS_WIN
  74. SP_BEGIN_ENTITY_MAP()
  75. SP_ENTITY(CIDCertEntity)
  76. SP_END_ENTITY_MAP()