Browse Source

1、是否监听电视串口号;

scbc.sat2 5 years ago
parent
commit
2559473afe

+ 6 - 2
LogModule/LogModule/Global.cpp

@@ -22,6 +22,8 @@ namespace Global
 	TCHAR g_szTVPort[MAX_PATH] = {0};
 	TCHAR g_szTVPort[MAX_PATH] = {0};
 	TCHAR g_szTVReboot[MAX_PATH] = {0};
 	TCHAR g_szTVReboot[MAX_PATH] = {0};
 	TCHAR g_szTVShutdown[MAX_PATH] = {0};
 	TCHAR g_szTVShutdown[MAX_PATH] = {0};
+	BOOL  g_bWatchTVPort = FALSE;
+
 	SENDPOWERKEY g_SendPowerKey = NULL;
 	SENDPOWERKEY g_SendPowerKey = NULL;
 	std::vector<TLog> g_vtAbnormal;
 	std::vector<TLog> g_vtAbnormal;
 
 
@@ -582,9 +584,11 @@ namespace Global
 		// 电视串口号;
 		// 电视串口号;
 		GetPrivateProfileString(_T("COMM"), _T("serial_communicator_port"), NULL, g_szTVPort, MAX_PATH, szConfig);
 		GetPrivateProfileString(_T("COMM"), _T("serial_communicator_port"), NULL, g_szTVPort, MAX_PATH, szConfig);
 		// 重启关键字;
 		// 重启关键字;
-		GetPrivateProfileString(_T("Abnromal"), _T("reboot"), NULL, g_szTVReboot, MAX_PATH, szConfig);
+		g_bWatchTVPort = GetPrivateProfileInt(_T("Abnormal"), _T("Watch"), 0, szConfig);
+		// 重启关键字;
+		GetPrivateProfileString(_T("Abnormal"), _T("reboot"), NULL, g_szTVReboot, MAX_PATH, szConfig);
 		// 关机关键字;
 		// 关机关键字;
-		GetPrivateProfileString(_T("Abnromal"), _T("shutdown"), NULL, g_szTVShutdown, MAX_PATH, szConfig);
+		GetPrivateProfileString(_T("Abnormal"), _T("shutdown"), NULL, g_szTVShutdown, MAX_PATH, szConfig);
 	}
 	}
 
 
 	void Split(std::string str1, std::string str2, std::vector<std::string> &vt)
 	void Split(std::string str1, std::string str2, std::vector<std::string> &vt)

+ 1 - 0
LogModule/LogModule/Global.h

@@ -22,6 +22,7 @@ namespace Global
 	extern TCHAR g_szTVPort[MAX_PATH];
 	extern TCHAR g_szTVPort[MAX_PATH];
 	extern TCHAR g_szTVReboot[MAX_PATH];
 	extern TCHAR g_szTVReboot[MAX_PATH];
 	extern TCHAR g_szTVShutdown[MAX_PATH];
 	extern TCHAR g_szTVShutdown[MAX_PATH];
+	extern BOOL  g_bWatchTVPort;
 
 
 	extern bool g_bEnableLog;
 	extern bool g_bEnableLog;
 	extern TCHAR g_szLogPath[MAX_PATH];
 	extern TCHAR g_szLogPath[MAX_PATH];

+ 6 - 0
LogModule/LogModule/LogModule.cpp

@@ -39,6 +39,12 @@ unsigned int __stdcall ThreadWathTVPort(PVOID pM)
 	{
 	{
 		// 读取配置文件;
 		// 读取配置文件;
 		Global::GetResourceCfg();
 		Global::GetResourceCfg();
+		if ( !Global::g_bWatchTVPort )
+		{
+			Sleep(5000);
+			continue;
+		}
+
 		if ( GetTickCount() - dwTickCount > 5000 )
 		if ( GetTickCount() - dwTickCount > 5000 )
 		{// 5秒更新一次;
 		{// 5秒更新一次;
 			dwTickCount = GetTickCount();
 			dwTickCount = GetTickCount();