BOOL CBusinessManage_GISTerminal::LoadConfig() { Crwini rwIniTemp; if(!rwIniTemp.CheckIniFile(gPGisMainCtrlProc.g_strConfigFile)) { gWriteLogApp.WriteLog(FOR_ALARM,"%s [SYS] 系统启动失败,找不到配置文件\n",CTime::GetCurrentTime().Format("%H:%M:%S")); return FALSE; } if(NULL == rwIniTemp.ReadString(_T("GISServer"),_T("LocalIP"),gPGisMainCtrlProc.g_strConfigFile,m_szLocalIP)) { strncpy(m_szLocalIP,"",sizeof(m_szLocalIP)); } if(NULL == (m_nLocalPort = rwIniTemp.GetInt(_T("GISServer"),_T("LocalPort"),gPGisMainCtrlProc.g_strConfigFile))) { m_nLocalPort = 9000; } if(NULL == rwIniTemp.ReadString(_T("GISServer"),_T("StartInfo"),gPGisMainCtrlProc.g_strConfigFile,m_szStartInfo)) { strncpy(m_szStartInfo,_T("服务启动成功!"),sizeof(m_szStartInfo)); } if(NULL == rwIniTemp.ReadString(_T("GISServer"),_T("ErrorInfo"),gPGisMainCtrlProc.g_strConfigFile,m_szErrorInfo)) { strncpy(m_szErrorInfo,_T("服务启动失败!"),sizeof(m_szErrorInfo)); } return TRUE; }
//设置日志 void CGPSProc::SetLog() { Crwini rwIniTemp; CString tempstr =_T("pGisPubNetCfg.ini"); if(rwIniTemp.CheckIniFile(tempstr)) { //日志级别 int nTempLevel; int nTempV; nTempLevel = rwIniTemp.GetInt(_T("SystemSet"),_T("LogLevel"),tempstr); nTempV = rwIniTemp.GetInt(_T("SystemSet"),_T("LogFileCleanupDate"),tempstr); gWriteLogApp.StartLog("GpsPublicNetLog",nTempLevel,nTempV); } }
BOOL CGPSProc::LoadIOCPSystemConfig() { Crwini rwIniTemp; CString tempstr =_T("pGisPubNetCfg.ini"); if(!rwIniTemp.CheckIniFile(tempstr)) { gWriteLogApp.WriteLog(FOR_ALARM,"%s [SYS] 系统启动失败,找不到配置文件\n",CTime::GetCurrentTime().Format("%H:%M:%S")); return FALSE; } if(0 == (m_dwMaxConnect = rwIniTemp.GetInt(_T("NetSet"),_T("MaxConnect"),tempstr))) { m_dwMaxConnect = 20000; } if(0 == (m_dwAcceptTime = rwIniTemp.GetInt(_T("NetSet"),_T("AcceptTime"),tempstr))) { m_dwAcceptTime = 10; } if(0 == (m_dwIdleOverTime = rwIniTemp.GetInt(_T("NetSet"),_T("IdleOverTime"),tempstr))) { m_dwIdleOverTime = 100; } if(0 == (m_dwHeartBeatTime = rwIniTemp.GetInt(_T("NetSet"),_T("HeartBeatTime"),tempstr))) { m_dwHeartBeatTime = 30; } if(0 == (m_dwTimeAutoConnect = rwIniTemp.GetInt(_T("NetSet"),_T("TimeAutoConnect"),tempstr))) { m_dwTimeAutoConnect = 5; } if(0 == (m_dwIODataCount = rwIniTemp.GetInt(_T("NetSet"),_T("IODataCount"),tempstr))) { m_dwIODataCount = 10; } if(0 == (m_dwIODataBuffer = rwIniTemp.GetInt(_T("NetSet"),_T("IODataBuffer"),tempstr))) { m_dwIODataBuffer = 1024; } if(0 == (m_nSocketBuffer = rwIniTemp.GetInt(_T("NetSet"),_T("SocketBuffer"),tempstr))) { m_nSocketBuffer = 8096; } if(rwIniTemp.ReadString(_T("OldTer"),_T("LocalIP"),tempstr,m_szOldLocalIP) == 0) { strncpy(m_szOldLocalIP,"",sizeof(m_szOldLocalIP)); } if(0 == (m_nOldLocalPort = rwIniTemp.GetInt(_T("OldTer"),_T("LocalPort"),tempstr))) { m_nOldLocalPort = 9001; } if(rwIniTemp.ReadString(_T("OldTer"),_T("StartInfo"),tempstr,m_szOldStartInfo) == 0) { strncpy(m_szOldStartInfo,_T("服务启动成功!"),sizeof(m_szOldStartInfo)); } if(rwIniTemp.ReadString(_T("OldTer"),_T("ErrorInfo"),tempstr,m_szOldErrorInfo) == 0) { strncpy(m_szOldErrorInfo,_T("服务启动失败!"),sizeof(m_szOldErrorInfo)); } if(rwIniTemp.ReadString(_T("NewTer"),_T("LocalIP"),tempstr,m_szNewLocalIP) == 0) { strncpy(m_szNewLocalIP,"",sizeof(m_szOldLocalIP)); } if(0 == (m_nNewLocalPort = rwIniTemp.GetInt(_T("NewTer"),_T("LocalPort"),tempstr))) { m_nNewLocalPort = 9002; } if(rwIniTemp.ReadString(_T("NewTer"),_T("StartInfo"),tempstr,m_szNewStartInfo) == 0) { strncpy(m_szNewStartInfo,_T("服务启动成功!"),sizeof(m_szNewStartInfo)); } if(rwIniTemp.ReadString(_T("NewTer"),_T("ErrorInfo"),tempstr,m_szNewErrorInfo) == 0) { strncpy(m_szNewErrorInfo,_T("服务启动失败!"),sizeof(m_szNewErrorInfo)); } if(rwIniTemp.ReadString(_T("PubToCon"),_T("LocalIP"),tempstr,m_szPubToConLocalIP) == 0) { strncpy(m_szPubToConLocalIP,"",sizeof(m_szPubToConLocalIP)); } if(rwIniTemp.ReadString(_T("PubToCon"),_T("RemoteIP"),tempstr,m_szPubToConRemoteIP) == 0) { strncpy(m_szPubToConRemoteIP,"",sizeof(m_szPubToConRemoteIP)); } if(0 == (m_nPubToConPort = rwIniTemp.GetInt(_T("PubToCon"),_T("RemotePort"),tempstr))) { m_nPubToConPort = 9003; } if(rwIniTemp.ReadString(_T("PubToCon"),_T("StartInfo"),tempstr,m_szPubToConStartInfo) == 0) { strncpy(m_szPubToConStartInfo,_T("服务启动成功!"),sizeof(m_szPubToConStartInfo)); } if(rwIniTemp.ReadString(_T("PubToCon"),_T("ErrorInfo"),tempstr,m_szPubToConErrorInfo) == 0) { strncpy(m_szPubToConErrorInfo,_T("服务启动失败!"),sizeof(m_szPubToConErrorInfo)); } if(0 == (m_nPubToConLocalPort = rwIniTemp.GetInt(_T("PubToCon"),_T("LocalPort"),tempstr))) { m_nPubToConLocalPort = 9004; } if(0 == (m_Udp = rwIniTemp.GetInt(_T("PubToCon"),_T("UDP"),tempstr))) { m_Udp = 0; } return TRUE; }
//读取系统配置数据 BOOL CGPSProc::LoadSystemConfig() { Crwini rwIniTemp; CString tempstr =_T("pGisPubNetCfg.ini"); if(!rwIniTemp.CheckIniFile(tempstr)) { gWriteLogApp.WriteLog(FOR_ALARM,"%s [SYS] 系统启动失败,找不到配置文件\n",CTime::GetCurrentTime().Format("%H:%M:%S")); return FALSE; } //当GPRS连接登录后GPS开启模式 m_nOpenGpsModel = rwIniTemp.GetInt(_T("SystemSet"),_T("OpenGpsModel"),tempstr); if(m_nOpenGpsModel > 0 ) { //默认设置GPS主动上传时间间隔 m_nInitFixGpsDt = rwIniTemp.GetInt(_T("SystemSet"),_T("DefaultFixGpsDt"),tempstr); if(m_nInitFixGpsDt <= 0) { m_nOpenGpsModel = 0; } else { if(m_nInitFixGpsDt >= 60) { m_nOpenGpsModel = 1; } else { if(m_nInitFixGpsDt < 5) //不能低于5s { m_nInitFixGpsDt = 5; } m_nOpenGpsModel = 2; } } //GSP次数 m_nMonitorGPSCount = rwIniTemp.GetInt(_T("SystemSet"),_T("MonitorGPSCount"),tempstr); if(m_nMonitorGPSCount <= 0) { m_nMonitorGPSCount = 0; } } m_nPubNetServerPort = rwIniTemp.GetInt(_T("TCPSet"),_T("PubNetServerPort"),tempstr); if(m_nPubNetServerPort == 0) { m_nPubNetServerPort = 5002; } if(rwIniTemp.ReadString(_T("TCPSet"),_T("PubNetServerIP"),tempstr,m_LocalIpAddress) == 0) { //return FALSE; } m_nLoginTimeOut = rwIniTemp.GetInt(_T("SystemSet"),_T("LoginTimeOut"),tempstr); m_nConnTickTimeOut = rwIniTemp.GetInt(_T("SystemSet"),_T("ConnTickTimeOut"),tempstr); m_bDispatchZeroGPS = FALSE; if(rwIniTemp.GetInt(_T("SystemSet"),_T("DispatchZeroGPS"),tempstr) > 0) { m_bDispatchZeroGPS = TRUE; } //读取内外码转换参数 m_nL = rwIniTemp.GetInt(_T("SetCpsx"),_T("L"),tempstr); m_nM = rwIniTemp.GetInt(_T("SetCpsx"),_T("M"),tempstr); m_nS = rwIniTemp.GetInt(_T("SetCpsx"),_T("S"),tempstr); //消息重发超时 m_nReSendWaitAckTimeOut = rwIniTemp.GetInt(_T("SystemSet"),_T("ReSendWaitAckTimeOut"),tempstr); //发生文字消息时间间隔 g_nSendTxtMsgInterval = rwIniTemp.GetInt(_T("SystemSet"),_T("SendTxtMsgInterval"),tempstr); if(g_nSendTxtMsgInterval <= 0 ) { g_nSendTxtMsgInterval = 1; } return TRUE; }