Example #1
0
        // GPGLL  - Geographic Position - Latitude longitude
        // GPRMC  - Recommended Minimum Specific GNSS Sentence
        // GPVTG  - Course over Ground and Ground Speed
        // GPGGA  - GPS Fix Data
        // GPGSA  - GNSS DOPS and Active Satellites
        // GPGSV  - GNSS Satellites in View

        /// <summary>
        /// DispatchSentnce
        /// Sends sentence to a parser based on sentence type
        /// </summary>
        /// <param name="sentence"></param>
        private void DispatchSentence(string sentence)
        {
            if (IsValid(sentence))
            {
                string sentenceType = sentence.Substring(1, 5);
                switch (sentenceType)
                {
                case "GPRMC":
                    RMC = new GPSRMC(sentence.Substring(sentence.IndexOf(',') + 1));
                    OnRMCEvent(RMC);
                    break;

                case "GPGGA":
                    GGA = new GPSGGA(sentence.Substring(sentence.IndexOf(',') + 1));
                    OnGGAEvent(GGA);
                    break;

                case "GPGLL":
                    GLL = new GPSGLL(sentence.Substring(sentence.IndexOf(',') + 1));
                    OnGLLEvent(GLL);
                    break;

                case "GPVTG":
                    VTG = new GPSVTG(sentence.Substring(sentence.IndexOf(',') + 1));
                    OnVTGEvent(VTG);
                    break;

                case "GPGSA":
                    GSA = new GPSGSA(sentence.Substring(sentence.IndexOf(',') + 1));
                    OnGSAEvent(GSA);
                    break;

                case "GPGSV":
                    GSV = new GPSGSV(sentence.Substring(sentence.IndexOf(',') + 1));
                    OnGSVEvent(GSV);
                    break;

                default:
                    break;
                }
            }
        }
Example #2
0
 protected virtual void OnVTGEvent(GPSVTG e)
 {
     VTGEvent(this, e);
 }