mod_cardswiper.cpp 3.7 KB

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