|
|
@@ -427,20 +427,7 @@ ErrorCodeEnum ResourceWatcherFSM::OnInit()
|
|
|
}
|
|
|
#if defined(RVC_OS_WIN)
|
|
|
if (m_bFirstRunAfterBoot) {
|
|
|
- //GetSystemMetrics (SM_CMONITORS) 计数仅显示可见的显示器
|
|
|
- const int screenNums = GetSystemMetrics(SM_CMONITORS);
|
|
|
- const int aimScreenNums4Stand2S = 2;
|
|
|
- const int aimScreenNums4Other = 1;
|
|
|
- if (0 == m_RvcSysinfo.strMachineType.Compare("RVC.Stand2S", true) && screenNums != aimScreenNums4Stand2S) {
|
|
|
- LogWarn(Severity_Low, Error_Unexpect, LOG_RESOURCEWATCHER_LACK_OF_MONITOR
|
|
|
- , CSimpleStringA::Format("{\"subject\":\"screen_count\",\"machine_type\":\"%s\",\"expect\":%d,\"actual\":%d}"
|
|
|
- , m_RvcSysinfo.strMachineType.GetData(), aimScreenNums4Stand2S, screenNums));
|
|
|
- }
|
|
|
- else if (0 != m_RvcSysinfo.strMachineType.Compare("RVC.Stand2S", true) && screenNums != aimScreenNums4Other) {
|
|
|
- LogWarn(Severity_Low, Error_Unexpect, LOG_RESOURCEWATCHER_LACK_OF_MONITOR
|
|
|
- , CSimpleStringA::Format("{\"subject\":\"screen_count\",\"machine_type\":\"%s\",\"expect\":%d,\"actual\":%d}"
|
|
|
- , m_RvcSysinfo.strMachineType.GetData(), aimScreenNums4Other, screenNums));
|
|
|
- }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
#endif //RVC_OS_WIN
|
|
|
@@ -486,60 +473,11 @@ void ResourceWatcherFSM::AfterInit()
|
|
|
GetEntityBase()->GetFunction()->PostThreadPoolTask(task);
|
|
|
}
|
|
|
DetectVersionHasChangedAndWarnCover();
|
|
|
-
|
|
|
#else
|
|
|
- if (m_bFirstRunAfterBoot) {
|
|
|
- //获取系统激活状态
|
|
|
- CSimpleStringA value(true);
|
|
|
- CSimpleStringA warnMsg(true);
|
|
|
- bool res = GetSysActiveStatus(value);
|
|
|
- if (!value.IsNullOrEmpty()) {
|
|
|
- auto elems = value.Split('|');
|
|
|
- std::map<std::string, std::string> info;
|
|
|
- info["subject"] = "system_activation";
|
|
|
- if (elems.GetCount() > 0) {
|
|
|
- for (int i = 0; i < elems.GetCount(); ++i) {
|
|
|
- auto sub_elems = elems[i].Split(':');
|
|
|
- if (sub_elems.GetCount() == 2) {
|
|
|
- CSimpleStringA val = sub_elems[1].GetData();
|
|
|
- CSimpleStringA key(true);
|
|
|
- //因为UOS内容用了中文的冒号,而Split函数无法拆分中文冒号(拆出来前面的内容有乱码),只能这样去操作
|
|
|
- if (sub_elems[0].IndexOf("服务器") != -1) {
|
|
|
- key = "server_addr";
|
|
|
- } else if (sub_elems[0].IndexOf("激活状") != -1) {
|
|
|
- key = "activation_status";
|
|
|
- }
|
|
|
- else if(sub_elems[0].IndexOf("授权状") != -1) {
|
|
|
- key = "authorization_status";
|
|
|
- }
|
|
|
- else if(sub_elems[0].IndexOf("到期时") != -1) {
|
|
|
- key = "deadline_status";
|
|
|
- }
|
|
|
- else if (sub_elems[0].IndexOf("序列") != -1) {
|
|
|
- key = "serial_number";
|
|
|
- if (val.GetLength() >= 23) {
|
|
|
- //NNAAA-7AAAY-*****-*****-MT6SK
|
|
|
- val[12] = val[13] = val[14] = val[15] = val[16] = '*';
|
|
|
- val[18] = val[19] = val[20] = val[21] = val[22] = '*';
|
|
|
- }
|
|
|
- }
|
|
|
- else {
|
|
|
- key = CSimpleStringA::Format("other%02d", i);
|
|
|
- }
|
|
|
- info[key.GetData()] = val.GetData();
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- info["fetch_status"] = "succ";
|
|
|
- std::pair<bool, std::string> strResult;
|
|
|
- strResult = generateJsonStr(info);
|
|
|
- value = strResult.second.c_str();
|
|
|
- }
|
|
|
- else {
|
|
|
- warnMsg = CSimpleStringA::Format("{\"subject\":\"system_activation\", \"fetch_status\":\"failed\"}");
|
|
|
- }
|
|
|
- LogWarn(Severity_Low, Error_Debug, LOG_INFO_SYSTEM_ACTIVATION_INFO, value);
|
|
|
- }
|
|
|
+ if (m_bFirstRunAfterBoot) {
|
|
|
+ AggerateAutoStatTask* task = new AggerateAutoStatTask(this);
|
|
|
+ GetEntityBase()->GetFunction()->PostThreadPoolTask(task);
|
|
|
+ }
|
|
|
#endif //RVC_OS_WIN
|
|
|
}
|
|
|
|
|
|
@@ -2033,6 +1971,24 @@ int ResourceWatcherFSM::InitialAutoStartupSetType()
|
|
|
return ret;
|
|
|
}
|
|
|
|
|
|
+void ResourceWatcherFSM::UploadScreenInfo()
|
|
|
+{
|
|
|
+ //GetSystemMetrics (SM_CMONITORS) 计数仅显示可见的显示器
|
|
|
+ const int screenNums = GetSystemMetrics(SM_CMONITORS);
|
|
|
+ const int aimScreenNums4Stand2S = 2;
|
|
|
+ const int aimScreenNums4Other = 1;
|
|
|
+ if (0 == m_RvcSysinfo.strMachineType.Compare("RVC.Stand2S", true) && screenNums != aimScreenNums4Stand2S) {
|
|
|
+ LogWarn(Severity_Low, Error_Unexpect, LOG_RESOURCEWATCHER_LACK_OF_MONITOR
|
|
|
+ , CSimpleStringA::Format("{\"subject\":\"screen_count\",\"machine_type\":\"%s\",\"expect\":%d,\"actual\":%d}"
|
|
|
+ , m_RvcSysinfo.strMachineType.GetData(), aimScreenNums4Stand2S, screenNums));
|
|
|
+ }
|
|
|
+ else if (0 != m_RvcSysinfo.strMachineType.Compare("RVC.Stand2S", true) && screenNums != aimScreenNums4Other) {
|
|
|
+ LogWarn(Severity_Low, Error_Unexpect, LOG_RESOURCEWATCHER_LACK_OF_MONITOR
|
|
|
+ , CSimpleStringA::Format("{\"subject\":\"screen_count\",\"machine_type\":\"%s\",\"expect\":%d,\"actual\":%d}"
|
|
|
+ , m_RvcSysinfo.strMachineType.GetData(), aimScreenNums4Other, screenNums));
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
void ResourceWatcherFSM::DeleteDuplicateAutoStartFile(bool toDeleteLastLegity)
|
|
|
{
|
|
|
std::vector<std::string> userlist;
|
|
|
@@ -4794,6 +4750,60 @@ void ResourceWatcherFSM::UploadSysVersionInfo(UINT& ver)
|
|
|
LogWarn(Severity_Low, Error_Hardware, LOG_RESOURCEWATCHER_SYSTEMINFO, ret.second.c_str());
|
|
|
}
|
|
|
|
|
|
+void ResourceWatcherFSM::UploadSysActivationStatus()
|
|
|
+{
|
|
|
+ //获取系统激活状态
|
|
|
+ CSimpleStringA value(true);
|
|
|
+ CSimpleStringA warnMsg(true);
|
|
|
+ bool res = GetSysActiveStatus(value);
|
|
|
+ if (!value.IsNullOrEmpty()) {
|
|
|
+ auto elems = value.Split('|');
|
|
|
+ std::map<std::string, std::string> info;
|
|
|
+ info["subject"] = "system_activation";
|
|
|
+ if (elems.GetCount() > 0) {
|
|
|
+ for (int i = 0; i < elems.GetCount(); ++i) {
|
|
|
+ auto sub_elems = elems[i].Split(':');
|
|
|
+ if (sub_elems.GetCount() == 2) {
|
|
|
+ CSimpleStringA val = sub_elems[1].GetData();
|
|
|
+ CSimpleStringA key(true);
|
|
|
+ //因为UOS内容用了中文的冒号,而Split函数无法拆分中文冒号(拆出来前面的内容有乱码),只能这样去操作
|
|
|
+ if (sub_elems[0].IndexOf("服务器") != -1) {
|
|
|
+ key = "server_addr";
|
|
|
+ }
|
|
|
+ else if (sub_elems[0].IndexOf("激活状") != -1) {
|
|
|
+ key = "activation_status";
|
|
|
+ }
|
|
|
+ else if (sub_elems[0].IndexOf("授权状") != -1) {
|
|
|
+ key = "authorization_status";
|
|
|
+ }
|
|
|
+ else if (sub_elems[0].IndexOf("到期时") != -1) {
|
|
|
+ key = "deadline_status";
|
|
|
+ }
|
|
|
+ else if (sub_elems[0].IndexOf("序列") != -1) {
|
|
|
+ key = "serial_number";
|
|
|
+ if (val.GetLength() >= 23) {
|
|
|
+ //NNAAA-7AAAY-*****-*****-MT6SK
|
|
|
+ val[12] = val[13] = val[14] = val[15] = val[16] = '*';
|
|
|
+ val[18] = val[19] = val[20] = val[21] = val[22] = '*';
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ key = CSimpleStringA::Format("other%02d", i);
|
|
|
+ }
|
|
|
+ info[key.GetData()] = val.GetData();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ info["fetch_status"] = "succ";
|
|
|
+ std::pair<bool, std::string> strResult;
|
|
|
+ strResult = generateJsonStr(info);
|
|
|
+ value = strResult.second.c_str();
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ warnMsg = CSimpleStringA::Format("{\"subject\":\"system_activation\", \"fetch_status\":\"failed\"}");
|
|
|
+ }
|
|
|
+ LogWarn(Severity_Low, Error_Debug, LOG_INFO_SYSTEM_ACTIVATION_INFO, value);
|
|
|
+}
|
|
|
|
|
|
string ResourceWatcherFSM::MemoryProcessStatus()
|
|
|
{
|