Beispiel #1
0
            public bool Parse(string nmea_string)
            {
                bool result = false;

                this.NMEAString = nmea_string;

                string raw_string = nmea_string.Substring(0, nmea_string.IndexOf('*'));

                this.CheckSum = nmea_string.Substring(nmea_string.IndexOf('*') + 1);
                string calculated = NMEAHelper.CalculateChecksum(nmea_string);

                this.Checked = (calculated == this.CheckSum);

                string[] field = raw_string.Split(NMEADelimiter);
                this.Time              = NMEAHelper.parseTime(field[INDEX_TIME]);
                this.Longitude         = NMEAHelper.parseLongitude(field[INDEX_LONGITUDE], field[INDEX_LONGITUDE_HEMISPHERE]);
                this.Latitude          = NMEAHelper.parseLatitude(field[INDEX_LATITUDE], field[INDEX_LATITUDE_HEMISPHERE]);
                this.Fix               = NMEAHelper.parseFixQuality(field[INDEX_FIX_QUALITY]);
                this.Satelites         = NMEAHelper.parseInt(field[INDEX_SATLITES]);
                this.HDOP              = NMEAHelper.parseFloat(field[INDEX_HDOP]);
                this.Altitude          = NMEAHelper.parseAltitude(field[INDEX_ALTITUDE], field[INDEX_ALTITUDE_DIMENSIONS]);
                this.Geoid             = NMEAHelper.parseGeoid(field[INDEX_GEOID], field[INDEX_GEOID_DIMENSIONS]);
                this.DGPS_Elapsed_Time = NMEAHelper.parseFloat(field[INDEX_DGPS_UPDATE]);
                this.DGPS_ID           = field[INDEX_DGPS_ID];
                return(result);
            }
Beispiel #2
0
            public bool Parse(string nmea_string)
            {
                bool result = false;

                this.NMEAString = nmea_string;

                string raw_string = nmea_string.Substring(0, nmea_string.IndexOf('*'));

                this.CheckSum = nmea_string.Substring(nmea_string.IndexOf('*') + 1);
                string calculated = NMEAHelper.CalculateChecksum(nmea_string);

                this.Checked = (calculated == this.CheckSum);

                string[] field = raw_string.Split(NMEADelimiter);
                this.Time      = NMEAHelper.parseTime(field[INDEX_TIME]);
                this.Valid     = NMEAHelper.parseValid(field[INDEX_VALID]);
                this.Latitude  = NMEAHelper.parseLatitude(field[INDEX_LATITUDE], field[INDEX_LATITUDE_HEMISPHERE]);
                this.Longitude = NMEAHelper.parseLongitude(field[INDEX_LONGITUDE], field[INDEX_LONGITUDE_HEMISPHERE]);

                this.Speed   = NMEAHelper.parseFloat(field[INDEX_SPEED]);
                this.Bearing = NMEAHelper.parseFloat(field[INDEX_BEARING]);
                this.Date    = NMEAHelper.parseDate(field[INDEX_DATE]);

                this.MagneticVariation = NMEAHelper.parseFloat(field[INDEX_MAG_VARI]);
                this.MagneticDeviation = NMEAHelper.parseDeviation(field[INDEX_MAG_DEV]);
                this.Mode = (field.Count() > INDEX_MODE) ? NMEAHelper.parseMode(field[INDEX_MODE]) : ModeIndicator.Data_not_valid;
                return(result);
            }