mod_pinpad.cpp 3.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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("InputWaitMore")("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("InputCancel")("handle front cancel");
  16. }
  17. void PinPadServerSession::Handle_Exit(SpOnewayCallContext<PinPadService_Exit_Info>::Pointer ctx)
  18. {
  19. DbgToBeidou(ctx->link, __FUNCTION__)();
  20. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setAPI("Exit")("handle exit");
  21. m_pEntity->Exit(ctx);
  22. }
  23. void PinPadServerSession::Handle_GetInputSM(SpReqAnsContext<PinPadService_GetInputSM_Req, PinPadService_GetInputSM_Ans>::Pointer ctx)
  24. {
  25. DbgToBeidou(ctx->link, __FUNCTION__)();
  26. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setAPI("GetInputSM")("timeout:%d,length:%d,confirm:%d", ctx->Req.timeout,ctx->Req.length,ctx->Req.confirm);
  27. m_pEntity->GetInputSM(ctx);
  28. }
  29. void PinPadServerSession::Handle_LoadKeysSM(SpReqAnsContext<PinPadService_LoadKeysSM_Req, PinPadService_LoadKeysSM_Ans>::Pointer ctx)
  30. {
  31. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setAPI("LoadKeysSM")("LoadKeysSM,initializeflag:%d,smflag:%d", ctx->Req.initializeflag, ctx->Req.smflag);
  32. DbgToBeidou(ctx->link, __FUNCTION__)();
  33. m_pEntity->LoadKeysSM(ctx);
  34. }
  35. void PinPadServerSession::Handle_EncryptDataSM(SpReqAnsContext<PinPadService_EncryptDataSM_Req, PinPadService_EncryptDataSM_Ans>::Pointer ctx)
  36. {
  37. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setAPI("EncryptDataSM")("EncryptDataSM,smflag:%d", ctx->Req.smflag);
  38. DbgToBeidou(ctx->link, __FUNCTION__)();
  39. m_pEntity->EncryptDataSM(ctx);
  40. }
  41. void PinPadServerSession::Handle_QueryFunc(SpReqAnsContext<PinPadService_QueryFunc_Req, PinPadService_QueryFunc_Ans>::Pointer ctx)
  42. {
  43. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setAPI("QueryFunc")();
  44. DbgToBeidou(ctx->link, __FUNCTION__)();
  45. m_pEntity->QueryFunc(ctx);
  46. }
  47. void PinPadServerSession::Handle_GetCheckCode(SpReqAnsContext<PinPadService_GetCheckCode_Req, PinPadService_GetCheckCode_Ans>::Pointer ctx)
  48. {
  49. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setAPI("GetCheckCode")();
  50. DbgToBeidou(ctx->link, __FUNCTION__)();
  51. m_pEntity->GetCheckCode(ctx);
  52. }
  53. void PinPadServerSession::Handle_GetDevInfo(SpReqAnsContext<PinPadService_GetDevInfo_Req, PinPadService_GetDevInfo_Ans>::Pointer ctx)
  54. {
  55. DbgToBeidou(ctx->link, __FUNCTION__)();
  56. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setAPI("GetDevInfo")();
  57. m_pEntity->GetDevInfo(ctx);
  58. }
  59. void CPinPadEntity::OnSysVarEvent(const char *pszKey,
  60. const char *pszValue, const char *pszOldValue, const char *pszEntityName)
  61. {
  62. if ((_strnicmp(pszKey, "UIState", strlen("UIState")) == 0))
  63. {
  64. if (_strnicmp(pszValue, "M", strlen("M")) == 0)
  65. m_fsm.SetInWhatPage(PageType_MainPage);
  66. else if (_strnicmp(pszValue, "U", strlen("U")) == 0)
  67. m_fsm.SetInWhatPage(PageType_UserDesktop);
  68. else
  69. m_fsm.SetInWhatPage(PageType_Other);
  70. }
  71. if ((_strnicmp(pszKey, "FWBReConn", strlen("FWBReConn")) == 0))
  72. {
  73. //"Y":open suc "U":unbind
  74. if (_strnicmp(pszValue, "Y", strlen("Y")) == 0 || _strnicmp(pszValue, "U", strlen("U")) == 0)
  75. {
  76. FSMEvent* e = new FSMEvent(USER_EVT_TODO_INIT);
  77. m_fsm.PostEventFIFO(e);
  78. }
  79. else if (_strnicmp(pszValue, "D", strlen("D")) == 0)
  80. m_fsm.ResetDevInitFlag();
  81. }
  82. }
  83. SP_BEGIN_ENTITY_MAP()
  84. SP_ENTITY(CPinPadEntity)
  85. SP_END_ENTITY_MAP()