Пример #1
0
            /// <summary>
            /// Set any possible values for the given NMEA data.
            /// It will continue to replace
            /// the values so the last value is used as the final value.
            /// </summary>
            /// <param name="sentence">NMEA sentence containing data.</param>
            private void SetValues(NmeaSentence sentence)
            {
                /*
                 * NMEA specification states that the first two letters of
                 * a sentence may change.  For example, for "$GPGSV" there may be variations such as
                 * "$__GSV" where the first two letters change.  As a result, we need only test the last three
                 * characters.
                 */

                try
                {
                    if (sentence.CommandWord.EndsWith("GGA", StringComparison.Ordinal))
                    {
                        // Yes.  Convert it using the fast pre-parseed constructor
                        GPGGA = new GpggaSentence(sentence.Sentence);

                        // Set the Lat and Lon and time
                    }
                    if (sentence.CommandWord.EndsWith("VTG", StringComparison.Ordinal))
                    {
                        // Yes.  Convert it using the fast pre-parseed constructor
                        GPVTG = new GpvtgSentence(sentence.Sentence);
                    }
                    if (sentence.CommandWord.EndsWith("RMC", StringComparison.Ordinal))
                    {
                        // Yes.  Convert it using the fast pre-parseed constructor
                        GPRMC = new GprmcSentence(sentence.Sentence);
                    }
                    if (sentence.CommandWord.EndsWith("RMF", StringComparison.Ordinal))
                    {
                        // Yes.  Convert it using the fast pre-parseed constructor
                        PGRMF = new PgrmfSentence(sentence.Sentence);
                    }
                    if (sentence.CommandWord.EndsWith("GLL", StringComparison.Ordinal))
                    {
                        // Yes.  Convert it using the fast pre-parseed constructor
                        GPGLL = new GpgllSentence(sentence.Sentence);
                    }
                    if (sentence.CommandWord.EndsWith("GSV", StringComparison.Ordinal))
                    {
                        // Yes.  Convert it using the fast pre-parseed constructor
                        GPGSV = new GpgsvSentence(sentence.Sentence);
                    }
                    if (sentence.CommandWord.EndsWith("GSA", StringComparison.Ordinal))
                    {
                        // Yes.  Convert it using the fast pre-parseed constructor
                        GPGSA = new GpgsaSentence(sentence.Sentence);
                    }
                    if (sentence.CommandWord.EndsWith("HDT", StringComparison.Ordinal))
                    {
                        // Yes.  Convert it using the fast pre-parseed constructor
                        GPHDT = new GphdtSentence(sentence.Sentence);
                    }
                }
                catch (Exception e)
                {
                    log.Error("Error decoding a NMEA sentance.", e);
                }
            }
Пример #2
0
            /// <summary>
            /// Set any possible values for the given NMEA data.
            /// It will continue to replace
            /// the values so the last value is used as the final value.
            /// </summary>
            /// <param name="sentence">NMEA sentence containing data.</param>
            private void SetValues(NmeaSentence sentence)
            {
                /*
                 * NMEA specification states that the first two letters of
                 * a sentence may change.  For example, for "$GPGSV" there may be variations such as
                 * "$__GSV" where the first two letters change.  As a result, we need only test the last three
                 * characters.
                 */

                if (sentence.CommandWord.EndsWith("GGA", StringComparison.Ordinal))
                {
                    // Yes.  Convert it using the fast pre-parseed constructor
                    GPGGA = new GpggaSentence(sentence.Sentence);

                    // Set the Lat and Lon and time
                }
                if (sentence.CommandWord.EndsWith("VTG", StringComparison.Ordinal))
                {
                    // Yes.  Convert it using the fast pre-parseed constructor
                    GPVTG = new GpvtgSentence(sentence.Sentence);
                }
                if (sentence.CommandWord.EndsWith("RMC", StringComparison.Ordinal))
                {
                    // Yes.  Convert it using the fast pre-parseed constructor
                    GPRMC = new GprmcSentence(sentence.Sentence);
                }
                if (sentence.CommandWord.EndsWith("RMF", StringComparison.Ordinal))
                {
                    // Yes.  Convert it using the fast pre-parseed constructor
                    PGRMF = new PgrmfSentence(sentence.Sentence);
                }
                if (sentence.CommandWord.EndsWith("GLL", StringComparison.Ordinal))
                {
                    // Yes.  Convert it using the fast pre-parseed constructor
                    GPGLL = new GpgllSentence(sentence.Sentence);
                }
                if (sentence.CommandWord.EndsWith("GSV", StringComparison.Ordinal))
                {
                    // Yes.  Convert it using the fast pre-parseed constructor
                    GPGSV = new GpgsvSentence(sentence.Sentence);
                }
                if (sentence.CommandWord.EndsWith("GSA", StringComparison.Ordinal))
                {
                    // Yes.  Convert it using the fast pre-parseed constructor
                    GPGSA = new GpgsaSentence(sentence.Sentence);
                }
                if (sentence.CommandWord.EndsWith("HDT", StringComparison.Ordinal))
                {
                    // Yes.  Convert it using the fast pre-parseed constructor
                    GPHDT = new GphdtSentence(sentence.Sentence);
                }
            }