|
|
@@ -9,8 +9,6 @@
|
|
|
#include <ws2tcpip.h>
|
|
|
#include <Winsock2.h>
|
|
|
#include <io.h>
|
|
|
-#include "..\mod_chromium\Chromium_client_g.h" //启动浏览器接口
|
|
|
-using namespace Chromium;
|
|
|
#include <WinUser.h>
|
|
|
#define GUARDIAN_FILENAME "GuardianBase.dll"
|
|
|
#else
|
|
|
@@ -21,8 +19,6 @@ using namespace Chromium;
|
|
|
#include <dlfcn.h>
|
|
|
#include <fcntl.h>
|
|
|
#include <sys/reboot.h>
|
|
|
-#include "../mod_chromium/Chromium_client_g.h" //启动浏览器接口
|
|
|
-using namespace Chromium;
|
|
|
#define GUARDIAN_FILENAME "libGuardianBase.so"
|
|
|
#endif //RVC_OS_WIN
|
|
|
|
|
|
@@ -35,21 +31,14 @@ using namespace Chromium;
|
|
|
#include "iniutil.h"
|
|
|
#include "osutil.h"
|
|
|
|
|
|
-//TODO: CrossPlaform [Gifur@2025730]
|
|
|
-#if defined(RVC_OS_LINUX)
|
|
|
-#include "EntityBootStruct.h"
|
|
|
-#include <regex.h>
|
|
|
-#include "RestfulFunc.h"
|
|
|
-#include "api_manage_list.h"
|
|
|
-#include "api_manufacture_controller.h"
|
|
|
-#include "JsonConvertHelper.hpp"
|
|
|
-#endif
|
|
|
using namespace std;
|
|
|
|
|
|
#include "mod_healthmanager.h"
|
|
|
#include "CommEntityUtil.hpp"
|
|
|
-#include "CommEntitySettings.hpp"
|
|
|
#include "TerminalInfoQueryConn.h"
|
|
|
+#include "Chromium_client_g.h" //启动浏览器接口
|
|
|
+using namespace Chromium;
|
|
|
+
|
|
|
|
|
|
const DWORD HEALTHMANAGER_TIMER_ID = 1;
|
|
|
const DWORD HEALTHMANAGER_WAIT_MAINPAGE_OPEN_TIMER_ID = 2;
|
|
|
@@ -65,15 +54,6 @@ const int MAX_START_AYSNC_TIMEOUT = 20000;
|
|
|
#define WORKING_BUFFER_SIZE 15000
|
|
|
#define MAX_TRIES 3
|
|
|
|
|
|
-#define MALLOC(x) HeapAlloc(GetProcessHeap(), 0, (x))
|
|
|
-#define FREE(x) HeapFree(GetProcessHeap(), 0, (x))
|
|
|
-
|
|
|
-#if defined(RVC_OS_LINUX)//oiltmp
|
|
|
-//for defines in header file
|
|
|
-#include "Chromium_client_g.h"
|
|
|
-using namespace Chromium;
|
|
|
-#endif
|
|
|
-
|
|
|
#define MediaDev_OutSpeaker 1
|
|
|
#define MediaDev_InSpeaker 2
|
|
|
#define MediaDev_OutMicrophone 3
|
|
|
@@ -101,6 +81,98 @@ private:
|
|
|
bool m_bDeleteSelf;
|
|
|
};
|
|
|
|
|
|
+namespace {
|
|
|
+
|
|
|
+ void InitializeOtherLogSwitch(CEntityBase* pEntity, const CSimpleStringA& strModuleName)
|
|
|
+ {
|
|
|
+ LOG_FUNCTION();
|
|
|
+ if (pEntity == NULL || strModuleName.IsNullOrEmpty()) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ struct OtherLogConfig
|
|
|
+ {
|
|
|
+ OtherLogConfig() :strLevel("OFF"), strType("FILE"), strDllName(""), strLogPath("") {}
|
|
|
+ OtherLogConfig(const CSimpleStringA& strModuleName) :strLevel("OFF"), strType("FILE"), strDllName(strModuleName), strLogPath("") {}
|
|
|
+
|
|
|
+ CSimpleStringA strLevel;
|
|
|
+ CSimpleStringA strType;
|
|
|
+ CSimpleStringA strDllName;
|
|
|
+ CSimpleStringA strLogPath;
|
|
|
+
|
|
|
+ void Settle()
|
|
|
+ {
|
|
|
+ toolkit_setenv("VENDOR_RECODE_LEVEL", strLevel);
|
|
|
+ toolkit_setenv("VENDOR_RECODE_TYPE", strType);
|
|
|
+ toolkit_setenv("VENDOR_DLL_NAME", strDllName);
|
|
|
+ toolkit_setenv("VENDOR_LOG_PATH", strLogPath);
|
|
|
+ }
|
|
|
+
|
|
|
+ } stLogConfig(strModuleName);
|
|
|
+
|
|
|
+ CSmartPointer<IConfigInfo> centerConfig;
|
|
|
+ pEntity->GetFunction()->OpenConfig(Config_CenterSetting, centerConfig);
|
|
|
+
|
|
|
+ int nSaveFileOrNot(0);
|
|
|
+
|
|
|
+ centerConfig->ReadConfigValueInt("Common", "SaveFile", nSaveFileOrNot);
|
|
|
+ stLogConfig.strType = "UPLOAD";
|
|
|
+ if ((nSaveFileOrNot & 1) == 1) {
|
|
|
+ if (!stLogConfig.strType.IsNullOrEmpty()) stLogConfig.strType += "|";
|
|
|
+ stLogConfig.strType += "FILE";
|
|
|
+ }
|
|
|
+
|
|
|
+ int nUploadLogLevel(1); /*INFO*/
|
|
|
+
|
|
|
+ CSimpleStringA strUploadLogLevelEntity(true);
|
|
|
+ centerConfig->ReadConfigValue(strModuleName.GetData(), "UpLoadLogLevel", strUploadLogLevelEntity);
|
|
|
+ if (strUploadLogLevelEntity.IsNullOrEmpty()) {
|
|
|
+ CSimpleStringA strUploadLogLevelComm(true);
|
|
|
+ centerConfig->ReadConfigValue("Common", "UpLoadLogLevel", strUploadLogLevelComm);
|
|
|
+ strUploadLogLevelEntity = strUploadLogLevelComm;
|
|
|
+ }
|
|
|
+ bool isValidDigit = !strUploadLogLevelEntity.IsNullOrEmpty();
|
|
|
+ for (int i = 0; i < strUploadLogLevelEntity.GetLength(); ++i) {
|
|
|
+ if (!(strUploadLogLevelEntity[i] >= '0' && strUploadLogLevelEntity[i] <= '9')) {
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("invalid param: %s", strUploadLogLevelEntity.GetData());
|
|
|
+ isValidDigit = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (isValidDigit) {
|
|
|
+ nUploadLogLevel = atoi(strUploadLogLevelEntity.GetData());
|
|
|
+ }
|
|
|
+ switch (nUploadLogLevel)
|
|
|
+ {
|
|
|
+ case 0: /*LOG_LEVEL_DEBUG*/
|
|
|
+ stLogConfig.strLevel = "ALL";
|
|
|
+ break;
|
|
|
+ case 1: /*LOG_LEVEL_INFO*/
|
|
|
+ stLogConfig.strLevel = "INFO";
|
|
|
+ break;
|
|
|
+ case 2: /*LOG_LEVEL_WARN*/
|
|
|
+ stLogConfig.strLevel = "WARN";
|
|
|
+ break;
|
|
|
+ case 3: /*LOG_LEVEL_ERROR*/
|
|
|
+ stLogConfig.strLevel = "ERROR";
|
|
|
+ break;
|
|
|
+ case 4: /*LOG_LEVEL_FATAL*/
|
|
|
+ stLogConfig.strLevel = "FATAL";
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ stLogConfig.strLevel = "OFF";
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ pEntity->GetFunction()->GetPath("Dbg", stLogConfig.strLogPath);
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("DbgPath: %s", stLogConfig.strLogPath.GetData());
|
|
|
+ stLogConfig.Settle();
|
|
|
+
|
|
|
+ DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("{\"RecordLevel\":\"%s\", \"RecordType\":\"%s\}", stLogConfig.strLevel.GetData(), stLogConfig.strType.GetData());
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
void HealthManagerSession::Handle_EnterState(SpReqAnsContext<HealthManagerService_EnterState_Req, HealthManagerService_EnterState_Ans>::Pointer ctx)
|
|
|
{
|
|
|
LOG_FUNCTION();
|
|
|
@@ -636,7 +708,7 @@ bool CHealthManagerEntity::StartGuardian()
|
|
|
GetFunction()->GetSystemStaticInfo(staticInfo);
|
|
|
|
|
|
/** 添加日志控制逻辑 Gifur@202414]*/
|
|
|
- SP::Module::Comm::Settings::InitializeOtherLogSwitch(this, "guardian");
|
|
|
+ InitializeOtherLogSwitch(this, "guardian");
|
|
|
DbgWithLink(LOG_LEVEL_INFO,LOG_TYPE_SYSTEM)("to start guardian");
|
|
|
// Start the child process.
|
|
|
CSimpleStringA csBinPath, csAll, csSep("\"");
|