|
@@ -725,27 +725,32 @@ CSimpleStringA CHealthManagerFSM::GetOsVersion()
|
|
|
getline(is, line);
|
|
|
int start = line.find("版本");
|
|
|
if (start != string::npos)
|
|
|
- return CSimpleStringA(line.substr(start + 5, line.length() - start - 7).c_str());
|
|
|
+ //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
|
|
|
}
|
|
|
|
|
@@ -854,8 +859,8 @@ void CHealthManagerFSM::ToLogWarnTermAboutInfo()
|
|
|
{
|
|
|
LOG_FUNCTION();
|
|
|
QueryAndSaveDNS();
|
|
|
- QueryAndSaveCPUInfo();
|
|
|
- QueryAndSendMonitorInfo();
|
|
|
+ QueryAndSendCPUInfo();
|
|
|
+ QueryAndSendDisplayInfo();
|
|
|
bool bTmpEtyNewStart = m_bEntityNewStart;
|
|
|
if (m_bEntityNewStart)
|
|
|
{
|
|
@@ -884,7 +889,6 @@ void CHealthManagerFSM::ToLogWarnTermAboutInfo()
|
|
|
CSimpleStringA csOSVerion(""), csWarnMsg("");
|
|
|
std::map<std::string, std::string> termInfo;
|
|
|
termInfo["version"] = m_sysInfo.InstallVersion.ToString();
|
|
|
- termInfo["CPUInfo"] = m_cpuInfo;
|
|
|
|
|
|
if (m_iAccessAuth == VtmLoad_AccessAuth_Suc)
|
|
|
{
|
|
@@ -1305,24 +1309,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");
|
|
@@ -1331,44 +1338,23 @@ 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("CPUName", 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::QueryAndSendMonitorInfo()
|
|
|
+void CHealthManagerFSM::QueryAndSendDisplayInfo()
|
|
|
{
|
|
|
- std::map<std::string, std::string> monitorInfo;
|
|
|
- int monitorNum = 0;
|
|
|
+ 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);
|
|
@@ -1392,19 +1378,28 @@ void CHealthManagerFSM::QueryAndSendMonitorInfo()
|
|
|
EnumDisplaySettings(devDevice.DeviceName, ENUM_CURRENT_SETTINGS, &devMode);
|
|
|
if (bPrimary)
|
|
|
{
|
|
|
- monitorInfo["PrimaryName"] = CSimpleStringA::Format("%s", devMode.dmDeviceName);
|
|
|
- monitorInfo["PrimaryResolution"] = CSimpleStringA::Format("%dx%d", devMode.dmPelsWidth, devMode.dmPelsHeight);
|
|
|
- monitorInfo["PrimaryText"] = CSimpleStringA::Format("%d+%d", devMode.dmPosition.x, devMode.dmPosition.y);
|
|
|
+ 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
|
|
|
{
|
|
|
- monitorInfo["SecondaryName"] = CSimpleStringA::Format("%s", devMode.dmDeviceName);
|
|
|
- monitorInfo["SecondaryResolution"] = CSimpleStringA::Format("%dx%d", devMode.dmPelsWidth, devMode.dmPelsHeight);
|
|
|
- monitorInfo["SecondaryText"] = CSimpleStringA::Format("%d+%d", devMode.dmPosition.x, devMode.dmPosition.y);
|
|
|
+ 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);
|
|
|
}
|
|
|
- monitorNum++;
|
|
|
}
|
|
|
}
|
|
|
+ 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);
|
|
@@ -1438,33 +1433,12 @@ void CHealthManagerFSM::QueryAndSendMonitorInfo()
|
|
|
while (!is.eof()) {
|
|
|
getline(is, line);
|
|
|
DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("line:%s", line.c_str());
|
|
|
- auto elems = SP::Utility::Split(line, ' ');
|
|
|
- if (elems.size() > 1) {
|
|
|
- if (line.find("primary") != string::npos)
|
|
|
- {
|
|
|
- monitorInfo["PrimaryName"] = SP::Utility::ToTrim(elems[0]);
|
|
|
- auto reso = SP::Utility::Split(elems[3], '+');
|
|
|
- if (reso.size() > 1)
|
|
|
- {
|
|
|
- monitorInfo["PrimaryResolution"] = SP::Utility::ToTrim(reso[0]);
|
|
|
- }
|
|
|
- monitorInfo["PrimaryText"] = line;
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- monitorInfo["SecondaryName"] = SP::Utility::ToTrim(elems[0]);
|
|
|
- auto reso = SP::Utility::Split(elems[3], '+');
|
|
|
- if (reso.size() > 1)
|
|
|
- {
|
|
|
- monitorInfo["SecondaryResolution"] = SP::Utility::ToTrim(reso[0]);
|
|
|
- }
|
|
|
- monitorInfo["SecondaryText"] = line;
|
|
|
- }
|
|
|
-
|
|
|
- monitorNum++;
|
|
|
- }
|
|
|
+
|
|
|
+ if (line.find("primary") != string::npos)
|
|
|
+ displayInfo["PrimaryText"] = line;
|
|
|
+ else
|
|
|
+ displayInfo["SecondaryText"] = line;
|
|
|
}
|
|
|
#endif
|
|
|
- monitorInfo["DisplayNum"] = CSimpleStringA::Format("%d", monitorNum);
|
|
|
- DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("InfoAboutDisplay")(generateJsonStr(monitorInfo).second.c_str());
|
|
|
+ DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM).setAPI("InfoAboutDisplay")(generateJsonStr(displayInfo).second.c_str());
|
|
|
}
|