Browse Source

Merge branch 'ST2' into uos_cjl_Init_Sogou_20231225

陈纪林80310970 1 year ago
parent
commit
e69d04004e

+ 1 - 1
CMakeLists.txt

@@ -284,7 +284,7 @@ if(CONAN_CACHE_CLEAR)
 	conan_local_remove()
 endif(CONAN_CACHE_CLEAR)
 
-conan_cmake_run(REQUIRES RvcFramework/1.2.0.88@LR04.02_FrameworkLib/dev
+conan_cmake_run(REQUIRES RvcFramework/1.2.0.94@LR04.02_FrameworkLib/dev
 	Audio/2023.0509.01@LR04.02_MediaRes/testing
 BASIC_SETUP CMAKE_TARGETS)
 

+ 2 - 2
DevAdapter/self/liblog4vendor/log4cplus_helper.cpp

@@ -68,7 +68,7 @@ namespace cmb {
 		:_append_console(NULL),_append_file(NULL),_append_socket(NULL),_append_none(NULL)
 		,_socket_send_running(false)
 	    ,_initialized(false),_append_type(0),_log_server_port(0),_log_listen_port(0)
-		,_initilzed_zip(false),_cur_upload_log(""),_cur_upload_offset(0),_log_level(NOT_SET_LOG_LEVEL)
+		,_initilzed_zip(false),_cur_upload_log(""),_cur_upload_offset(0),_log_level(NOT_SET_LOG_LEVEL), _initialize_uploaded(false)
 	{
 		_log_dir.clear();
 		_log_server_ip.clear();
@@ -346,7 +346,7 @@ namespace cmb {
 	{
 #if !defined(NDEBUG)
 		if(_initialized) {
-			LOG4PLUS_LOG(INFO, get_logger(), text.c_str());
+			LOG4PLUS_LOG(DEBUG, get_logger(), text.c_str());
 			loglink(LOG_LEVEL_DEBUG, text);
 		}
 #endif //!defined(NDEBUG)

+ 1 - 0
DevAdapter/self/liblog4vendor/log4cplus_helper.h

@@ -175,6 +175,7 @@ namespace cmb {
 
 		int _log_level;
 
+		bool _initialize_uploaded;
 		upload_helper _upload_helper;
 	};
 }

+ 2 - 2
DevAdapter/self/liblog4vendor/log4upload.cpp

@@ -191,7 +191,7 @@ bool upload_helper::initialize(const cmb::log_init_config& cfg)
         pinst_log_producer_config_set_max_buffer_limit(config, 64 * 1024 * 1024);
         //set send thread count
         pinst_log_producer_config_set_send_thread_count(config, 2);
-        pinst_log_producer_config_set_persistent_max_log_count(config, 20 * 1000);
+        pinst_log_producer_config_set_persistent_max_log_count(config, 50 * 1000);
         pinst_log_producer_config_set_skyeye_servname(config, (char*)"Terminal");
         pinst_log_producer_config_set_skyeye_cmptId(config, (char*)"LR04");
         pinst_log_producer_config_set_skyeye_cmptname(config, (char*)"FrameworkLib");
@@ -216,7 +216,7 @@ bool upload_helper::initialize(const cmb::log_init_config& cfg)
 
         //мÓͳһÈÕÖ¾ÅäÖÃ
         pinst_log_producer_config_set_united_appname(config, (char*)"LR04");
-        pinst_log_producer_config_set_united_version(config, (char*)"1.0");
+        pinst_log_producer_config_set_united_version(config, (char*)"2.0");
         pinst_log_producer_config_set_united_needArchived(config, 0);
         pinst_log_producer_config_set_united_deployUnitId(config, (char*)"LR04.02@FrameworkLib_PRD_PRD");
         pinst_log_producer_config_set_united_serviceUnitId(config, (char*)"LR04.02_FrameworkLib");

+ 3 - 1
DevAdapter/self/liblog4vendor/log4vendor.cpp

@@ -87,6 +87,8 @@ namespace cmb {
 		const std::string record_type = toupper(env.record_type);
 		if(record_type.find("FILE") != std::string::npos)
 			config->log_type |= CMB_LOG_TYPE_FILE;
+		if (record_type.find("UPLOAD") != std::string::npos)
+			config->log_type |= CMB_LOG_TYPE_SOCKET;
 
 		/*get log level*/
 		const std::string record_level = toupper(env.record_level);
@@ -205,7 +207,7 @@ namespace cmb {
 
 		/*提前在这里赋值,以便让 LOG4VTM 宏生效*/
 		log4plus_initialized = true;
-        if (is_vtm_env) {
+        if (is_vtm_env && (lhs->log_type & CMB_LOG_TYPE_SOCKET) != 0) {
             log4cplus_helper::get_instance()->initialize_linklog(*lhs);
         }
 		LOG4VTM(INFO, "==============Log4Vendor(" << instance_name << ") start==============");

+ 12 - 40
Module/include/DevEntityCommBase.hpp

@@ -248,48 +248,20 @@ inline void CDevAdptEntityBase::InitializeVendorLogSwitch()
 	}
 
 	bool fromLocal = false;
-	/*�Ӽ������ö�ȡ�Ŀ���Ϊ�رգ����Զ�ȡ���ص�����*/
-	if (stLogConfig.strLevel.Compare("OFF", true) == 0) {
-		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Try to read from global settings.");
-		CSmartPointer<IConfigInfo> spConfig;
-		ErrorCodeEnum erroCode = GetFunction()->OpenConfig(Config_Cache, spConfig);
-
-		CAutoArray<CSimpleStringA> adapters;
-		spConfig->ReadAllKeys("AdapterLogSwith", adapters);
-		CSimpleStringA strKey(true);
-		for (int i = 0; i < adapters.GetCount(); ++i) {
-            DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("%d: %s, %s", i, adapters[i].GetData(), GetEntityName());
-			if (adapters[i].Compare(GetEntityName(), true) == 0) {
-				strKey = adapters[i];
-				break;
-			}
-		}
-		if (!strKey.IsNullOrEmpty()) {
-			CSimpleStringA strValue(true);
-			spConfig->ReadConfigValue("AdapterLogSwith", strKey, strValue);
-			CAutoArray<CSimpleStringA> settings;
-			DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Value: %s", strValue.GetData());
-			if (!strValue.IsNullOrEmpty() && (settings = strValue.Split(',')).GetCount() == 2) {
-				if (settings[0].GetLength() == 1 && atoi(settings[0]) >= 1 && settings[1].GetLength() == 1) {
-					if (settings[1].Compare("1") == 0)  stLogConfig.strLevel = "Fatal";
-					else if (settings[1].Compare("2") == 0)  stLogConfig.strLevel = "Error";
-					else if (settings[1].Compare("3") == 0)  stLogConfig.strLevel = "Warn";
-					else if (settings[1].Compare("4") == 0)  stLogConfig.strLevel = "Info";
-					else if (settings[1].Compare("5") == 0)  stLogConfig.strLevel = "Trace";
-					else stLogConfig.strLevel = "All";
-					fromLocal = true;
-				}
-			}
-		}
-	} 
-
 	if (stLogConfig.strLevel.Compare("OFF", true) != 0) {
 
-		str.Clear();
-		centerConfig->ReadConfigValue(GetEntityName(), "Type", str);
-		if (!str.IsNullOrEmpty())
-			stLogConfig.strType = str;
-
+		//str.Clear();
+		//centerConfig->ReadConfigValue(GetEntityName(), "Type", str);
+		//if (!str.IsNullOrEmpty())
+		//	stLogConfig.strType = str;
+
+		stLogConfig.strType = "UPLOAD";
+		int nSaveFileOrNot(0);
+		centerConfig->ReadConfigValueInt("Common", "SaveFile", nSaveFileOrNot);
+		if ((nSaveFileOrNot & 1) == 1) {
+			if (!stLogConfig.strType.IsNullOrEmpty()) stLogConfig.strType += "|";
+			stLogConfig.strType += "FILE";
+		}
 		GetFunction()->GetPath("Dbg", stLogConfig.strLogPath);
 		DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_SYSTEM)("Dbg: %s", stLogConfig.strLogPath.GetData());
 		stLogConfig.Settle();

+ 13 - 1
Module/mod_CardIssuerStand/CardIssuerFSM.cpp

@@ -5216,6 +5216,7 @@ int CCardIssuerFSM::SplitDevModelInfo()
 		return -1;
 	}
 	m_csCM = "";
+	m_csRF = "";
 	CSimpleStringA csTmpModel(m_devCat.szModel);
 	CAutoArray<CSimpleStringA> arrParam;
 	arrParam.Init(16);
@@ -5226,6 +5227,11 @@ int CCardIssuerFSM::SplitDevModelInfo()
 		{
 			m_csCM = arrParam[i].SubString(3, arrParam[i].GetLength() - 3);
 		}
+		if (_strnicmp(arrParam[i], "RF", 2) == 0)
+		{
+			m_csRF = arrParam[i].GetData();//获取非接支持的字段值
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("szModel: RF=%s", m_csRF.GetData());
+		}
 	}
 	return 0;
 }
@@ -5354,7 +5360,12 @@ bool CCardIssuerFSM::IfUseRf()
 {
 	if (m_bStopUseRF)
 		return false;
-	
+
+	//加入szmodel非接字段属性判断
+	if (m_csRF.Compare("Y") == 0) {
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("szModel,RF=%s", m_csRF.GetData());
+		return true;
+	}	
 	CAutoArray<CSimpleStringA> arr = m_rfVendorList.Split('|');
 	//Dbg("%s,%d", m_rfVendorList.GetData(),arr.GetCount());
 	for (int i = 0; i < arr.GetCount(); ++i)
@@ -5363,5 +5374,6 @@ bool CCardIssuerFSM::IfUseRf()
 		if (m_adapterInfo.adapterFilePath.IndexOf(arr[i].GetData()) > 0)
 			return true;
 	}
+
 	return false;
 }

+ 2 - 2
Module/mod_CardIssuerStand/CardIssuerFSM.h

@@ -956,8 +956,8 @@ private:
 
 	char *m_pDataToARQC;
 	long xxTest;
-	CSimpleStringA m_currCardNo, m_captureReason, m_csMachineType, m_csSite,m_terminalNo,m_addCardNo,m_addCardSerial
-		,m_csCM, m_rfVendorList, m_csDevSN;
+	CSimpleStringA m_currCardNo, m_captureReason, m_csMachineType, m_csSite, m_terminalNo, m_addCardNo, m_addCardSerial
+		, m_csCM, m_rfVendorList, m_csDevSN, m_csRF;
 	char m_AuthCode[2];
 	vector<CMBBin> m_vBin;
 	int SplitTrack2(CSimpleStringA pTrack2,Track2Data &decodeData);

+ 2 - 2
Module/mod_CenterSetting/CenterSettingConn.cpp

@@ -514,7 +514,7 @@ void CenterSettingsMicroServiceHelper::UpdateVersion()
     m_pCenterConfig->ReadConfigValue("CenterSetting", "UpdateVersionUrl", url);
 
     HttpClientResponseResult result;
-    HttpClientRequestConfig config(HttpRequestMethod::POST, url.GetData());
+    HttpClientRequestConfig config(HttpRequestMethod::POST, url.GetData(), &SpGetToken);
 
     updateVersionReq.terminal_no = m_terminalInfo.strTerminalID.GetData();
     updateVersionReq.version_no = m_strVersion;
@@ -698,7 +698,7 @@ int CenterSettingsMicroServiceHelper::GetCenterSettingsFromHttp(CenterSettingReq
     }getCenterSettingAns;
 
     HttpClientResponseResult result;
-    HttpClientRequestConfig config(HttpRequestMethod::POST, req.m_url);
+    HttpClientRequestConfig config(HttpRequestMethod::POST, req.m_url, &SpGetToken);
     if (req.m_timeOut > 0) config.SetTimeout(req.m_timeOut);
 
     getCenterSettingReq.m_terminal_no = req.m_terminal_no;

+ 3 - 3
Module/mod_accessauth/AccessAuthFSM.cpp

@@ -196,7 +196,7 @@ struct TimeSynTask : ITaskSp
 		timeSyncReq.curTime = CSmallDateTime::GetNow().GetTime64();
 
 		HttpClientResponseResult result;
-		HttpClientRequestConfig config(HttpRequestMethod::POST, m_fsm->GetmAccessAuthHost().GetData());
+		HttpClientRequestConfig config(HttpRequestMethod::POST, m_fsm->GetmAccessAuthHost().GetData(), &SpGetToken);
 		config.SetChildUri("/api/v3/sessionkey");
 		SP::Module::Restful::FulfillRequestJsonBody(&config, timeSyncReq);
 		RestfulClient client = RestfulClient::getInstance();
@@ -436,7 +436,7 @@ struct UpdateWKTask : ITaskSp
 		}
 
 		HttpClientResponseResult result;
-		HttpClientRequestConfig config(HttpRequestMethod::POST, m_fsm->GetmAccessAuthHost().GetData());
+		HttpClientRequestConfig config(HttpRequestMethod::POST, m_fsm->GetmAccessAuthHost().GetData(), &SpGetToken);
 		config.SetChildUri("/api/v5/wkupdate");
 
 		SP::Module::Restful::FulfillRequestJsonBody(&config, updateWKReq);
@@ -622,7 +622,7 @@ struct GetTokenTask : ITaskSp
 		} getTokenAns;
 
 		HttpClientResponseResult result;
-		HttpClientRequestConfig config(HttpRequestMethod::POST, m_fsm->GetmAccessAuthHost().GetData());
+		HttpClientRequestConfig config(HttpRequestMethod::POST, m_fsm->GetmAccessAuthHost().GetData(), &SpGetToken);
 		config.SetChildUri("/api/v3/access");
 
 		getTokenReqJson.installVersion = getTokenReq.installVersion;

+ 1 - 1
Module/mod_accessauth/mod_AccessAuth.cpp

@@ -192,7 +192,7 @@ struct InitializerInitMKTask : ITaskSp
 		} instanceAns;
 
 		HttpClientResponseResult result;
-		HttpClientRequestConfig config(HttpRequestMethod::POST, m_entity->GetInitUrl().GetData());
+		HttpClientRequestConfig config(HttpRequestMethod::POST, m_entity->GetInitUrl().GetData(), &SpGetToken);
 		config.SetChildUri("/api/v5/initmk");
 		SP::Module::Restful::FulfillRequestJsonBody(&config, instanceReq);
 

+ 1 - 1
Module/mod_alarm/AlarmFSM.cpp

@@ -135,7 +135,7 @@ namespace Task
 #else
 		bool SendAlarmTaskImpl() {
 			HttpClientResponseResult result;
-			HttpClientRequestConfig config(HttpRequestMethod::POST, m_fsm->m_sendUrl.GetData());
+			HttpClientRequestConfig config(HttpRequestMethod::POST, m_fsm->m_sendUrl.GetData(), &SpGetToken);
 
 			string reqStr = "";
 			if(m_fsm->m_unSendAlarm.IsNullOrEmpty()){

+ 14 - 2
Module/mod_cardissuer/CardIssuerFSM.cpp

@@ -1516,6 +1516,7 @@ ErrorCodeEnum CCardIssuerFSM::OpenDevice(BYTE btOpenType, const char* pDevSN)
 
 		if (eErrDev == Error_Succeed)
 		{
+			ToLogRootINIInfo();
 			m_bOpened = true;
 			m_devOpenFailedCount = 0;
 			ZeroMemory(m_devCat.szModel, sizeof(m_devCat.szModel));
@@ -5070,7 +5071,6 @@ void CCardIssuerFSM::GetVendorDllName(CSimpleStringA& strDevAdaptorPath)
 	pEntity->LoadVendorLibName();
 	FulfillAdapterInfoFrom(pEntity->vendorLibInfo);
 	strDevAdaptorPath = m_adapterInfo.adapterFilePath;
-	ToLogRootINIInfo();
 	return;
 }
 bool CCardIssuerFSM::AccountExchange(const char *origAcc, CSimpleStringA &acc, int dir)
@@ -5218,6 +5218,7 @@ int CCardIssuerFSM::SplitDevModelInfo()
 		return -1;
 	}
 	m_csCM = "";
+	m_csRF = "";
 	CSimpleStringA csTmpModel(m_devCat.szModel);
 	CAutoArray<CSimpleStringA> arrParam;
 	arrParam.Init(16);
@@ -5228,6 +5229,11 @@ int CCardIssuerFSM::SplitDevModelInfo()
 		{
 			m_csCM = arrParam[i].SubString(3, arrParam[i].GetLength() - 3);
 		}
+		if (_strnicmp(arrParam[i], "RF", 2) == 0)
+		{
+			m_csRF = arrParam[i].GetData();//获取非接支持的字段值
+			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("szModel: RF=%s", m_csRF.GetData());
+		}
 	}
 	return 0;
 }
@@ -5356,7 +5362,12 @@ bool CCardIssuerFSM::IfUseRf()
 {
 	if (m_bStopUseRF)
 		return false;
-	
+
+	//加入szmodel非接字段属性判断
+	if (m_csRF.Compare("Y") == 0) {
+		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("szModel,RF=%s", m_csRF.GetData());
+		return true;
+	}	
 	CAutoArray<CSimpleStringA> arr = m_rfVendorList.Split('|');
 	//Dbg("%s,%d", m_rfVendorList.GetData(),arr.GetCount());
 	for (int i = 0; i < arr.GetCount(); ++i)
@@ -5365,5 +5376,6 @@ bool CCardIssuerFSM::IfUseRf()
 		if (m_adapterInfo.adapterFilePath.IndexOf(arr[i].GetData()) > 0)
 			return true;
 	}
+
 	return false;
 }

+ 2 - 2
Module/mod_cardissuer/CardIssuerFSM.h

@@ -955,8 +955,8 @@ private:
 
 	char *m_pDataToARQC;
 	long xxTest;
-	CSimpleStringA m_currCardNo, m_captureReason, m_csMachineType, m_csSite,m_terminalNo,m_addCardNo,m_addCardSerial
-		,m_csCM, m_rfVendorList, m_csDevSN;
+	CSimpleStringA m_currCardNo, m_captureReason, m_csMachineType, m_csSite, m_terminalNo, m_addCardNo, m_addCardSerial
+		, m_csCM, m_rfVendorList, m_csDevSN, m_csRF;
 	char m_AuthCode[2];
 	vector<CMBBin> m_vBin;
 	int SplitTrack2(CSimpleStringA pTrack2,Track2Data &decodeData);

+ 3 - 0
Module/mod_chromium/CModTools.cpp

@@ -777,6 +777,9 @@ namespace Chromium {
 					CSimpleString::Format("install page check err, can not connect to %s or %s", installUrls[0].c_str(), installUrls[1].c_str()).GetData());
 			}
 			std::string dstInstallUrl = checkRet.first ? checkRet.second : installUrls[0];
+			CSimpleString runningVer = "";
+			m_pEntity->GetFunction()->GetRunningVersion(runningVer);
+			dstInstallUrl.append("?version=").append(runningVer.GetData());
 			auto strCmdLine = generateInstallCmd(dstInstallUrl);
 			auto openCefRet = openCef(strCmdLine, false);
 			if (Error_Succeed == openCefRet.first)

+ 1 - 1
Module/mod_chromium/CWebsocketServer.cpp

@@ -269,7 +269,7 @@ namespace Chromium {
 
 
 			auto logType = json_deal::getStringFromCjsonObj(pJson.get(), msg_logType);//it can be equal to Sys/User
-			LOG_TYPE_E t_type = (logType.second.Compare("User", true) == 0) ? LOG_TYPE_BUSINESS_USER : LOG_TYPE_BUSINESS_SYSTEM;
+			LOG_TYPE_E t_type = (logType.second.Compare("User", true) == 0) ? LOG_TYPE_USER : LOG_TYPE_SYSTEM;
 
 			//通过变量方式进行处理
 			DbgWithLink t_obj(changeMessageTypeToLogLevel(messageType), t_type);

+ 5 - 7
Module/mod_chromium/mod_chromium.h

@@ -35,14 +35,12 @@
 
 
 #pragma once
-namespace Chromium
-{
+namespace Chromium {
 
-#define BROWSER_TIMER_ID 0xF002
-#define BROWSER_TIMER_INTERVAL 3600000
+	#define BROWSER_TIMER_ID 0xF002
+	#define BROWSER_TIMER_INTERVAL 3600000
 
-	typedef struct
-	{
+	typedef struct {
 		std::string key;
 		std::string value;
 		std::string oldValue;
@@ -136,7 +134,7 @@ namespace Chromium
 		int getBrowserStartTimes();
 	private:
 		//subscribe
-		CUUID m_uidCameraListener, m_uuidAccessAuth, m_uuidResourceWatch, m_uidBrowserListenser, m_uuidAccessAuthErr, m_uuidAllFault, m_uuidVTMLoader;
+		CUUID m_uidCameraListener, m_uuidAccessAuth, m_uuidResourceWatch,m_uidBrowserListenser, m_uuidAccessAuthErr, m_uuidAllFault, m_uuidVTMLoader;
 		virtual void OnLog(const CAutoArray<CUUID>& SubIDs, const CUUID nLogID, const LogTypeEnum eLogType, const SeverityLevelEnum eLevel,
 			const DWORD dwSysError, const DWORD dwUserCode, const DWORD dwEntityInstanceID, const WORD wEntityDevelID,
 			const CAutoArray<DWORD>& Param, const char* pszEntityName, const char* pszModuleName, const char* pszMessage, const linkContext& pLinkInfo);

+ 3 - 3
Module/mod_healthmanager/mod_healthmanager.cpp

@@ -2345,7 +2345,7 @@ void CHealthManagerEntity::DeployTerminal(SpReqAnsContext<HealthManagerService_D
 			CSimpleStringA matchInfo(true);
 
             //走总行服务
-            HttpClientRequestConfig config(serverIP.GetData());
+            HttpClientRequestConfig config(serverIP.GetData(), &SpGetToken);
             HttpClientResponseResult result;
             config.SetChildUri(URLPATH_REGISTER_FULL_LIST);
             config.AppendQuery("terminalNo", terminalNo.GetData());
@@ -3236,9 +3236,9 @@ void CHealthManagerEntity::ToCalcRebootHourAndMinute(int restartBegin, int resta
 		restartBegin = 1;
 		restartEnd = 6;
 	}
-	//以1分钟对重启区间进行切片,截取终端号后7位进行取模hash到重启区间
+	//以1分钟对重启区间进行切片,截取终端号前6位+最后1位,进行取模hash到重启区间
 	int modNum = (restartEnd - restartBegin) * 60 -1;//if the modNum like 300 or 200 ,the remainder is not random ,because the TerminalNo is not random
-	int xTerm = atoi(m_sysStaticInfo.strTerminalID.SubString(m_sysStaticInfo.strTerminalID.GetLength() - 7, 3) + m_sysStaticInfo.strTerminalID.SubString(m_sysStaticInfo.strTerminalID.GetLength() - 1, 1));
+	int xTerm = atoi(m_sysStaticInfo.strTerminalID.SubString(0, 6) + m_sysStaticInfo.strTerminalID.SubString(m_sysStaticInfo.strTerminalID.GetLength() - 1, 1));
 	int minutes = xTerm % modNum;
 	m_restartHour = 1 + (minutes / 60);
 	m_restartMinute = minutes - (m_restartHour - 1) * 60;

+ 31 - 15
Module/mod_vtmloader/VtmLoaderFSM.cpp

@@ -4,6 +4,7 @@
 #include "VtmLoader_UserCode.h"
 #include "EventCode.h"
 
+
 #if defined(RVC_OS_WIN)
 #include <io.h>
 #include "..\RvcVer.h"
@@ -122,8 +123,14 @@ DWORD checkUrlActive(LPVOID param)
 				, t_upload_TerminalSys_Suc, t_upload_TerminalUser_Suc, t_upload_BussinessSys_Suc, t_upload_BussinessUser_Suc, t_upload_beidou_Suc,
 				t_upload_TerminalSys_Err, t_upload_TerminalUser_Err, t_upload_BussinessSys_Err, t_upload_BussinessUser_Err, t_upload_beidou_Err).GetData());
 	}
+	return 0;
+}
 
-
+DWORD AlarmVersionErr(LPVOID param)
+{
+	CVtmLoaderFSM* cur = (CVtmLoaderFSM*)param;
+	Sleep(5000);//wait mod_alarm start
+	LogWarn(Severity_Middle, Error_Bug, VtmLoader_DETECT_VERSION_ERR, cur->m_verShowMsg.GetData());
 	return 0;
 }
 
@@ -147,7 +154,7 @@ CVtmLoaderFSM::CVtmLoaderFSM()
 	m_iCanIgnoreAddrDetect = 0;
 	m_ullMaxAddrDetectTime = 10*60*1000;//10 minutes
 	m_iDetectInterval = 5000;
-	m_terminalNoFromWeb = "";
+	m_terminalNoFromWeb = m_verShowMsg = "";
 }
 
 CVtmLoaderFSM::~CVtmLoaderFSM()
@@ -393,7 +400,8 @@ void CVtmLoaderFSM::s2_on_entry()
 	DWORD elapseTimeTemp = dwElapse / 1000;
 	CSimpleStringA xMsg = CSimpleStringA::Format("{\"Decripstion\":\"Enter safeload state.\",\"version\":\"%s\",\"elapseTime\":\"%d\"}", m_sysInfo.InstallVersion.ToString().GetData(), elapseTimeTemp);
 	//LogWarn(Severity_Low, Error_Unexpect, HealthManager_UserErrorCode_Enter_SafeLoad_State, xMsg.GetData());
-
+	if (!VerifyVer())
+		return;
 
 	bool bAsync = false;
 	m_eStage = LOADSTAGE_SAFELOAD;
@@ -943,11 +951,6 @@ int CVtmLoaderFSM::NetWorkCheckAndGetSetting()
 		}
 	}
 
-	if (!VerifyVer())
-		return -1;
-
-	
-
 	m_ullGetConfigCost = (SP::Module::Comm::RVCGetTickCount() - ullTmpStart) / 1000;//second
 	//加载实体列表
 
@@ -1137,6 +1140,17 @@ int CVtmLoaderFSM::EntityLoad()
 			DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("StartEntity HealthManager failed(%d).", eErrCode);
 			return -1;
 		}
+		eErrCode = pFuncPrivilege->StartEntity("InteractiveControl", NULL, spWait);
+		if (eErrCode == Error_Succeed)
+		{
+			if (spWait != NULL)
+				eErrCode = spWait->WaitAnswer(MAX_AYSNC_TIMEOUT);
+		}
+		else
+		{
+			DbgWithLink(LOG_LEVEL_ERROR, LOG_TYPE_SYSTEM)("StartEntity InteractiveControl failed(%d).", eErrCode);
+			return -1;
+		}
 		//wait for all the things have beed done,then save TerminalNo to root.ini
 		while (true)
 		{	
@@ -1457,7 +1471,6 @@ bool CVtmLoaderFSM::VerifyVer()
 	CSmartPointer<IConfigInfo> pConfig;
 	GetEntityBase()->GetFunction()->OpenConfig(Config_CenterSetting, pConfig);
 
-
 	int VerifyVersion = 0;
 	CSimpleStringA activeVer;
 	bool isVerEqual = false;
@@ -1471,6 +1484,7 @@ bool CVtmLoaderFSM::VerifyVer()
 #endif
 	if (curVer == activeVer.GetData())
 		isVerEqual = true;
+	
 	if (!isVerEqual)
 	{
 		CSimpleString showMsg = CSimpleString::Format("version not equal, file version:%s, acitve verion:%s", curVer.c_str(), activeVer.GetData());
@@ -1480,10 +1494,12 @@ bool CVtmLoaderFSM::VerifyVer()
 			DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)(showMsg.GetData());
 			break;
 		case 1:
-			LogWarn(Severity_Middle, Error_Unexpect, VtmLoader_DETECT_VERSION_ERR, showMsg.GetData());
+			m_verShowMsg = showMsg;
+			CloseHandle(CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&AlarmVersionErr, this, 0, NULL));
 			break;
 		case 2:
-			LogWarn(Severity_Middle, Error_Unexpect, VtmLoader_DETECT_VERSION_ERR, showMsg.GetData());
+			m_verShowMsg = showMsg;
+			CloseHandle(CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)&AlarmVersionErr, this, 0, NULL));
 			return false;
 			break;
 		default:
@@ -1791,13 +1807,13 @@ bool CVtmLoaderFSM::RefreshDeviceConfig(SpReqAnsContext<VtmLoaderService_CheckDe
 {
 	if (ctx->Req.entityName.IsNullOrEmpty() || ctx->Req.paramNum <= 0)
 	{
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER)("param error! nothing to refresh");
+		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER)("param error! nothing to refresh");
 		return false;
 	}
-	DbgWithLink(LOG_LEVEL_DEBUG, LOG_TYPE_USER)("entityName:%s,paramNum:%d,module.GetCount:%d",ctx->Req.entityName.GetData(),ctx->Req.paramNum,ctx->Req.module.GetCount());
+	DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER)("entityName:%s,paramNum:%d,module.GetCount:%d",ctx->Req.entityName.GetData(),ctx->Req.paramNum,ctx->Req.module.GetCount());
 	if (ctx->Req.module.GetCount() < ctx->Req.paramNum || ctx->Req.name.GetCount() < ctx->Req.paramNum || ctx->Req.value.GetCount() < ctx->Req.paramNum)
 	{
-		DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_USER)("param array length error! nothing to refresh");
+		DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_USER)("param array length error! nothing to refresh");
 		return false;
 	}
 	for (int i = 0; i < ctx->Req.paramNum; i++)
@@ -1844,7 +1860,7 @@ void CVtmLoaderFSM::CheckDeviceBaseEntity(SpReqAnsContext<VtmLoaderService_Check
 		ctx->Answer(Error_Unexpect, VtmLoader_FailToStartEntity);
 		return;
 	}
-
+		
 	//TODO we should wait for device entity open suc?
 	int count = 0;
 	do

+ 1 - 0
Module/mod_vtmloader/VtmLoaderFSM.h

@@ -108,6 +108,7 @@ private:
 	END_FSM_RULE()
 public:
 	int m_refreshWaitSec, m_uploadLogInfo_waitSec;
+	CSimpleString m_verShowMsg;
 	int NetWorkCheckAndGetSetting();
 	bool GetConfig();
 	bool VerifyVer();

+ 4 - 0
Module/mod_vtmloader/tokenDefine.h

@@ -1,7 +1,11 @@
 #pragma once
 #include "IHttpFunc.h"
 #include <string>
+#if defined(RVC_OS_WIN)
+#include "json.h"
+#else
 #include "json/json.h"
+#endif
 #include "SpSecureClient.h"
 
 #define TOKEN_GETURL_ERR 0x10A00001

+ 41 - 9
Other/libRestfulFunc/RestfulFunc.h

@@ -32,6 +32,9 @@
 * -2:超时
 * -3:地址不符合规范
 */
+
+typedef void (*restFul_GetTokenCallBack)(char *, char *);
+
 RESTFULFUNC_API int HttpProbe(const std::string& url, std::string& out_msg, uint32_t wait_max_secs = (uint32_t)-1);
 
 /*!
@@ -118,20 +121,23 @@ struct HttpClientRequestConfig
      * @param[out] 
      * @return : 
      */
-    HttpClientRequestConfig(const std::string& uri) 
+    HttpClientRequestConfig(const std::string& uri, restFul_GetTokenCallBack t_getToken)
         :mMethod(HttpRequestMethod::GET), mUri(uri), mToValidCert(false)
-        , mBodyContent(""), mContentType(""), mHeaderAcceptType("application/json"), mTimeoutSecs(0)
+        , mBodyContent(""), mContentType(""), mHeaderAcceptType("application/json"), mTimeoutSecs(0), m_withToken(true)
     {
+        InitGetToken(t_getToken);
     }
-    HttpClientRequestConfig(HttpRequestMethod method)
-        : mMethod(method), mToValidCert(false), mBodyContent(""), mHeaderAcceptType("application/json")
+    HttpClientRequestConfig(HttpRequestMethod method, restFul_GetTokenCallBack t_getToken)
+        : mMethod(method), mToValidCert(false), mBodyContent(""), mHeaderAcceptType("application/json"), m_withToken(true)
         , mContentType(""), mTimeoutSecs(0)
     {
+        InitGetToken(t_getToken);
     }
-    HttpClientRequestConfig(HttpRequestMethod method, const std::string& uri) 
-        :mMethod(method), mUri(uri), mToValidCert(false), mBodyContent("")
+    HttpClientRequestConfig(HttpRequestMethod method, const std::string& uri, restFul_GetTokenCallBack t_getToken)
+        :mMethod(method), mUri(uri), mToValidCert(false), mBodyContent(""), m_withToken(true)
         , mContentType(""), mHeaderAcceptType("application/json"), mTimeoutSecs(0)
     {
+        InitGetToken(t_getToken);
     }
 
     void SetRequestType(HttpRequestMethod method) { mMethod = method; }
@@ -175,6 +181,22 @@ struct HttpClientRequestConfig
     virtual void PreDo() {}
     virtual void PostDo() {}
 
+    bool getToken(std::string & t_channelId, std::string &t_token) const {
+        char channelId[256] = "";
+        char token[256] = "";
+        if (m_withToken && g_tokenCall != NULL)
+        {
+            g_tokenCall(channelId, token);
+            if (std::string(channelId).length() > 0 && std::string(token).length() > 0)
+            {
+                t_channelId = channelId;
+                t_token = token;
+                return true;
+            }
+        }
+        return false;
+    }
+
 private:
 
     HttpRequestMethod mMethod;
@@ -186,20 +208,30 @@ private:
 
     std::map<std::string, std::string> mQueryPairs;
 
+    bool m_withToken;
     bool mToValidCert;
     uint32_t mTimeoutSecs;
+    restFul_GetTokenCallBack g_tokenCall;
+    void InitGetToken(restFul_GetTokenCallBack t_getToken) {
+        if (t_getToken)
+            g_tokenCall = t_getToken;
+        else
+            g_tokenCall = nullptr;
+
+        
+    };
 };
 
 struct HttpClientPostTypeRequest : public HttpClientRequestConfig
 {
     HttpClientPostTypeRequest(const std::string& uri)
-        :HttpClientRequestConfig(HttpRequestMethod::POST, uri) {}
+        :HttpClientRequestConfig(HttpRequestMethod::POST, uri, nullptr) {}
 };
 
 struct HttpClientUploadRequest : public HttpClientRequestConfig
 {
     HttpClientUploadRequest(const std::string& uri)
-        :HttpClientRequestConfig(HttpRequestMethod::DOWNLOAD, uri)
+        :HttpClientRequestConfig(HttpRequestMethod::DOWNLOAD, uri, nullptr)
     {
     }
 
@@ -236,7 +268,7 @@ private:
 struct HttpClientDownloadRequest : public HttpClientRequestConfig
 {
     HttpClientDownloadRequest(const std::string& uri) 
-        :HttpClientRequestConfig(HttpRequestMethod::DOWNLOAD, uri) {
+        :HttpClientRequestConfig(HttpRequestMethod::DOWNLOAD, uri, nullptr) {
         SetAcceptType("*/*");
     }
 };

+ 7 - 0
Other/libRestfulFunc/RestfulFuncImpl.cpp

@@ -181,6 +181,13 @@ void RestfulClient::Do(const HttpClientRequestConfig* const pRequestConfig, Http
 	request.set_request_uri(urib.to_string());
 	request.headers().add(header_names::accept, STRW(pRequestConfig->GetAcceptType()));
 
+	std::string token, channelId;
+	if (pRequestConfig->getToken(channelId, token))
+	{
+		request.headers().add("channelId", channelId);
+		request.headers().add("token", token);
+	}
+
 	if (pRequestConfig->GetRequestType() != HttpRequestMethod::GET) {
 		request.set_body(STRW(pRequestConfig->GetBodyContent()), STRW(pRequestConfig->GetContentType()));
 	}

+ 3 - 3
Other/libRestfulFunc/test/testNormlReqAns.cpp

@@ -4,7 +4,7 @@
 
 TEST_CASE("test api manage", "[restful]")
 {
-    HttpClientRequestConfig config("https://rvcgateway.paasst.cmbchina.cn/terminal");
+    HttpClientRequestConfig config("https://rvcgateway.paasst.cmbchina.cn/terminal", NULL);
     HttpClientResponseResult result;
     config.SetChildUri("/api/manage/regist/7555980103");
     RestfulClient client = RestfulClient::getInstance();
@@ -15,7 +15,7 @@ TEST_CASE("test api manage", "[restful]")
 
 TEST_CASE("test  api stage get api", "[restful]")
 {
-    HttpClientRequestConfig config("https://rvcterminal.paasst.cmbchina.cn");
+    HttpClientRequestConfig config("https://rvcterminal.paasst.cmbchina.cn", NULL);
     HttpClientResponseResult result;
     config.SetChildUri("/api/stage");
     config.AppendQuery("terminalNo", "7555980001");
@@ -27,7 +27,7 @@ TEST_CASE("test  api stage get api", "[restful]")
 
 TEST_CASE("test  api stage post api", "[restful]")
 {
-    HttpClientRequestConfig config("https://rvcterminal.paasst.cmbchina.cn");
+    HttpClientRequestConfig config("https://rvcterminal.paasst.cmbchina.cn", NULL);
     config.SetRequestType(HttpRequestMethod::POST);
     config.SetChildUri("/api/stage");
     config.SetJsonBody("{\"terminalNo\":\"7555980001\", \"errEntityList\":\"566666\"}");

+ 1 - 1
Other/liblog4rvcother/log4cplus_helper.cpp

@@ -346,7 +346,7 @@ namespace cmb {
 	{
 #if !defined(NDEBUG)
 		if(_initialized) {
-			LOG4PLUS_LOG(INFO, get_logger(), text.c_str());
+			LOG4PLUS_LOG(DEBUG, get_logger(), text.c_str());
 			loglink(LOG_LEVEL_DEBUG, text);
 		}
 #endif //!defined(NDEBUG)

+ 0 - 7
Tool/guardian/guardian.cpp

@@ -747,7 +747,6 @@ void CheckDoWork(int sig)
 	cout << "CheckDoWork" << endl;
 	if (SIGALRM == sig)
 	{
-		LOG4VTM(INFO, "to check value(linux)");
 		EnterCriticalSectionRVC(g_cs);
 
 		if (!g_bFrameQuit)
@@ -818,14 +817,11 @@ void* DoNetControlLinux(void* arg)
 void DataProcessLinux(int socket,const char*data)
 {
 	GuardianInfo* pInfo = (GuardianInfo*)data;
-	LOG4VTM(INFO, "eType:" << pInfo->eType);
-	LOG4VTM(INFO, "dwParam1:" << pInfo->dwParam1);
 	LOG4VTM(DEBUG, "eType:" << pInfo->eType << ",p1:" << pInfo->dwParam1 << ",p2:" << pInfo->dwParam2 << ",dwSize:" << pInfo->dwSize);
 	switch (pInfo->eType)
 	{
 	case GdOpShakeHand:
 	{
-		LOG4VTM(INFO, "Shake hand.");
 		if (!g_bFrameOnline)
 		{
 			g_bFrameOnline = true;
@@ -979,12 +975,10 @@ void DataProcessLinux(int socket,const char*data)
 void DataProcess(LPPER_HANDLE_DATA pPerHandleData,LPPER_IO_OPERATION_DATA pPerIoData)
 {
 	GuardianInfo* pInfo = (GuardianInfo*)pPerIoData->Buffer;
-	LOG4VTM(INFO, "eType:" << pInfo->eType);
 	switch(pInfo->eType)
 	{
 	case GdOpShakeHand:
 		{
-			LOG4VTM(INFO, "Shake hand.");
 			if (!g_bFrameOnline)
 			{
 				g_bFrameOnline = true;
@@ -1181,7 +1175,6 @@ DWORD WINAPI DoWork(void* pData)
 	while(1)
 	{
 		WaitForSingleObject(hTimer,INFINITE);
-		LOG4VTM(INFO, "to check value");
 		EnterCriticalSectionRVC(g_cs);
 
 		if (!g_bFrameQuit)