mod_pinpad.cpp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // mod_pinpad.cpp : Defines the exported functions for the DLL application.
  2. //
  3. #include "stdafx.h"
  4. #include "mod_PinPad.h"
  5. void PinPadServerSession::Handle_InputWaitMore(SpOnewayCallContext<PinPadService_InputWaitMore_Info>::Pointer ctx)
  6. {
  7. DbgToBeidou(ctx->link, __FUNCTION__)();
  8. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setAPI(__FUNCTION__)("InputWaitMore something u want to know...");
  9. m_pEntity->InputWaitMore(ctx);
  10. }
  11. void PinPadServerSession::Handle_InputCancel(SpOnewayCallContext<PinPadService_InputCancel_Info>::Pointer ctx)
  12. {
  13. DbgToBeidou(ctx->link, __FUNCTION__)();
  14. m_pEntity->InputCancel(ctx);
  15. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setAPI(__FUNCTION__)("handle front cancel");
  16. }
  17. void PinPadServerSession::Handle_Exit(SpOnewayCallContext<PinPadService_Exit_Info>::Pointer ctx)
  18. {
  19. DbgToBeidou(ctx->link, __FUNCTION__)();
  20. m_pEntity->Exit(ctx);
  21. }
  22. void PinPadServerSession::Handle_GetInputJS(SpReqAnsContext<PinPadService_GetInputJS_Req, PinPadService_GetInputJS_Ans>::Pointer ctx)
  23. {
  24. DbgToBeidou(ctx->link, __FUNCTION__)();
  25. m_pEntity->GetInputJS(ctx);
  26. }
  27. void PinPadServerSession::Handle_InputCancelJS(SpReqAnsContext<PinPadService_InputCancelJS_Req, PinPadService_InputCancelJS_Ans>::Pointer ctx)
  28. {
  29. DbgToBeidou(ctx->link, __FUNCTION__)();
  30. m_pEntity->InputCancelJS(ctx);
  31. }
  32. void PinPadServerSession::Handle_GetInputSM(SpReqAnsContext<PinPadService_GetInputSM_Req, PinPadService_GetInputSM_Ans>::Pointer ctx)
  33. {
  34. DbgToBeidou(ctx->link, __FUNCTION__)();
  35. m_pEntity->GetInputSM(ctx);
  36. }
  37. void PinPadServerSession::Handle_LoadKeysSM(SpReqAnsContext<PinPadService_LoadKeysSM_Req, PinPadService_LoadKeysSM_Ans>::Pointer ctx)
  38. {
  39. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setAPI(__FUNCTION__)("LoadKeysSM,initializeflag:%d,smflag:%d", ctx->Req.initializeflag, ctx->Req.smflag);
  40. DbgToBeidou(ctx->link, __FUNCTION__)();
  41. m_pEntity->LoadKeysSM(ctx);
  42. }
  43. void PinPadServerSession::Handle_EncryptDataSM(SpReqAnsContext<PinPadService_EncryptDataSM_Req, PinPadService_EncryptDataSM_Ans>::Pointer ctx)
  44. {
  45. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setAPI(__FUNCTION__)("EncryptDataSM,smflag:%d", ctx->Req.smflag);
  46. DbgToBeidou(ctx->link, __FUNCTION__)();
  47. m_pEntity->EncryptDataSM(ctx);
  48. }
  49. void PinPadServerSession::Handle_QueryFunc(SpReqAnsContext<PinPadService_QueryFunc_Req, PinPadService_QueryFunc_Ans>::Pointer ctx)
  50. {
  51. m_pEntity->QueryFunc(ctx);
  52. }
  53. void PinPadServerSession::Handle_GetCheckCode(SpReqAnsContext<PinPadService_GetCheckCode_Req, PinPadService_GetCheckCode_Ans>::Pointer ctx)
  54. {
  55. DbgToBeidou(ctx->link, __FUNCTION__)();
  56. m_pEntity->GetCheckCode(ctx);
  57. }
  58. void PinPadServerSession::Handle_GetDevInfo(SpReqAnsContext<PinPadService_GetDevInfo_Req, PinPadService_GetDevInfo_Ans>::Pointer ctx)
  59. {
  60. m_pEntity->GetDevInfo(ctx);
  61. }
  62. void CPinPadEntity::DoInputCancelJS(SpReqAnsContext<PinPadService_InputCancelJS_Req, PinPadService_InputCancelJS_Ans>::Pointer ctx)
  63. {
  64. ULLINT ullBeginTime = SP::Module::Comm::RVCGetTickCount();
  65. ULLINT ullEndTime = SP::Module::Comm::RVCGetTickCount();
  66. while ((ullEndTime - ullBeginTime) < 5000)
  67. {
  68. if (_stricmp(m_fsm.GetCurrStateName(), "Input") != 0)
  69. {
  70. ctx->Answer(Error_Succeed);
  71. break;
  72. }
  73. Sleep(500);
  74. ullEndTime = SP::Module::Comm::RVCGetTickCount();
  75. }
  76. }
  77. void CPinPadEntity::OnSysVarEvent(const char *pszKey,
  78. const char *pszValue, const char *pszOldValue, const char *pszEntityName)
  79. {
  80. if ((_strnicmp(pszKey, "UIState", strlen("UIState")) == 0))
  81. {
  82. m_fsm.OnUIState4SetWhatPage(pszValue);
  83. }
  84. }
  85. SP_BEGIN_ENTITY_MAP()
  86. SP_ENTITY(CPinPadEntity)
  87. SP_END_ENTITY_MAP()