mod_cardswiper.cpp 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. // mod_cardswiper.cpp : Defines the exported functions for the DLL application.
  2. #pragma once
  3. #include "stdafx.h"
  4. #include "SpBase.h"
  5. #include "mod_cardswiper.h"
  6. #include "CardSwiperClass.h"
  7. #include "EventCode.h"
  8. void CardSwiperServerSession::Handle_Read(SpReqAnsContext<CardSwiperService_Read_Req, CardSwiperService_Read_Ans>::Pointer ctx)
  9. {
  10. LOG_FUNCTION();
  11. DbgToBeidou(ctx->link, __FUNCTION__)();
  12. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI("Read")("Invoke Read");
  13. m_pEntity->Read(ctx);
  14. }
  15. void CardSwiperServerSession::Handle_PreOnline(SpReqAnsContext<CardSwiperService_PreOnline_Req, CardSwiperService_PreOnline_Ans>::Pointer ctx)
  16. {
  17. LOG_FUNCTION();
  18. DbgToBeidou(ctx->link, __FUNCTION__)();
  19. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI("PreOnline")("Invoke PreOnline");
  20. m_pEntity->PreOnline(ctx);
  21. }
  22. void CardSwiperServerSession::Handle_PostOnline(SpReqAnsContext<CardSwiperService_PostOnline_Req, CardSwiperService_PostOnline_Ans>::Pointer ctx)
  23. {
  24. LOG_FUNCTION();
  25. DbgToBeidou(ctx->link, __FUNCTION__)();
  26. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI("PostOnline")("Invoke PostOnline");
  27. m_pEntity->PostOnline(ctx);
  28. }
  29. void CardSwiperServerSession::Handle_Exit(SpOnewayCallContext<CardSwiperService_Exit_Info>::Pointer ctx)
  30. {
  31. LOG_FUNCTION();
  32. DbgToBeidou(ctx->link, __FUNCTION__)();
  33. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI("Exit")("Invoke Exit");
  34. m_pEntity->Exit(ctx);
  35. }
  36. void CardSwiperServerSession::Handle_GetDevInfo(SpReqAnsContext<CardSwiperService_GetDevInfo_Req, CardSwiperService_GetDevInfo_Ans>::Pointer ctx)
  37. {
  38. //oilyang@20220418 通道型信息查询,如有必要,应该在发起端记录
  39. //DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI("GetDevInfo")("Invoke GetDevInfo");
  40. DbgToBeidou(ctx->link, __FUNCTION__)();
  41. m_pEntity->GetDevInfo(ctx);
  42. }
  43. void CardSwiperServerSession::Handle_CancelInsert(SpOnewayCallContext<CardSwiperService_CancelInsert_Info>::Pointer ctx)
  44. {
  45. LOG_FUNCTION();
  46. DbgToBeidou(ctx->link, __FUNCTION__)();
  47. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI("CancelInsert")("Invoke CancelInsert");
  48. m_pEntity->CancelInsert(ctx);
  49. }
  50. void CardSwiperServerSession::Handle_Eject(SpReqAnsContext<CardSwiperService_Eject_Req, CardSwiperService_Eject_Ans>::Pointer ctx)
  51. {
  52. LOG_FUNCTION();
  53. DbgToBeidou(ctx->link, __FUNCTION__)();
  54. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI("Eject")("Invoke Eject");
  55. m_pEntity->Eject(ctx);
  56. }
  57. void CardSwiperServerSession::Handle_QueryCardInfo(SpReqAnsContext<CardSwiperService_QueryCardInfo_Req, CardSwiperService_QueryCardInfo_Ans>::Pointer ctx)
  58. {
  59. LOG_FUNCTION();
  60. DbgToBeidou(ctx->link, __FUNCTION__)();
  61. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI("QueryCardInfo")("Invoke QueryCardInfo");
  62. m_pEntity->QueryCardInfo(ctx);
  63. }
  64. void CardSwiperServerSession::Handle_QueryConnInfo(SpReqAnsContext<CardSwiperService_QueryConnInfo_Req, CardSwiperService_QueryConnInfo_Ans>::Pointer ctx)
  65. {
  66. LOG_FUNCTION();
  67. DbgToBeidou(ctx->link, __FUNCTION__)();
  68. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI("QueryConnInfo")("Invoke QueryConnInfo");
  69. m_pEntity->QueryConnInfo(ctx);
  70. }
  71. void CardSwiperServerSession::Handle_InsertWaitMore(SpOnewayCallContext<CardSwiperService_InsertWaitMore_Info>::Pointer ctx)
  72. {
  73. LOG_FUNCTION();
  74. DbgToBeidou(ctx->link, __FUNCTION__)();
  75. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI("InsertWaitMore")("Invoke InsertWaitMore");
  76. m_pEntity->InsertWaitMore(ctx);
  77. }
  78. void CardSwiperServerSession::Handle_QueryFWBList(SpReqAnsContext<CardSwiperService_QueryFWBList_Req, CardSwiperService_QueryFWBList_Ans>::Pointer ctx)
  79. {
  80. LOG_FUNCTION();
  81. DbgToBeidou(ctx->link, __FUNCTION__)();
  82. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI("QueryFWBList")("Invoke QueryFWBList");
  83. m_pEntity->QueryFWBList(ctx);
  84. }
  85. void CardSwiperServerSession::Handle_BindFWB(SpReqAnsContext<CardSwiperService_BindFWB_Req, CardSwiperService_BindFWB_Ans>::Pointer ctx)
  86. {
  87. LOG_FUNCTION();
  88. DbgToBeidou(ctx->link, __FUNCTION__)();
  89. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI("BindFWB")("Invoke BindFWB");
  90. m_pEntity->BindFWB(ctx);
  91. }
  92. void CCardSwiperEntity::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUID nLogID, const LogTypeEnum eLogType, const SeverityLevelEnum eLevel,
  93. const DWORD dwSysError, const DWORD dwUserCode, const DWORD dwEntityInstanceID, const WORD wEntityDevelID,
  94. const CAutoArray<DWORD> &Param, const char *pszEntityName, const char *pszModuleName,const char *pszMessage, const linkContext &pLinkInfo)
  95. {
  96. switch (dwUserCode)
  97. {
  98. case EVENT_ACCESSAUTH_SUCCEED:
  99. {
  100. m_fsm.SetAAState(0);
  101. }
  102. break;
  103. case EVENT_ACCESSAUTH_FAILED:
  104. case EVENT_ACCESSAUTH_TIMEOUT:
  105. DbgWarn("access auth failed.");
  106. m_fsm.SetAAState(1);
  107. break;
  108. default:
  109. break;
  110. }
  111. }
  112. void CCardSwiperEntity::OnSysVarEvent(const char* pszKey, const char* pszValue, const char* pszOldValue, const char* pszEntityName)
  113. {
  114. if ((_strnicmp(pszKey, "UIState", strlen("UIState")) == 0))
  115. {
  116. if (_strnicmp(pszValue, "M", strlen("M")) == 0)
  117. {
  118. m_fsm.SetMainPageFlag(true);
  119. }
  120. else
  121. m_fsm.SetMainPageFlag(false);
  122. }
  123. }
  124. SP_BEGIN_ENTITY_MAP()
  125. SP_ENTITY(CCardSwiperEntity)
  126. SP_END_ENTITY_MAP()