GUIConsoleFSM.cpp 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. #include "stdafx2.h"
  2. #include "GUIConsoleFSM.h"
  3. CGUIConsoleFSM::CGUIConsoleFSM()
  4. :m_pGuiTask(NULL), m_bTopMostWin(false)
  5. {
  6. }
  7. CGUIConsoleFSM::~CGUIConsoleFSM()
  8. {
  9. }
  10. ErrorCodeEnum CGUIConsoleFSM::OnInit()
  11. {
  12. AddStateHooker(this);
  13. m_pGuiTask = new GUITask();
  14. m_pGuiTask->Kickoff(m_pEntity);
  15. return Error_Succeed;
  16. }
  17. ErrorCodeEnum CGUIConsoleFSM::OnExit()
  18. {
  19. RemoveStateHooker(this);
  20. if (m_pGuiTask != NULL)
  21. {
  22. m_pGuiTask->Close();
  23. delete m_pGuiTask;
  24. m_pGuiTask = NULL;
  25. }
  26. return Error_Succeed;
  27. }
  28. void CGUIConsoleFSM::OnStateTrans(int iSrcState, int iDstState)
  29. {
  30. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("state change from %s to %s", GetStateName(iSrcState), GetStateName(iDstState));
  31. if (iDstState == s4 || iDstState == s5)
  32. {
  33. m_pGuiTask->ShowMaintainView(true, iDstState == s5);
  34. }
  35. else
  36. {
  37. m_pGuiTask->ShowMaintainView(false, false);
  38. }
  39. }
  40. void CGUIConsoleFSM::s1_on_entry()
  41. {
  42. auto pFunc = m_pEntity->GetFunction();
  43. pFunc->SetSysVar("LocalMaintain", "N");
  44. // 维护窗口显示到后台
  45. #if defined(RVC_OS_WIN)
  46. m_pGuiTask->SetWindowPosition(false);
  47. m_bTopMostWin = false;
  48. HWND hWnd = FindWindow(_T("Shell_TrayWnd"), NULL);
  49. if (hWnd != NULL) {
  50. SendMessage(hWnd, WM_COMMAND, 419, 0);
  51. }
  52. //灰显“begin initial”菜单,add by zl 20170228
  53. //加开关进行控制,add by zl 20170711
  54. CSmartPointer<IConfigInfo> pConfig;
  55. auto rc = m_pEntity->GetFunction()->OpenConfig(Config_CenterSetting, pConfig);
  56. assert(rc == Error_Succeed);
  57. int nUkeyFlg = 0;
  58. rc = pConfig->ReadConfigValueInt("Initializer", "SupportUkey", nUkeyFlg);
  59. assert(rc == Error_Succeed);
  60. DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("SupportUkey[%d]", nUkeyFlg);
  61. if (1 == nUkeyFlg) {
  62. m_pGuiTask->ShowBeginInit(FALSE);
  63. }
  64. CSystemStaticInfo sysInfo;
  65. rc = pFunc->GetSystemStaticInfo(sysInfo);
  66. if (rc == Error_Succeed && !sysInfo.strMachineType.Compare("RVC.Pad", true) && !sysInfo.strSite.Compare("cmb.FLB", true)) {
  67. m_pGuiTask->EnableMobileDialMenu(TRUE);
  68. } else {
  69. m_pGuiTask->EnableMobileDialMenu(FALSE);
  70. }
  71. #endif //RVC_OS_WIN
  72. }
  73. void CGUIConsoleFSM::s1_on_exit()
  74. {
  75. }
  76. unsigned int CGUIConsoleFSM::s1_on_event(FSMEvent* event)
  77. {
  78. return 0;
  79. }
  80. void CGUIConsoleFSM::s2_on_entry()
  81. {
  82. auto pFunc = m_pEntity->GetFunction();
  83. pFunc->SetSysVar("LocalMaintain", "O");
  84. }
  85. void CGUIConsoleFSM::s2_on_exit()
  86. {
  87. }
  88. unsigned int CGUIConsoleFSM::s2_on_event(FSMEvent* event)
  89. {
  90. if (event->iEvt == Event_CertVerified)
  91. {
  92. return event->param1;
  93. }
  94. return 0;
  95. }
  96. void CGUIConsoleFSM::s3_on_entry()
  97. {
  98. auto pFunc = m_pEntity->GetFunction();
  99. pFunc->SetSysVar("LocalMaintain", "V");
  100. }
  101. void CGUIConsoleFSM::s3_on_exit()
  102. {
  103. }
  104. unsigned int CGUIConsoleFSM::s3_on_event(FSMEvent* event)
  105. {
  106. if (event->iEvt == Event_SessionEnd)
  107. {
  108. return event->param1;
  109. }
  110. return 0;
  111. }
  112. void CGUIConsoleFSM::s4_on_entry()
  113. {
  114. auto pFunc = m_pEntity->GetFunction();
  115. pFunc->SetSysVar("LocalMaintain", "M");
  116. // 弹出维护窗口
  117. m_pGuiTask->SetWindowPosition(true);
  118. m_bTopMostWin = true;
  119. //显示“begin initial”菜单,add by zl 20170228
  120. m_pGuiTask->ShowBeginInit(TRUE);
  121. }
  122. void CGUIConsoleFSM::s4_on_exit()
  123. {
  124. }
  125. unsigned int CGUIConsoleFSM::s4_on_event(FSMEvent* event)
  126. {
  127. return 0;
  128. }
  129. void CGUIConsoleFSM::s5_on_entry()
  130. {
  131. auto pFunc = m_pEntity->GetFunction();
  132. pFunc->SetSysVar("LocalMaintain", "H");
  133. // 弹出维护窗口
  134. m_pGuiTask->SetWindowPosition(true);
  135. m_bTopMostWin = true;
  136. }
  137. void CGUIConsoleFSM::s5_on_exit()
  138. {
  139. }
  140. unsigned int CGUIConsoleFSM::s5_on_event(FSMEvent* event)
  141. {
  142. return 0;
  143. }