mod_cardswiper.cpp 3.7 KB

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