示例#1
0
 public void DisplayData(CommonClass.MessageType type, string msg)
 {
     EventHandler method = null;
     try
     {
         if (((this._displayWindow != null) && !this._viewPause) && !this._displayWindow.IsDisposed)
         {
             if (this._displayWindow != null)
             {
                 if (this._displayWindow.InvokeRequired)
                 {
                     if (method == null)
                     {
                         method = delegate {
                             this.localDisplayData(type, msg);
                         };
                     }
                     this._displayWindow.BeginInvoke(method);
                 }
                 else
                 {
                     this.localDisplayData(type, msg);
                 }
             }
             else
             {
                 MessageBox.Show("CommonUtilsClass: DisplayData() _displayWindow is null", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
             }
         }
     }
     catch (Exception exception)
     {
         MessageBox.Show("Error: " + exception.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
     }
 }
示例#2
0
 private void localDisplayData(CommonClass.MessageType type, string msg)
 {
     if (this.LineCount > this.MAX_LINE)
     {
         this._displayWindow.Clear();
         this.LineCount = 0;
     }
     if (type == CommonClass.MessageType.Matching)
     {
         this._displayWindow.SelectionFont = new Font(this._displayWindow.SelectionFont, FontStyle.Bold);
     }
     else
     {
         this._displayWindow.SelectionFont = new Font(this._displayWindow.SelectionFont, FontStyle.Regular);
     }
     this._displayWindow.SelectionColor = CommonClass.MessageColor[(int) type];
     this._displayWindow.AppendText(msg);
     if (!msg.Contains("\r\n"))
     {
         this._displayWindow.AppendText("\r\n");
     }
     this._displayWindow.ScrollToBottom();
 }
示例#3
0
        private void SetViewTypeAndUpdateMenuCheck(CommonClass.TransmissionType viewType)
        {
            this.hexToolStripMenuItem.Checked = false;
            this.aSCIIToolStripMenuItem.Checked = false;
            this.sSBToolStripMenuItem.Checked = false;
            this.gP2ToolStripMenuItem.Checked = false;
            this.cSVToolStripMenuItem.Checked = false;
            this._viewType = CommonClass.TransmissionType.GP2;
            switch (viewType)
            {
                case CommonClass.TransmissionType.Text:
                    this.aSCIIToolStripMenuItem.Checked = true;
                    this._viewType = CommonClass.TransmissionType.Text;
                    this.comm.RxCurrentTransmissionType = CommunicationManager.TransmissionType.Text;
                    return;

                case CommonClass.TransmissionType.Hex:
                    this.hexToolStripMenuItem.Checked = true;
                    this._viewType = CommonClass.TransmissionType.Hex;
                    this.comm.RxCurrentTransmissionType = CommunicationManager.TransmissionType.Hex;
                    return;

                case CommonClass.TransmissionType.SSB:
                    this.sSBToolStripMenuItem.Checked = true;
                    this._viewType = CommonClass.TransmissionType.SSB;
                    this.comm.RxCurrentTransmissionType = CommunicationManager.TransmissionType.SSB;
                    return;

                case CommonClass.TransmissionType.GP2:
                    this.gP2ToolStripMenuItem.Checked = true;
                    this._viewType = CommonClass.TransmissionType.GP2;
                    this.comm.RxCurrentTransmissionType = CommunicationManager.TransmissionType.GP2;
                    return;

                case CommonClass.TransmissionType.GPS:
                    this.cSVToolStripMenuItem.Checked = true;
                    this._viewType = CommonClass.TransmissionType.GPS;
                    this.comm.RxCurrentTransmissionType = CommunicationManager.TransmissionType.GPS;
                    return;
            }
        }
示例#4
0
 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;
 }
示例#5
0
        public bool File_DataReceived(CommonClass.MessageType type, string inputString, bool match, string matchString, string timeStamp)
        {
            bool flag = false;
            try
            {
                if (matchString == string.Empty)
                {
                    match = false;
                    matchString = @"(\w+)";
                }
                Regex regex = new Regex(matchString, RegexOptions.Compiled);
                if (!this._isFirstCalled)
                {
                    this.SetupRxCtrl();
                    this._isFirstCalled = true;
                }
                if (type == CommonClass.MessageType.Incoming)
                {
                    if (this.RxTransType == TransmissionType.Text)
                    {
                        MessageQData data = new MessageQData();
                        data.MessageId = 0;
                        data.MessageType = CommonClass.MessageType.Incoming;
                        string str = string.Empty;
                        int num = -1;
                        int num2 = -1;
                        int num3 = -1;
                        bool flag2 = false;
                        bool flag3 = false;
                        bool flag4 = false;
                        bool flag5 = false;
                        string timeStampInString = HelperFunctions.GetTimeStampInString();
                        if (this._rxType == ReceiverType.NMEA)
                        {
                            try
                            {
                                object obj2;
                                str = inputString.Trim(new char[] { '\n', '\r' });
                                if (!str.StartsWith("$"))
                                {
                                    goto Label_024E;
                                }
                                string str8 = str.Substring(0, 6);
                                if (str8 != null)
                                {
                                    if (!(str8 == "$GPGGA"))
                                    {
                                        if (((str8 == "$GPGSV") || (str8 == "$GPRMC")) || (str8 == "$GPGSA"))
                                        {
                                            goto Label_010D;
                                        }
                                    }
                                    else
                                    {
                                        num = 0x29;
                                        flag2 = true;
                                    }
                                }
                                goto Label_0110;
                            Label_010D:
                                flag2 = true;
                            Label_0110:
                                Monitor.Enter(obj2 = this.ListenersCtrl.ListenerLock);
                                try
                                {
                                    foreach (string str4 in this.ListenersCtrl.ListenerList.Keys)
                                    {
                                        ListenerContent content = (ListenerContent) this.ListenersCtrl.ListenerList[str4];
                                        if ((content.Source == 0) && content.State)
                                        {
                                            if (content.Chan > 0)
                                            {
                                                if (content.Chan == num2)
                                                {
                                                    flag3 = true;
                                                }
                                            }
                                            else
                                            {
                                                flag3 = true;
                                            }
                                            if (content.MsgId > 0)
                                            {
                                                if (content.MsgId == num)
                                                {
                                                    flag4 = true;
                                                }
                                            }
                                            else
                                            {
                                                flag4 = true;
                                            }
                                            if (content.SubId > 0)
                                            {
                                                if (content.SubId == num3)
                                                {
                                                    flag5 = true;
                                                }
                                            }
                                            else
                                            {
                                                flag5 = true;
                                            }
                                            if ((flag3 && flag4) && flag5)
                                            {
                                                content.MessageText = str;
                                                content.MessageTime = timeStampInString;
                                            }
                                            flag3 = flag4 = flag5 = false;
                                        }
                                    }
                                }
                                finally
                                {
                                    Monitor.Exit(obj2);
                                }
                                if (flag2)
                                {
                                    this.getSignalForGUI_NMEA(str);
                                }
                                data.MessageText = str;
                                this.DebugPrint(CommonClass.MessageType.Incoming, str);
                                this._log.WriteLine(str);
                                return flag;
                            Label_024E:
                                this.DebugPrint(CommonClass.MessageType.Incoming, str);
                                this._log.WriteLine(str);
                            }
                            catch (Exception exception)
                            {
                                this.ErrorPrint(exception.Message);
                            }
                            return flag;
                        }
                        str = inputString;
                        this.DebugPrint(CommonClass.MessageType.Incoming, str);
                        this._log.WriteLine(str);
                        return flag;
                    }
                    if (this.RxTransType == TransmissionType.Hex)
                    {
                        if (match)
                        {
                            flag = regex.IsMatch(inputString);
                            if (flag)
                            {
                                type = CommonClass.MessageType.Error;
                            }
                        }
                        this.DebugPrint(type, inputString);
                        this._log.WriteLine(inputString);
                        return flag;
                    }
                    byte[] buffer = HelperFunctions.HexToByte(inputString);
                    string str5 = string.Empty;
                    string[] separator = new string[] { "\r\n" };
                    string input = string.Empty;
                    foreach (byte num4 in buffer)
                    {
                        this._inDataBytes.Add(num4);
                    }
                    str5 = this.ByteToMsgQueue(new byte[0]);
                    if (str5.Length != 0)
                    {
                        foreach (string str7 in str5.Split(separator, StringSplitOptions.None))
                        {
                            if (str7.Length == 0)
                            {
                                continue;
                            }
                            switch (this.RxTransType)
                            {
                                case TransmissionType.SSB:
                                    input = str7;
                                    break;

                                case TransmissionType.GP2:
                                    input = CommonUtilsClass.LogToGP2(str7, timeStamp);
                                    break;

                                case TransmissionType.GPS:
                                    input = this.LogToCSV(str7);
                                    break;

                                default:
                                    input = str7;
                                    break;
                            }
                            if (match)
                            {
                                flag = regex.IsMatch(input);
                                if (flag)
                                {
                                    type = CommonClass.MessageType.Matching;
                                }
                            }
                            if (this._isCheckEpoch && this._isEpochMessage)
                            {
                                flag = true;
                                this._isCheckEpoch = false;
                            }
                            this.DebugPrint(type, input);
                        }
                    }
                    return flag;
                }
                if (match)
                {
                    flag = regex.IsMatch(inputString);
                    if (flag)
                    {
                        type = CommonClass.MessageType.Matching;
                    }
                }
                if (this._isCheckEpoch && this._isEpochMessage)
                {
                    flag = true;
                    this._isCheckEpoch = false;
                }
                this.DebugPrint(type, inputString);
                this._log.WriteLine(inputString);
            }
            catch (Exception exception2)
            {
                this.ErrorPrint(exception2.ToString());
            }
            return flag;
        }
示例#6
0
 public void DebugPrint(CommonClass.MessageType type, string inputData)
 {
     if (this.DebugViewRTBDisplay != null)
     {
         CommonUtilsClass debugViewRTBDisplay = this.DebugViewRTBDisplay;
         debugViewRTBDisplay.LineCount++;
         this.DebugViewRTBDisplay.DisplayData(type, inputData);
     }
 }
示例#7
0
 public virtual void WriteData(CommonClass.MyRichTextBox display, string msg)
 {
 }