GUIConsoleFSM.cpp 3.4 KB

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