mod_gpio.cpp 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #include "stdafx.h"
  2. #include "mod_gpio.h"
  3. void CGpioServiceSession::Handle_GetDevInfo(SpReqAnsContext<GpioService_GetDevInfo_Req,
  4. GpioService_GetDevInfo_Ans>::Pointer ctx)
  5. {
  6. DbgToBeidou(ctx->link, __FUNCTION__)();
  7. m_pEntity->GetDevInfo(ctx);
  8. }
  9. void CGpioServiceSession::Handle_Exit(SpOnewayCallContext<GpioService_Exit_Info>::Pointer ctx)
  10. {
  11. DbgToBeidou(ctx->link, __FUNCTION__)();
  12. m_pEntity->Exit(ctx);
  13. }
  14. void CGpioEntity::OnPreStart(CAutoArray<CSimpleStringA> strArgs, CSmartPointer<ITransactionContext> pTransactionContext)
  15. {
  16. ErrorCodeEnum erroCode = m_fsm.Init(this);
  17. GetFunction()->RegistSysVarEvent("UIState", this);
  18. if (erroCode == Error_Succeed) {
  19. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("Gpio open succeeded.");
  20. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("subscribelog...");
  21. //oiltmp the subscribelog should distinct machine type?
  22. GetFunction()->SubscribeLog(m_uuidHealth, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "HealthManager");
  23. GetFunction()->SubscribeLog(m_uuidIDC, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "IDCertificate");
  24. GetFunction()->SubscribeLog(m_uuidFP, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "FingerPrint");
  25. GetFunction()->SubscribeLog(m_uuidKB, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "PinPad");
  26. GetFunction()->SubscribeLog(m_uuidCR, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "CardIssuerStand");
  27. GetFunction()->SubscribeLog(m_uuidCA, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "CustomerAware");
  28. GetFunction()->SubscribeLog(m_uuidCC, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "ContactlessCard");
  29. GetFunction()->SubscribeLog(m_uuidDD, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "DeviceControl");
  30. GetFunction()->SubscribeLog(m_uuidCS, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "CardIssuerStore");
  31. GetFunction()->SubscribeLog(m_uuidHSPscanner, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "HSPScanner");
  32. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("sub ok...");
  33. m_fsm.AfterInit();
  34. }
  35. else
  36. {
  37. DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("gpio open failed: %s.", SpStrError(erroCode));
  38. }
  39. pTransactionContext->SendAnswer(Error_Succeed);
  40. }
  41. void CGpioEntity::OnLog(const CAutoArray<CUUID>& SubIDs, const CUUID nLogID, const LogTypeEnum eLogType, const SeverityLevelEnum eLevel,
  42. const DWORD dwSysError, const DWORD dwUserCode, const DWORD dwEntityInstanceID, const WORD wEntityDevelID,
  43. const CAutoArray<DWORD>& Param, const char* pszEntityName, const char* pszModuleName, const char* pszMessage, const linkContext& pLinkInfo)
  44. {
  45. m_fsm.OnLogEvent(dwUserCode);
  46. }
  47. void CGpioEntity::OnSysVarEvent(const char* pszKey, const char* pszValue, const char* pszOldValue, const char* pszEntityName)
  48. {
  49. if ((_strnicmp(pszKey, "UIState", strlen("UIState")) == 0))
  50. {
  51. m_fsm.OnUIState4SetWhatPage(pszValue);
  52. }
  53. }
  54. SP_BEGIN_ENTITY_MAP()
  55. SP_ENTITY(CGpioEntity)
  56. SP_END_ENTITY_MAP()