public CommunicationManager(string baud, string par, string sBits, string dBits, string name, CommonClass.MyRichTextBox rtb, MyPanel pnl, MyPanel pn_SVs, MyPanel pn_Loc, ReceiverType rx) { this._ok2send = true; this.SendFlag = 1; this._baudRate = string.Empty; this._parity = string.Empty; this._stopBits = string.Empty; this._dataBits = string.Empty; this._portName = string.Empty; this._portNum = "-1"; this._TTBPortNum = "-1"; this._rxName = string.Empty; this._sourceDeviceName = string.Empty; this._readBuffer = 0x2000; this._lowPowerParams = new lowPowerParams(); this.comPort = new CommWrapper(); this.SrcDeviceName = string.Empty; this.lockread = new object(); this.lockwrite = new object(); this._protocol = "SSB"; this._rxType = ReceiverType.SLC; this.m_Protocols = new MsgFactory(ConfigurationManager.AppSettings["InstalledDirectory"] + @"\Protocols\Protocols.xml"); this.m_NavData = new NavigationAnalysisData(ConfigurationManager.AppSettings["InstalledDirectory"] + @"\Protocols\ReferenceLocation.xml"); this.m_TestSetup = new TestSetup(); this._productFamily = CommonClass.ProductType.GSD4e; this._trackerPort = string.Empty; this._resetPort = string.Empty; this._hostPair1 = string.Empty; this._requiredRunHost = true; this._hostSWFilePath = string.Empty; this._hostAppCfgFilePath = string.Empty; this._hostAppMEMSCfgPath = string.Empty; this._I2CmasterAddr = string.Empty; this._I2CslaveAddr = string.Empty; this._I2Cport = string.Empty; this.DefaultTCXOFreq = string.Empty; this.TrackerPortSelect = "uart"; this.OnOffLineUsage = "uart_cts"; this.ExtSResetNLineUsage = "uart_dtr"; this.WarmupDelay = 0x3ff; this.DebugSettings = 1; this.IsVersion4_1_A8AndAbove = true; this._requireEE = true; this._eeSelected = string.Empty; this._serverName = string.Empty; this._serverPort = string.Empty; this._authenCode = string.Empty; this._eeDayNum = string.Empty; this._bankTime = string.Empty; this.dataGui = new DataForGUI(); this.dataGui_ALL = new DataForGUI(60); this.SignalDataQ_ALL = new Queue<SignalData>(); this.TotalOfGroupMsg1 = 1; this.dataICTrack = new TrackerIC(); this.RxCtrl = new Receiver(); this.AutoReplyCtrl = new AutoReplyMgr(); this.TTBPort = new CommWrapper(); this.TrackerICCtrl = new TrackerIC(); this.SiRFNavStartStop = new SiRFNavParams(); this.NavigationParamrters = new NavigationParametersClass(); this.NavSolutionParams = new NavSolutionClass(); this.ConnectErrorString = string.Empty; this._hwCfgMsgQName = string.Empty; this._timeAidMsgQName = string.Empty; this._freqAidMsgQName = string.Empty; this._posAidMsgQName = string.Empty; this._posReqAckMsgQName = string.Empty; this._autoReplyConfigFilePath = clsGlobal.InstalledDirectory + @"\scripts\SiRFLiveAutomationSetupAutoReply.cfg"; this.ErrorLogFilePath = string.Empty; this.DisplayQueue = new Queue(MAX_MSG_BUFFER); this.ToSwitchProtocol = "OSP"; this.ToSwitchBaud = "115200"; this._messageProtocol = "OSP"; this._currentProtocol = "OSP"; this._currentBaud = "115200"; this._IMUFilePath = ""; this._aidingProtocol = "SSB"; this._myWindowTitle = string.Empty; this._CSVBuff = new byte[MAX_BYTES_BUFFER]; this._enableLocationMapView = true; this._enableSignalView = true; this._enableSVsMap = true; this._enableSatelliteStats = true; this._monitorNav = true; this._enableMEMSView = true; this._enableCompassView = true; this._locationMapRadius = 5.0; this._responseViewRTBDisplay = new CommonUtilsClass(); this._errorViewRTBDisplay = new CommonUtilsClass(); this._debugViewRTBDisplay = new CommonUtilsClass(); this.StringRxNavParams = string.Empty; this._helperFunctions = new HelperFunctions(); this._dataReadLock = new object(); this.DisplayDataLock = new object(); this._inDataBytes = new List<byte>(); this.ErrorStringList = new List<string>(); this.LockErrorLog = new object(); this.ErrorCfgFilePath = clsGlobal.InstalledDirectory + @"\Config\errorLists.cfg"; this.UserSpecifiedLogCfgFilePath = clsGlobal.InstalledDirectory + @"\Config\userMessageLists.cfg"; this.UserSpecifiedMsgList = new List<string>(); this.UserSpecifiedSubStringList = new List<string>(); this.StringDRNavStatus = string.Empty; this.StringDRNavState = string.Empty; this.StringDRNavSubsystemData = string.Empty; this.StringDRInputCarBusData = string.Empty; this.StringDRSensorData = string.Empty; this.I2CModeSwitchDone = true; this.NavTruthDataHash = new Hashtable(); this._debugViewMatchStr = string.Empty; this.ToSendMsgQueue = new Queue(); this._lockwrite = new object(); this.MAX_SIG_BUFFER = 5; this.LockSignalDataUpdate = new object(); this.LockSignalDataUpdate_ALL = new object(); this.SignalDataQ = new Queue<SignalData>(); this.NMEA_navMode = "No Fix"; this._lockCommErrorCnt = new object(); this.m_NavData = new NavigationAnalysisData(ConfigurationManager.AppSettings["InstalledDirectory"] + @"\Protocols\ReferenceLocation.xml"); this._baudRate = baud; this._parity = par; this._stopBits = sBits; this._dataBits = dBits; this._portName = name; this._displayPanelSignal = pnl; this._displayPanelSVs = pn_SVs; this._displayPanelLocation = pn_Loc; this._rxType = rx; this._rxType = ReceiverType.SLC; this.RxTransType = TransmissionType.GPS; this._idx_CSVBuff = 0; this._CSVBuff.Initialize(); this._b1 = 0; this._b2 = 0; this._nmea_Str = ""; this._lastAidingSessionReportedClockDrift = 0.0; this._lastClockDrift = 0; }
public CommunicationManager(bool hasPlotData) { this._ok2send = true; this.SendFlag = 1; this._baudRate = string.Empty; this._parity = string.Empty; this._stopBits = string.Empty; this._dataBits = string.Empty; this._portName = string.Empty; this._portNum = "-1"; this._TTBPortNum = "-1"; this._rxName = string.Empty; this._sourceDeviceName = string.Empty; this._readBuffer = 0x2000; this._lowPowerParams = new lowPowerParams(); this.comPort = new CommWrapper(); this.SrcDeviceName = string.Empty; this.lockread = new object(); this.lockwrite = new object(); this._protocol = "SSB"; this._rxType = ReceiverType.SLC; this.m_Protocols = new MsgFactory(ConfigurationManager.AppSettings["InstalledDirectory"] + @"\Protocols\Protocols.xml"); this.m_NavData = new NavigationAnalysisData(ConfigurationManager.AppSettings["InstalledDirectory"] + @"\Protocols\ReferenceLocation.xml"); this.m_TestSetup = new TestSetup(); this._productFamily = CommonClass.ProductType.GSD4e; this._trackerPort = string.Empty; this._resetPort = string.Empty; this._hostPair1 = string.Empty; this._requiredRunHost = true; this._hostSWFilePath = string.Empty; this._hostAppCfgFilePath = string.Empty; this._hostAppMEMSCfgPath = string.Empty; this._I2CmasterAddr = string.Empty; this._I2CslaveAddr = string.Empty; this._I2Cport = string.Empty; this.DefaultTCXOFreq = string.Empty; this.TrackerPortSelect = "uart"; this.OnOffLineUsage = "uart_cts"; this.ExtSResetNLineUsage = "uart_dtr"; this.WarmupDelay = 0x3ff; this.DebugSettings = 1; this.IsVersion4_1_A8AndAbove = true; this._requireEE = true; this._eeSelected = string.Empty; this._serverName = string.Empty; this._serverPort = string.Empty; this._authenCode = string.Empty; this._eeDayNum = string.Empty; this._bankTime = string.Empty; this.dataGui = new DataForGUI(); this.dataGui_ALL = new DataForGUI(60); this.SignalDataQ_ALL = new Queue<SignalData>(); this.TotalOfGroupMsg1 = 1; this.dataICTrack = new TrackerIC(); this.RxCtrl = new Receiver(); this.AutoReplyCtrl = new AutoReplyMgr(); this.TTBPort = new CommWrapper(); this.TrackerICCtrl = new TrackerIC(); this.SiRFNavStartStop = new SiRFNavParams(); this.NavigationParamrters = new NavigationParametersClass(); this.NavSolutionParams = new NavSolutionClass(); this.ConnectErrorString = string.Empty; this._hwCfgMsgQName = string.Empty; this._timeAidMsgQName = string.Empty; this._freqAidMsgQName = string.Empty; this._posAidMsgQName = string.Empty; this._posReqAckMsgQName = string.Empty; this._autoReplyConfigFilePath = clsGlobal.InstalledDirectory + @"\scripts\SiRFLiveAutomationSetupAutoReply.cfg"; this.ErrorLogFilePath = string.Empty; this.DisplayQueue = new Queue(MAX_MSG_BUFFER); this.ToSwitchProtocol = "OSP"; this.ToSwitchBaud = "115200"; this._messageProtocol = "OSP"; this._currentProtocol = "OSP"; this._currentBaud = "115200"; this._IMUFilePath = ""; this._aidingProtocol = "SSB"; this._myWindowTitle = string.Empty; this._CSVBuff = new byte[MAX_BYTES_BUFFER]; this._enableLocationMapView = true; this._enableSignalView = true; this._enableSVsMap = true; this._enableSatelliteStats = true; this._monitorNav = true; this._enableMEMSView = true; this._enableCompassView = true; this._locationMapRadius = 5.0; this._responseViewRTBDisplay = new CommonUtilsClass(); this._errorViewRTBDisplay = new CommonUtilsClass(); this._debugViewRTBDisplay = new CommonUtilsClass(); this.StringRxNavParams = string.Empty; this._helperFunctions = new HelperFunctions(); this._dataReadLock = new object(); this.DisplayDataLock = new object(); this._inDataBytes = new List<byte>(); this.ErrorStringList = new List<string>(); this.LockErrorLog = new object(); this.ErrorCfgFilePath = clsGlobal.InstalledDirectory + @"\Config\errorLists.cfg"; this.UserSpecifiedLogCfgFilePath = clsGlobal.InstalledDirectory + @"\Config\userMessageLists.cfg"; this.UserSpecifiedMsgList = new List<string>(); this.UserSpecifiedSubStringList = new List<string>(); this.StringDRNavStatus = string.Empty; this.StringDRNavState = string.Empty; this.StringDRNavSubsystemData = string.Empty; this.StringDRInputCarBusData = string.Empty; this.StringDRSensorData = string.Empty; this.I2CModeSwitchDone = true; this.NavTruthDataHash = new Hashtable(); this._debugViewMatchStr = string.Empty; this.ToSendMsgQueue = new Queue(); this._lockwrite = new object(); this.MAX_SIG_BUFFER = 5; this.LockSignalDataUpdate = new object(); this.LockSignalDataUpdate_ALL = new object(); this.SignalDataQ = new Queue<SignalData>(); this.NMEA_navMode = "No Fix"; this._lockCommErrorCnt = new object(); if (hasPlotData) { this.dataPlot = new DataForPlotting(); } this.m_NavData = new NavigationAnalysisData(ConfigurationManager.AppSettings["InstalledDirectory"] + @"\Protocols\ReferenceLocation.xml"); this._baudRate = "115200"; this._parity = "None"; this._stopBits = "1"; this._dataBits = "8"; this._portName = "COM8"; this._rxType = ReceiverType.SLC; this.RxTransType = TransmissionType.GPS; this.LogFormat = TransmissionType.GPS; this._idx_CSVBuff = 0; this._CSVBuff.Initialize(); this._b1 = 0; this._b2 = 0; this._nmea_Str = ""; this._lastAidingSessionReportedClockDrift = 0.0; this._lastClockDrift = 0; this._log = new LogManager(clsGlobal.SiRFLiveVersion); this.CMC = new CommMgrClass(); if (File.Exists(this.ErrorCfgFilePath)) { this.ErrorStringList.Clear(); StreamReader reader = new StreamReader(this.ErrorCfgFilePath); string str = reader.ReadLine(); if ((str != null) && (str != string.Empty)) { foreach (string str2 in str.Split(new char[] { '%' })) { string str3 = str2.TrimEnd(new char[0]); this.ErrorStringList.Add(str3.TrimStart(new char[0])); } } reader.Close(); reader.Dispose(); reader = null; } if (File.Exists(this.UserSpecifiedLogCfgFilePath)) { this.UserSpecifiedMsgList.Clear(); this.UserSpecifiedSubStringList.Clear(); StreamReader reader2 = new StreamReader(this.UserSpecifiedLogCfgFilePath); string str4 = reader2.ReadLine(); if ((str4 != null) && (str4 != string.Empty)) { foreach (string str5 in str4.Split(new char[] { '%' })) { string str6 = str5.TrimEnd(new char[0]); this.UserSpecifiedMsgList.Add(str6.TrimStart(new char[0])); } str4 = reader2.ReadLine(); } if ((str4 != null) && (str4 != string.Empty)) { foreach (string str7 in str4.Split(new char[] { '%' })) { string str8 = str7.TrimEnd(new char[0]); this.UserSpecifiedSubStringList.Add(str8.TrimStart(new char[0])); } } if (this.UserSpecifiedSubStringList.Count < this.UserSpecifiedMsgList.Count) { int num = this.UserSpecifiedMsgList.Count - this.UserSpecifiedSubStringList.Count; for (int i = 0; i < num; i++) { this.UserSpecifiedSubStringList.Add("Y"); } } reader2.Close(); reader2.Dispose(); reader2 = null; } }
private void cleanupClass() { this.dataGui = null; if (this.dataPlot != null) { this.dataPlot.Dispose(); this.dataPlot = null; } if (this._debugViewRTBDisplay != null) { this._debugViewRTBDisplay = null; } if (this._displayPanelCompass != null) { this._displayPanelCompass.Dispose(); this._displayPanelCompass = null; } if (this._displayPanelDRSensors != null) { this._displayPanelDRSensors.Dispose(); this._displayPanelDRSensors = null; } if (this._displayPanelDRStatusStates != null) { this._displayPanelDRStatusStates.Dispose(); this._displayPanelDRStatusStates = null; } if (this._displayPanelLocation != null) { this._displayPanelLocation.Dispose(); this._displayPanelLocation = null; } if (this._displayPanelMEMS != null) { this._displayPanelMEMS.Dispose(); this._displayPanelMEMS = null; } if (this._displayPanelPitch != null) { this._displayPanelPitch.Dispose(); this._displayPanelPitch = null; } if (this._displayPanelRoll != null) { this._displayPanelRoll.Dispose(); this._displayPanelRoll = null; } if (this._displayPanelSatelliteStats != null) { this._displayPanelSatelliteStats.Dispose(); this._displayPanelSatelliteStats = null; } if (this._displayPanelSignal != null) { this._displayPanelSignal.Dispose(); this._displayPanelSignal = null; } if (this._displayPanelSVs != null) { this._displayPanelSVs.Dispose(); this._displayPanelSVs = null; } if (this._displayPanelSVTraj != null) { this._displayPanelSVTraj.Dispose(); this._displayPanelSVTraj = null; } if (this._errorViewRTBDisplay != null) { this._errorViewRTBDisplay = null; } if (this._responseViewRTBDisplay != null) { this._responseViewRTBDisplay = null; } if (this.RxCtrl != null) { this.RxCtrl.Dispose(); this.RxCtrl = null; } this.ListenersCtrl = null; this.AutoReplyCtrl = null; if (this.TTBPort != null) { this.TTBPort.Dispose(); this.TTBPort = null; } if (this.comPort != null) { this.comPort.Dispose(); this.comPort = null; } this.NavigationParamrters = null; this.NavTruthDataHash = null; this.NavSolutionParams = null; this.TrackerICCtrl = null; this.SiRFNavStartStop = null; this.m_NavData = null; this._CSVBuff = null; this.m_Protocols.Dispose(); this.m_Protocols = null; this.CMC = null; this.Log = null; this.ToSendMsgQueue.Clear(); this.ToSendMsgQueue = null; this.ErrorStringList.Clear(); this.ErrorStringList = null; this.UserSpecifiedMsgList.Clear(); this.UserSpecifiedMsgList = null; this.UserSpecifiedSubStringList.Clear(); this.UserSpecifiedSubStringList = null; this._inDataBytes.Clear(); this._inDataBytes = null; }
public bool OpenTTBPort(int comNumber) { if (this.TTBPort != null) { try { if (this.TTBPort.IsOpen) { this.TTBPort.Close(); this.TTBPort = new CommWrapper(); } this.TTBPort.PortName = "COM" + comNumber.ToString(); this.TTBPort.BaudRate = 0xe100; this.TTBPort.DataBits = 8; this.TTBPort.Parity = (OpenNETCF.IO.Serial.Parity) Enum.Parse(typeof(OpenNETCF.IO.Serial.Parity), "None"); this.TTBPort.StopBits = (OpenNETCF.IO.Serial.StopBits) Enum.Parse(typeof(OpenNETCF.IO.Serial.StopBits), "One"); this.TTBPort.Open(); return true; } catch (Exception exception) { string str = "Open TTB port: " + exception.Message; this.ErrorPrint(str); return false; } } string errorStr = "Open TTB port not specified"; this.ErrorPrint(errorStr); return false; }