Browse Source

Z991239-5462 #comment fea: can compile success in uos system

chenliangyu 1 year ago
parent
commit
5f2830f7ec

+ 32 - 0
Module/mod_ResourceWatcher/ResourceWatcher_msg_g.h

@@ -0,0 +1,32 @@
+
+#ifndef __RESOURCEWATCHER_MSG_G_H
+#define __RESOURCEWATCHER_MSG_G_H
+
+#pragma once
+
+// This code is generated by spgen tool!
+
+#include "SpHelper.h"
+
+namespace ResourceWatcher {
+#define eMsg_BrowserCacheClean 2
+
+#define eMsgSig_BrowserCacheClean 1728030659
+
+struct BrowserCacheClean
+{
+	int needClean;
+	int reversed1;
+	CSimpleStringA reversed2;
+
+	void Serialize(SpBuffer &Buf)
+	{
+		auto & buf = Buf & needClean & reversed1 & reversed2;
+	}
+
+};
+
+///////////////////////////
+
+} // namespace ResourceWatcher
+#endif // __RESOURCEWATCHER_MSG_G_H

+ 3 - 2
Module/mod_chromium/CMakeLists.txt

@@ -175,13 +175,14 @@ target_include_directories(${MODULE_NAME} PRIVATE
 	${ThirdPartyHeadRoot}/msgpack
 	${MODULE_BASE_DIR}/mod_upload
 	${MODULE_BASE_DIR}/mod_healthmanager
+	${CONAN_INCLUDE_DIRS_SDL2}
 )
 # 添加实体需要依赖的其他共享库(包括系统库):连接器包含的包
-target_link_directories(${MODULE_NAME} PRIVATE ${CONAN_LIB_DIRS_BOOST} ${CONAN_LIB_DIRS_OPENSSL} ${CONAN_LIB_DIRS_CEFCONTROL} ${LIBPROFILER_LIBRARY_DIRS})
+target_link_directories(${MODULE_NAME} PRIVATE ${CONAN_LIB_DIRS_BOOST} ${CONAN_LIB_DIRS_OPENSSL} ${CONAN_LIB_DIRS_CEFCONTROL} ${LIBPROFILER_LIBRARY_DIRS} ${CONAN_LIB_DIRS_SDL2})
 if(MSVC)
 set(${MODULE_PREFIX}_LIBS ${MODULE_BASE_ALL_LIBS} ${CONAN_PKG_LIBS_OPENSSL} ${CONAN_PKG_LIBS_CEFCONTROL})
 else()
-set(${MODULE_PREFIX}_LIBS ${MODULE_BASE_ALL_LIBS} ${CONAN_PKG_LIBS_OPENSSL})
+set(${MODULE_PREFIX}_LIBS ${MODULE_BASE_ALL_LIBS} ${CONAN_PKG_LIBS_OPENSSL} ${CONAN_LIBS_SDL2})
 endif(MSVC)
 
 

+ 117 - 14
Module/mod_chromium/CModTools.cpp

@@ -11,6 +11,12 @@
 #include <boost/process.hpp>
 #include <boost/thread.hpp>
 #include "CommEntityUtil.hpp"
+#include <SDL2/SDL.h>
+//#include <winpr/wnd.h>
+#define HWND_TOP (0)
+#define HWND_BOTTOM (1)
+#define HWND_TOPMOST (-1)
+#define HWND_NOTOPMOST (-2)
 #endif
 #include "baseEx.h"
 #include "CModTools.h"
@@ -25,7 +31,7 @@
 #include "EventCode.h"
 #include "url_encoder.h"
 #include "SpUtility.h"
-#include <winpr/wnd.h>
+
 
 
 void SystemRunTest(const std::string& systemCmd);
@@ -543,17 +549,112 @@ namespace Chromium {
 #endif //RVC_OS_LINUX
 	}
 
-	std::string CModTools::generateCommonPage(std::string url, std::string name, std::string size, std::string point, int top)
+	std::string CModTools::generateCommonPage(std::string url, std::string name, int width, int height, int point_x, int point_y, int top)
 	{
 #if defined(RVC_OS_LINUX)
-		return generateBrowserCMDForEverything(url, 0); //need change later, because common page may not run in full-screen mode
+		CSimpleStringA strBasePath(true);
+		this->m_pEntity->GetFunction()->GetPath("BaseDir", strBasePath);
+		std::string strPath(strBasePath.GetData());
+		const std::string execute_newbrowser_path = strPath + SPLIT_SLASH_STR + "res" + SPLIT_SLASH_STR + "RunScript" + SPLIT_SLASH_STR + "startBrower.sh";
+		const std::string execute_oldbrowser_path = strPath + SPLIT_SLASH_STR + "res" + SPLIT_SLASH_STR + "RunScript" + SPLIT_SLASH_STR + "startUOSBrower.sh";
+		CSimpleStringA strParams(true);
+		if (width > 0 && height > 0)
+			strParams.Append(" --window-size=").Append(std::to_string(width).c_str()).Append(",").Append(std::to_string(height).c_str());
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("1");
+		
+		do
+		{
+			if (point_x != -1 && point_y != -1)
+			{
+				strParams.Append(" --window-position=").Append(std::to_string(point_x).c_str()).Append(",").Append(std::to_string(point_y).c_str());
+				break;
+			}
+
+
+			if (SDL_Init(SDL_INIT_VIDEO) < 0) {
+				break;
+			}
+
+			SDL_DisplayMode mode;
+			if (SDL_GetDesktopDisplayMode(0, &mode) != 0) {
+				// 错误处理
+				SDL_Quit();
+				break;
+			}		
+
+
+			// 获取屏幕的宽度和高度
+			int screen_width = mode.w;
+			int screen_height = mode.h;
+			SDL_Quit();
+
+			point_x = (screen_width - width) / 2;
+			point_y = (screen_height - height) / 2;
+			strParams.Append(" --window-position=").Append(std::to_string(point_x).c_str()).Append(",").Append(std::to_string(point_y).c_str());
+
+		} while (false);
+		
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("2");
+
+		//旧版浏览器(系统自带)
+		if (m_UseUOSBrowser == 1) {
+
+			CSimpleStringA strUOSBrowserPath(execute_oldbrowser_path.c_str());
+			strParams.Append(" --new-window --no-first-run --disable-popup-blocking --disable-notifications --disable-desktop-notifications ");
+			strParams.Append(" --allow-running-insecure-content --disable-infobars --disable-suggestions-service --disable-save-password-bubble --disable-component-update");
+			
+			
+
+			CSimpleStringA tempPath;
+			this->m_pEntity->GetFunction()->GetPath("Temp", tempPath);
+			CSimpleStringA cachePath(tempPath);
+			cachePath.Append(CSimpleStringA(SPLIT_SLASH_STR)).Append("UOSBrowser_").Append(name.c_str());
+			strParams.Append(" --disk-cache-dir=").Append(cachePath);
+			strParams.Append(" --disk-cache-size=").Append("2147483647"); //2G
+			if (g_withMedia)
+				strParams.Append(" 	--use-fake-ui-for-media-stream");
+
+			CSimpleStringA usrDataPath(tempPath);
+			usrDataPath.Append(SPLIT_SLASH_STR).Append("UOSBrowserConfig_").Append(name.c_str());
+			strParams.Append(" --user-data-dir=").Append(usrDataPath);
+			strParams.Append(" --app=").Append(url.c_str());
+			strUOSBrowserPath.Append(strParams);
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("3");
+			return strUOSBrowserPath.GetData();
+		}
+
+		//新版浏览器
+		if (m_UseUOSBrowser == 2) {
+
+			CSimpleStringA strUOSBrowserPath(execute_newbrowser_path.c_str());
+			strParams.Append(" --kiosk --incognito --allow-running-insecure-content --new-window");
+
+			CSimpleStringA tempPath;
+			this->m_pEntity->GetFunction()->GetPath("Temp", tempPath);
+			CSimpleStringA cachePath(tempPath);
+			cachePath.Append(CSimpleStringA(SPLIT_SLASH_STR)).Append("Browser_").Append(name.c_str());
+			strParams.Append(" --disk-cache-dir=").Append(cachePath);
+			strParams.Append(" --disk-cache-size=").Append("2147483647"); //2G
+			if (g_withMedia)
+				strParams.Append(" 	--use-fake-ui-for-media-stream");
+
+			CSimpleStringA usrDataPath(tempPath);
+			usrDataPath.Append(SPLIT_SLASH_STR).Append("BrowserConfig_").Append(name.c_str());
+			strParams.Append(" --user-data-dir=").Append(usrDataPath);
+			strParams.Append(" --app=").Append(url.c_str());
+			strUOSBrowserPath.Append(strParams);
+			return strUOSBrowserPath.GetData();
+		}
+		return std::string("");
 #else
 		CSimpleStringA strChromiumPath = GetCefHead(this->m_pEntity), strCmdLine = "";
 		strCmdLine.Append(strChromiumPath).Append(" --url=").Append(url.c_str());
-		if(size.length() > 0)
-			strCmdLine.Append(" --center-size=").Append(size.c_str());
-		if(point.length() > 0)
-			strCmdLine.Append(" --src-pos=").Append(point.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());
+		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());
+		}
 		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());
@@ -754,7 +855,7 @@ namespace Chromium {
 			g_mutexFreerdp.unlock();
 			});
 
-		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("start browser %d", reason._to_integral());
+		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("start browser %d, %s", reason._to_integral(), reason._to_string());
 
 		if (reason._to_integral() == ERR_PAGE_REASON::main)
 		{
@@ -816,7 +917,8 @@ namespace Chromium {
 		 else if (reason._to_integral() == ERR_PAGE_REASON::startup)
 		{
 			auto url = std::string(R"(file:///)") + getErrUrl(reason).second;
-			auto strCmdline = generateCommonPage(url, (+ERR_PAGE_REASON::startup)._to_string(), "900*600", "", (int)HWND_NOTOPMOST);
+			auto strCmdline = generateCommonPage(url, (+ERR_PAGE_REASON::startup)._to_string(), 900, 600, -1, -1, (int)HWND_NOTOPMOST);
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("startup page %s", strCmdline.c_str());
 			auto openCefRet = openCef(strCmdline, false);
 			if (Error_Succeed == openCefRet.first)
 				return std::make_pair(Error_Succeed, openCefRet.second);
@@ -827,7 +929,8 @@ namespace Chromium {
 		 else if (reason._to_integral() == ERR_PAGE_REASON::performance_monitor)
 		{
 			auto url = std::string(R"(file:///)") + getErrUrl(reason).second;
-			auto strCmdline = generateCommonPage(url, (+ERR_PAGE_REASON::performance_monitor)._to_string(), "900*600", "", (int)HWND_NOTOPMOST);
+			auto strCmdline = generateCommonPage(url, (+ERR_PAGE_REASON::performance_monitor)._to_string(), 900, 600, -1, -1, (int)HWND_NOTOPMOST);
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("startup page %s", strCmdline.c_str());
 			auto openCefRet = openCef(strCmdline, false);
 			if (Error_Succeed == openCefRet.first)
 				return std::make_pair(Error_Succeed, openCefRet.second);
@@ -911,7 +1014,7 @@ namespace Chromium {
 		return std::make_pair(Error_Unexpect, 0);
 	}
 
-	std::pair<ErrorCodeEnum, int> CModTools::startCommonPage(std::string name, std::string url, std::string size, std::string point, std::string top)
+	std::pair<ErrorCodeEnum, int> CModTools::startCommonPage(std::string name, std::string url, int width, int height, int point_x, int point_y, std::string top)
 	{
 		CSimpleString topStr = top.c_str();
 		int top_param = (int)HWND_NOTOPMOST;
@@ -924,14 +1027,14 @@ namespace Chromium {
 		else if (topStr.Compare("bottom", true) == 0)
 			top_param = (int)HWND_BOTTOM;
 
-		auto strCmdline = generateCommonPage(url, name, size, point, top_param);
+		auto strCmdline = generateCommonPage(url, name, width, height, point_x, point_y, top_param);
 		auto openCefRet = openCef(strCmdline, false);
 		if (Error_Succeed == openCefRet.first)
 			return std::make_pair(Error_Succeed, openCefRet.second);
 		else
 		{
-			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("open cef %s size:%s at %s in layer %s failed: %d"
-				, name.c_str(), size.c_str(), point.c_str(), top.c_str(), openCefRet.first);
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("open cef %s size:%d*%d at %d*%d in layer %s failed: %d"
+				, name.c_str(), width, height, height, point_x, point_y, top.c_str(), openCefRet.first);
 			return std::make_pair(openCefRet.first, openCefRet.first);
 		}
 

+ 2 - 2
Module/mod_chromium/CModTools.h

@@ -40,7 +40,7 @@ namespace Chromium {
 		std::pair<ErrorCodeEnum, int> StartChromiumBrowser(ERR_PAGE_REASON reason = ERR_PAGE_REASON::main,
 			std::tuple < std::string, std::string> normalParam = std::tuple <std::string, std::string>("", ""),
 			std::tuple<std::string, std::string, std::string, DWORD, DWORD> exParam = std::tuple<std::string, std::string, std::string, DWORD, DWORD>("", "", "", 0, 0));
-		std::pair<ErrorCodeEnum, int> startCommonPage(std::string name, std::string url, std::string size, std::string point, std::string top);
+		std::pair<ErrorCodeEnum, int> startCommonPage(std::string name, std::string url, int width, int height, int point_x, int point_y, std::string top);
 		void stopCommonPage(std::string name);
 		void StopChromiumBrowser(ERR_PAGE_REASON reason, bool stopAll = false);
 		void StopSingleChromiumBrowserByName(std::string cefName);
@@ -84,7 +84,7 @@ namespace Chromium {
 		std::string generateInstallCmd(std::string installUrl);
 		std::string generateAdCmd(std::string AdUrl);
 		std::string generateSpecialPageFromOtherEntityCmd(std::string mainUrl);
-		std::string generateCommonPage(std::string url, std::string name, std::string size, std::string point, int top);
+		std::string generateCommonPage(std::string url, std::string name, int width, int height, int point_x, int point_y, int top);
 #if defined(RVC_OS_LINUX)
         //pagetype: 0: 首页全屏, 1:副屏全屏,2:错误页;3:外部调用
         std::string generateBrowserCMDForEverything(const std::string& url, int pageType);

+ 8 - 4
Module/mod_chromium/Chromium.xml

@@ -41,10 +41,14 @@
 				<param name="title" type="string"/>
 				<!-- 页面的链接,类型为字符串 -->
 				<param name="url" type="string"/>
-				<!-- 页面的大小,类型为字符串 -->
-				<param name="size" type="string"/>
-				<!-- 页面的位置,如果不传的话则在中心,类型为字符串 -->
-				<param name="point" type="string"/>
+				<!-- 页面的宽,类型为字符串 -->
+				<param name="width" type="int"/>
+				<!-- 页面的高,类型为字符串 -->
+				<param name="height" type="int"/>
+				<!-- 页面的x,类型为字符串, 如果传-1,-1则默认在中间打开 -->
+				<param name="point_x" type="int"/>
+				<!-- 页面的y,类型为字符串 -->
+				<param name="point_y" type="int"/>
 				<!-- 页面的层级,有效参数包含top,topmost, non_topmost, bottom,类型为字符串 -->
 				<param name="top" type="string"/>
 			</req>

+ 5 - 3
Module/mod_chromium/Chromium_def_g.h

@@ -91,13 +91,15 @@ struct ChromiumSrv_OpenCommonPage_Req
 {
 	CSimpleStringA title;
 	CSimpleStringA url;
-	CSimpleStringA size;
-	CSimpleStringA point;
+	int width;
+	int height;
+	int point_x;
+	int point_y;
 	CSimpleStringA top;
 
 	void Serialize(SpBuffer &Buf)
 	{
-		auto & buf = Buf & title & url & size & point & top;
+		auto & buf = Buf & title & url & width & height & point_x & point_y & top;
 	}
 
 };

+ 56 - 43
Module/mod_chromium/mod_chromium.cpp

@@ -162,10 +162,12 @@ namespace Chromium {
 	{
 		std::string strTitle = ctx->Req.title.GetData();
 		std::string strUrl = ctx->Req.url.GetData();
-		std::string strSize = ctx->Req.size.GetData();
-		std::string strPoint = ctx->Req.point.GetData();
+		int width = ctx->Req.width;
+		int height = ctx->Req.height;
+		int point_x = ctx->Req.point_x;
+		int point_y = ctx->Req.point_y;
 		std::string strTop = ctx->Req.top.GetData();
-		auto ret = CModTools::get_mutable_instance().startCommonPage(strTitle, strUrl, strSize, strPoint, strTop);
+		auto ret = CModTools::get_mutable_instance().startCommonPage(strTitle, strUrl, width, height, point_x, point_y, strTop);
 		ctx->Answer(ret.first, ret.first);
 	
 	}
@@ -260,36 +262,7 @@ namespace Chromium {
 			FetchCustomMainUrl(strArgs);
 			CModTools::get_mutable_instance().InitCModTools(this);
 
-#if defined(RVC_OS_LINUX)
-			// clear all the browser
-			CModTools::get_mutable_instance().killAllChromium();
-			DoBrowserCacheClearJob();
 
-			CSimpleStringA strDbgPath;
-			GetFunction()->GetPath("Dbg", strDbgPath);
-			set_traceback_path(strDbgPath.GetData());
-			boost::thread([]() {
-				for (auto i = 1; i < 28; i++)
-				{
-					if (SIGTERM == i)
-						signal(i, [](int signum)->void {
-						DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("receive signal:%d, closeChromium", signum);
-						CModTools::get_mutable_instance().killAllChromiumByThread(3);
-						CWebsocketServer::stopServer();
-						signal(signum, SIG_DFL);
-						raise(signum);
-
-							});
-					else if (SIGSEGV == i || SIGABRT == i)
-						signal(i, &seg_signal_handler);
-					else if (SIGPROF == i || SIGALRM == i || SIGVTALRM == i)
-						continue;
-					else
-						signal(i, &normal_signal_handle);
-				}
-
-				}).detach();
-#endif
 
 #if (defined _WIN32 || defined _WIN64)
 				const int ArgsCount = strArgs.GetCount();
@@ -391,21 +364,22 @@ namespace Chromium {
 				{
 					DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("can not open centerSetting, maybe fault");
 				}
-
+#ifdef RVC_OS_WIN
 				if (m_withMagic)
 				{
 					std::string magicStr = CModTools::get_mutable_instance().getMagicStr();
 					boost::thread(boost::bind(SaveCefclientLog, magicStr)).detach();
-				}				
+				}
+#endif
 
 				boost::thread(boost::bind(&CChromiumEntity::DoWithSysVarEvent, this)).detach();//用于处理sysvar,避免由于阻塞动作,导致实体卡住,lost
 		}
-				if (m_withSpecialTest)
-				{
-					CSimpleString strPath;
-					GetFunction()->GetPath("Downloads", strPath);
-					DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("Downloads path %s, ", strPath.GetData());
-				}
+		if (m_withSpecialTest)
+		{
+			CSimpleString strPath;
+			GetFunction()->GetPath("Downloads", strPath);
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("Downloads path %s, ", strPath.GetData());
+		}
 	}
 
 	bool CChromiumEntity::OnPreStart_socketStart(CAutoArray<CSimpleStringA>& strArgs, CSmartPointer<ITransactionContext>& pTransactionContext)
@@ -569,7 +543,11 @@ namespace Chromium {
 	{
 		OnPreStart_Init(m_strArgs, m_pTransactionContext);//初始化部分, perf ,killchromium, signal, get custom url
 
+#ifndef RVC_OS_WIN
+		Chromium::CModTools::get_mutable_instance().killAllChromium();//linux will kill all browser before open main page
+#endif // RVC_OS_UOS
 
+		
 		if (!IsConfigMode()) {
 			if (!OnPreStart_register(m_strArgs, m_pTransactionContext)) {
 				return;
@@ -640,8 +618,42 @@ namespace Chromium {
 		m_pTransactionContext = pTransactionContext;
 		pTransactionContext->SendAnswer(Error_Succeed);
 
+#if defined(RVC_OS_LINUX)
+		// clear all the browser
+		CModTools::get_mutable_instance().killAllChromium();
+		DoBrowserCacheClearJob();
+
+		CSimpleStringA strDbgPath;
+		GetFunction()->GetPath("Dbg", strDbgPath);
+		set_traceback_path(strDbgPath.GetData());
+		boost::thread([]() {
+			for (auto i = 1; i < 28; i++)
+			{
+				if (SIGTERM == i)
+					signal(i, [](int signum)->void {
+					DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("receive signal:%d, closeChromium", signum);
+					CModTools::get_mutable_instance().killAllChromiumByThread(3);
+					CWebsocketServer::stopServer();
+					signal(signum, SIG_DFL);
+					raise(signum);
+
+						});
+				else if (SIGSEGV == i || SIGABRT == i)
+					signal(i, &seg_signal_handler);
+				else if (SIGPROF == i || SIGALRM == i || SIGVTALRM == i)
+					continue;
+				else
+					signal(i, &normal_signal_handle);
+			}
+
+			}).detach();
+#endif
+
+
+
 		//all the init,register,openWeb run thread
 		auto startFun = [&]() {
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("OnPreStart - startFun");
 			// init cef logger first
 #if (defined _WIN32 || defined _WIN64)
 			if (!logProducer)
@@ -657,6 +669,7 @@ namespace Chromium {
 			if (!OnPreStart_socketStart(m_strArgs, m_pTransactionContext)) {//OnPreStart_socketStart()->new CWebsocketServer(strStructPath, this) 时间过长
 				return;
 			}
+			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("OnPreStart - OnPreStart_socketStart end");
 
 
 			//the system info may be not complete.If the device is not install ,it can't not read the terminalNo.
@@ -668,7 +681,7 @@ namespace Chromium {
 				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");
-				startWithCfg();
+				startWithCfg();//it will open install page
 				return;
 			}
 
@@ -690,7 +703,7 @@ namespace Chromium {
 					GetFunction()->GetVTMErrMsg(123456, strDescription, strVTMCode);
 				}
 				//should not open startup page, since it is already run before.
-				startWithCfg();//属于chromium重启或者其他情况,已经初始化好配置
+				startWithCfg();//属于chromium重启或者其他情况,已经初始化好配置, open main, ad and other page
 			}
 			else
 			{
@@ -874,7 +887,7 @@ namespace Chromium {
 			refreshLogLevel();//后置后需要刷新log level,因为chromium是先启动的实体
 			if (m_installMode)//Do not init Entity again in install mode
 				break;
-			startWithCfg();
+			startWithCfg();//open errPage or normal page
 			break;
 		case Event_VtmLoader_GetVTMERRMSG_Suc:
 			/*

+ 5 - 3
Module/mod_guiconsole/GUIConsole_def_g.h

@@ -379,13 +379,15 @@ struct GUIConsoleService_OpenCommonPage_Req
 {
 	CSimpleStringA title;
 	CSimpleStringA url;
-	CSimpleStringA size;
-	CSimpleStringA point;
+	int width;
+	int height;
+	int point_x;
+	int point_y;
 	CSimpleStringA top;
 
 	void Serialize(SpBuffer &Buf)
 	{
-		auto & buf = Buf & title & url & size & point & top;
+		auto & buf = Buf & title & url & width & height & point_x & point_y & top;
 	}
 
 };

+ 8 - 4
Module/mod_guiconsole/GuiConsole.xml

@@ -251,10 +251,14 @@
 				<param name="title" type="string"/>
 				<!-- 页面的链接,类型为字符串 -->
 				<param name="url" type="string"/>
-				<!-- 页面的大小,类型为字符串 -->
-				<param name="size" type="string"/>
-				<!-- 页面的位置,如果不传的话则在中心,类型为字符串 -->
-				<param name="point" type="string"/>
+				<!-- 页面的宽,类型为字符串 -->
+				<param name="width" type="int"/>
+				<!-- 页面的高,类型为字符串 -->
+				<param name="height" type="int"/>
+				<!-- 页面的x,类型为字符串, 如果传-1,-1则默认在中间打开 -->
+				<param name="point_x" type="int"/>
+				<!-- 页面的y,类型为字符串 -->
+				<param name="point_y" type="int"/>
 				<!-- 页面的层级,有效参数包含top,topmost, notopmost, bottom,类型为字符串 -->
 				<param name="top" type="string"/>
 			</req>

+ 93 - 80
Module/mod_guiconsole/guiconsole_define.cpp

@@ -24,7 +24,7 @@ std::string GenerateTimeStr()
 #endif // RVC_OS_WIN
 
 
-
+#ifdef RVC_OS_WIN
 // memInfo ½á¹¹Ìå
 struct memInfo {
 	ULONGLONG TotalMemory;
@@ -78,85 +78,6 @@ void PollMemInfo(memInfo& info)
 	info.UpTime = GetTickCount64();
 }
 
-/* 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);
-			}
-		}
-	}
-
-	timer->start();
-
-	*/
-
 std::pair<long, std::string> PollProcessList(long UpdateTime, system_monitor_status& curStatus)
 {
 	HANDLE Snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPALL, 0);
@@ -325,6 +246,98 @@ std::pair<long, std::string> PollProcessList(long UpdateTime, system_monitor_sta
 	return std::make_pair(0, "");
 }
 
+#else
+std::pair<long, std::string> PollProcessList(long UpdateTime, system_monitor_status& curStatus)
+{
+	return std::make_pair(0, "");
+}
+
+
+/* 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);
+			}
+		}
+	}
+
+	timer->start();
+
+	*/
+#endif
+
+
+
+
+
+
 static const std::unordered_map<LogTypeEnum, std::string> logTypeEnumToString = {
 	{LogTypeEnum::Log_Ignore, "Ignore"},
 	{LogTypeEnum::Log_Event, "Event"},

+ 12 - 2
Module/mod_guiconsole/mod_guiconsole.cpp

@@ -3,7 +3,15 @@
 #include <EventCode.h>
 #include "GUIConsole_msg_g.h"
 #include <chrono>
+
+
+#ifdef RVC_OS_WIN
 #include "..\mod_chromium\Chromium_client_g.h"
+#else
+#include "../mod_chromium/Chromium_client_g.h" //启动浏览器接口
+#endif // RVC_OS_WIN
+
+
 
 bool isPad = false;
 
@@ -670,8 +678,10 @@ void CGUIConsoleSession::Handle_OpenCommonPage(SpReqAnsContext<GUIConsoleService
 		Chromium::ChromiumSrv_OpenCommonPage_Ans  ans;
 		req.title = ctx->Req.title;
 		req.url = ctx->Req.url;
-		req.size = ctx->Req.size;
-		req.point = ctx->Req.point;
+		req.width = ctx->Req.width;
+		req.height = ctx->Req.height;
+		req.point_x = ctx->Req.point_x;
+		req.point_y = ctx->Req.point_y;
 		req.top = ctx->Req.top;
 
 

+ 1 - 1
Module/mod_vtmloader/mod_vtmloader.cpp

@@ -34,7 +34,7 @@ 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));
+	//CloseHandle(CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&thread_testEvent, this, 0, NULL));
 	pTransactionContext->SendAnswer(Error_Succeed) ;		
 }