GUIConsoleFSM.cpp 3.4 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. Dbg("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. #endif //RVC_OS_WIN
  53. //灰显“begin initial”菜单,add by zl 20170228
  54. //加开关进行控制,add by zl 20170711
  55. CSmartPointer<IConfigInfo> pConfig;
  56. auto rc = m_pEntity->GetFunction()->OpenConfig(Config_CenterSetting, pConfig);
  57. assert(rc == Error_Succeed);
  58. int nUkeyFlg = 0;
  59. rc = pConfig->ReadConfigValueInt("Initializer", "SupportUkey", nUkeyFlg);
  60. assert(rc == Error_Succeed);
  61. Dbg("SupportUkey[%d]", nUkeyFlg);
  62. if (1==nUkeyFlg)
  63. {
  64. m_pGuiTask->ShowBeginInit(FALSE);
  65. }
  66. CSystemStaticInfo sysInfo;
  67. rc = pFunc->GetSystemStaticInfo(sysInfo);
  68. if (rc == Error_Succeed && !sysInfo.strMachineType.Compare("RVC.Pad", true) && !sysInfo.strSite.Compare("cmb.FLB", true)) {
  69. m_pGuiTask->EnableMobileDialMenu(TRUE);
  70. } else {
  71. m_pGuiTask->EnableMobileDialMenu(FALSE);
  72. }
  73. }
  74. void CGUIConsoleFSM::s1_on_exit()
  75. {
  76. }
  77. unsigned int CGUIConsoleFSM::s1_on_event(FSMEvent* event)
  78. {
  79. return 0;
  80. }
  81. void CGUIConsoleFSM::s2_on_entry()
  82. {
  83. auto pFunc = m_pEntity->GetFunction();
  84. pFunc->SetSysVar("LocalMaintain", "O");
  85. }
  86. void CGUIConsoleFSM::s2_on_exit()
  87. {
  88. }
  89. unsigned int CGUIConsoleFSM::s2_on_event(FSMEvent* event)
  90. {
  91. if (event->iEvt == Event_CertVerified)
  92. {
  93. return event->param1;
  94. }
  95. return 0;
  96. }
  97. void CGUIConsoleFSM::s3_on_entry()
  98. {
  99. auto pFunc = m_pEntity->GetFunction();
  100. pFunc->SetSysVar("LocalMaintain", "V");
  101. }
  102. void CGUIConsoleFSM::s3_on_exit()
  103. {
  104. }
  105. unsigned int CGUIConsoleFSM::s3_on_event(FSMEvent* event)
  106. {
  107. if (event->iEvt == Event_SessionEnd)
  108. {
  109. return event->param1;
  110. }
  111. return 0;
  112. }
  113. void CGUIConsoleFSM::s4_on_entry()
  114. {
  115. auto pFunc = m_pEntity->GetFunction();
  116. pFunc->SetSysVar("LocalMaintain", "M");
  117. // 弹出维护窗口
  118. m_pGuiTask->SetWindowPosition(true);
  119. m_bTopMostWin = true;
  120. //显示“begin initial”菜单,add by zl 20170228
  121. m_pGuiTask->ShowBeginInit(TRUE);
  122. }
  123. void CGUIConsoleFSM::s4_on_exit()
  124. {
  125. }
  126. unsigned int CGUIConsoleFSM::s4_on_event(FSMEvent* event)
  127. {
  128. return 0;
  129. }
  130. void CGUIConsoleFSM::s5_on_entry()
  131. {
  132. auto pFunc = m_pEntity->GetFunction();
  133. pFunc->SetSysVar("LocalMaintain", "H");
  134. // 弹出维护窗口
  135. m_pGuiTask->SetWindowPosition(true);
  136. m_bTopMostWin = true;
  137. }
  138. void CGUIConsoleFSM::s5_on_exit()
  139. {
  140. }
  141. unsigned int CGUIConsoleFSM::s5_on_event(FSMEvent* event)
  142. {
  143. return 0;
  144. }