mod_gpio.cpp 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. m_pEntity->Exit(ctx);
  12. }
  13. void CGpioEntity::OnPreStart(CAutoArray<CSimpleStringA> strArgs, CSmartPointer<ITransactionContext> pTransactionContext)
  14. {
  15. ErrorCodeEnum erroCode = m_fsm.Init(this);
  16. GetFunction()->RegistSysVarEvent("UIState", this);
  17. if (erroCode == Error_Succeed) {
  18. DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Gpio open succeeded.");
  19. //oiltmp the subscribelog should distinct machine type?
  20. GetFunction()->SubscribeLog(m_uuidHealth, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "HealthManager");
  21. GetFunction()->SubscribeLog(m_uuidIDC, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "IDCertificate");
  22. GetFunction()->SubscribeLog(m_uuidFP, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "FingerPrint");
  23. GetFunction()->SubscribeLog(m_uuidKB, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "PinPad");
  24. GetFunction()->SubscribeLog(m_uuidCR, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "CardIssuerStand");
  25. GetFunction()->SubscribeLog(m_uuidCA, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "CustomerAware");
  26. GetFunction()->SubscribeLog(m_uuidCC, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "ContactlessCard");
  27. GetFunction()->SubscribeLog(m_uuidCS, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "CardIssuerStore");
  28. GetFunction()->SubscribeLog(m_uuidHSPscanner, this, Log_Event, Severity_Middle, Error_IgnoreAll, -1, "HSPScanner");
  29. m_fsm.AfterInit();
  30. }
  31. else
  32. {
  33. DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("init gpio failed: %s", SpStrError(erroCode));
  34. }
  35. pTransactionContext->SendAnswer(Error_Succeed);
  36. }
  37. void CGpioEntity::OnLog(const CAutoArray<CUUID>& SubIDs, const CUUID nLogID, const LogTypeEnum eLogType, const SeverityLevelEnum eLevel,
  38. const DWORD dwSysError, const DWORD dwUserCode, const DWORD dwEntityInstanceID, const WORD wEntityDevelID,
  39. const CAutoArray<DWORD>& Param, const char* pszEntityName, const char* pszModuleName, const char* pszMessage, const linkContext& pLinkInfo)
  40. {
  41. m_fsm.OnLogEvent(dwUserCode);
  42. }
  43. void CGpioEntity::OnSysVarEvent(const char* pszKey, const char* pszValue, const char* pszOldValue, const char* pszEntityName)
  44. {
  45. if ((_strnicmp(pszKey, "UIState", strlen("UIState")) == 0))
  46. {
  47. m_fsm.OnUIState4SetWhatPage(pszValue);
  48. }
  49. }
  50. SP_BEGIN_ENTITY_MAP()
  51. SP_ENTITY(CGpioEntity)
  52. SP_END_ENTITY_MAP()