|
|
@@ -688,7 +688,7 @@ namespace Chromium {
|
|
|
}
|
|
|
//if contain default setting, then oepn web by setting
|
|
|
#if (defined _WIN32 || defined _WIN64)
|
|
|
- if (m_strArgs.GetCount())
|
|
|
+ if (m_strArgs.GetCount())//It do not contain default setting normally
|
|
|
{
|
|
|
if (ConfigManager::getInstance().m_strCustomMainUrl.length() > 0)
|
|
|
openMainPage();
|
|
|
@@ -898,11 +898,6 @@ namespace Chromium {
|
|
|
if (Error_Succeed == ret)
|
|
|
InitUserCodeToMsgTip(strErrorCodeArr, strDescriptionArr, strRemarkArr);
|
|
|
|
|
|
- if (ConfigManager::getInstance().m_withSpecialTest)
|
|
|
- {
|
|
|
- CSimpleStringA strDescription, strVTMCode;
|
|
|
- GetFunction()->GetVTMErrMsg(123456, strDescription, strVTMCode);
|
|
|
- }
|
|
|
//should not open startup page, since it is already run before.
|
|
|
DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("startWithCfg:open normal page");
|
|
|
startWithCfg();//属于chromium重启或者其他情况,已经初始化好配置, open main, ad and other page
|
|
|
@@ -910,6 +905,14 @@ namespace Chromium {
|
|
|
else
|
|
|
{
|
|
|
if (!ConfigManager::getInstance().m_noStartupPage) openStartupPage();//open startup page in normal mode
|
|
|
+ // startup page may open long time
|
|
|
+ if(ErrorCodeEnum::Error_Succeed == GetFunction()->GetSysVar("TerminalStage", t_terminalState))
|
|
|
+ {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("may open startup too long, current terminalStage:%s", t_terminalState.GetData());
|
|
|
+ DoWithErrMsgListUpdate();
|
|
|
+ startWithCfg();
|
|
|
+ }
|
|
|
+
|
|
|
ErrorCodeEnum rc = Error_Succeed;
|
|
|
if (Error_Succeed == (rc = GetFunction()->SubscribeLog(m_uuidVTMLoader, this, Log_Event, Severity_None, Error_IgnoreAll, -1, "VtmLoader")))
|
|
|
LogManager::getInstance().logEntityStatus("订阅VtmLoader成功", LOG_LEVEL_INFO, 0, "none");
|
|
|
@@ -967,6 +970,107 @@ namespace Chromium {
|
|
|
return ConfigManager::getInstance().getSysInfo().strMachineType.IsEndWith("CardStore", true) || ConfigManager::getInstance().getSysInfo().strMachineType.IsEndWith("CardPrinter", true);
|
|
|
}
|
|
|
|
|
|
+ void CChromiumEntity::DoWithErrMsgListUpdate()
|
|
|
+ {
|
|
|
+ if (!isMsgTipExist())
|
|
|
+ {
|
|
|
+ CAutoArray<CSimpleStringA> strErrorCodeArr;
|
|
|
+ CAutoArray<CSimpleStringA> strDescriptionArr;
|
|
|
+ CAutoArray<CSimpleStringA> strRemarkArr;
|
|
|
+ auto ret = GetFunction()->GetPrivilegeFunction()->GetVTMErrMsgArr(strErrorCodeArr, strDescriptionArr, strRemarkArr);
|
|
|
+ if (Error_Succeed == ret && strErrorCodeArr.GetCount() > 0)
|
|
|
+ {
|
|
|
+ InitUserCodeToMsgTip(strErrorCodeArr, strDescriptionArr, strRemarkArr);
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("update msg tips success");
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ void CChromiumEntity::DoWithTerminalStage_toA()
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ if (CModTools::get_mutable_instance().IsConfigWork())//url正常时才关闭
|
|
|
+ {
|
|
|
+#if defined(RVC_OS_LINUX)
|
|
|
+ auto srcPids = getUosBrowserPIDs(CModTools::get_mutable_instance().getUosBrowser());
|
|
|
+#endif // RVC_OS_UOS
|
|
|
+
|
|
|
+ if (ConfigManager::getInstance().m_runAd) openAdPage();
|
|
|
+ openMainPage();
|
|
|
+ CModTools::get_mutable_instance().StopChromiumBrowser(ERR_PAGE_REASON::breakdown);
|
|
|
+
|
|
|
+ std::this_thread::sleep_for(std::chrono::seconds(3));
|
|
|
+ LogWarn(Severity_Low, Error_Debug, LOG_SLV_CHROMIUM_URLOPEN, "正在启动业务界面");
|
|
|
+
|
|
|
+#if defined(RVC_OS_LINUX)
|
|
|
+ for (auto it : srcPids)
|
|
|
+ {
|
|
|
+ CSimpleStringA cmd = CSimpleStringA::Format("sudo kill -9 %d", it);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("CloseCommonPage %s", cmd.GetData());
|
|
|
+ system(cmd.GetData());
|
|
|
+ }
|
|
|
+#else
|
|
|
+ CModTools::get_mutable_instance().StopChromiumBrowser(ERR_PAGE_REASON::startup);
|
|
|
+#endif
|
|
|
+ startupPageClean();
|
|
|
+
|
|
|
+ //DbgEx("UnregistSysVarEvent TerminalStage %s", Error_Succeed == GetFunction()->UnregistSysVarEvent("TerminalStage") ? "success" : "fail");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (const std::exception& e)
|
|
|
+ {
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("TerminalStage:A run exception, %s", e.what());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ void CChromiumEntity::DoWithTerminalStage_toX()
|
|
|
+ {
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("TerminalStage X, do nothing.");
|
|
|
+ }
|
|
|
+
|
|
|
+ void CChromiumEntity::DoWithTerminalStage_toOther(std::string terminalStageVal)
|
|
|
+ {
|
|
|
+ try
|
|
|
+ {
|
|
|
+ if (!ConfigManager::getInstance().m_withBrowser)
|
|
|
+ {
|
|
|
+#if defined(RVC_OS_LINUX)
|
|
|
+ auto srcPids = getUosBrowserPIDs(CModTools::get_mutable_instance().getUosBrowser());
|
|
|
+#endif // RVC_OS_UOS
|
|
|
+
|
|
|
+ if (ConfigManager::getInstance().m_existRootIni && ConfigManager::getInstance().m_installMode)
|
|
|
+ return;//if root.ini exist and in install mode, do not close startup page
|
|
|
+#if defined(RVC_OS_LINUX)
|
|
|
+ for (auto it : srcPids)
|
|
|
+ {
|
|
|
+ CSimpleStringA cmd = CSimpleStringA::Format("sudo kill -9 %d", it);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("CloseCommonPage %s", cmd.GetData());
|
|
|
+ system(cmd.GetData());
|
|
|
+ }
|
|
|
+#else
|
|
|
+ CModTools::get_mutable_instance().StopChromiumBrowser(ERR_PAGE_REASON::startup);
|
|
|
+#endif
|
|
|
+ startupPageClean();
|
|
|
+ ERR_PAGE_REASON reson = ERR_PAGE_REASON::breakdown;
|
|
|
+ if (0 == CSimpleStringA("S").Compare(terminalStageVal.c_str(), true))
|
|
|
+ reson = ERR_PAGE_REASON::warnPrompt;
|
|
|
+ else if(0 == CSimpleStringA("M").Compare(terminalStageVal.c_str(), true))
|
|
|
+ reson = ERR_PAGE_REASON::audioErr;
|
|
|
+
|
|
|
+ auto openRet = CModTools::get_mutable_instance().StartChromiumBrowser(reson,
|
|
|
+ std::tuple < std::string, std::string>(ConfigManager::getInstance().getSysInfo().strTerminalID.GetData(), generateTimeStr()));
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("access failed, open err page %s, %d", Error_Succeed == openRet.first ? "success" : "fail", openRet.second);
|
|
|
+ CModTools::get_mutable_instance().StopChromiumBrowser(ERR_PAGE_REASON::main);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (const std::exception& e)
|
|
|
+ {
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("TerminalStage:other run exception, %s", e.what());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
void CChromiumEntity::DoWithSysVarEvent()
|
|
|
{
|
|
|
//DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("create thread:%s", __FUNCTION__);
|
|
|
@@ -1000,100 +1104,14 @@ namespace Chromium {
|
|
|
/** 该事件有变化才会触发错误页 [Gifur@2022324]*/
|
|
|
else if (0 == CSimpleStringA("TerminalStage").Compare(curEvent.key.c_str(), true))
|
|
|
{
|
|
|
- if (!isMsgTipExist())
|
|
|
- {
|
|
|
- CAutoArray<CSimpleStringA> strErrorCodeArr;
|
|
|
- CAutoArray<CSimpleStringA> strDescriptionArr;
|
|
|
- CAutoArray<CSimpleStringA> strRemarkArr;
|
|
|
- auto ret = GetFunction()->GetPrivilegeFunction()->GetVTMErrMsgArr(strErrorCodeArr, strDescriptionArr, strRemarkArr);
|
|
|
- if (Error_Succeed == ret && strErrorCodeArr.GetCount() > 0)
|
|
|
- {
|
|
|
- InitUserCodeToMsgTip(strErrorCodeArr, strDescriptionArr, strRemarkArr);
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("update msg tips over the change of TerminalStage");
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
+ DoWithErrMsgListUpdate();
|
|
|
|
|
|
if (0 == CSimpleStringA("A").Compare(curEvent.value.c_str(), true))
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- if (CModTools::get_mutable_instance().IsConfigWork())//url正常时才关闭
|
|
|
- {
|
|
|
-#if defined(RVC_OS_LINUX)
|
|
|
- auto srcPids = getUosBrowserPIDs(CModTools::get_mutable_instance().getUosBrowser());
|
|
|
-#endif // RVC_OS_UOS
|
|
|
-
|
|
|
- if (ConfigManager::getInstance().m_runAd) openAdPage();
|
|
|
- openMainPage();
|
|
|
- CModTools::get_mutable_instance().StopChromiumBrowser(ERR_PAGE_REASON::breakdown);
|
|
|
-
|
|
|
- std::this_thread::sleep_for(std::chrono::seconds(3));
|
|
|
- LogWarn(Severity_Low, Error_Debug, LOG_SLV_CHROMIUM_URLOPEN, "正在启动业务界面");
|
|
|
-
|
|
|
-#if defined(RVC_OS_LINUX)
|
|
|
- for (auto it : srcPids)
|
|
|
- {
|
|
|
- CSimpleStringA cmd = CSimpleStringA::Format("sudo kill -9 %d", it);
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("CloseCommonPage %s", cmd.GetData());
|
|
|
- system(cmd.GetData());
|
|
|
- }
|
|
|
-#else
|
|
|
- CModTools::get_mutable_instance().StopChromiumBrowser(ERR_PAGE_REASON::startup);
|
|
|
-#endif
|
|
|
- startupPageClean();
|
|
|
-
|
|
|
- //DbgEx("UnregistSysVarEvent TerminalStage %s", Error_Succeed == GetFunction()->UnregistSysVarEvent("TerminalStage") ? "success" : "fail");
|
|
|
- }
|
|
|
- }
|
|
|
- catch (const std::exception& e)
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("TerminalStage:A run exception, %s", e.what());
|
|
|
- }
|
|
|
- }
|
|
|
+ DoWithTerminalStage_toA();
|
|
|
else if (0 == CSimpleStringA("X").Compare(curEvent.value.c_str(), true))
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("TerminalStage X, do nothing.");
|
|
|
+ DoWithTerminalStage_toX();
|
|
|
else
|
|
|
- {
|
|
|
- try
|
|
|
- {
|
|
|
- if (!ConfigManager::getInstance().m_withBrowser)
|
|
|
- {
|
|
|
-#if defined(RVC_OS_LINUX)
|
|
|
- auto srcPids = getUosBrowserPIDs(CModTools::get_mutable_instance().getUosBrowser());
|
|
|
-#endif // RVC_OS_UOS
|
|
|
-
|
|
|
- if (ConfigManager::getInstance().m_existRootIni && ConfigManager::getInstance().m_installMode)
|
|
|
- return;//if root.ini exist and in install mode, do not close startup page
|
|
|
-#if defined(RVC_OS_LINUX)
|
|
|
- for (auto it : srcPids)
|
|
|
- {
|
|
|
- CSimpleStringA cmd = CSimpleStringA::Format("sudo kill -9 %d", it);
|
|
|
- DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("CloseCommonPage %s", cmd.GetData());
|
|
|
- system(cmd.GetData());
|
|
|
- }
|
|
|
-#else
|
|
|
- CModTools::get_mutable_instance().StopChromiumBrowser(ERR_PAGE_REASON::startup);
|
|
|
-#endif
|
|
|
- startupPageClean();
|
|
|
- ERR_PAGE_REASON reson = ERR_PAGE_REASON::breakdown;
|
|
|
- if (0 == CSimpleStringA("S").Compare(curEvent.value.c_str(), true))
|
|
|
- reson = ERR_PAGE_REASON::warnPrompt;
|
|
|
- else if(0 == CSimpleStringA("M").Compare(curEvent.value.c_str(), true))
|
|
|
- reson = ERR_PAGE_REASON::audioErr;
|
|
|
-
|
|
|
- auto openRet = CModTools::get_mutable_instance().StartChromiumBrowser(reson,
|
|
|
- std::tuple < std::string, std::string>(ConfigManager::getInstance().getSysInfo().strTerminalID.GetData(), generateTimeStr()));
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("access failed, open err page %s, %d", Error_Succeed == openRet.first ? "success" : "fail", openRet.second);
|
|
|
- CModTools::get_mutable_instance().StopChromiumBrowser(ERR_PAGE_REASON::main);
|
|
|
- }
|
|
|
- }
|
|
|
- catch (const std::exception& e)
|
|
|
- {
|
|
|
- DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM).setAPI(__FUNCTION__)("TerminalStage:other run exception, %s", e.what());
|
|
|
- }
|
|
|
- }
|
|
|
+ DoWithTerminalStage_toOther(curEvent.value);
|
|
|
|
|
|
}
|
|
|
else if (0 == CSimpleStringA("CardStoreInUse").Compare(curEvent.key.c_str(), true) && CheckIsCardStore())
|