#include "stdafx2.h" #include "GUIConsoleFSM.h" CGUIConsoleFSM::CGUIConsoleFSM() :m_pGuiTask(NULL), m_bTopMostWin(false) { } CGUIConsoleFSM::~CGUIConsoleFSM() { } ErrorCodeEnum CGUIConsoleFSM::OnInit() { AddStateHooker(this); m_pGuiTask = new GUITask(); m_pGuiTask->Kickoff(m_pEntity); return Error_Succeed; } ErrorCodeEnum CGUIConsoleFSM::OnExit() { RemoveStateHooker(this); if (m_pGuiTask != NULL) { m_pGuiTask->Close(); delete m_pGuiTask; m_pGuiTask = NULL; } return Error_Succeed; } void CGUIConsoleFSM::OnStateTrans(int iSrcState, int iDstState) { DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("state change from %s to %s", GetStateName(iSrcState), GetStateName(iDstState)); if (iDstState == s4 || iDstState == s5) { m_pGuiTask->ShowMaintainView(true, iDstState == s5); } else { m_pGuiTask->ShowMaintainView(false, false); } } void CGUIConsoleFSM::s1_on_entry() { auto pFunc = m_pEntity->GetFunction(); pFunc->SetSysVar("LocalMaintain", "N"); // 维护窗口显示到后台 #if defined(RVC_OS_WIN) m_pGuiTask->SetWindowPosition(false); m_bTopMostWin = false; HWND hWnd = FindWindow(_T("Shell_TrayWnd"), NULL); if (hWnd != NULL) { SendMessage(hWnd, WM_COMMAND, 419, 0); } //灰显“begin initial”菜单,add by zl 20170228 //加开关进行控制,add by zl 20170711 CSmartPointer pConfig; auto rc = m_pEntity->GetFunction()->OpenConfig(Config_CenterSetting, pConfig); assert(rc == Error_Succeed); int nUkeyFlg = 0; rc = pConfig->ReadConfigValueInt("Initializer", "SupportUkey", nUkeyFlg); assert(rc == Error_Succeed); DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("SupportUkey[%d]", nUkeyFlg); if (1 == nUkeyFlg) { m_pGuiTask->ShowBeginInit(FALSE); } CSystemStaticInfo sysInfo; rc = pFunc->GetSystemStaticInfo(sysInfo); if (rc == Error_Succeed && !sysInfo.strMachineType.Compare("RVC.Pad", true) && !sysInfo.strSite.Compare("cmb.FLB", true)) { m_pGuiTask->EnableMobileDialMenu(TRUE); } else { m_pGuiTask->EnableMobileDialMenu(FALSE); } #endif //RVC_OS_WIN } void CGUIConsoleFSM::s1_on_exit() { } unsigned int CGUIConsoleFSM::s1_on_event(FSMEvent* event) { return 0; } void CGUIConsoleFSM::s2_on_entry() { auto pFunc = m_pEntity->GetFunction(); pFunc->SetSysVar("LocalMaintain", "O"); } void CGUIConsoleFSM::s2_on_exit() { } unsigned int CGUIConsoleFSM::s2_on_event(FSMEvent* event) { if (event->iEvt == Event_CertVerified) { return event->param1; } return 0; } void CGUIConsoleFSM::s3_on_entry() { auto pFunc = m_pEntity->GetFunction(); pFunc->SetSysVar("LocalMaintain", "V"); } void CGUIConsoleFSM::s3_on_exit() { } unsigned int CGUIConsoleFSM::s3_on_event(FSMEvent* event) { if (event->iEvt == Event_SessionEnd) { return event->param1; } return 0; } void CGUIConsoleFSM::s4_on_entry() { auto pFunc = m_pEntity->GetFunction(); pFunc->SetSysVar("LocalMaintain", "M"); // 弹出维护窗口 m_pGuiTask->SetWindowPosition(true); m_bTopMostWin = true; //显示“begin initial”菜单,add by zl 20170228 m_pGuiTask->ShowBeginInit(TRUE); } void CGUIConsoleFSM::s4_on_exit() { } unsigned int CGUIConsoleFSM::s4_on_event(FSMEvent* event) { return 0; } void CGUIConsoleFSM::s5_on_entry() { auto pFunc = m_pEntity->GetFunction(); pFunc->SetSysVar("LocalMaintain", "H"); // 弹出维护窗口 m_pGuiTask->SetWindowPosition(true); m_bTopMostWin = true; } void CGUIConsoleFSM::s5_on_exit() { } unsigned int CGUIConsoleFSM::s5_on_event(FSMEvent* event) { return 0; }