mod_ContactlessCard.cpp 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. // mod_ContactlessCard.cpp : Defines the exported functions for the DLL application.
  2. //
  3. #include "stdafx.h"
  4. #include "mod_ContactlessCard.h"
  5. //oiltest
  6. #include "ContactlessCard_msg_g.h"
  7. bool bCard = false;
  8. void ContactlessCardServerSession::Handle_Insert(SpReqAnsContext<ContactlessCardService_Insert_Req, ContactlessCardService_Insert_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(__FUNCTION__)("Invoke Insert");
  13. m_pEntity->Insert(ctx);
  14. }
  15. void ContactlessCardServerSession::Handle_CancelInsert(SpOnewayCallContext<ContactlessCardService_CancelInsert_Info>::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(__FUNCTION__)("Invoke CancelInsert");
  20. m_pEntity->CancelInsert(ctx);
  21. }
  22. void ContactlessCardServerSession::Handle_InsertWaitMore(SpOnewayCallContext<ContactlessCardService_InsertWaitMore_Info>::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(__FUNCTION__)("Invoke InsertWaitMore");
  27. m_pEntity->InsertWaitMore(ctx);
  28. }
  29. void ContactlessCardServerSession::Handle_PreOnline(SpReqAnsContext<ContactlessCardService_PreOnline_Req, ContactlessCardService_PreOnline_Ans>::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(__FUNCTION__)("Invoke PreOnline");
  34. m_pEntity->PreOnline(ctx);
  35. }
  36. void ContactlessCardServerSession::Handle_PostOnline(SpReqAnsContext<ContactlessCardService_PostOnline_Req, ContactlessCardService_PostOnline_Ans>::Pointer ctx)
  37. {
  38. LOG_FUNCTION();
  39. DbgToBeidou(ctx->link, __FUNCTION__)();
  40. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke PostOnline");
  41. m_pEntity->PostOnline(ctx);
  42. }
  43. void ContactlessCardServerSession::Handle_Eject(SpReqAnsContext<ContactlessCardService_Eject_Req, ContactlessCardService_Eject_Ans>::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(__FUNCTION__)("Invoke Eject");
  48. m_pEntity->Eject(ctx);
  49. }
  50. void ContactlessCardServerSession::Handle_Exit(SpOnewayCallContext<ContactlessCardService_Exit_Info>::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(__FUNCTION__)("Invoke Exit");
  55. m_pEntity->Exit(ctx);
  56. }
  57. void ContactlessCardServerSession::Handle_QueryCardInfo(SpReqAnsContext<ContactlessCardService_QueryCardInfo_Req, ContactlessCardService_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(__FUNCTION__)("Invoke QueryCardInfo");
  62. m_pEntity->QueryCardInfo(ctx);
  63. }
  64. void ContactlessCardServerSession::Handle_GetDevInfo(SpReqAnsContext<ContactlessCardService_GetDevInfo_Req, ContactlessCardService_GetDevInfo_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(__FUNCTION__)("Invoke GetDevInfo");
  69. m_pEntity->GetDevInfo(ctx);
  70. }
  71. //new interface
  72. void ContactlessCardServerSession::Handle_CancelReadJS(SpOnewayCallContext<ContactlessCardService_CancelReadJS_Info>::Pointer ctx)
  73. {
  74. LOG_FUNCTION();
  75. DbgToBeidou(ctx->link, __FUNCTION__)();
  76. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke CancelReadJS");
  77. m_pEntity->CancelReadJS(ctx);
  78. }
  79. void ContactlessCardServerSession::Handle_ReadJS(SpReqAnsContext<ContactlessCardService_ReadJS_Req, ContactlessCardService_ReadJS_Ans>::Pointer ctx)
  80. {
  81. LOG_FUNCTION();
  82. DbgToBeidou(ctx->link, __FUNCTION__)();
  83. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke ReadJS");
  84. m_pEntity->ReadJS(ctx);
  85. }
  86. void ContactlessCardServerSession::Handle_PostOnlineJS(SpReqAnsContext<ContactlessCardService_PostOnlineJS_Req, ContactlessCardService_PostOnlineJS_Ans>::Pointer ctx)
  87. {
  88. LOG_FUNCTION();
  89. DbgToBeidou(ctx->link, __FUNCTION__)();
  90. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke PostOnlineJS");
  91. m_pEntity->PostOnlineJS(ctx);
  92. }
  93. void ContactlessCardServerSession::Handle_EjectJS(SpReqAnsContext<ContactlessCardService_EjectJS_Req, ContactlessCardService_EjectJS_Ans>::Pointer ctx)
  94. {
  95. LOG_FUNCTION();
  96. DbgToBeidou(ctx->link, __FUNCTION__)();
  97. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke EjectJS");
  98. m_pEntity->EjectJS(ctx);
  99. }
  100. void ContactlessCardServerSession::Handle_QueryHasCardJS(SpReqAnsContext<ContactlessCardService_QueryHasCardJS_Req, ContactlessCardService_QueryHasCardJS_Ans>::Pointer ctx)
  101. {
  102. LOG_FUNCTION();
  103. DbgToBeidou(ctx->link, __FUNCTION__)();
  104. DbgWithLink(LOG_LEVEL_INFO, ctx->link.checkEmpty() ? LOG_TYPE_SYSTEM : LOG_TYPE_USER).setAPI(__FUNCTION__)("Invoke QueryHasCardJS");
  105. m_pEntity->QueryHasCardJS(ctx);
  106. }
  107. void CContactlessCardEntity::OnSysVarEvent(const char* pszKey, const char* pszValue, const char* pszOldValue, const char* pszEntityName)
  108. {
  109. if ((_strnicmp(pszKey, "UIState", strlen("UIState")) == 0))
  110. {
  111. m_fsm.OnUIState4SetWhatPage(pszValue);
  112. if (_strnicmp(pszValue, "M", strlen("M")) == 0) {
  113. m_fsm.ExitToMainPage();
  114. }
  115. }
  116. }
  117. SP_BEGIN_ENTITY_MAP()
  118. SP_ENTITY(CContactlessCardEntity)
  119. SP_END_ENTITY_MAP()