|
@@ -1785,108 +1785,6 @@ void CHealthManagerEntity::ControlEntityLife(SpReqAnsContext<HealthManagerServic
|
|
|
ctx->Answer(result);
|
|
|
}
|
|
|
|
|
|
-ErrorCodeEnum CHealthManagerEntity::GetTmpRootFilePath(CSimpleStringA& rootPath, CSimpleStringA& rootTmpPath, CSimpleStringA& rootBackPath)
|
|
|
-{
|
|
|
- CSimpleStringA strRootCfgPath;
|
|
|
- ErrorCodeEnum ec = GetFunction()->GetPath("HardwareCfg", strRootCfgPath);
|
|
|
- rootPath = strRootCfgPath;
|
|
|
- rootPath += SPLIT_SLASH_STR;
|
|
|
- rootPath += "root.ini";
|
|
|
-
|
|
|
- rootTmpPath = rootPath + ".tmp";
|
|
|
-
|
|
|
-
|
|
|
- SYSTEMTIME curTime = CSmallDateTime::GetNow().ToSystemTime();
|
|
|
- CSimpleStringA strBackupFileSuffix = CSimpleStringA::Format(".bak%04d%02d%02d%02d%02d%02d%03d",
|
|
|
- curTime.wYear, curTime.wMonth, curTime.wDay, curTime.wHour, curTime.wMinute, curTime.wSecond, curTime.wMilliseconds);
|
|
|
-
|
|
|
- rootBackPath = rootPath + strBackupFileSuffix;
|
|
|
-
|
|
|
- return ec;
|
|
|
-}
|
|
|
-
|
|
|
-void CHealthManagerEntity::RecordInstallBeginTimeStamp(const CSimpleString& strTimeStamp, BOOL forceReset)
|
|
|
-{
|
|
|
- if (!forceReset) {
|
|
|
- /** 有时间戳记录的情况下不再覆盖记录 [Gifur@2023823]*/
|
|
|
- CSimpleStringA strReserved(true);
|
|
|
- const ErrorCodeEnum rc = GetInstallBeginTimeStamp(strReserved);
|
|
|
- if (!strReserved.IsNullOrEmpty()) {
|
|
|
- return;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- CSmartPointer<IConfigInfo> pConfig;
|
|
|
- GetFunction()->OpenConfig(Config_Cache, pConfig);
|
|
|
- if (strTimeStamp.IsNullOrEmpty()) {
|
|
|
- pConfig->WriteConfigValue("TerminalDeploy", "StartTimeStamp", CSimpleStringA::Format("0x%08X", (DWORD)CSmallDateTime::GetNow()));
|
|
|
- } else {
|
|
|
- pConfig->WriteConfigValue("TerminalDeploy", "StartTimeStamp", strTimeStamp);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-ErrorCodeEnum CHealthManagerEntity::GetInstallBeginTimeStamp(CSimpleString& strTimeStamp)
|
|
|
-{
|
|
|
- CSmartPointer<IConfigInfo> pConfig;
|
|
|
- GetFunction()->OpenConfig(Config_Cache, pConfig);
|
|
|
- CSimpleStringA strValue(true);
|
|
|
- pConfig->ReadConfigValue("TerminalDeploy", "StartTimeStamp", strValue);
|
|
|
- if (strValue.IsNullOrEmpty()) {
|
|
|
- return Error_DataCheck;
|
|
|
- }
|
|
|
-
|
|
|
- strTimeStamp = strValue;
|
|
|
- return Error_Succeed;
|
|
|
-
|
|
|
-}
|
|
|
-
|
|
|
-ErrorCodeEnum CHealthManagerEntity::GetGuidePageUrlWithStep(int whichStep, CSimpleStringA& strUrl)
|
|
|
-{
|
|
|
- strUrl.Clear();
|
|
|
- CSimpleStringA pagePath;
|
|
|
- ErrorCodeEnum ec = GetFunction()->GetPath("Base", pagePath);
|
|
|
- pagePath.Append(SPLIT_SLASH_STR "res" SPLIT_SLASH_STR "ManagerDesktop" SPLIT_SLASH_STR "guide.html");
|
|
|
- if (whichStep > 0) {
|
|
|
- CSimpleStringA terminalNo;
|
|
|
- CSimpleStringA vendorType;
|
|
|
- CSimpleStringA serverIP;
|
|
|
- do {
|
|
|
- CSmartPointer<IConfigInfo> pConfig;
|
|
|
- GetFunction()->OpenConfig(Config_Cache, pConfig);
|
|
|
- const ErrorCodeEnum ec0 = pConfig->ReadConfigValue("TerminalDeploy", "TerminalNo", terminalNo);
|
|
|
- const ErrorCodeEnum ec1 = pConfig->ReadConfigValue("TerminalDeploy", "Manufacturer", vendorType);
|
|
|
- const ErrorCodeEnum ec2 = pConfig->ReadConfigValue("TerminalDeploy", "ServerIP", serverIP);
|
|
|
- Dbg("read step: %s, %s, %s", SpStrError(ec0), SpStrError(ec1), SpStrError(ec2));
|
|
|
- } while (false);
|
|
|
-
|
|
|
- pagePath = CSimpleStringA::Format("%s?page=%d", pagePath.GetData(), whichStep);
|
|
|
- bool prefix(true);
|
|
|
-
|
|
|
- if (!terminalNo.IsNullOrEmpty() || !vendorType.IsNullOrEmpty() || !serverIP.IsNullOrEmpty()) {
|
|
|
-
|
|
|
- CSimpleStringA strSearch(true);
|
|
|
- if (!terminalNo.IsNullOrEmpty()) {
|
|
|
- if (prefix) strSearch += "&";
|
|
|
- strSearch += CSimpleStringA("terminalno=") + terminalNo;
|
|
|
- prefix = true;
|
|
|
- }
|
|
|
- if (!vendorType.IsNullOrEmpty()) {
|
|
|
- if (prefix) strSearch += "&";
|
|
|
- strSearch += CSimpleStringA("vendor=") + vendorType;
|
|
|
- prefix = true;
|
|
|
- }
|
|
|
- if (!serverIP.IsNullOrEmpty()) {
|
|
|
- if (prefix) strSearch += "&";
|
|
|
- strSearch += CSimpleStringA("ip=") + serverIP;
|
|
|
- prefix = true;
|
|
|
- }
|
|
|
- pagePath += strSearch;
|
|
|
- }
|
|
|
- }
|
|
|
- strUrl = CSimpleStringA("file:///") + pagePath + CSimpleStringA("");
|
|
|
- return ec;
|
|
|
-}
|
|
|
-
|
|
|
namespace
|
|
|
{
|
|
|
|
|
@@ -1915,37 +1813,6 @@ namespace
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-ErrorCodeEnum CHealthManagerEntity::TellChromiumOpenGuidePage(const CSimpleStringA& pageUrl)
|
|
|
-{
|
|
|
- ErrorCodeEnum result(Error_Succeed);
|
|
|
- auto pClient = new ChromiumSrv_ClientBase(this);
|
|
|
- result = pClient->Connect();
|
|
|
- if (result == Error_Succeed) {
|
|
|
- ChromiumSrv_OpenBrowser_Req req;
|
|
|
- ChromiumSrv_OpenBrowser_Ans ans;
|
|
|
- req.mainUrl = pageUrl;
|
|
|
- req.viceUrl = "";
|
|
|
- req.type = "OutsideRequest";
|
|
|
- req.name = "GuidePage";
|
|
|
- req.exclusiveMode = true;
|
|
|
- req.top = -1;
|
|
|
-
|
|
|
- result = (*pClient)(EntityResource::getLink().upgradeLink())->OpenBrowser(req, ans, 10000);
|
|
|
- if (result == Error_Succeed) {
|
|
|
- Dbg("Request Chromium::OpenBrowser succ!");
|
|
|
- }
|
|
|
- else {
|
|
|
- Dbg("Request Chromium::OpenBrowser failed: %s", SpStrError(result));
|
|
|
- }
|
|
|
- pClient->GetFunction()->CloseSession();
|
|
|
- }
|
|
|
- else {
|
|
|
- pClient->SafeDelete();
|
|
|
- Dbg("Connect to Chromium entity failed: %s", SpStrError(result));
|
|
|
- }
|
|
|
- return result;
|
|
|
-}
|
|
|
-
|
|
|
ErrorCodeEnum CHealthManagerEntity::DealSpecifiedEntity(DealType type, LPCTSTR lpcszEntityName, LPCTSTR lpcszCmdline, bool bForce, CSimpleStringA& strErrMsg)
|
|
|
{
|
|
|
ErrorCodeEnum result(Error_Succeed);
|
|
@@ -2052,37 +1919,6 @@ bool CHealthManagerEntity::IsTestMode()
|
|
|
return !!flag;
|
|
|
}
|
|
|
|
|
|
-bool CHealthManagerEntity::IsLackOfConfig(int& stepMode)
|
|
|
-{
|
|
|
- stepMode = 0;
|
|
|
- int lastRecordTime = 0;
|
|
|
- CSystemRunInfo runInfo;
|
|
|
- ErrorCodeEnum ec = GetFunction()->GetSystemRunInfo(runInfo);
|
|
|
- if (ec != Error_Succeed) {
|
|
|
- stepMode = ec;
|
|
|
- Dbg("get framework info failed: %s", SpStrError(ec));
|
|
|
- return false;
|
|
|
- }
|
|
|
- if (runInfo.eState == FrameworkState_NotConfig) {
|
|
|
- Dbg("not config from framework");
|
|
|
- stepMode = -1;
|
|
|
- return true;
|
|
|
- }
|
|
|
- else {
|
|
|
- CSmartPointer<IConfigInfo> pConfig;
|
|
|
- GetFunction()->OpenConfig(Config_Cache, pConfig);
|
|
|
- int stepStatus(0);
|
|
|
- pConfig->ReadConfigValueInt("TerminalDeploy", "CurrStep", stepMode);
|
|
|
- pConfig->ReadConfigValueInt("TerminalDeploy", "CurrState", stepStatus);
|
|
|
- pConfig->ReadConfigValueInt("TerminalDeploy", "TimeStamp", lastRecordTime);
|
|
|
-
|
|
|
- if (stepMode != DeployStep_Begin && DeployStep_Finished != stepMode) {
|
|
|
- Dbg("not config from cache: step=%d, status=%d", stepMode, stepStatus);
|
|
|
- return true;
|
|
|
- }
|
|
|
- }
|
|
|
- return false;
|
|
|
-}
|
|
|
void CHealthManagerEntity::OnEntityStateHook(const char* pszEntityName, const char* pszTriggerEntity, EntityStateEnum eState, EntityStateEnum eLastState)
|
|
|
{
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("%s trigger by %s: from %s to %s", pszEntityName, pszTriggerEntity, SpStrEntityState(eLastState), SpStrEntityState(eState));
|