Ver código fonte

!2 merge performance

chenliangyu 1 ano atrás
pai
commit
1562bd5a6a
35 arquivos alterados com 1414 adições e 359 exclusões
  1. 3 0
      Framework/Common/RVCEventCode.h
  2. 2 2
      Framework/RvcLogSdk/log_producer_manager.c
  3. 1 1
      Framework/spbase/SpEntity.cpp
  4. 7 2
      Framework/spbase/SpModule.cpp
  5. 2 0
      Framework/spbase/sp_cfg.cpp
  6. 3 2
      Framework/spbase/sp_httpDefine.cpp
  7. 16 0
      Framework/spbase/sp_runTask.cpp
  8. 1 0
      Framework/spbase/sp_runTask.h
  9. 2 1
      Framework/spshell/app.cpp
  10. 1 0
      Framework/spshell/spshell.cpp
  11. 10 0
      Module/include/EventCode.h
  12. 12 34
      Module/mod_chromium/CModTools.cpp
  13. 18 3
      Module/mod_chromium/mod_chromium.cpp
  14. 1 0
      Module/mod_chromium/mod_chromium.h
  15. 18 1
      Module/mod_guiconsole/CMakeLists.txt
  16. 1 2
      Module/mod_guiconsole/GUIConsole_msg_g.h
  17. 1 2
      Module/mod_guiconsole/GuiConsole.xml
  18. 158 116
      Module/mod_guiconsole/guiconsole_define.cpp
  19. 27 26
      Module/mod_guiconsole/guiconsole_define.h
  20. 350 0
      Module/mod_guiconsole/linux_system_monitor/linux_parser.cpp
  21. 61 0
      Module/mod_guiconsole/linux_system_monitor/linux_parser.h
  22. 52 0
      Module/mod_guiconsole/linux_system_monitor/process.cpp
  23. 33 0
      Module/mod_guiconsole/linux_system_monitor/process.h
  24. 46 0
      Module/mod_guiconsole/linux_system_monitor/processor.cpp
  25. 12 0
      Module/mod_guiconsole/linux_system_monitor/processor.h
  26. 122 0
      Module/mod_guiconsole/linux_system_monitor/system.cpp
  27. 28 0
      Module/mod_guiconsole/linux_system_monitor/system.h
  28. 205 16
      Module/mod_guiconsole/mod_guiconsole.cpp
  29. 179 126
      Module/mod_healthmanager/HealthManagerFSM.cpp
  30. 19 13
      Module/mod_healthmanager/HealthManagerFSM.h
  31. 5 5
      Module/mod_healthmanager/mod_healthmanager.cpp
  32. 2 2
      Module/mod_pinpad/PinPadFSM.cpp
  33. 3 1
      Module/mod_vtmloader/VtmLoaderFSM.cpp
  34. 11 2
      Module/mod_vtmloader/mod_vtmloader.cpp
  35. 2 2
      addin/cmake/DependencyConanFiles.cmake

+ 3 - 0
Framework/Common/RVCEventCode.h

@@ -24,4 +24,7 @@ inline CSimpleStringA DWORD2Hex(DWORD cur)
 #define RTAERR_SPSHELL_EXCEPTION			"RTA0012"	//框架crash
 
 
+#define RTAERR_SPHOST_IOM_FAILED			"RTA0021"	//iom create failed
+
+
 #endif

+ 2 - 2
Framework/RvcLogSdk/log_producer_manager.c

@@ -327,7 +327,7 @@ void* log_producer_write_persistent_thread(void* param)
         lens = ClibsharequeueGetLens(producer_manager->share_queue);
         
         now = time(NULL);
-        if ((lens < MAX_SHAREQUEUE_LENS / 4) && (now - last_write_time < 3)) {//每3s执行一次事务
+        if ((lens < MAX_SHAREQUEUE_LENS / 4) && (now - last_write_time < 1)) {//每1s执行一次事务
             CS_LEAVE(persistent_manager->lock);
             continue;
         }
@@ -441,7 +441,7 @@ void* log_producer_flush_thread(void* param)
             // if no job, check now loggroup
             _try_flush_loggroup(producer_manager);
 	    }
-        Sleep(1000);
+        Sleep(100);
     }
 
     

+ 1 - 1
Framework/spbase/SpEntity.cpp

@@ -1389,7 +1389,7 @@ ErrorCodeEnum SpEntity::GetPath(const char *pszKey,CSimpleStringA &strPath)
 	if (!pszKey)
 		return Error_Null;
 
-	if (_stricmp(pszKey, "Root") == 0) {
+	if (_stricmp(pszKey, "Root") == 0 || _stricmp(pszKey, "Run") == 0) {
 		strPath = env->dir->root_path;
 	} else if (_stricmp(pszKey, "RootVer") == 0) {
 		strPath = env->dir->root_ver_path;

+ 7 - 2
Framework/spbase/SpModule.cpp

@@ -15,6 +15,7 @@
 #endif //RVC_OS_WIN
 
 #include <winpr/thread.h>
+#include <RVCEventCode.h>
 
 SpModule::SpModule( sp_mod_t *mod, sp_cfg_shell_module_t *cfg_mod ) 
 	: m_arrEntity(NULL)
@@ -97,8 +98,12 @@ ErrorCodeEnum SpModule::Init( const char *url )
 	//sp_dbg_debug("to create iom instance...");
 	rc = sp_iom_create(url, m_mod->cfg->idx, &m_iom);
 	if (rc != 0) {
-		DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("creat iom instance failed!");
-		return Error_Param;
+		Sleep(500);
+		if (0 != (rc = sp_iom_create(url, m_mod->cfg->idx, &m_iom)))
+		{
+			DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM).setResultCode(RTAERR_SPHOST_IOM_FAILED)("creat iom instance failed!");
+			return Error_Param;
+		}
 	}
 
 	rc = sp_log_client_create(NULL, m_iom, &m_anonymous_log);

+ 2 - 0
Framework/spbase/sp_cfg.cpp

@@ -41,6 +41,7 @@
 #include <ctime>
 #include <sstream>
 #include <iomanip>
+#include <windows.h>
 #define UPDATE_ROOT_BY_HTTP
 #else
 #include "JsonConvertHelper.hpp"
@@ -48,6 +49,7 @@
 #include "sp_checkEntity.h"
 
 
+
 #if defined(_MSC_VER)
 
 std::map<std::string, std::string> g_specialRunInfoArr;

+ 3 - 2
Framework/spbase/sp_httpDefine.cpp

@@ -701,9 +701,10 @@ std::pair<bool, TerminalCfgRet> GetTerminalCfgFromUrl(CSimpleString url, const s
 	for (int i = 0; i < urlArr.GetCount(); i++)
 	{
 		auto curUrl = urlArr[i];
-		if (curUrl.GetLength() == 0)
+		if (curUrl.GetLength() == 0 || terminalNo.length() == 0)
 		{
-			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("GetTerminalCfgFromUrl::urlArr may be wrong, pos:%d, %s", i, url.GetData());
+			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("GetTerminalCfgFromUrl::urlArr may be wrong, pos:%d, url:%s, terminalNo:%s",
+				i, url.GetData(), terminalNo.c_str());
 			continue;
 		}
 		TerminalCfgReq req;

+ 16 - 0
Framework/spbase/sp_runTask.cpp

@@ -121,6 +121,22 @@ int sp_runtask_killprocess()
 	return 0;
 }
 
+void sp_tryquickStartCef()
+{
+#if defined(RVC_OS_WIN)
+	char tmp[MAX_PATH];
+	GetModuleFileNameA(NULL, tmp, MAX_PATH);
+	*strrchr(tmp, SPLIT_SLASH) = 0;
+	sprintf(tmp, "%s" SPLIT_SLASH_STR "Chromium" SPLIT_SLASH_STR "cefclient.exe", tmp);
+	if (!ExistsFile(tmp))
+	{
+		std::string cmd = tmp;
+		cmd.append(" --listpeers");
+		WinExec(cmd.c_str(), SW_HIDE);
+	}
+#endif
+}
+
 int sp_runtask_loadLogLevel()
 {
 	sp_tryRefreshLogLevelFromCacheConfig();

+ 1 - 0
Framework/spbase/sp_runTask.h

@@ -10,6 +10,7 @@ extern "C" {
 	SPBASE_API int sp_runtask_killprocess();
 	SPBASE_API int sp_runtask_startprocess();
 	SPBASE_API int sp_runtask_loadLogLevel();
+	SPBASE_API void sp_tryquickStartCef();
 
 #ifdef __cplusplus
 } // extern "C" {

+ 2 - 1
Framework/spshell/app.cpp

@@ -178,6 +178,7 @@ static int kickoff_startlist()
 
 #include "shm_mem.h"
 #include "sp_runTask.h"
+#include <RVCEventCode.h>
 
 int  RenameLightPacks(const char *pszAdPath)
 {
@@ -432,7 +433,7 @@ int app_init(const sp_cfg_start_args_t* args, std::function<void(const char* msg
 	/** and create bus endpt inner*/
 	rc = sp_iom_create(env->url, SP_SHELL_MOD_ID, &g_app.iom);
 	if (rc != 0) {
-		DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("create iom failed!");
+		DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM).setResultCode(RTAERR_SPHOST_IOM_FAILED)("create iom failed!");
 #if defined(_MSC_VER)
 		return std::make_pair(rc, "create iom failed!");
 #else

+ 1 - 0
Framework/spshell/spshell.cpp

@@ -1092,6 +1092,7 @@ int main(int argc, char** argv)
 	}
 #endif //_MSC_VER
 	sp_runtask_loadLogLevel();
+	sp_tryquickStartCef();
     create_log_producer_default("SpShell", 0);
     DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("===================SpShell start=====================");
     DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("process id: %d, saveFile:%d", GetCurrentProcessId(), saveFile);

+ 10 - 0
Module/include/EventCode.h

@@ -698,6 +698,16 @@ ERROR_ACCESSAUTH_CONNECT_ACS_x}
 #define WARN_GUICONSOLE_BASICINFO_RUNINFO_FAILED		0x50820703
 //实体控制,打开日志失败,日志不存在
 #define WARN_GUICONSOLE_ENTITYCONTROL_LOG_NOTEXIST		0x50820801
+//实体控制,帮助-root配置打开失败
+#define WARN_GUICONSOLE_HELP_ROOT_FAILED			0x50820901
+//实体控制,帮助-center配置打开失败
+#define WARN_GUICONSOLE_HELP_CENTER_FAILED			0x50820902
+//实体控制,帮助-shell配置打开失败
+#define WARN_GUICONSOLE_HELP_SHELL_FAILED			0x50820903
+//实体控制,帮助-vtmerr配置打开失败
+#define WARN_GUICONSOLE_HELP_VTMERR_FAILED			0x50820904
+//实体控制,帮助--获取节点失败
+#define WARN_GUICONSOLE_HELP_GETSECTION_FAILED			0x50820905
 
 
 

+ 12 - 34
Module/mod_chromium/CModTools.cpp

@@ -261,14 +261,11 @@ namespace Chromium {
         this->m_pEntity->GetFunction()->GetPath("Temp", cachePath);
         cachePath.Append(CSimpleStringA(SPLIT_SLASH_STR)).Append("cefCache_").Append(m_strCacheHead.length() > 0 ? m_strCacheHead.c_str() : "").Append(errType._to_string());
 		errPageUrl.Append(" --cache-path=").Append(cachePath);
-        if (g_useMagic)
-			errPageUrl.Append(" --magic-str=").Append(m_magicStr.c_str());
 		if (g_withMedia)
 			errPageUrl.Append(" --enable-media-stream=1 --enable-speech-input=1");
 		if (g_withConsole)
 			errPageUrl.Append(" --with-console");
-		errPageUrl.Append(" --no-sandbox").Append(" --hide-controls").Append(" --hide-tabs");
-		errPageUrl.Append(" --top=-1");
+		errPageUrl.Append(" --no-sandbox").Append(" --hide-controls --hide-overlays --hide-frame  --winhttp-proxy-resolver").Append(" --always-on-top");
 
         switch (errType) {
         case ERR_PAGE_REASON::TerminalManagerKickOut:
@@ -481,17 +478,12 @@ namespace Chromium {
         this->m_pEntity->GetFunction()->GetPath("Temp", cachePath);
         cachePath.Append(CSimpleStringA(SPLIT_SLASH_STR)).Append("cefCache_").Append(m_strCacheHead.length() > 0 ? m_strCacheHead.c_str() : "").Append((+ERR_PAGE_REASON::Ad)._to_string());
         strCmdLine.Append(" --cache-path=").Append(cachePath);
-        if (g_useMagic)
-            strCmdLine.Append(" --magic-str=").Append(m_magicStr.c_str());
 		if (g_withMedia)
 			strCmdLine.Append(" --enable-media-stream=1 --enable-speech-input=1");
 		if (g_withConsole)
 			strCmdLine.Append(" --with-console");
-        strCmdLine.Append(" --no-sandbox");
-        strCmdLine.Append(" --hide-controls");
-        strCmdLine.Append(" --hide-tabs");
+        strCmdLine.Append(" --no-sandbox").Append(" --hide-controls --hide-overlays --hide-frame  --winhttp-proxy-resolver");
         strCmdLine.Append(" --logextend=").Append((+PAGE_TYPE::Ad)._to_string());
-        strCmdLine.Append(" --top=-1");
         strCmdLine.Append(" --run-extend");
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("cmdline : %s", strCmdLine.GetData());
         return strCmdLine.GetData();
@@ -513,19 +505,14 @@ namespace Chromium {
             .Append(isExtend ? (+ERR_PAGE_REASON::extend)._to_string() : (+ERR_PAGE_REASON::main)._to_string());
         //strCmdLine.Append(" --hide-controls=true")
         strCmdLine.Append(" --cache-path=").Append(cachePath);
-        strCmdLine.Append(" --no-sandbox");
-        strCmdLine.Append(" --hide-controls");
-        if (g_useMagic)
-            strCmdLine.Append(" --magic-str=").Append(m_magicStr.c_str());
+        strCmdLine.Append(" --no-sandbox").Append(" --hide-controls --hide-overlays --hide-frame  --winhttp-proxy-resolver");
 		if (g_withMedia)
 			strCmdLine.Append(" --enable-media-stream=1 --enable-speech-input=1");
 		if (g_withConsole)
 			strCmdLine.Append(" --with-console");
-        strCmdLine.Append(" --hide-tabs");
         if (m_withDebugMode)
             strCmdLine.Append(" --remote-debugging-port=9222");
         if (isExtend) {
-            strCmdLine.Append(" --with-tab");
             strCmdLine.Append(" --logextend=").Append((+PAGE_TYPE::extend)._to_string());
         } else
             strCmdLine.Append(" --logextend=").Append((+PAGE_TYPE::slv)._to_string());
@@ -555,10 +542,8 @@ namespace Chromium {
 		this->m_pEntity->GetFunction()->GetPath("Temp", cachePath);
 		cachePath.Append(CSimpleStringA(SPLIT_SLASH_STR)).Append("cefCache_").Append(m_strCacheHead.length() > 0 ? m_strCacheHead.c_str() : "").Append((+ERR_PAGE_REASON::Ad)._to_string());
 		strCmdLine.Append(" --cache-path=").Append(cachePath);
-		strCmdLine.Append(" --no-sandbox");
-		strCmdLine.Append(" --hide-controls");
+		strCmdLine.Append(" --no-sandbox").Append(" --hide-controls --hide-overlays --hide-frame  --winhttp-proxy-resolver");
 		strCmdLine.Append(" --lang=zh-CN");//install page need language chinese
-		strCmdLine.Append(" --hide-tabs");
 		strCmdLine.Append(" --logextend=").Append((+PAGE_TYPE::Install)._to_string());
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("cmdline : %s", strCmdLine.GetData());
 		return strCmdLine.GetData();
@@ -663,21 +648,18 @@ namespace Chromium {
 		CSimpleStringA strChromiumPath = GetCefHead(this->m_pEntity), strCmdLine = "";
 		strCmdLine.Append(strChromiumPath).Append(" --url=").Append(url.c_str());
 		if (width > 0 && height > 0)
-			strCmdLine.Append(" --center-size=").Append(std::to_string(width).c_str()).Append("*").Append(std::to_string(height).c_str());
+			strCmdLine.Append(" --window-size=").Append(std::to_string(width).c_str()).Append(",").Append(std::to_string(height).c_str());
 		if (point_x != -1 && point_y != -1)
 		{
-			strCmdLine.Append(" --src-pos=").Append(std::to_string(point_x).c_str()).Append("*").Append(std::to_string(point_y).c_str());
+			strCmdLine.Append(" --window-position=").Append(std::to_string(point_x).c_str()).Append(",").Append(std::to_string(point_y).c_str());
 		}
 		CSimpleStringA cachePath;
 		this->m_pEntity->GetFunction()->GetPath("Temp", cachePath);
 		cachePath.Append(CSimpleStringA(SPLIT_SLASH_STR)).Append("cefCache_").Append(m_strCacheHead.length() > 0 ? m_strCacheHead.c_str() : "").Append(name.c_str());
 		strCmdLine.Append(" --cache-path=").Append(cachePath);
-		strCmdLine.Append(" --no-sandbox");
-		strCmdLine.Append(" --hide-controls");
+		strCmdLine.Append(" --no-sandbox").Append(" --hide-controls --hide-overlays --hide-frame  --winhttp-proxy-resolver --bring-top");
 		strCmdLine.Append(" --lang=zh-CN");//install page need language chinese
-		strCmdLine.Append(" --hide-tabs");
 		strCmdLine.Append(" --logextend=").Append(name.c_str());
-		strCmdLine.Append(" --top=").Append(std::to_string(top).c_str());
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("%s cmdline : %s", name.c_str(), strCmdLine.GetData());
 		return strCmdLine.GetData();
 #endif
@@ -694,21 +676,16 @@ namespace Chromium {
         cachePath.Append(CSimpleStringA(SPLIT_SLASH_STR)).Append("cefCache_").Append(m_strCacheHead.length() > 0 ? m_strCacheHead.c_str() : "").Append(m_specialPage_temp_name.c_str());
         //strCmdLine.Append(" --hide-controls=true")
         strCmdLine.Append(" --cache-path=").Append(cachePath);
-        strCmdLine.Append(" --no-sandbox");//don't use single-process, it will affect the cef log
-        strCmdLine.Append(" --hide-controls");
-        if (g_useMagic)
-            strCmdLine.Append(" --magic-str=").Append(m_magicStr.c_str());
+        strCmdLine.Append(" --no-sandbox").Append(" --hide-controls --hide-overlays --hide-frame  --winhttp-proxy-resolver");;//don't use single-process, it will affect the cef log
 		if (g_withMedia)
 			strCmdLine.Append(" --enable-media-stream=1 --enable-speech-input=1");
 		if (g_withConsole)
 			strCmdLine.Append(" --with-console");
-        strCmdLine.Append(" --hide-tabs");
         strCmdLine.Append(" --logextend=").Append(m_specialPage_temp_name.c_str());
         if (m_specialPage_temp_size.length() > 0)
-            strCmdLine.Append(" --center-size=").Append(m_specialPage_temp_size.c_str());
+            strCmdLine.Append(" --window-size=").Append(m_specialPage_temp_size.c_str());
         if (m_specialPage_temp_point.length() > 0)
-            strCmdLine.Append(" --src-pos=").Append(m_specialPage_temp_point.c_str());
-        strCmdLine.Append(" --top=").Append(std::to_string((unsigned long long)m_specialPage_temp_top).c_str());
+            strCmdLine.Append(" --window-positio=").Append(m_specialPage_temp_point.c_str());
         strCmdLine.Append(" --errurl=file:\/\/\/").Append(getErrUrl(ERR_PAGE_REASON::main).second.c_str());
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("cmdline : %s", strCmdLine.GetData());
         return strCmdLine.GetData();
@@ -927,7 +904,8 @@ namespace Chromium {
 			if (Error_Succeed == openCefRet.first) {
                 LogWarn(Severity_Low, Error_Debug, LOG_EVT_CHROMIUM_OPEN_MAIN_URL,
                         CSimpleStringA::Format("StartChromiumBrowser %s", mainUrlRet.second.c_str()));
-
+				DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setLogCode("QLR0402402F0")
+					(CSimpleStringA::Format("StartChromiumBrowser %s", mainUrlRet.second.c_str()).GetData());
 #ifndef DEVOPS_ON_PRD
                 LogEvent(Severity_High, LOG_EVT_CHROMIUM_OPEN_MAIN_URL, CSimpleStringA::Format("当前打开的业务链接:%s", mainUrlRet.second.c_str()));
 #endif

+ 18 - 3
Module/mod_chromium/mod_chromium.cpp

@@ -78,7 +78,7 @@ namespace Chromium {
 	CChromiumEntity::CChromiumEntity() :m_pWsServer(NULL), m_iTcpBridgePort(4504), m_pTimerListener(NULL), m_strCustomMainUrl(true)
 		, m_runAd(false), m_runMain(false), m_runExtend(false), m_runLogin(false), m_withBrowser(false), m_withMin(false), m_withClose(false)
 		, m_withDebugMode(false), m_withMagic(false), m_withNoFileLog(false), m_installMode(false), m_withMedia(false), m_withSpecialTest(false), m_withConsole(false),
-		m_withLinkLog(false), m_withUnsafeAd(false)
+		m_withLinkLog(false), m_withUnsafeAd(false), m_noStartupPage(false)
 	{
 		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("CChromiumEntity constructor");
 
@@ -350,6 +350,7 @@ namespace Chromium {
 				{
 					auto webMaskKey = CSimpleString::Format("WebMask_%s", m_sysInfo.strMachineType.GetData());
 					CSimpleString webMaskStr;
+					bool no_startup = false;
 					if (Error_Succeed == spConfig->ReadConfigValue("Chromium", webMaskKey.GetData(), webMaskStr))
 					{
 						auto maskArr = webMaskStr.Split('|');
@@ -386,7 +387,15 @@ namespace Chromium {
 								m_withNoFileLog = true;
 							else if (!trimStr.Compare("with_console", true))//control browser will print console logs
 								g_withConsole = m_withConsole = true;
+							else if (!trimStr.Compare("no_startup", true))//control browser will print console logs
+								no_startup = true;
 						}
+						CSmartPointer<IConfigInfo> chromiumCfg;
+						if (m_runMain == true && Error_Succeed == GetFunction()->OpenConfig(Config_Cache, chromiumCfg))
+							chromiumCfg->WriteConfigValueInt("Run", "no_startup", no_startup ? 1 : 0);
+
+
+
 #if (defined _WIN32 || defined _WIN64)
 						if (m_withDebugMode)
 							CModTools::get_mutable_instance().setWithDebugMode(m_withDebugMode);
@@ -641,7 +650,12 @@ namespace Chromium {
 
 	void CChromiumEntity::OnPreStart(CAutoArray<CSimpleStringA> strArgs, CSmartPointer<ITransactionContext> pTransactionContext)
 	{
+		int noStartup = 0;
+		CSmartPointer<IConfigInfo> chromiumCfg;
+		if (Error_Succeed == GetFunction()->OpenConfig(Config_Cache, chromiumCfg))
+			chromiumCfg->ReadConfigValueInt("Run", "no_startup", noStartup);
 
+		m_noStartupPage = (noStartup == 1);
 
 
 #if defined(RVC_OS_LINUX)
@@ -705,7 +719,7 @@ namespace Chromium {
 			GetFunction()->GetSystemStaticInfo(t_sysInfo);
 			if (t_sysInfo.strTerminalID.GetLength() == 0)// the machine is in install mode, hence start a simple init and open the install page 
 			{
-				openStartupPage();//open startup page in install mode
+				if(!m_noStartupPage) openStartupPage();//open startup page in install mode
 				m_installMode = true;
 				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("subscribe VtmLoader %s",
 					(Error_Succeed == GetFunction()->SubscribeLog(m_uuidVTMLoader, this, Log_Event, Severity_None, Error_IgnoreAll, -1, "VtmLoader")) ? "success" : "failed");
@@ -794,7 +808,7 @@ namespace Chromium {
 			}
 			else
 			{
-				openStartupPage();//open startup page in normal mode
+				if (!m_noStartupPage) openStartupPage();//open startup page in normal mode
 				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("subscribe VtmLoader %s",
 					(Error_Succeed == GetFunction()->SubscribeLog(m_uuidVTMLoader, this, Log_Event, Severity_None, Error_IgnoreAll, -1, "VtmLoader")) ? "success" : "failed");
 			}
@@ -983,6 +997,7 @@ namespace Chromium {
 
 	void CChromiumEntity::OnPreClose(EntityCloseCauseEnum eCloseCause, CSmartPointer<ITransactionContext> pTransactionContext)
 	{
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("Chromium Run OnPreClose");
 		exitClean();
 		pTransactionContext->SendAnswer(Error_Succeed);
 	}

+ 1 - 0
Module/mod_chromium/mod_chromium.h

@@ -169,6 +169,7 @@ namespace Chromium {
 		boost::condition_variable_any m_eventCondition;//满足有数据时激活线程
 		CAutoArray<CSimpleStringA> m_strArgs;
 		CSmartPointer<ITransactionContext> m_pTransactionContext;
+		bool m_noStartupPage;
 		
 #ifdef RVC_OS_LINUX
 		std::map<std::string, std::vector<int>> m_commonPageArr;

+ 18 - 1
Module/mod_guiconsole/CMakeLists.txt

@@ -24,20 +24,37 @@ if(Boost_FOUND)
 	MESSAGE( STATUS "Boost_LIB_VERSION = ${Boost_LIB_VERSION}")
 endif()
 
-
+if(MSVC)
+set(${MODULE_PREFIX}_SRCS
+	mod_guiconsole.cpp
+	guiconsole_define.cpp
+	${ThirdPartyHeadRoot}/modp_b64/modp_b64.cc
+	)
+else()
 set(${MODULE_PREFIX}_SRCS
 	mod_guiconsole.cpp
 	guiconsole_define.cpp
+	${ThirdPartyHeadRoot}/modp_b64/modp_b64.cc
+	linux_system_monitor/linux_parser.cpp
+	linux_system_monitor/process.cpp
+	linux_system_monitor/processor.cpp
+	linux_system_monitor/system.cpp
 	)
+endif(MSVC)
 
 set(MOD_VERSION_STRING "0.0.1-dev1")
 add_module_libraries(${MODULE_PREFIX} ${MODULE_NAME} ${MOD_VERSION_STRING})
 
 MESSAGE( STATUS "CONAN_INCLUDE_DIRS_JSONCPP = ${CONAN_INCLUDE_DIRS_JSONCPP}")
 
+target_include_directories(${MODULE_NAME} PRIVATE
+	${ThirdPartyHeadRoot}/modp_b64
+)
+
 target_link_directories(${MODULE_NAME} PRIVATE
 	${CONAN_LIB_DIRS_JSONCPP}
 	${CONAN_LIB_DIRS_BOOST}
+	linux_system_monitor
 )
 
 # 添加实体需要依赖的其他共享库(包括系统库)

+ 1 - 2
Module/mod_guiconsole/GUIConsole_msg_g.h

@@ -61,12 +61,11 @@ struct PerformanceList
 	CAutoArray<int> pidArr;
 	CAutoArray<double> cpuArr;
 	CAutoArray<double> memoryArr;
-	CAutoArray<CSimpleStringA> cmdlineArr;
 	CAutoArray<int> handleNumArr;
 
 	void Serialize(SpBuffer &Buf)
 	{
-		auto & buf = Buf & NameArr & pidArr & cpuArr & memoryArr & cmdlineArr & handleNumArr;
+		auto & buf = Buf & NameArr & pidArr & cpuArr & memoryArr & handleNumArr;
 	}
 
 };

+ 1 - 2
Module/mod_guiconsole/GuiConsole.xml

@@ -74,7 +74,7 @@
 		<!-- 定义一个名为 OpenPerformanceSender 的双向通信,用于打开性能发送功能,我认为这个一直发会比较消耗内网资源,因为需要一直有状态更新,只在ST环境打开 -->
 		<twoway name="OpenPerformanceSender" overlap="true" simpleret="true">
 			<req>
-				<!-- 发送频率-秒,类型为整数,建议为5s -->
+				<!-- 发送频率-秒,类型为整数,建议为1s, 参考任务管理器频率:高:更新时间为0.5秒 正常:这是默认值,更新时间为 1 秒-->
 				<param name="sendFrequence" type="int"/>
 				<!-- 预留参数2,类型为整数 -->
 				<param name="reserved2" type="int"/>
@@ -321,7 +321,6 @@
 		<param name="pidArr" type="array_int"/>
 		<param name="cpuArr" type="array_double"/>
 		<param name="memoryArr" type="array_double"/>
-		<param name="cmdlineArr" type="array_string"/>
 		<param name="handleNumArr" type="array_int"/>
 	</message>
 </entity>

+ 158 - 116
Module/mod_guiconsole/guiconsole_define.cpp

@@ -2,6 +2,7 @@
 #include <winpr/sysinfo.h>
 #include <EventCode.h>
 #include <unordered_map>
+#include <cmath>
 
 std::string GenerateTimeStr()
 {
@@ -21,10 +22,10 @@ std::string GenerateTimeStr()
 #include <conio.h>
 #include <pdh.h>
 #include <math.h>
-#endif // RVC_OS_WIN
+#include <map>
+#include <chrono>
+#include <thread>
 
-
-#ifdef RVC_OS_WIN
 // memInfo ½á¹¹Ìå
 struct memInfo {
 	ULONGLONG TotalMemory;
@@ -78,6 +79,29 @@ void PollMemInfo(memInfo& info)
 	info.UpTime = GetTickCount64();
 }
 
+typedef struct system_times
+{
+	FILETIME IdleTime, KernelTime, UserTime;
+} system_times;
+
+typedef struct process_times
+{
+	FILETIME CreationTime, ExitTime, KernelTime, UserTime;
+} process_times;
+
+__int64 Filetime2Int64(const FILETIME& ftime)
+{
+	LARGE_INTEGER li;
+	li.LowPart = ftime.dwLowDateTime;
+	li.HighPart = ftime.dwHighDateTime;
+	return li.QuadPart;
+}
+
+__int64 CompareFileTime2(const FILETIME& preTime, const FILETIME& nowTime)
+{
+	return Filetime2Int64(nowTime) - Filetime2Int64(preTime);
+}
+
 std::pair<long, std::string> PollProcessList(long UpdateTime, system_monitor_status& curStatus)
 {
 	HANDLE Snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPALL, 0);
@@ -94,29 +118,38 @@ std::pair<long, std::string> PollProcessList(long UpdateTime, system_monitor_sta
 	memInfo info;
 	PollMemInfo(info);
 
+	HANDLE curHandle = NULL; // curProcess Handle
+
+	std::map<int, process_times> cpuTimes;//calculate cpu time
+
 	for (; Status; Status = Process32Next(Snapshot, &Entry)) {
 		processStatus Process;
 		Process.ID = Entry.th32ProcessID;
 		if (Process.ID == 0)
 			continue;
-		Process.ThreadCount = Entry.cntThreads;
-		Process.BasePriority = Entry.pcPriClassBase;
-		Process.ParentPID = Entry.th32ParentProcessID;
+		//Process.HandleCount = Entry.cntThreads;
+		//Process.BasePriority = Entry.pcPriClassBase;
+		//Process.ParentPID = Entry.th32ParentProcessID;
 
-		_tcsncpy_s(Process.ExeName, MAX_PATH, Entry.szExeFile, MAX_PATH);
+		Process.processName = Entry.szExeFile;
 		_tcsncpy_s(Process.UserName, UNLEN, _T("SYSTEM"), UNLEN);
 
-		Process.Handle = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, Entry.th32ProcessID);
-		if (Process.Handle) {
-			PROCESS_MEMORY_COUNTERS ProcMemCounters;
-			if (GetProcessMemoryInfo(Process.Handle, &ProcMemCounters, sizeof(ProcMemCounters))) {
-				Process.UsedMemory = (unsigned __int64)ProcMemCounters.WorkingSetSize;
-				Process.PercentMemory = (double)TO_MB(Process.UsedMemory) / (double)info.TotalMemory;
+		curHandle = OpenProcess(PROCESS_QUERY_LIMITED_INFORMATION, FALSE, Entry.th32ProcessID);
+		if (curHandle) {
+			DWORD handleCount = 0;
+			GetProcessHandleCount(curHandle, &handleCount);
+			Process.HandleCount = handleCount;
+
+
+			PROCESS_MEMORY_COUNTERS_EX ProcMemCounters;
+			if (GetProcessMemoryInfo(curHandle, (PROCESS_MEMORY_COUNTERS*)&ProcMemCounters, sizeof(ProcMemCounters))) {
+				Process.UsedMemory = (unsigned __int64)TO_MB(ProcMemCounters.WorkingSetSize);
+				Process.PercentMemory = (double)Process.UsedMemory / (double)info.TotalMemory;
 			}
 
 
 			HANDLE ProcessTokenHandle;
-			if (OpenProcessToken(Process.Handle, TOKEN_READ, &ProcessTokenHandle)) {
+			if (OpenProcessToken(curHandle, TOKEN_READ, &ProcessTokenHandle)) {
 				DWORD ReturnLength;
 
 				GetTokenInformation(ProcessTokenHandle, TokenUser, 0, 0, &ReturnLength);
@@ -137,44 +170,110 @@ std::pair<long, std::string> PollProcessList(long UpdateTime, system_monitor_sta
 				}
 				CloseHandle(ProcessTokenHandle);
 			}
+			CloseHandle(curHandle);
 		}
 
 		curStatus.processList.push_back(Process);
 
+		HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, Entry.th32ProcessID);
+		if (hProcess) {
+			// »ñÈ¡³õʼ CPU ʱ¼ä
+			FILETIME ftCreation, ftExit, ftKernel, ftUser;
+			if (!GetProcessTimes(hProcess, &ftCreation, &ftExit, &ftKernel, &ftUser)) {
+				CloseHandle(hProcess);
+				continue;
+			}
+			process_times srcTime;
+			srcTime.CreationTime = ftCreation;
+			srcTime.ExitTime = ftExit;
+			srcTime.KernelTime = ftKernel;
+			srcTime.UserTime = ftUser;
+			cpuTimes[Process.ID] = srcTime;
+			CloseHandle(hProcess);
+		}
 	}
 
 	CloseHandle(Snapshot);
 
-	DWORD NewProcessCount = curStatus.processList.size();
+	FILETIME preIdleTime;
+	FILETIME preKernelTime;
+	FILETIME preUserTime;
+	GetSystemTimes(&preIdleTime, &preKernelTime, &preUserTime);
 
-	typedef struct system_times
-	{
-		FILETIME IdleTime, KernelTime, UserTime;
-	} system_times;
+	
+	std::this_thread::sleep_for(std::chrono::seconds(UpdateTime));
 
-	system_times PrevSysTimes;
+	FILETIME idleTime;
+	FILETIME kernelTime;
+	FILETIME userTime;
+	GetSystemTimes(&idleTime, &kernelTime, &userTime);
 
-	GetSystemTimes(&PrevSysTimes.IdleTime, &PrevSysTimes.KernelTime, &PrevSysTimes.UserTime);
+	auto idle = CompareFileTime2(preIdleTime, idleTime);
+	auto kernel = CompareFileTime2(preKernelTime, kernelTime);
+	auto user = CompareFileTime2(preUserTime, userTime);
 
-	typedef struct process_times
+	for (auto &it : curStatus.processList)
 	{
-		FILETIME CreationTime, ExitTime, KernelTime, UserTime;
-	} process_times;
+		FILETIME ftCreation, ftExit, ftKernel, ftUser;
+		HANDLE hProcess;
+		ULARGE_INTEGER ulKernelStart, ulUserStart, ulKernelEnd, ulUserEnd;
 
-	process_times* ProcessTimes = (process_times*)malloc(NewProcessCount * sizeof(*ProcessTimes));
+		hProcess = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, it.ID);
+		if (hProcess == NULL) {
+			continue;
+		}
+
+		if (!GetProcessTimes(hProcess, &ftCreation, &ftExit, &ftKernel, &ftUser)) {
+			CloseHandle(hProcess);
+			continue;
+		}
+
+		if (cpuTimes.find(it.ID) == cpuTimes.end())
+			continue;
+
+		ulKernelStart.LowPart = cpuTimes[it.ID].KernelTime.dwLowDateTime;
+		ulKernelStart.HighPart = cpuTimes[it.ID].KernelTime.dwHighDateTime;
+		ulUserStart.LowPart = cpuTimes[it.ID].UserTime.dwLowDateTime;
+		ulUserStart.HighPart = cpuTimes[it.ID].UserTime.dwHighDateTime;
+
+		ulKernelEnd.LowPart = ftKernel.dwLowDateTime;
+		ulKernelEnd.HighPart = ftKernel.dwHighDateTime;
+		ulUserEnd.LowPart = ftUser.dwLowDateTime;
+		ulUserEnd.HighPart = ftUser.dwHighDateTime;
+
+		ULONGLONG kernelDiff = ulKernelEnd.QuadPart - ulKernelStart.QuadPart;
+		ULONGLONG userDiff = ulUserEnd.QuadPart - ulUserStart.QuadPart;
+		ULONGLONG totalDiff = kernelDiff + userDiff;
+
+
+		double cpuUsage = 100.0 * totalDiff / (kernel + user);
 
+		it.PercentProcessorTime = cpuUsage / 100.0;
+		CloseHandle(hProcess);
+	}
+
+
+
+	/*
+	//get total system information
+
+	DWORD NewProcessCount = curStatus.processList.size();
+	
+	process_times* ProcessTimes = (process_times*)malloc(NewProcessCount * sizeof(*ProcessTimes));
+	
 	for (DWORD ProcIndex = 0; ProcIndex < NewProcessCount; ProcIndex++) {
 		processStatus* Process = &curStatus.processList[ProcIndex];
 		process_times* ProcessTime = &ProcessTimes[ProcIndex];
-		if (Process->Handle) {
-			GetProcessTimes(Process->Handle, &ProcessTime->CreationTime, &ProcessTime->ExitTime, &ProcessTime->KernelTime, &ProcessTime->UserTime);
+		if (curHandle) {
+			GetProcessTimes(curHandle, &ProcessTime->CreationTime, &ProcessTime->ExitTime, &ProcessTime->KernelTime, &ProcessTime->UserTime);
 
 			IO_COUNTERS IoCounters;
-			if (GetProcessIoCounters(Process->Handle, &IoCounters)) {
+			if (GetProcessIoCounters(curHandle, &IoCounters)) {
 				Process->DiskOperationsPrev = IoCounters.ReadTransferCount + IoCounters.WriteTransferCount;
 			}
 		}
 	}
+	
 
 	Sleep(UpdateTime);
 
@@ -192,8 +291,8 @@ std::pair<long, std::string> PollProcessList(long UpdateTime, system_monitor_sta
 		process_times ProcessTime = { 0 };
 		process_times* PrevProcessTime = &ProcessTimes[ProcIndex];
 		processStatus* Process = &curStatus.processList[ProcIndex];
-		if (Process->Handle) {
-			GetProcessTimes(Process->Handle, &ProcessTime.CreationTime, &ProcessTime.ExitTime, &ProcessTime.KernelTime, &ProcessTime.UserTime);
+		if (curHandle) {
+			GetProcessTimes(curHandle, &ProcessTime.CreationTime, &ProcessTime.ExitTime, &ProcessTime.KernelTime, &ProcessTime.UserTime);
 
 			ULONGLONG ProcKernelDiff = SubtractTimes(&ProcessTime.KernelTime, &PrevProcessTime->KernelTime);
 			ULONGLONG ProcUserDiff = SubtractTimes(&ProcessTime.UserTime, &PrevProcessTime->UserTime);
@@ -211,22 +310,22 @@ std::pair<long, std::string> PollProcessList(long UpdateTime, system_monitor_sta
 			FILETIME SysTime;
 			GetSystemTimeAsFileTime(&SysTime);
 
-			Process->UpTime = SubtractTimes(&SysTime, &ProcessTime.CreationTime) / 10000;
-
+			//Process->UpTime = SubtractTimes(&SysTime, &ProcessTime.CreationTime) / 10000;
+			/* get disk information
 			IO_COUNTERS IoCounters;
-			if (GetProcessIoCounters(Process->Handle, &IoCounters)) {
+			if (GetProcessIoCounters(curHandle, &IoCounters)) {
 				Process->DiskOperations = IoCounters.ReadTransferCount + IoCounters.WriteTransferCount;
 				Process->DiskUsage = (DWORD)((Process->DiskOperations - Process->DiskOperationsPrev) * (1000 / UpdateTime));
 			}
-
-			CloseHandle(Process->Handle);
-			Process->Handle = 0;
+			
+			CloseHandle(curHandle);
+			curHandle = NULL;
 		}
 	}
 
 	free(ProcessTimes);
 
-	/* Since we have the values already we can compute CPU usage too */
+	// Since we have the values already we can compute CPU usage too 
 	ULONGLONG SysTime = SysKernelDiff + SysUserDiff;
 	if (SysTime > 0) {
 		double Percentage = (double)(SysTime - SysIdleDiff) / (double)SysTime;
@@ -242,95 +341,38 @@ std::pair<long, std::string> PollProcessList(long UpdateTime, system_monitor_sta
 	curStatus.UsedPageMemoryPerc = info.UsedPageMemoryPerc;
 	curStatus.total_uptime = info.UpTime;
 
-
+	*/
 	return std::make_pair(0, "");
 }
 
 #else
-std::pair<long, std::string> PollProcessList(long UpdateTime, system_monitor_status& curStatus)
-{
-	return std::make_pair(0, "");
-}
 
+#include "linux_system_monitor/system.h"
 
-/* Linux reference
-	timer->stop();
-
-	ui->performTableWidget->clearContents();
-
-	process->start("/bin/bash");
-	if(process->waitForStarted(3000)) {
-		process->write(cmd.toLatin1());
-		process->closeWriteChannel();
-		process->waitForFinished(3000);
-		QString result = process->readAllStandardOutput();
-		QRegularExpression reg;
-		reg.setPattern(" +");
-		result = result.replace(reg," ");
-		QStringList elemList = result.split("\n");
-		elemList.removeFirst();
-		elemList.removeLast();
-		ui->performTableWidget->setRowCount(elemList.length());
-		for(int i=0;i< elemList.length();i++) {
-			QString line = elemList.at(i);
-			QStringList elems = line.split(" ");
-			QString strPID = elems.at(RAW_PID_INDEX);
-			bool root = false, related = false;
-			for(int j=0; j<ui->performTableWidget->columnCount(); j++) {
-				QTableWidgetItem* item = new QTableWidgetItem;
-				item->setBackground((i % 2 != 0) ? QColor("#f5f5f5") : QColor("#ffffff"));
-				if(j== COLUMN_NAME_INDEX) {
-					item->setWhatsThis(strPID);
-					line = elems.at(RAW_COMMAND_INDEX);
-					if (line.compare("spshell", Qt::CaseInsensitive) == 0
-						|| line.compare("sphost", Qt::CaseInsensitive) == 0
-						|| line.compare("cefclient", Qt::CaseInsensitive) == 0
-						|| line.compare("guardian", Qt::CaseInsensitive) == 0) {
-						related = true;
-						item->setForeground(QBrush(Qt::red));
-
-						if (line.compare("sphost", Qt::CaseInsensitive) == 0 && elems.count() > 7 && elems.at(7).startsWith("mod_")) {
-							line = elems.at(7);
-						}
-					}
 
-					item->setToolTip(line);
-					item->setText(line);
-				}
-				else if (j == COLUMN_PID_INDEX) {
-					item->setTextAlignment(Qt::AlignHCenter);
-					item->setText(elems.at(RAW_PID_INDEX));
-				}
-				else if (j == COLUMN_CPU_INDEX) {
-					item->setTextAlignment(Qt::AlignHCenter);
-					item->setText(elems.at(RAW_CPU_INDEX));
-				}
-				else if (j == COLUMN_MEM_INDEX) {
-					item->setTextAlignment(Qt::AlignHCenter);
-					item->setText(elems.at(RAW_MEM_INDEX));
-				}
-				else if(j== COLUMN_COMMAND_INDEX)
-				{
-					line = elems.mid(5).join(" ");
-					item->setText(line);
-					item->setToolTip(line);
-				} else if(j == COLUMN_FDS_INDEX) {
-					if (related) {
-						int fds = GetProcessFdsImpl(pro, strPID.toInt());
-						item->setText(QString::number(fds));
-					} else {
-						item->setText("NA");
-					}
-
-				}
-				ui->performTableWidget->setItem(i, j, item);
-			}
-		}
+std::pair<long, std::string> PollProcessList(long UpdateTime, system_monitor_status& curStatus)
+{
+	System system;
+	auto processArr = system.Processes();
+	curStatus.processList.clear();
+	for (auto it : processArr)
+	{
+		processStatus cur;
+		cur.ID = it.Pid();
+		cur.processName = it.name();
+		char buffer[20];
+		std::sprintf(buffer, "%.2f", it.CpuUtilization());
+		cur.PercentProcessorTime = std::atof(buffer);
+		cur.UsedMemory = std::stoi(it.Ram());
+		cur.HandleCount = it.fdHandles();
+		curStatus.processList.push_back(cur);
 	}
 
-	timer->start();
 
-	*/
+	return std::make_pair(0, "");
+}
+
+
 #endif
 
 

+ 27 - 26
Module/mod_guiconsole/guiconsole_define.h

@@ -85,43 +85,44 @@ struct TerminalBaseInfo
 };
 
 // ½« process ¸ÄÃûΪ processStatus
-typedef struct processStatus {
-    TCHAR ExeName[MAX_PATH];
-    DWORD ID;
-    HANDLE Handle;
+struct processStatus {
+    std::string processName;
+    int ID;
     double PercentProcessorTime;
     unsigned long UsedMemory;
     double PercentMemory;
-    ULONGLONG UpTime;
-    DWORD BasePriority;
-    DWORD ThreadCount;
-    TCHAR UserName[MAX_PATH];
-    TCHAR cmdline[MAX_PATH];
-    DWORD ParentPID;
-    ULONGLONG DiskOperationsPrev;
-    ULONGLONG DiskOperations;
-    DWORD DiskUsage;
-    DWORD TreeDepth;
+    int HandleCount;
+
+
+	char UserName[MAX_PATH];
+	//ULONGLONG UpTime;
+    //DWORD BasePriority;
+    //DWORD ParentPID;
+    //ULONGLONG DiskOperationsPrev;
+    //ULONGLONG DiskOperations;
+    //DWORD DiskUsage;
+    //DWORD TreeDepth;
 
     // Constructor to initialize the fields
     processStatus() {
-        ZeroMemory(ExeName, sizeof(ExeName));
         ID = 0;
-        Handle = nullptr;
         PercentProcessorTime = 0.0;
         UsedMemory = 0;
         PercentMemory = 0.0;
-        UpTime = 0;
-        BasePriority = 0;
-        ThreadCount = 0;
-        ZeroMemory(UserName, sizeof(UserName));
-        ParentPID = 0;
-        DiskOperationsPrev = 0;
-        DiskOperations = 0;
-        DiskUsage = 0;
-        TreeDepth = 0;
+        
+        HandleCount = 0;
+        
+		ZeroMemory(UserName, sizeof(UserName));
+		//Handle = nullptr;
+		//UpTime = 0;
+		//BasePriority = 0;
+        //ParentPID = 0;
+        //DiskOperationsPrev = 0;
+        //DiskOperations = 0;
+        //DiskUsage = 0;
+        //TreeDepth = 0;
     }
-} processStatus;
+};
 
 struct system_monitor_status {
     std::vector<processStatus> processList;

+ 350 - 0
Module/mod_guiconsole/linux_system_monitor/linux_parser.cpp

@@ -0,0 +1,350 @@
+#include <dirent.h>
+#include <unistd.h>
+#include <string>
+#include <vector>
+#include <iostream>
+
+#include "linux_parser.h"
+
+using std::stof;
+using std::string;
+using std::to_string;
+using std::vector;
+
+// DONE: An example of how to read data from the filesystem
+string LinuxParser::OperatingSystem() {
+  string line;
+  string key;
+  string value;
+  std::ifstream filestream(kOSPath);
+  if (filestream.is_open()) {
+    while (std::getline(filestream, line)) {
+      std::replace(line.begin(), line.end(), ' ', '_');
+      std::replace(line.begin(), line.end(), '=', ' ');
+      std::replace(line.begin(), line.end(), '"', ' ');
+      std::istringstream linestream(line);
+      while (linestream >> key >> value) {
+        if (key == "PRETTY_NAME") {
+          std::replace(value.begin(), value.end(), '_', ' ');
+          return value;
+        }
+      }
+    }
+  }
+  return value;
+}
+
+// DONE: An example of how to read data from the filesystem
+string LinuxParser::Kernel() {
+  string os, kernel, kernel2;
+  string line;
+  std::ifstream stream(kProcDirectory + kVersionFilename);
+  if (stream.is_open()) {
+    std::getline(stream, line);
+    std::istringstream linestream(line);
+    linestream >> os >> kernel >> kernel2;
+  }
+  kernel = kernel + " " + kernel2; 
+  return kernel;
+}
+
+vector<int> LinuxParser::Pids() {
+  vector<int> pids;
+  DIR* directory = opendir(kProcDirectory.c_str());
+  struct dirent* file;
+  while ((file = readdir(directory)) != nullptr) {
+    // Is this a directory?
+    if (file->d_type == DT_DIR) {
+      // Is every character of the name a digit?
+      string filename(file->d_name);
+      if (std::all_of(filename.begin(), filename.end(), isdigit)) {
+        int pid = stoi(filename);
+        pids.push_back(pid);
+      }
+    }
+  }
+  closedir(directory);
+  return pids;
+}
+
+// TODO: Read and return the system memory utilization
+float LinuxParser::MemoryUtilization() { return 0.0; }
+
+// TODO: Read and return the system uptime
+long LinuxParser::UpTime() { 
+  
+  string uptime, line; 
+  
+  string path =  kProcDirectory + "/uptime";
+  std::ifstream filestream(path);
+
+  if (filestream.is_open()) {
+    while (std::getline(filestream, line)) {
+      std::istringstream linestream(line);
+      linestream >> uptime;
+    }
+  }
+  return std::stol(uptime); 
+
+}
+
+// TODO: Read and return the number of jiffies for the system
+long LinuxParser::Jiffies() { return 0; }
+
+// TODO: Read and return the number of active jiffies for a PID
+long LinuxParser::ActiveJiffies(int pid[[maybe_unused]]) { return 0; }
+
+// TODO: Read and return the number of active jiffies for the system
+long LinuxParser::ActiveJiffies() { return 0; }
+
+// TODO: Read and return the number of idle jiffies for the system
+long LinuxParser::IdleJiffies() { return 0; }
+
+// TODO: Read and return CPU utilization
+vector<string> LinuxParser::CpuUtilization() { return {"0.2"}; }
+
+// TODO: Read and return the total number of processes
+int LinuxParser::TotalProcesses() { 
+  
+  vector<int> idVec = LinuxParser::Pids() ;
+  int numProcess = idVec.size();
+
+  return numProcess; 
+}
+
+// TODO: Read and return the number of running processes
+int LinuxParser::RunningProcesses() {
+    
+  vector<int> idVec = LinuxParser::Pids() ;
+  vector<int> idVec_running; 
+
+  
+  for (int pid: idVec){
+     int memory_usage = std::stoi(LinuxParser::Ram(pid));
+     if (memory_usage >0){
+       idVec_running.push_back(pid);
+     }
+  }
+  
+
+  /*
+  for (int pid: idVec){
+     float cpu_utilizaiton = LinuxParser::CpuUtilization(pid);
+     if (cpu_utilizaiton >0.01){
+       idVec_running.push_back(pid);
+     }
+  }
+  */
+
+
+
+  int numProcess_running = idVec_running.size();
+
+  return numProcess_running; 
+}
+
+// TODO: Read and return the command associated with a process
+string LinuxParser::Command(int pid) { 
+  
+  string cmd = "n.a."; 
+  string line;
+
+  string path =  kProcDirectory + "/" + std::to_string(pid) + "/cmdline";
+  std::ifstream filestream(path);
+
+  if (filestream.is_open()) {
+    while (std::getline(filestream, line)) {
+      std::istringstream linestream(line);
+      linestream >> cmd;
+    }
+  }
+  return cmd;
+}
+
+std::string LinuxParser::name(int pid)
+{
+    string name = "";
+
+    std::string comm_file = "/proc/" + std::to_string(pid) + "/comm";
+    std::ifstream ifs(comm_file.c_str());
+    if (ifs.is_open()) {
+        std::getline(ifs, name);
+        ifs.close();
+    }
+    return name;
+}
+
+int LinuxParser::fdHandles(int pid)
+{
+    std::string fd_dir = "/proc/" + std::to_string(pid) + "/fd";
+    DIR* dir = opendir(fd_dir.c_str());
+    if (dir == nullptr) {
+        return 0;
+    }
+    int count = 0;
+    while (readdir(dir) != nullptr) {
+        ++count;
+    }
+    closedir(dir);
+    return count;
+}
+
+// TODO: Read and return the memory used by a process
+string LinuxParser::Ram(int pid) { 
+  
+  string line;
+  string key;
+  string value = std::to_string(0);
+  string path =  kProcDirectory + "/" + std::to_string(pid) + "/status";
+
+  std::ifstream filestream(path);
+  if (filestream.is_open()) {
+    while (std::getline(filestream, line)) {
+      std::replace(line.begin(), line.end(), ':', ' ');
+      std::istringstream linestream(line);
+      while (linestream >> key >> value) {
+        if (key == "VmRSS") {
+          //std::cout<< " match!" << std::to_string(pid) << " \n";
+          return std::to_string(std::stoi(value)/1024);
+        }
+      }
+    }
+  }
+  return std::to_string(0);
+  
+ }
+
+// TODO: Read and return the user ID associated with a process
+string LinuxParser::Uid(int pid) { 
+  
+  string line;
+  string key;
+  string value;
+  string path =  kProcDirectory + "/" + std::to_string(pid) + "/status";
+
+  std::ifstream filestream(path);
+  if (filestream.is_open()) {
+    while (std::getline(filestream, line)) {
+      std::replace(line.begin(), line.end(), ':', ' ');
+      std::istringstream linestream(line);
+      while (linestream >> key >> value) {
+        if (key == "Uid") {
+          return value;
+        }
+      }
+    }
+  }
+  return value;
+}
+
+// TODO: Read and return the user associated with a process
+string LinuxParser::User(int pid) { 
+  
+  string uid = LinuxParser::Uid(pid); 
+  string uname = "USER";
+
+  string line;
+  string username, x, id;
+ 
+  string path =  "/etc/passwd";
+
+  std::ifstream filestream(path);
+  if (filestream.is_open()) {
+    while (std::getline(filestream, line)) {
+      std::replace(line.begin(), line.end(), ':', ' ');
+      std::istringstream linestream(line);
+      while (linestream >> username >>  x >> id) {
+        if (id == uid) {
+          uname = username;
+        }
+      }
+    }
+  }
+  return uname;
+}
+
+
+// TODO: Read and return the uptime of a process
+long int LinuxParser::UpTime(int pid) { 
+  
+  //std::cout <<"pid:" << pid << "\n"; 
+  string line;
+  string v;
+  string path =  kProcDirectory + "/" + std::to_string(pid) + "/stat";
+
+  long int uptime, starttime;
+
+  std::ifstream filestream(path);
+  if (filestream.is_open()) {
+    while (std::getline(filestream, line)) {
+      std::istringstream linestream(line);
+      for (int i=0; i<22; i++){
+        linestream >> v;
+      }
+     
+      if (std::all_of(v.begin(), v.end(), isdigit)) {
+        starttime = std::stol(v)/sysconf(_SC_CLK_TCK);
+      }
+    }
+  }
+
+  uptime = LinuxParser::UpTime();
+
+  return uptime - starttime;
+  
+}
+
+float LinuxParser::ProcessMemoryUtilization(int pid)
+{
+    string line;
+    string key;
+    string value = std::to_string(0);
+    string path = kProcDirectory + "/" + std::to_string(pid) + "/status";
+
+    std::ifstream filestream(path);
+    if (filestream.is_open()) {
+        while (std::getline(filestream, line)) {
+            std::replace(line.begin(), line.end(), ':', ' ');
+            std::istringstream linestream(line);
+            while (linestream >> key >> value) {
+                if (key == "VmRSS") {
+                    //std::cout<< " match!" << std::to_string(pid) << " \n";
+                    return std::stoi(value);
+                }
+            }
+        }
+    }
+    return 0;
+}
+
+
+float LinuxParser::CpuUtilization(int pid){
+
+  string line;
+  string v;
+  string path =  kProcDirectory + "/" + std::to_string(pid) + "/stat";
+
+  float cpuTime;
+
+  std::ifstream filestream(path);
+  if (filestream.is_open()) {
+    while (std::getline(filestream, line)) {
+      std::istringstream linestream(line);
+      for (int i=0; i<22; i++){
+        linestream >> v;
+        if (i==13 || i==14 ||  i==15 || i==16){
+          cpuTime += std::stof(v);
+        }
+      }    
+    }
+  }
+
+  float  processUptime = LinuxParser::UpTime();
+  cpuTime /= sysconf(_SC_CLK_TCK);
+
+  float utilization = cpuTime / processUptime; 
+
+  //std::cout << "cpuTime:" << cpuTime <<  " utilization: " << utilization << "\n";
+  return utilization;
+
+}

+ 61 - 0
Module/mod_guiconsole/linux_system_monitor/linux_parser.h

@@ -0,0 +1,61 @@
+#ifndef SYSTEM_PARSER_H
+#define SYSTEM_PARSER_H
+
+#include <fstream>
+#include <regex>
+#include <string>
+
+namespace LinuxParser {
+// Paths
+const std::string kProcDirectory{"/proc/"};
+const std::string kCmdlineFilename{"/cmdline"};
+const std::string kCpuinfoFilename{"/cpuinfo"};
+const std::string kStatusFilename{"/status"};
+const std::string kStatFilename{"/stat"};
+const std::string kUptimeFilename{"/uptime"};
+const std::string kMeminfoFilename{"/meminfo"};
+const std::string kVersionFilename{"/version"};
+const std::string kOSPath{"/etc/os-release"};
+const std::string kPasswordPath{"/etc/passwd"};
+
+// System
+float MemoryUtilization();
+long UpTime();
+std::vector<int> Pids();
+int TotalProcesses();
+int RunningProcesses();
+std::string OperatingSystem();
+std::string Kernel();
+
+// CPU
+enum CPUStates {
+  kUser_ = 0,
+  kNice_,
+  kSystem_,
+  kIdle_,
+  kIOwait_,
+  kIRQ_,
+  kSoftIRQ_,
+  kSteal_,
+  kGuest_,
+  kGuestNice_
+};
+std::vector<std::string> CpuUtilization();
+long Jiffies();
+long ActiveJiffies();
+long ActiveJiffies(int pid);
+long IdleJiffies();
+
+// Processes
+std::string Command(int pid);
+std::string Ram(int pid);
+std::string Uid(int pid);
+std::string User(int pid);
+long int UpTime(int pid);
+float CpuUtilization(int pid);
+float ProcessMemoryUtilization(int pid);
+std::string name(int pid);
+int fdHandles(int pid);
+};  // namespace LinuxParser
+
+#endif

+ 52 - 0
Module/mod_guiconsole/linux_system_monitor/process.cpp

@@ -0,0 +1,52 @@
+#include <unistd.h>
+#include <cctype>
+#include <sstream>
+#include <string>
+#include <vector>
+
+#include "process.h"
+#include "linux_parser.h"
+
+using std::string;
+using std::to_string;
+using std::vector;
+
+// TODO: Return this process's ID
+int Process::Pid() { return pid; }
+
+// TODO: Return this process's CPU utilization
+float Process::CpuUtilization() const { return LinuxParser::CpuUtilization(pid);}
+
+float Process::MemUtilization() const { return LinuxParser::ProcessMemoryUtilization(pid); }
+
+// TODO: Return the command that generated this process
+string Process::Command() { return LinuxParser::Command(pid); }
+
+// TODO: Return this process's memory utilization
+string Process::Ram() { return LinuxParser::Ram(pid); }
+
+// TODO: Return the user (name) that generated this process
+string Process::User() { return LinuxParser::User(pid); }
+
+string Process::name() { return LinuxParser::name(pid); }
+
+// TODO: Return the age of this process (in seconds)
+long int Process::UpTime() { return LinuxParser::UpTime(pid); }
+
+int Process::fdHandles() { return LinuxParser::fdHandles(pid); }
+
+// TODO: Overload the "less than" comparison operator for Process objects
+// REMOVE: [[maybe_unused]] once you define the function
+bool Process::operator<(Process const &b)  { 
+    
+    float a_val = this->CpuUtilization(); 
+    float b_val = b.CpuUtilization();
+
+    if (a_val < b_val) {return true;}
+    else {return false;}
+    
+    }
+
+Process::Process(int id){
+    pid = id; 
+}

+ 33 - 0
Module/mod_guiconsole/linux_system_monitor/process.h

@@ -0,0 +1,33 @@
+#ifndef PROCESS_H
+#define PROCESS_H
+
+#include <string>
+
+#include "processor.h"
+
+
+/*
+Basic class for Process representation
+It contains relevant attributes as shown below
+*/
+class Process {
+ public:
+  int Pid();                               // TODO: See src/process.cpp
+  std::string User();                      // TODO: See src/process.cpp
+  std::string name();                      // TODO: See src/process.cpp
+  std::string Command();                   // TODO: See src/process.cpp
+  float CpuUtilization() const;                  // TODO: See src/process.cpp
+  float MemUtilization() const;                  // TODO: See src/process.cpp
+  std::string Ram();                       // TODO: See src/process.cpp
+  long int UpTime();                       // TODO: See src/process.cpp
+  int fdHandles();                       // TODO: See src/process.cpp
+  bool operator<(Process const &b)     ;  // TODO: See src/process.cpp
+  Process(int);
+
+  // TODO: Declare any necessary private members
+ private:
+  int pid; 
+  Processor cpu;
+};
+
+#endif

+ 46 - 0
Module/mod_guiconsole/linux_system_monitor/processor.cpp

@@ -0,0 +1,46 @@
+#include <dirent.h>
+#include <unistd.h>
+#include <string>
+#include <vector>
+#include <iostream>
+#include <thread>
+
+
+
+#include "processor.h"
+#include "linux_parser.h"
+
+
+// TODO: Return the aggregate CPU utilization
+float Processor::Utilization() {  
+
+    float utilization = 0.0;
+
+    std::string line;
+    std::string key;
+    std::string val1, val2;
+    float uptime, idletime;
+    std::string path =  LinuxParser::kProcDirectory + "/uptime";
+
+    std::ifstream filestream(path);
+    if (filestream.is_open()) {
+        while (std::getline(filestream, line)) {
+            std::istringstream linestream(line);
+            while (linestream >> val1 >> val2) {
+                uptime = std::stof(val1);
+                idletime = std::stof(val2);
+            }
+        }
+    }
+    
+   
+    int num_of_cores = std::thread::hardware_concurrency();
+    // std::cout << "num_of_cores:" << num_of_cores << "\n"; 
+
+
+    utilization = (uptime  * num_of_cores - idletime) / (uptime * num_of_cores); 
+    // std::cout <<"uptime: " <<uptime <<  " idletime: " << idletime << " utilization:" <<utilization << "\n";
+    
+    return utilization; 
+
+}

+ 12 - 0
Module/mod_guiconsole/linux_system_monitor/processor.h

@@ -0,0 +1,12 @@
+#ifndef PROCESSOR_H
+#define PROCESSOR_H
+
+class Processor {
+ public:
+  float Utilization();  // TODO: See src/processor.cpp
+
+  // TODO: Declare any necessary private members
+ private:
+};
+
+#endif

+ 122 - 0
Module/mod_guiconsole/linux_system_monitor/system.cpp

@@ -0,0 +1,122 @@
+#include <unistd.h>
+#include <cstddef>
+#include <set>
+#include <string>
+#include <vector>
+#include <iostream>
+#include <typeinfo>
+#include <algorithm>    // std::reverse
+
+
+#include "process.h"
+#include "processor.h"
+#include "system.h"
+#include "linux_parser.h"
+
+using std::set;
+using std::size_t;
+using std::string;
+using std::vector;
+
+#include "linux_parser.h"
+
+
+// TODO: Return the operating system name
+std::string System::OperatingSystem() { 
+    string os =  LinuxParser::OperatingSystem();
+    return os; 
+    }
+
+// TODO: Return the system's kernel identifier (string)
+std::string System::Kernel() { 
+    string kernel = LinuxParser::Kernel();
+    return kernel;
+    }
+
+// TODO: Return the system's CPU 
+Processor& System::Cpu() {  
+    return cpu_; 
+    }
+
+
+// TODO: Return the system's memory utilization
+float System::MemoryUtilization() { 
+    float utilization;
+
+    float totalMemoryUsage = 0;
+
+    vector<int> idVec = LinuxParser::Pids() ;
+    for (int pid : idVec){
+        Process pro(pid);
+        int memory_usage = std::stoi(LinuxParser::Ram(pid));
+        if (memory_usage >0){
+            totalMemoryUsage += memory_usage ;
+        }
+    } 
+
+
+    string cmd = "n.a."; 
+    string line, key, value;
+    string path =  LinuxParser::kProcDirectory + "/meminfo";
+
+    float memoryMax = 1;
+    std::ifstream filestream(path);
+    if (filestream.is_open()) {
+        while (std::getline(filestream, line)) {
+            std::replace(line.begin(), line.end(), ':', ' ');
+            std::istringstream linestream(line);
+            while (linestream >> key >> value) {
+                if (key == "MemTotal") {
+                    memoryMax = std::stoi(value)/1024;
+                }
+            }
+        }
+    }
+
+
+    utilization = totalMemoryUsage / memoryMax; 
+
+    return utilization; }
+
+// TODO: Return the number of processes actively running on the system
+int System::RunningProcesses() { 
+    
+    int runprocess = LinuxParser::RunningProcesses();
+    return runprocess;
+    }
+
+// TODO: Return the total number of processes on the system
+int System::TotalProcesses() { 
+    
+    int ttlprocess = LinuxParser::TotalProcesses();
+    return ttlprocess;
+    }
+
+// TODO: Return the number of seconds since the system started running
+long System::UpTime() { 
+    long uptime = LinuxParser::UpTime();
+    return uptime; 
+    }
+
+// TODO: Return a container composed of the system's processes
+vector<Process>& System::Processes() { 
+    
+    vector<int> idVec = LinuxParser::Pids() ;
+
+    vector<Process> processes_tmp;
+
+    for (int pid : idVec){
+        Process pro(pid);
+        int memory_usage = std::stoi(LinuxParser::Ram(pid));
+        if (memory_usage >0){
+            processes_tmp.push_back(pro);
+        }
+    } 
+
+    processes_ = processes_tmp;
+
+    std::sort(processes_.begin(), processes_.end());
+    std::reverse(processes_.begin(), processes_.end());
+
+    
+    return processes_; }

+ 28 - 0
Module/mod_guiconsole/linux_system_monitor/system.h

@@ -0,0 +1,28 @@
+#ifndef SYSTEM_H
+#define SYSTEM_H
+
+#include <string>
+#include <vector>
+
+
+#include "process.h"
+#include "processor.h"
+
+class System {
+ public:
+  Processor& Cpu();                   // TODO: See src/system.cpp
+  std::vector<Process>& Processes();  // TODO: See src/system.cpp
+  float MemoryUtilization();          // TODO: See src/system.cpp
+  long UpTime();                      // TODO: See src/system.cpp
+  int TotalProcesses();               // TODO: See src/system.cpp
+  int RunningProcesses();             // TODO: See src/system.cpp
+  std::string Kernel();               // TODO: See src/system.cpp
+  std::string OperatingSystem();      // TODO: See src/system.cpp
+
+  // TODO: Define any necessary private members
+ private:
+  Processor cpu_ = {};
+  std::vector<Process> processes_ = {};
+};
+
+#endif

+ 205 - 16
Module/mod_guiconsole/mod_guiconsole.cpp

@@ -4,6 +4,7 @@
 #include "GUIConsole_msg_g.h"
 #include <chrono>
 #include <fstream>
+#include "modp_b64.h"
 
 
 
@@ -26,6 +27,7 @@ void openProcess(std::string cmdline)
 #include <unistd.h>
 #include <cstdlib>
 #endif // RVC_OS_WIN
+#include <regex>
 
 
 
@@ -313,30 +315,77 @@ std::pair<DWORD, std::string> CGUIConsoleEntity::openPerformanceSender(SpReqAnsC
 			system_monitor_status curStatus;
 			auto pullret = PollProcessList(m_performanceSenderFrequence, curStatus);
 
+			//fiter all the vtm processes
+			const std::vector<std::string> vtmProcess = std::initializer_list<std::string>{"spshell", "sphost", "guardian", "cefclient", "uosbrowser", "browser"};
+			std::vector<processStatus> vtmProcessArr;
+			for (auto it : curStatus.processList)
+			{
+				for (auto it2 : vtmProcess)
+				{
+					std::string processName = it.processName;
+					std::for_each(processName.begin(), processName.end(), [](char& c) {
+						c = std::tolower(c);
+						});
+					if (processName.find(it2) != -1)
+					{
+						vtmProcessArr.push_back(it);
+						break;
+					}
+				}
+			}
+
+			//change all sphost to real modname
+			std::map<int, std::string> pidAndNames;
+			CSystemRunInfo runInfo = { 0 };
+			GetFunction()->GetSystemRunInfo(runInfo);
+			for (int i = 0; i < runInfo.strRunningEntityNames.GetCount(); i++) //实体进程的名称默认全为sphost,需转换为对应实体名
+			{
+				string entityName = runInfo.strRunningEntityNames[i].GetData();
+				CEntityRunInfo entityInfo = { 0 };
+				GetFunction()->GetEntityRunInfo(entityName.c_str(), entityInfo);
+				pidAndNames[entityInfo.dwProcessID] = entityName;
+			}
+			for (auto &it : vtmProcessArr)
+			{
+				if (pidAndNames.find(it.ID) != pidAndNames.end())
+					it.processName = pidAndNames[it.ID];
+			}
+
+			std::vector<processStatus> vtmProcessArr_removeSphost;
+			for (auto it : vtmProcessArr)
+			{
+				if (it.processName.find("sphost") == -1)
+					vtmProcessArr_removeSphost.push_back(it);
+			}
+
 			PerformanceList dst;
-			dst.NameArr.Init(curStatus.processList.size());
-			dst.pidArr.Init(curStatus.processList.size());
-			dst.cpuArr.Init(curStatus.processList.size());
-			dst.memoryArr.Init(curStatus.processList.size());
-			dst.cmdlineArr.Init(curStatus.processList.size());
-			dst.handleNumArr.Init(curStatus.processList.size());
-			for (int i = 0; i < curStatus.processList.size(); i++)
+			dst.NameArr.Init(vtmProcessArr_removeSphost.size());
+			dst.pidArr.Init(vtmProcessArr_removeSphost.size());
+			dst.cpuArr.Init(vtmProcessArr_removeSphost.size());
+			dst.memoryArr.Init(vtmProcessArr_removeSphost.size());
+			dst.handleNumArr.Init(vtmProcessArr_removeSphost.size());
+			for (int i = 0; i < vtmProcessArr_removeSphost.size(); i++)
 			{
-				dst.NameArr[i] = curStatus.processList[i].ExeName;
-				dst.pidArr[i] = curStatus.processList[i].ID;
-				dst.cpuArr[i] = curStatus.processList[i].PercentProcessorTime;
-				dst.memoryArr[i] = curStatus.processList[i].PercentMemory;
-				dst.cmdlineArr[i] = "";
-				dst.handleNumArr[i] = curStatus.processList[i].ThreadCount;
+				dst.NameArr[i] = vtmProcessArr_removeSphost[i].processName.c_str();
+				dst.pidArr[i] = vtmProcessArr_removeSphost[i].ID;
+				dst.cpuArr[i] = vtmProcessArr_removeSphost[i].PercentProcessorTime;
+				dst.memoryArr[i] = (double)vtmProcessArr_removeSphost[i].UsedMemory;
+				dst.handleNumArr[i] = vtmProcessArr_removeSphost[i].HandleCount;
 			}
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("cur entity num %d", dst.NameArr.GetCount());
 			SpSendBroadcast(GetFunction(), eMsg_PerformanceList, eMsgSig_PerformanceList, dst);
 
+
+#ifdef RVC_OS_LINUX
 			for (auto cur = std::chrono::milliseconds(0); cur < std::chrono::seconds(m_performanceSenderFrequence); cur = cur + std::chrono::milliseconds(50))
 			{
 				std::this_thread::sleep_for(std::chrono::milliseconds(50));
 				if (!m_isOpenPerformanceSender)
 					return;
 			}
+#endif
+			if (!m_isOpenPerformanceSender)
+				return;
 		}
 	};
 	
@@ -619,26 +668,166 @@ std::pair<DWORD, std::string> CGUIConsoleEntity::GetHelpInformationArr(SpReqAnsC
 	}
 	return std::pair<DWORD, std::string>(ErrorCodeEnum::Error_Succeed, "");
 }
+#if(defined _WIN32 || defined _WIN64)
+
+char* ConvertGBKToUtf8(const char* gbk, int* n)
+{
+	int len = MultiByteToWideChar(CP_ACP, 0, gbk, -1, NULL, 0);
+	WCHAR* wszGBK = new WCHAR[len + 1];
+	memset(wszGBK, 0, len * 2 + 2);
+	MultiByteToWideChar(CP_ACP, 0, gbk, -1, wszGBK, len);
+
+	len = WideCharToMultiByte(CP_UTF8, 0, wszGBK, -1, NULL, 0, NULL, NULL);
+	char* szUtf8 = new char[len + 1];
+	memset(szUtf8, 0, len + 1);
+	WideCharToMultiByte(CP_UTF8, 0, wszGBK, -1, szUtf8, len, NULL, NULL);
+
+	delete[] wszGBK;
+	*n = len - 1;
+	return szUtf8;
+}
+
+void ConvertGBKToUtf8(std::string& str)
+{
+	int len = 0;
+	char* dst = ConvertGBKToUtf8(str.c_str(), &len);
+	str = dst;
+	delete[] dst;
+}
+
+
+#endif
+
+static const std::string base64_chars =
+"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+"abcdefghijklmnopqrstuvwxyz"
+"0123456789+/";
+
+std::string base64_encode(const std::string& input) {
+	std::string ret;
+	int i = 0;
+	int j = 0;
+	unsigned char char_array_3[3];
+	unsigned char char_array_4[4];
+	int in_len = input.size();
+	const unsigned char* bytes_to_encode = reinterpret_cast<const unsigned char*>(input.c_str());
+
+	while (in_len--) {
+		char_array_3[i++] = *(bytes_to_encode++);
+		if (i == 3) {
+			char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
+			char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
+			char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
+			char_array_4[3] = char_array_3[2] & 0x3f;
+
+			for (i = 0; i < 4; i++)
+				ret += base64_chars[char_array_4[i]];
+			i = 0;
+		}
+	}
+
+	if (i) {
+		for (j = i; j < 3; j++)
+			char_array_3[j] = '\0';
+
+		char_array_4[0] = (char_array_3[0] & 0xfc) >> 2;
+		char_array_4[1] = ((char_array_3[0] & 0x03) << 4) + ((char_array_3[1] & 0xf0) >> 4);
+		char_array_4[2] = ((char_array_3[1] & 0x0f) << 2) + ((char_array_3[2] & 0xc0) >> 6);
+		char_array_4[3] = char_array_3[2] & 0x3f;
+
+		for (j = 0; j < i + 1; j++)
+			ret += base64_chars[char_array_4[j]];
+
+		while (i++ < 3)
+			ret += '=';
+	}
+
+	return ret;
+}
+
+
 
 std::pair<DWORD, std::string> CGUIConsoleEntity::GetHelpDetail(SpReqAnsContext<GUIConsoleService_GetHelpDetail_Req, GUIConsoleService_GetHelpDetail_Ans>::Pointer ctx)
 {
 	CSimpleString tilte = ctx->Req.title;
+	CSmartPointer<IConfigInfo> spConfig;
+	
 	if (tilte.Compare("runcfg", true) == 0)
 	{
 		ctx->Ans.subtitle = "root配置";
-		ctx->Ans.detail = "root配置";
+		ErrorCodeEnum erroCode = GetFunction()->OpenConfig(Config_Root, spConfig);
+		if (!IS_SUCCEED(erroCode))
+			return std::pair<DWORD, std::string>(WARN_GUICONSOLE_HELP_ROOT_FAILED, "");
 	}
 	else if (tilte.Compare("centercfg", true) == 0)
 	{
 		ctx->Ans.subtitle = "集中配置";
-		ctx->Ans.detail = "集中配置";
+		ErrorCodeEnum erroCode = GetFunction()->OpenConfig(Config_CenterSetting, spConfig);
+		if (!IS_SUCCEED(erroCode))
+			return std::pair<DWORD, std::string>(WARN_GUICONSOLE_HELP_CENTER_FAILED, "");
 	}
 	else if (tilte.Compare("shellcfg", true) == 0)
 	{
 		ctx->Ans.subtitle = "shell配置";
-		ctx->Ans.detail = "shell配置";
+		ErrorCodeEnum erroCode = GetFunction()->OpenConfig(Config_Shell, spConfig);
+		if (!IS_SUCCEED(erroCode))
+			return std::pair<DWORD, std::string>(WARN_GUICONSOLE_HELP_SHELL_FAILED, "");
+	}
+
+	CAutoArray<CSimpleStringA> arrSections, arrKeys;
+
+	CSimpleStringA dstStr;
+	dstStr.Append("## ").Append(ctx->Ans.subtitle).Append("\n");
+	dstStr += "| moudle | name | value |\n";//table header
+	dstStr += "-----|------|-----\n";//sperate
+
+	if (Error_Succeed != spConfig->ReadAllSections(arrSections))
+	{
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("Read all sections failed.");
+		return std::pair<DWORD, std::string>(WARN_GUICONSOLE_HELP_GETSECTION_FAILED, "");
 	}
 
+	for (int i = 0; i < arrSections.GetCount(); ++i)
+	{
+		spConfig->ReadAllKeys(arrSections[i].GetData(), arrKeys);
+		for (int j = 0; j < arrKeys.GetCount(); ++j)
+		{
+			CSimpleStringA value, tmp;
+			spConfig->ReadConfigValue(arrSections[i].GetData(), arrKeys[j].GetData(), value);
+
+			tmp = CSimpleStringA::Format("{\"moudle\":\"%s\", \"name\":\"%s\", \"value\":\"%s\"}",
+				arrSections[i].GetData(), arrKeys[j].GetData(), value.GetData());
+			std::string result = value.GetData();
+			std::string::size_type pos = 0;
+			while ((pos = result.find("|", pos)) != std::string::npos) {
+				result.replace(pos, 1, "\\|");
+				pos += 2; // 跳过新插入的"\\"
+			}
+
+			dstStr.Append("| ").Append(arrSections[i]).Append(" | ").Append(arrKeys[j]).Append(" | ").Append(result.c_str()).Append(" |\n");
+		}
+	}
+	std::string srcStr = dstStr.GetData();
+#if(defined _WIN32 || defined _WIN64)
+	//ConvertGBKToUtf8(srcStr);
+	//boost::locale::generator gen;
+	//std::locale loc = gen("zh_CN.GBK");
+	//srcStr = boost::locale::conv::to_utf<char>(srcStr, loc);
+	//dstStr = string_to_utf8(dstStr.GetData()).c_str();
+	//auto aaaStr = utf8_to_string(dstStr.GetData());
+#endif
+
+	/*
+	int base64Len = modp_b64_encode_len(srcStr.length());
+	char *base64Data = (char*)malloc(sizeof(char) * base64Len);
+	modp_b64_encode(base64Data, (const char*)srcStr.c_str(), srcStr.length());
+	*/
+
+	//auto base64Data = base64_encode(srcStr);
+
+	//ctx->Ans.detail = base64Data.c_str();
+
+	ctx->Ans.detail = srcStr.c_str();
 	return std::pair<DWORD, std::string>(ErrorCodeEnum::Error_Succeed, "");
 }
 

+ 179 - 126
Module/mod_healthmanager/HealthManagerFSM.cpp

@@ -5,6 +5,7 @@
 #include <regex>
 #include "CommEntityUtil.hpp"
 #include "SpUtility.h"
+#include "iniutil.h"
 #if defined(RVC_OS_WIN)
 #include <TlHelp32.h>
 #include <iphlpapi.h>
@@ -18,7 +19,6 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
-#include "iniutil.h"
 #endif //RVC_OS_WIN
 
 
@@ -167,38 +167,16 @@ unsigned int CHealthManagerFSM::s4_on_event(FSMEvent* pEvt)
 				WKUpdatePeriodTask* pTask = new WKUpdatePeriodTask(this);
 				GetEntityBase()->GetFunction()->PostThreadPoolTask(pTask);
 			}
-			//oilyang@20170316@comment
-			//for user desktop,start iebrowser no matter what TerminalStage is.
-			//if (csTermStage[0] != 'A')
-			//	break;
-			eErrCode = GetEntityBase()->GetFunction()->SetSysVar("RunState","O");
-			if (eErrCode != Error_Succeed)
-			{
-				DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("set RunState O failed (%d).",eErrCode);
-			}
 
-			CSmartPointer<IEntityFunction> spEntityFunction = GetEntityBase()->GetFunction();
-			CSmartPointer<IAsynWaitSp> spWait;
-			CSmartPointer<IEntityFunctionPrivilege> pFuncPrivilege = spEntityFunction.ConvertCase<IEntityFunctionPrivilege>();
-			CEntityRunInfo acInfo;
-			eErrCode = spEntityFunction->GetEntityRunInfo("Chromium",acInfo);
-			if (eErrCode == Error_Succeed && acInfo.eState == EntityState_NoStart)
-			{
-			}
-			else if (eErrCode == Error_Succeed && acInfo.eState == EntityState_Idle)
-			{//if IE/Chromium start before healthmanager,we suppose healthmanager is restart unexpectly,then set m_bEnterMainPageEver true
-				//m_bIEBeforeHealth = true;
-			}
 			LogTermInfoTask* task = new LogTermInfoTask(this);
 			GetEntityBase()->GetFunction()->PostThreadPoolTask(task);
-			if (m_iAccessAuth != AccessAuth_Suc)
+			if (m_iAccessAuth != VtmLoad_AccessAuth_Suc)
 				PostProcessAfterUpgrade();
 		}
 		break;
 	case USER_EVT_MAITAIN:
 		DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("to maintain...");
 		m_stateBeforeMaintain = m_fsmState;
-		m_bIdleToMaintain = true;
 		pEvt->SetHandled();
 		break;
 	case USER_EVT_ENTER_CUSTOMER_MANAGER:
@@ -210,25 +188,20 @@ unsigned int CHealthManagerFSM::s4_on_event(FSMEvent* pEvt)
 		if (pEvt->param1 == 1)
 		{
 			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("VtmLoader load SIPphone entity failed, to Set TerminalStage M.");
-			GetEntityBase()->GetFunction()->SetSysVar("TerminalStage", "M");
-			break;
+			SetVtmLoadResult(VtmLoad_MediaLoadFail);
+			return pEvt->param1;
 		}
 		else if (pEvt->param1 == 2)
 		{
 			DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("VtmLoader load SYNCSTART(boot cfg = 2) entity failed, to Set TerminalStage C.");
-			GetEntityBase()->GetFunction()->SetSysVar("TerminalStage", "C");
-			break;
+			SetVtmLoadResult(VtmLoad_OtherSyncEntityLoadFail);
+			return pEvt->param1;
 		}
-		if (!m_bIdleToMaintain)//???no use anymore?
+		if (m_iAccessAuth == VtmLoad_AccessAuth_Init)
 		{
-			if (m_iAccessAuth == AccessAuth_Init)
-			{
-				WaitToCallAccessAuthTask* pTask = new WaitToCallAccessAuthTask(this);
-				GetEntityBase()->GetFunction()->PostThreadPoolTask(pTask);
-			}
+			WaitToCallAccessAuthTask* pTask = new WaitToCallAccessAuthTask(this);
+			GetEntityBase()->GetFunction()->PostThreadPoolTask(pTask);
 		}
-		else
-			m_bIdleToMaintain = false;
 	}
 		break;
 	default:
@@ -243,8 +216,6 @@ void CHealthManagerFSM::s5_on_entry()
 	LogTermInfoTask* task = new LogTermInfoTask(this);
 	GetEntityBase()->GetFunction()->PostThreadPoolTask(task);
 	m_fsmState = HM_FSM_STATE_FAULT;
-	//oilyang@20210930 add to call for Close Page
-	GetEntityBase()->GetFunction()->SetSysVar("TerminalStage", "C");
 	PostProcessAfterUpgrade();
 }
 void CHealthManagerFSM::s5_on_exit()
@@ -465,13 +436,14 @@ int CHealthManagerFSM::AccessAuthDoWork()
 		{
 			//存在循环刷数据的情况,暂时不记这个,只记失败
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode("QLR0402501Z10301")("to call AccessAuth's Regist");
+			m_ullAuthStart = SP::Module::Comm::RVCGetTickCount();
 			eErrCode = (*m_pACClient)(EntityResource::getLink().upgradeLink())->Regist();
 			m_bHasAuthEver = true;
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("accessauth regist %d", eErrCode);
 			if (eErrCode == Error_Succeed)
 			{
 				do {
-					if (m_iAccessAuth != AccessAuth_Init)
+					if (m_iAccessAuth != VtmLoad_AccessAuth_Init)
 						break;
 					Sleep(1000);
 				} while (1);//wait for accessauth send result
@@ -499,26 +471,33 @@ int CHealthManagerFSM::AccessAuthDoWork()
 	return 1;
 }
 
-void CHealthManagerFSM::SetAccessAuth(int bResult)
+void CHealthManagerFSM::SetVtmLoadResult(int bResult)
 {
 	m_iAccessAuth = bResult;
 	ErrorCodeEnum eErrCode;
-	if (bResult == AccessAuth_Suc)
+	if (bResult == VtmLoad_AccessAuth_Suc)
 	{
 		eErrCode = GetEntityBase()->GetFunction()->SetSysVar("TerminalStage", "A");
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("AccessAuthSuc")("%d", SP::Module::Comm::RVCGetTickCount() - m_ullAuthStart);
 	}
-	else if (bResult == AccessAuth_servFail) //准入服务端返回失败
+	else if (bResult == VtmLoad_AccessAuth_servFail) //准入服务端返回失败
 	{
 		eErrCode = GetEntityBase()->GetFunction()->SetSysVar("TerminalStage", "S");
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("AccessAuthFailServ")("%d", SP::Module::Comm::RVCGetTickCount() - m_ullAuthStart);
+	}
+	else if (bResult == VtmLoad_MediaLoadFail) //音视频校验不通过
+	{
+		eErrCode = GetEntityBase()->GetFunction()->SetSysVar("TerminalStage", "M");
 	}
-	else //准入其他失败
+	else //其他失败
 	{
 		eErrCode = GetEntityBase()->GetFunction()->SetSysVar("TerminalStage", "C");
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("AccessAuthFailOther")("%d", SP::Module::Comm::RVCGetTickCount() - m_ullAuthStart);
 	}
 	if (eErrCode != Error_Succeed)
-		DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("set TerminalStage %d,failed:%s", bResult, SpStrError(eErrCode));
+		DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("set TerminalStage %d,failed:%s", bResult, SpStrError(eErrCode));
 	else
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("set TerminalStage %d", bResult);
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("set TerminalStage %d", bResult);
 
 }
 
@@ -749,28 +728,33 @@ CSimpleStringA CHealthManagerFSM::GetOsVersion()
 	while(!is.eof()){
 		getline(is, line);
 		int start = line.find("版本");
-		if (start > 0)
-			return CSimpleStringA(line.substr(start + 5, line.length() - start - 7).c_str());
+		if (start != string::npos)
+			//return CSimpleStringA(line.substr(start + 5, line.length() - start - 7).c_str());
+			return CSimpleStringA(line.c_str());
 		else
 			continue;
 	}
 	return "";
 #else
+	std::map<std::string, std::string> osInfo;
 	const char filePath[] = "/etc/os-version";
-	CSimpleStringA strVersion;
 	char tmp[33];
 	memset(tmp, 0, 33);
+	inifile_read_str_s("Version", "SystemName", "unknown", tmp, 32, filePath);
+	osInfo["SystemName"] = tmp;
+	memset(tmp, 0, 33);
+	inifile_read_str_s("Version", "ProductType", "unknown", tmp, 32, filePath);
+	osInfo["ProductType"] = tmp;
+	memset(tmp, 0, 33);
 	inifile_read_str_s("Version", "MajorVersion", "unknown", tmp, 32, filePath);
-	strVersion = tmp;
-	strVersion += ".";
+	osInfo["MajorVersion"] = tmp;
 	memset(tmp, 0, 33);
 	inifile_read_str_s("Version", "MinorVersion", "unknown", tmp, 32, filePath);
-	strVersion += tmp;
-	strVersion += ".";
+	osInfo["MinorVersion"] = tmp;
 	memset(tmp, 0, 33);
 	inifile_read_str_s("Version", "OsBuild", "unknown", tmp, 32, filePath);
-	strVersion += tmp;
-	return strVersion;
+	osInfo["OsBuild"] = tmp;
+	return generateJsonStr(osInfo).second.c_str();
 #endif
 }
 
@@ -879,7 +863,8 @@ void CHealthManagerFSM::ToLogWarnTermAboutInfo()
 {
 	LOG_FUNCTION();
 	QueryAndSaveDNS();
-	QueryAndSaveCPUInfo();
+	QueryAndSendCPUInfo();
+	QueryAndSendDisplayInfo();
 	bool bTmpEtyNewStart = m_bEntityNewStart;
 	if (m_bEntityNewStart)
 	{
@@ -907,11 +892,9 @@ void CHealthManagerFSM::ToLogWarnTermAboutInfo()
 	}
     CSimpleStringA csOSVerion(""), csWarnMsg("");
 	std::map<std::string, std::string> termInfo;
-	std::map<std::string, std::string> pcInfo;
 	termInfo["version"] = m_sysInfo.InstallVersion.ToString();
-	termInfo["CPUInfo"] = m_cpuInfo;
 
-	if (m_iAccessAuth == AccessAuth_Suc)
+	if (m_iAccessAuth == VtmLoad_AccessAuth_Suc)
 	{
 		termInfo["AccessAuth"] = "T";
 	}
@@ -925,34 +908,16 @@ void CHealthManagerFSM::ToLogWarnTermAboutInfo()
 	csOSVerion = GetOsVersion();
 	if (!csOSVerion.IsNullOrEmpty())
 		termInfo["OSVersion"] = csOSVerion;
-	pcInfo["TerminalNo"] = m_sysInfo.strTerminalID;//20220704 add by zjw
+	termInfo["Harddisk"] = QueryHarddiskInfo();
 
 #if defined(RVC_OS_WIN)
 	termInfo["OSType"] = "Windows";
-	QueryComputerInfo();
-	pcInfo["Manufacturer"] = m_computerInfo["Manufacturer"];
-	pcInfo["ComputerName"] = m_computerInfo["ComputerName"];
-	pcInfo["ComputerVersion"] = m_computerInfo["ComputerVersion"];
-	pcInfo["SerialNumber"] = m_computerInfo["SerialNumber"];
-	std::string strOSVersionName, strOSArch;
-	CSystemStatus tempStatus;
-	tempStatus.GetOsInfo(strOSVersionName, strOSArch);
-	if (!strOSArch.empty()) {
-		pcInfo["SystemArch"] = strOSArch;
-	}
 	termInfo["AsiaInfo"] = CheckProcessExistByName("NTRtScan.exe") ? "Y" : "N";
 	termInfo["UniAccess"] = CheckProcessExistByName("UniAccessAgent.exe") ? "Y" : "N";
 	termInfo["RuiYan"] = CheckProcessExistByName("RuiYan.exe") ? "Y" : "N";
 	termInfo["Symantec"] = CheckProcessExistByName("SavUI.exe") ? "Y" : "N";
 #else
 	termInfo["OSType"] = "UOS";
-	pcInfo["Manufacturer"] = m_sysInfo.strManufacturer.IsNullOrEmpty() ? "": m_sysInfo.strManufacturer.GetData();
-	pcInfo["MachineModel"] = m_sysInfo.strMachineModel.IsNullOrEmpty() ? "" : m_sysInfo.strMachineModel.GetData();
-	pcInfo["SN"] = m_sysInfo.strMachineSN.IsNullOrEmpty() ? "" : m_sysInfo.strMachineSN.GetData();
-	//???oiltmp
-	termInfo["Manufacturer"] = m_sysInfo.strManufacturer.IsNullOrEmpty() ? "" : m_sysInfo.strManufacturer.GetData();
-	termInfo["MachineMode"] = m_sysInfo.strMachineModel.IsNullOrEmpty() ? "" : m_sysInfo.strMachineModel.GetData();
-	termInfo["MachineSN"] = m_sysInfo.strMachineSN.IsNullOrEmpty() ? "" : m_sysInfo.strMachineSN.GetData();
 #endif
 
 	CSmartPointer<IConfigInfo> spConfigRun;
@@ -1001,20 +966,15 @@ void CHealthManagerFSM::ToLogWarnTermAboutInfo()
 	termInfo["AppPath"] = csRunPath;
 
 	std::pair<bool, std::string> strResult;
-	std::pair<bool, std::string> strPCInfo;
 	strResult = generateJsonStr(termInfo);
-	strPCInfo = generateJsonStr(pcInfo);
 
 	spConfigRun->ReadConfigValue("Run", "WarnMsg", csWarnMsg);
-	DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("ToLogWarnTermAboutInfo:[%s]", strResult.second.c_str());
 	//oilyang@20210323 discard the following rule of throwing LogWarn.Always throw LogWarn 
 	//oilyang@20201201 log warn every time if content of msg has changed
 	if (bTmpEtyNewStart)
 	{
 		LogWarn(Severity_Low, Error_Unexpect, LOG_WARN_HEALTH_UPLOAD_INFO_ABOUT_TERM, strResult.second.c_str());
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("InfoAboutTerm")(strResult.second.c_str());
-		LogWarn(Severity_Low, Error_Unexpect, HealthManager_UserErrorCode_First_Info_AboutTerm, strResult.second.c_str());
-		LogWarn(Severity_Low, Error_Unexpect, HealthManager_UserErrorCode_First_Info_AboutPC, strPCInfo.second.c_str());
 	}
 	else
 	{
@@ -1297,6 +1257,8 @@ bool CHealthManagerFSM::CheckProcessExistByName(CSimpleStringA procName)
 }
 void CHealthManagerFSM::QueryAndSaveDNS()
 {
+	for (int i = 0; i < m_dns.GetCount(); ++i)
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("before to get, the m_dns[%s]", m_dns[i].c_str());
 	m_dns.Clear();
 	CSimpleStringA runInfoPath, csDNSKeyword;
 	ErrorCodeEnum eErr = GetEntityBase()->GetFunction()->GetPath("runinfo", runInfoPath);
@@ -1304,7 +1266,7 @@ void CHealthManagerFSM::QueryAndSaveDNS()
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("GetPath runinfo error=%d.", eErr);
 		return;
 	}
-	runInfoPath += "\\runcfg\\dns";
+	runInfoPath = runInfoPath + SPLIT_SLASH_STR + "runcfg" + SPLIT_SLASH_STR + "dns";
 
 #if defined(RVC_OS_WIN)
 	CSimpleStringA csCmd;
@@ -1314,7 +1276,7 @@ void CHealthManagerFSM::QueryAndSaveDNS()
 #else
 	std::string sucContent, failedContent;
 	CSimpleStringA strCmd;
-	strCmd = CSimpleStringA::Format("cat /etc/resolv.conf | grep \" nameserver\" >%s", runInfoPath.GetData());
+	strCmd = CSimpleStringA::Format("cat /etc/resolv.conf | grep \"nameserver\" >%s", runInfoPath.GetData());
 	bool ret = SP::Module::Util::ShellExecute(strCmd.GetData(), sucContent, failedContent);
 	csDNSKeyword = "nameserver";
 #endif //RVC_OS_WIN
@@ -1323,26 +1285,26 @@ void CHealthManagerFSM::QueryAndSaveDNS()
 	if (!is.is_open())
 	{
 		DWORD dwErr = GetLastError();
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("open runcfg\\dns file failed. [%d]", dwErr);
+		DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("open %s file failed. [%d]", runInfoPath.GetData(), dwErr);
 		return;
 	}
 
 	string line;
 	while (!is.eof()) {
 		getline(is, line);
-		int start = line.find(csDNSKeyword.GetData());
-		if (start > 0)
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("line:%s", line.c_str());
+		size_t start = line.find(csDNSKeyword.GetData());
+		if (start != string::npos)
 		{
-			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s", line.c_str());
 #if defined(RVC_OS_WIN)
 			int dnsStart = line.find(": ");
-			if (dnsStart > 0)
+			if (dnsStart != string::npos)
 			{
 				string xDns = SP::Utility::ToTrim(line.substr(dnsStart + 1, line.length() - dnsStart - 1));
 				m_dns.Append(&xDns, 0, 1);
 			}
 #else
-			string xDns = SP::Utility::ToTrim(line.substr(start + 1, line.length() - start - 1));
+			string xDns = SP::Utility::ToTrim(line.substr(start + csDNSKeyword.GetLength() + 1, line.length() - start - csDNSKeyword.GetLength() - 1));
 			m_dns.Append(&xDns, 0, 1);
 #endif
 		}
@@ -1351,24 +1313,27 @@ void CHealthManagerFSM::QueryAndSaveDNS()
 	}
 	return;
 }
-void CHealthManagerFSM::QueryAndSaveCPUInfo()
+void CHealthManagerFSM::QueryAndSendCPUInfo()
 {
+#if defined(RVC_OS_WIN)
 	if (!m_cpuInfo.IsNullOrEmpty())
 	{
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("have queried cpu info, no need to query again, current cpuinfo:%s", m_cpuInfo.GetData());
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("InfoAboutCPU")(m_cpuInfo.GetData());
 		return;
 	}
-#if defined(RVC_OS_WIN)
+
 	SYSTEM_INFO si;
 	GetSystemInfo(&si);
 	std::map<std::string, std::string> map_cpuInfo;
 
-	map_cpuInfo.insert(std::make_pair("CPUType", CSimpleStringA::Format("%d", si.dwProcessorType)));
-	map_cpuInfo.insert(std::make_pair("CPULevel", CSimpleStringA::Format("%d", si.wProcessorLevel)));
-	map_cpuInfo.insert(std::make_pair("CPUArch", CSimpleStringA::Format("%d", si.wProcessorArchitecture)));
-	map_cpuInfo.insert(std::make_pair("CPURevision", CSimpleStringA::Format("%d", si.wProcessorRevision)));
-	map_cpuInfo.insert(std::make_pair("CPUNum", CSimpleStringA::Format("%d", si.dwNumberOfProcessors)));
+	map_cpuInfo.insert(std::make_pair("dwProcessorType", CSimpleStringA::Format("%d", si.dwProcessorType)));
+	map_cpuInfo.insert(std::make_pair("wProcessorLevel", CSimpleStringA::Format("%d", si.wProcessorLevel)));
+	map_cpuInfo.insert(std::make_pair("wProcessorArchitecture", CSimpleStringA::Format("%d", si.wProcessorArchitecture)));
+	map_cpuInfo.insert(std::make_pair("wProcessorRevision", CSimpleStringA::Format("%d", si.wProcessorRevision)));
+	map_cpuInfo.insert(std::make_pair("dwNumberOfProcessors", CSimpleStringA::Format("%d", si.dwNumberOfProcessors)));
 	m_cpuInfo = generateJsonStr(map_cpuInfo).second.c_str();
+	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("InfoAboutCPU")(m_cpuInfo.GetData());
 
 #else
 	ifstream cpuinfo("/proc/cpuinfo");
@@ -1377,37 +1342,125 @@ void CHealthManagerFSM::QueryAndSaveCPUInfo()
 		return;
 	}
 	std::map<std::string, std::string> map_cpuInfo;
-	bool bModelName(false), bArch(false), bRevision(false);
-	string line, modelName(""), arch(""), revision("");
-
-	std::regex patternModelName("model\\s+name\\s*:\\s*(.*)");
-	std::regex patternArch("CPU\\s*architecture\\s*:(.*)");
-	std::regex patternRevision("CPU\\s+revision\\s*:\\s*(.*)");
-	std::regex patternProcess("processor\\s*:\\s*(.*)");
-	std::smatch match;
-	int processNum = 0;
+	string line;
 	while (std::getline(cpuinfo, line)) {
-		if (std::regex_search(line, match, patternModelName) && !bModelName) {
-			modelName = match[1];
-			bModelName = true;
-		}
-		else if (std::regex_search(line, match, patternArch) && !bArch) {
-			arch = match[1];
-			bArch = true;
-		}
-		else if (std::regex_search(line, match, patternRevision) && !bRevision) {
-			revision = match[1];
-			bRevision = true;
+		auto elems = SP::Utility::Split(line, ':');
+		if (elems.size() > 1) {
+			map_cpuInfo[SP::Utility::ToTrim(elems[0])] = SP::Utility::ToTrim(elems[1]);
+			if (line.find("CPU revision") != string::npos)
+				DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("InfoAboutCPU")(generateJsonStr(map_cpuInfo).second.c_str());
 		}
-		else if (std::regex_search(line, match, patternProcess))
-			processNum++;
-	}
-	cpuinfo.close();
-	map_cpuInfo.insert(std::make_pair("ModelName", modelName));
-	map_cpuInfo.insert(std::make_pair("CPUArch", arch));
-	map_cpuInfo.insert(std::make_pair("CPURevision", revision));
-	map_cpuInfo.insert(std::make_pair("CPUNum", CSimpleStringA::Format("%d", processNum)));
-	m_cpuInfo = generateJsonStr(map_cpuInfo).second.c_str();
+	}
 #endif //RVC_OS_WIN
 	return;
+}
+void CHealthManagerFSM::QueryAndSendDisplayInfo()
+{
+	std::map<std::string, std::string> primaryInfo; 
+	std::map<std::string, std::string> secondaryInfo;
+	std::map<std::string, std::string> displayInfo;
+#if defined(RVC_OS_WIN)
+	DISPLAY_DEVICE devDevice;
+	devDevice.cb = sizeof(DISPLAY_DEVICE);
+
+	//获取系统中的所有显示设备
+	EnumDisplayDevices(NULL, ENUM_CURRENT_SETTINGS, &devDevice, 0);
+
+	bool bPrimary = false;
+	// 遍历显示设备列表
+	for (int i = 0; EnumDisplayDevices(NULL, i, &devDevice, 0) != 0; i++)
+	{
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("devDevice.StateFlags:%d", devDevice.StateFlags);
+		bPrimary = false;
+		//if connected
+		if (devDevice.StateFlags & DISPLAY_DEVICE_ACTIVE)
+		{
+			if (devDevice.StateFlags & DISPLAY_DEVICE_PRIMARY_DEVICE)
+				bPrimary = true;
+			// 获取显示设备的分辨率
+			DEVMODE devMode;
+			devMode.dmSize = sizeof(DEVMODE);
+			EnumDisplaySettings(devDevice.DeviceName, ENUM_CURRENT_SETTINGS, &devMode);
+			if (bPrimary)
+			{
+				primaryInfo["dmDeviceName"] = CSimpleStringA::Format("%s", devMode.dmDeviceName);
+				primaryInfo["dmPelsWidth"] = CSimpleStringA::Format("%d", devMode.dmPelsWidth);
+				primaryInfo["dmPelsHeight"] = CSimpleStringA::Format("%d", devMode.dmPelsHeight);
+				primaryInfo["dmDisplayOrientation"] = CSimpleStringA::Format("%d", devMode.dmDisplayOrientation);
+				primaryInfo["dmDisplayFixedOutput"] = CSimpleStringA::Format("%d", devMode.dmDisplayFixedOutput);
+				primaryInfo["dmPosition.x"] = CSimpleStringA::Format("%d", devMode.dmPosition.x);
+				primaryInfo["dmPosition.y"] = CSimpleStringA::Format("%d", devMode.dmPosition.y);
+			}
+			else
+			{
+				secondaryInfo["dmDeviceName"] = CSimpleStringA::Format("%s", devMode.dmDeviceName);
+				secondaryInfo["dmPelsWidth"] = CSimpleStringA::Format("%d", devMode.dmPelsWidth);
+				secondaryInfo["dmPelsHeight"] = CSimpleStringA::Format("%d", devMode.dmPelsHeight);
+				secondaryInfo["dmDisplayOrientation"] = CSimpleStringA::Format("%d", devMode.dmDisplayOrientation);
+				secondaryInfo["dmDisplayFixedOutput"] = CSimpleStringA::Format("%d", devMode.dmDisplayFixedOutput);
+				secondaryInfo["dmPosition.x"] = CSimpleStringA::Format("%d", devMode.dmPosition.x);
+				secondaryInfo["dmPosition.y"] = CSimpleStringA::Format("%d", devMode.dmPosition.y);
+			}
+		}
+	}
+	displayInfo["PrimaryText"] = generateJsonStr(primaryInfo).second.c_str();
+	displayInfo["SecondaryText"] = generateJsonStr(secondaryInfo).second.c_str();
+#else
+	CSimpleStringA runInfoPath, csDNSKeyword;
+	ErrorCodeEnum eErr = GetEntityBase()->GetFunction()->GetPath("runinfo", runInfoPath);
+	if (eErr != Error_Succeed) {
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("GetPath runinfo error=%d.", eErr);
+		return;
+	}
+	runInfoPath = runInfoPath + SPLIT_SLASH_STR + "runcfg" + SPLIT_SLASH_STR + "monitor";
+
+
+	std::string sucContent, failedContent;
+	CSimpleStringA strCmd;
+	strCmd = CSimpleStringA::Format("xrandr | grep \" connected\"  >%s", runInfoPath.GetData());
+	bool ret = SP::Module::Util::ShellExecute(strCmd.GetData(), sucContent, failedContent);
+	if (!ret)
+	{
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("failedContent:%s", failedContent.c_str());
+		return;
+	}
+
+	ifstream is;
+	is.open(runInfoPath.GetData(), ios::binary);
+	if (!is.is_open())
+	{
+		DWORD dwErr = GetLastError();
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("open %s file failed. [%d]", runInfoPath.GetData(), dwErr);
+		return;
+	}
+
+	string line;
+	while (!is.eof()) {
+		getline(is, line);
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("line:%s", line.c_str());
+
+		if (line.find("connected") != string::npos)
+		{
+			if (line.find("primary") != string::npos)
+				displayInfo["PrimaryText"] = line;
+			else
+				displayInfo["SecondaryText"] = line;
+		}
+	}
+#endif
+	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("InfoAboutDisplay")(generateJsonStr(displayInfo).second.c_str());
+}
+string CHealthManagerFSM::QueryHarddiskInfo()
+{
+	CSimpleStringA csRunCfgPath("");
+	GetEntityBase()->GetFunction()->GetPath("RunCfg", csRunCfgPath);
+	csRunCfgPath = csRunCfgPath + SPLIT_SLASH_STR + "AccessAuthorization.ini";
+	char tmp[256];
+	memset(tmp, 0, 256);
+	inifile_read_str_s("system", "info", "", tmp, 255, csRunCfgPath);
+	auto elems = SP::Utility::Split(tmp, '|');
+	if (elems.size() > 2) {
+		return SP::Utility::ToTrim(elems[2]);
+	}
+	return "";
 }

+ 19 - 13
Module/mod_healthmanager/HealthManagerFSM.h

@@ -82,12 +82,14 @@ enum HealthManagerFSMState
 	HM_FSM_STATE_MAINTAINING,
 	HM_FSM_STATE_CMS,
 };
-enum AccessAuthResult
+enum VtmLoadResult
 {
-	AccessAuth_Init = 0,
-	AccessAuth_Suc,
-	AccessAuth_Fail,
-	AccessAuth_servFail
+	VtmLoad_AccessAuth_Init = 0,
+	VtmLoad_AccessAuth_Suc,
+	VtmLoad_AccessAuth_Fail,
+	VtmLoad_AccessAuth_servFail,
+	VtmLoad_MediaLoadFail,
+	VtmLoad_OtherSyncEntityLoadFail,
 };
 
 struct callback_entry : public IReleasable
@@ -138,6 +140,8 @@ public:
 	BEGIN_FSM_RULE(CHealthManagerFSM,s0)
 		FSM_RULE_ENTRY(s0,s4, USER_EVT_WAIT_DEAMON_FINISHED,0)
 		FSM_RULE_ENTRY(s4,s5,USER_EVT_ACCESSAUTH_FINISHED,1)
+		FSM_RULE_ENTRY(s4, s5, USER_EVT_VTMLOADER_FINISHED, 1)
+		FSM_RULE_ENTRY(s4, s5, USER_EVT_VTMLOADER_FINISHED, 2)
 		FSM_RULE_ENTRY(s4,s6,USER_EVT_MAITAIN,0)
 		FSM_RULE_ENTRY(s4,s11,USER_EVT_ENTER_CUSTOMER_MANAGER,0)
 		FSM_RULE_ENTRY(s5,s6,USER_EVT_MAITAIN,0)
@@ -152,8 +156,8 @@ public:
 	END_FSM_RULE()
 
 	CHealthManagerFSM():m_SysState("I"),m_pACClient(NULL)
-	, m_iAccessAuth(AccessAuth_Init)
-	, m_bIdleToMaintain(false), m_custMngerState(0), m_pDevCtrlClient(NULL), m_bHasAuthEver(false)
+	, m_iAccessAuth(VtmLoad_AccessAuth_Init)
+	, m_custMngerState(0), m_pDevCtrlClient(NULL), m_bHasAuthEver(false)
 	, m_checkCode(""), m_bFirstAccessAuth(true)
 	, m_bIEBeforeHealth(false), m_bInAccessAuthDoWork(false)
 	, m_bEntityNewStart(true), m_iDoNotUpdateWKDaily(0)
@@ -184,15 +188,15 @@ public:
 	int WaitDeamonFinish();
 
 	int AccessAuthDoWork();
-	void SetAccessAuth(int bResult);
-	bool GetAccessAuthFlag(){return m_iAccessAuth == AccessAuth_Suc;}
+	void SetVtmLoadResult(int bResult);
+	bool GetAccessAuthFlag(){return m_iAccessAuth == VtmLoad_AccessAuth_Suc;}
 	int GetFSMState(){return m_fsmState;}
 	void ToReAccessAuth(bool bEver=false);
 	void SetCustomerMngerState(int iValue){m_custMngerState = iValue;}
 	int GetCustomerMngerState(){return m_custMngerState;}
 	int QueryAccessAuthStatus()
 	{
-		if (m_iAccessAuth == AccessAuth_Suc)
+		if (m_iAccessAuth == VtmLoad_AccessAuth_Suc)
 			return 0;
 		else
 		{
@@ -233,17 +237,19 @@ private:
 	int sumday(int year,int month,int day);//计算天数
 	bool CheckProcessExistByName(CSimpleStringA procName);
 	void QueryAndSaveDNS();
-	void QueryAndSaveCPUInfo();
+	void QueryAndSendCPUInfo();
+	void QueryAndSendDisplayInfo();
+	string QueryHarddiskInfo();
 
 private:
 	CSimpleStringA m_SysState, m_checkCode, m_LoadEntityList, m_cpuInfo;
 	int m_fsmState, m_stateBeforeMaintain, m_custMngerState, m_preFsmState
 		,m_iAccessAuth/*-1 未准入; 0 准入失败;1 准入成功*/, m_iDoNotUpdateWKDaily, m_wkUpdatePeriod/*if exceed the period time,we should update key*/;
 	AccessAuthService_ClientBase *m_pACClient;
-	bool m_bIdleToMaintain, m_bHasAuthEver, m_bFirstAccessAuth
+	bool m_bHasAuthEver, m_bFirstAccessAuth
 		, m_bIEBeforeHealth, m_bInAccessAuthDoWork, m_bEntityNewStart, m_bPinPadOpenSuc;
 	DWORD m_elapseTimeFromOSStart;
-	ULONGLONG m_ullElapseFromOSStart;
+	ULONGLONG m_ullElapseFromOSStart, m_ullAuthStart;
 	DeviceControlService_ClientBase *m_pDevCtrlClient;
 	CSystemStaticInfo m_sysInfo;
 	std::map<string, string> m_computerInfo;

+ 5 - 5
Module/mod_healthmanager/mod_healthmanager.cpp

@@ -1119,7 +1119,7 @@ void CHealthManagerEntity::OnLog(const CAutoArray<CUUID>& SubIDs, const CUUID nL
 	case EVENT_ACCESSAUTH_SUCCEED:
 	{
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER).setLogCode("QLR0402501Z10302")("access auth succeed.");
-		m_fsm.SetAccessAuth(AccessAuth_Suc);
+		m_fsm.SetVtmLoadResult(VtmLoad_AccessAuth_Suc);
 		m_bNeedAuthRetry = false;
 		m_bNeedGuardianRestart = true;
 		m_dwTimeOfAuthSuc = SP::Module::Comm::RVCGetTickCount() / 1000;
@@ -1166,7 +1166,7 @@ void CHealthManagerEntity::OnLog(const CAutoArray<CUUID>& SubIDs, const CUUID nL
 			m_bNeedAuthRetry = false;
 			m_bNeedGuardianRestart = true;
 		}
-		m_fsm.SetAccessAuth(AccessAuth_Fail);
+		m_fsm.SetVtmLoadResult(VtmLoad_AccessAuth_Fail);
 		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setLogCode("QLR0402501Z10302").setResultCode("RTA5103")("receive accessauth failed result:%d", dwUserCode);
 		if (m_bNeedAuthRetry)
 		{
@@ -1180,7 +1180,7 @@ void CHealthManagerEntity::OnLog(const CAutoArray<CUUID>& SubIDs, const CUUID nL
 		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("unkown access failed.no retry, no restart.");
 		m_bNeedAuthRetry = false;
 		m_bNeedGuardianRestart = false; //服务端准入失败无需重启
-		m_fsm.SetAccessAuth(AccessAuth_servFail);
+		m_fsm.SetVtmLoadResult(VtmLoad_AccessAuth_servFail);
 		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER)("access auth failed %d. TerminalStage = S", dwUserCode);
 		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER).setLogCode("QLR0402501Z10302").setResultCode("RTA5103")("receive accessauth failed result:%d", dwUserCode);
 		if (m_bNeedAuthRetry)
@@ -1332,8 +1332,8 @@ bool CHealthManagerEntity::StartManagerDesktopPage(CSimpleStringA pageName)
 		req.mainUrl = statusPagePath;
 		req.type = "SpecialPageFromOtherEntity";
 		req.name = "tempMessage";
-		req.param1 = CSimpleStringA::Format("%d*%d", width, height);
-		req.param2 = CSimpleStringA::Format("0*0");
+		req.param1 = CSimpleStringA::Format("%d,%d", width, height);
+		req.param2 = CSimpleStringA::Format("0,0");
 		req.top = -1;
 
 		error = (*chromiumClient)(EntityResource::getLink().upgradeLink())->OpenBrowser(req, ans, 10000);

+ 2 - 2
Module/mod_pinpad/PinPadFSM.cpp

@@ -465,7 +465,7 @@ int CPinPadFSM::Initial()
 	CSimpleStringA csRunInfo, csSNBakFile;
 	if ((eErr = GetEntityBase()->GetFunction()->GetPath("RunInfo", csRunInfo)) == Error_Succeed)
 	{
-		csSNBakFile = csRunInfo + SPLIT_SLASH_STR + "snbak.dat";
+		csSNBakFile = csRunInfo + SPLIT_SLASH_STR + "runcfg" + SPLIT_SLASH_STR + "snbak.dat";
 		ifstream infile(csSNBakFile, std::ofstream::binary);
 		char* buffer = new char[16];
 		ZeroMemory(buffer, 16);
@@ -1120,7 +1120,7 @@ int CPinPadFSM::LoadKeySM(SpReqAnsContext<PinPadService_LoadKeysSM_Req, PinPadSe
 			CSimpleStringA csRunInfo,csSNBakFile;
 			if ((eErr = GetEntityBase()->GetFunction()->GetPath("RunInfo", csRunInfo)) == Error_Succeed)
 			{
-				csSNBakFile = csRunInfo + SPLIT_SLASH_STR + "snbak.dat";
+				csSNBakFile = csRunInfo + SPLIT_SLASH_STR + "runcfg" + SPLIT_SLASH_STR + "snbak.dat";
 				ofstream outfile(csSNBakFile, std::ofstream::binary|ios::trunc);
 
 				int size = m_keySNSM.GetLength();

+ 3 - 1
Module/mod_vtmloader/VtmLoaderFSM.cpp

@@ -1040,6 +1040,7 @@ int CVtmLoaderFSM::EntityLoad()
 		return -1;
 
 	LogWarn(Severity_Low, Error_Succeed, VtmLoader_BootInfoPrint, "开始加载实体");
+	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("StartLoadEntity")("开始加载实体");
 
 	//int count, cbNum, slNum, opNum;
 	//count = cbNum = slNum = opNum = 0;
@@ -2895,7 +2896,8 @@ bool CVtmLoaderFSM::CheckConfigInfoInTestRoom()
 				return false;
 			}
 		}
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("check machine model ok");
 	}
-	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_USER)("check machine model ok");
+	
 	return true;
 }

+ 11 - 2
Module/mod_vtmloader/mod_vtmloader.cpp

@@ -34,7 +34,15 @@ void VtmLoaderServerSession::Handle_DealWithOldEvent(SpReqAnsContext<VtmLoaderSe
 void CVtmLoaderEntity::OnPreStart(CAutoArray<CSimpleStringA> strArgs,CSmartPointer<ITransactionContext> pTransactionContext) 
 {
 	m_FSM.Init(this);
-	//CloseHandle(CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&thread_testEvent, this, 0, NULL));
+	CSmartPointer<IEntityFunction> pFunc = GetFunction();
+	CSmartPointer<IEntityFunctionPrivilege> pFuncPrivilege = pFunc.ConvertCase<IEntityFunctionPrivilege>();
+	ErrorCodeEnum eErrCode = pFuncPrivilege->RegistEntityStateEvent(NULL, this);//only for "HealthManager"
+	if (eErrCode != Error_Succeed)
+	{
+		DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("RegistEntityState failed(%d).", eErrCode);
+		pTransactionContext->SendAnswer(eErrCode);
+		return;
+	}
 	pTransactionContext->SendAnswer(Error_Succeed) ;		
 }
 
@@ -66,6 +74,7 @@ void CVtmLoaderEntity::OnEntityStateHook(const char* pszEntityName, const char*
 {
 	if (_strnicmp("HealthManager", pszEntityName, strlen("HealthManager")) != 0 || eState != EntityState_Lost)
 		return;
+	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%s,eState:%d", pszEntityName, eState);
 	CSmartPointer<IEntityFunction> pFunc = GetFunction();
 	CSmartPointer<IEntityFunctionPrivilege> pFuncPrivilege = pFunc.ConvertCase<IEntityFunctionPrivilege>();
 	if (pFuncPrivilege == NULL)
@@ -157,7 +166,7 @@ void CVtmLoaderEntity::EntityLostProc(CSimpleStringA entityName)
 
 
 		auto dealOldEventThread = [&] {
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("DealWithOldEvent called eventId, %d", s_ctx->Req.eventId);
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setLogCode(VtmLoaderService_LogCode_DealWithOldEvent)("DealWithOldEvent called eventId, %d", s_ctx->Req.eventId);
 			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("DealWithOldEvent called reqStrRev1, %s", s_ctx->Req.reqStrRev1);
 			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("DealWithOldEvent called reqStrRev2, %s", s_ctx->Req.reqStrRev2);
 			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("DealWithOldEvent called reqIntRev1, %d", s_ctx->Req.reqIntRev1);

+ 2 - 2
addin/cmake/DependencyConanFiles.cmake

@@ -69,7 +69,7 @@ if(MSVC)
 			#mod_chromium
 			CEFControl/1.0@LR04.02_ThirdParty/testing
 			#mod_chromium
-			cefclient_mutable/2.0.37@LR04.02_ThirdParty/testing
+			cefclient_mutable/2.0.44@LR04.02_ThirdParty/testing
 			#libaudiorender
 			speex/1.2.1@LR04.02_ThirdParty/testing
 			#libvideoframework
@@ -80,7 +80,7 @@ if(MSVC)
 			Misc/2024.0313.1@LR04.02_ThirdParty/msvc
 			)
 			
-	list(APPEND CONAN_CURPLATFORM_LIB_NAMES cefclient_const/1.1@LR04.02_ThirdParty/testing)
+	list(APPEND CONAN_CURPLATFORM_LIB_NAMES cefclient_const/2.0.41@LR04.02_ThirdParty/testing)
 	list(APPEND CONAN_CURPLATFORM_LIB_NAMES RuntimeBase/2024.0401.02@LR04.02_ThirdParty/testing)
 else()
 	set(CONAN_CURPLATFORM_LIB_NAMES