Преглед на файлове

Z991239-6348 #comment feat: 实体启动时检测一次TerminalStage状态(框架在实体启动前到达终态无法触发状态变化事件)

陈纪林80310970 преди 3 месеца
родител
ревизия
a6be823470
променени са 1 файла, в които са добавени 21 реда и са изтрити 2 реда
  1. 21 2
      Module/mod_ResourceWatcher/mod_ResourceWatcher.h

+ 21 - 2
Module/mod_ResourceWatcher/mod_ResourceWatcher.h

@@ -86,7 +86,25 @@ public:
 			m_fsm.TriggerAtStatusChanged(true);
 		}
 		spEntityFunction->RegistSysVarEvent("UIState", this);
-		spEntityFunction->RegistSysVarEvent("terminalStage", this);
+
+		CSimpleStringA terminalStage;
+		spEntityFunction->GetSysVar("TerminalStage", terminalStage);
+		if (
+			0 == CSimpleStringA("C").Compare(terminalStage, true)
+			|| 0 == CSimpleStringA("S").Compare(terminalStage, true)
+			|| 0 == CSimpleStringA("M").Compare(terminalStage, true)
+			|| 0 == CSimpleStringA("A").Compare(terminalStage, true)
+			)
+		{
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Terminal has been lastStage(%s) before ResourceWatcher start.", terminalStage);
+			m_fsm.TriggerProccessUpload();
+		}
+		else
+		{
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Terminal is starting, regist the teminalStage Event.");
+			spEntityFunction->RegistSysVarEvent("terminalStage", this);
+		}
+		
 
 		CSmartPointer<IConfigInfo> spCtSettingConfig;
 		GetFunction()->OpenConfig(Config_CenterSetting, spCtSettingConfig);
@@ -220,13 +238,14 @@ public:
 		if ((_strnicmp(pszKey, "UIState", strlen("UIState")) == 0)) {
 			m_fsm.TriggerAtStatusChanged(_strnicmp(pszValue, "M", strlen("M")) == 0);
 		}
-		else if ((_strnicmp(pszKey, "terminalStage", strlen("terminalStage")) == 0)) {
+		else if ((_strnicmp(pszKey, "TerminalStage", strlen("TerminalStage")) == 0)) {
 			if (0 == CSimpleStringA("C").Compare(pszValue, true)
 				|| 0 == CSimpleStringA("S").Compare(pszValue, true)
 				|| 0 == CSimpleStringA("M").Compare(pszValue, true)
 				|| 0 == CSimpleStringA("A").Compare(pszValue, true)
 				)
 			{
+				DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Status changed, teminalStage = %s.", pszValue);
 				m_fsm.TriggerProccessUpload();
 			}
 		}