/// <summary>
        /// Sentence constructor
        /// </summary>
        public GPGLLGpsSentence(string Sentence) : base(Sentence)
        {
            // Base
            this.SentenceName = "$GPGLL";
            this.Description  = "Geographic Position - Latitude/Longitude";

            // Instance
            _fixed     = isFixed(this.Words[6]);
            _latitude  = new LatitudeLongitude(this.Words[1], this.Words[2]);
            _longitude = new LatitudeLongitude(this.Words[3], this.Words[4]);

            if (this.Words[5].Length == 6)
            {
                // Only HHMMSS
                _uTCPosition = new TimeSpan(
                    0,
                    int.Parse(this.Words[5].Substring(0, 2)),
                    int.Parse(this.Words[5].Substring(2, 2)),
                    int.Parse(this.Words[5].Substring(4, 2)));
            }
            else
            {
                // HHMMSS.MS
                _uTCPosition = new TimeSpan(
                    0,
                    int.Parse(this.Words[5].Substring(0, 2)),
                    int.Parse(this.Words[5].Substring(2, 2)),
                    int.Parse(this.Words[5].Substring(4, 2)),
                    int.Parse(this.Words[5].Substring(7)));
            }
        }
        /// <summary>
        /// Sentence constructor
        /// </summary>
        public GPGLLGpsSentence(string Sentence)
            : base(Sentence)
        {
            // Base
            this.SentenceName = "$GPGLL";
            this.Description = "Geographic Position - Latitude/Longitude";

            // Instance
            _fixed = isFixed(this.Words[6]);
            _latitude = new LatitudeLongitude(this.Words[1], this.Words[2]);
            _longitude = new LatitudeLongitude(this.Words[3], this.Words[4]);

            if(this.Words[5].Length == 6)
            {
                // Only HHMMSS
                _uTCPosition = new TimeSpan(
                    0,
                    int.Parse(this.Words[5].Substring(0, 2)),
                    int.Parse(this.Words[5].Substring(2, 2)),
                    int.Parse(this.Words[5].Substring(4, 2)));
            }
            else
            {
                // HHMMSS.MS
                _uTCPosition = new TimeSpan(
                    0,
                    int.Parse(this.Words[5].Substring(0, 2)),
                    int.Parse(this.Words[5].Substring(2, 2)),
                    int.Parse(this.Words[5].Substring(4, 2)),
                    int.Parse(this.Words[5].Substring(7)));
            }
        }
        /// <summary>
        /// Sentence constructor
        /// </summary>
        public GPRMCGpsSentence(string SentenceInstance)
            : base(SentenceInstance)
        {
            // Base
            SentenceName = "$GPRMC";
            Description = "Recommended Minimum Specific GPS/TRANSIT Data";

            // Instance
            _fixed = isFixed(Words[2]);
            _latitude = new LatitudeLongitude(Words[3], Words[4]);
            _longitude = new LatitudeLongitude(Words[5], Words[6]);
            _speedOverGround = new GpsSpeed(Words[7]);
            if(Words[8] == String.Empty)
            {
                _courseOverGround = -1;
            }
            else
            {
                _courseOverGround = double.Parse(Words[8], new CultureInfo("en-US"));
            }
            _magneticVariation = Words[10];

            if (Words[1].Length != 0)
            {
                try
                {
                    if (Words[1].Length == 6)
                    {
                        // Only HHMMSS
                        _uTCDateTime = new DateTime(
                            int.Parse(Words[9].Substring(4, 2)),
                            int.Parse(Words[9].Substring(2, 2)),
                            int.Parse(Words[9].Substring(0, 2)),
                            int.Parse(Words[1].Substring(0, 2)),
                            int.Parse(Words[1].Substring(2, 2)),
                            int.Parse(Words[1].Substring(4, 2)));
                    }
                    else
                    {
                        // HHMMSS.MS
                        _uTCDateTime = new DateTime(
                            int.Parse(Words[9].Substring(4, 2)),
                            int.Parse(Words[9].Substring(2, 2)),
                            int.Parse(Words[9].Substring(0, 2)),
                            int.Parse(Words[1].Substring(0, 2)),
                            int.Parse(Words[1].Substring(2, 2)),
                            int.Parse(Words[1].Substring(4, 2)),
                            int.Parse(Words[1].Substring(7)));
                    }
                }
                catch(ArgumentNullException){}
            }
        }
Example #4
0
        /// <summary>
        /// Sentence constructor
        /// </summary>
        public GPGGAGpsSentence(string Sentence) : base(Sentence)
        {
            // Base
            SentenceName = "$GPGGA";
            Description  = "Global Positioning System Fixed Data";

            var enUS = new CultureInfo("en-US");

            // Instance
            if (Words[1].Length == 6)
            {
                // Only HHMMSS
                _uTCTime = new TimeSpan(
                    0,
                    int.Parse(Words[1].Substring(0, 2)),
                    int.Parse(Words[1].Substring(2, 2)),
                    int.Parse(Words[1].Substring(4, 2)));
            }
            else
            {
                // HHMMSS.MS
                _uTCTime = new TimeSpan(
                    0,
                    int.Parse(Words[1].Substring(0, 2)),
                    int.Parse(Words[1].Substring(2, 2)),
                    int.Parse(Words[1].Substring(4, 2)),
                    int.Parse(Words[1].Substring(7)));
            }

            _latitude  = new LatitudeLongitude(Words[2], Words[3]);
            _longitude = new LatitudeLongitude(Words[4], Words[5]);
            if (Words[6] != string.Empty)
            {
                _positionFix = (PositionFix)int.Parse(Words[6]);
            }
            if (Words[7] != string.Empty)
            {
                _satelitesUsed = int.Parse(Words[7]);
            }
            if (Words[8] != string.Empty)
            {
                _hDOP = double.Parse(Words[8], enUS);
            }
            if (Words[9] != string.Empty)
            {
                _altitude = double.Parse(Words[9], enUS);
            }
            if (Words[11] != string.Empty)
            {
                _geoidSeparation = double.Parse(Words[11], enUS);
            }
        }
Example #5
0
        /// <summary>
        /// Sentence constructor
        /// </summary>
        public GPRMCGpsSentence(string SentenceInstance) : base(SentenceInstance)
        {
            // Base
            SentenceName = "$GPRMC";
            Description  = "Recommended Minimum Specific GPS/TRANSIT Data";

            // Instance
            _fixed           = isFixed(Words[2]);
            _latitude        = new LatitudeLongitude(Words[3], Words[4]);
            _longitude       = new LatitudeLongitude(Words[5], Words[6]);
            _speedOverGround = new GpsSpeed(Words[7]);
            if (Words[8] == String.Empty)
            {
                _courseOverGround = -1;
            }
            else
            {
                _courseOverGround = double.Parse(Words[8], new CultureInfo("en-US"));
            }
            _magneticVariation = Words[10];

            if (Words[1].Length != 0)
            {
                try
                {
                    if (Words[1].Length == 6)
                    {
                        // Only HHMMSS
                        _uTCDateTime = new DateTime(
                            int.Parse(Words[9].Substring(4, 2)),
                            int.Parse(Words[9].Substring(2, 2)),
                            int.Parse(Words[9].Substring(0, 2)),
                            int.Parse(Words[1].Substring(0, 2)),
                            int.Parse(Words[1].Substring(2, 2)),
                            int.Parse(Words[1].Substring(4, 2)));
                    }
                    else
                    {
                        // HHMMSS.MS
                        _uTCDateTime = new DateTime(
                            int.Parse(Words[9].Substring(4, 2)),
                            int.Parse(Words[9].Substring(2, 2)),
                            int.Parse(Words[9].Substring(0, 2)),
                            int.Parse(Words[1].Substring(0, 2)),
                            int.Parse(Words[1].Substring(2, 2)),
                            int.Parse(Words[1].Substring(4, 2)),
                            int.Parse(Words[1].Substring(7)));
                    }
                }
                catch (ArgumentNullException) {}
            }
        }
        /// <summary>
        /// Sentence constructor
        /// </summary>
        public GPGGAGpsSentence(string Sentence)
            : base(Sentence)
        {
            // Base
            SentenceName = "$GPGGA";
            Description = "Global Positioning System Fixed Data";

            var enUS = new CultureInfo("en-US");

            // Instance
            if(Words[1].Length == 6)
            {
                // Only HHMMSS
                _uTCTime = new TimeSpan(
                    0,
                    int.Parse(Words[1].Substring(0, 2)),
                    int.Parse(Words[1].Substring(2, 2)),
                    int.Parse(Words[1].Substring(4, 2)));
            }
            else
            {
                // HHMMSS.MS
                _uTCTime = new TimeSpan(
                    0,
                    int.Parse(Words[1].Substring(0, 2)),
                    int.Parse(Words[1].Substring(2, 2)),
                    int.Parse(Words[1].Substring(4, 2)),
                    int.Parse(Words[1].Substring(7)));
            }

            _latitude = new LatitudeLongitude(Words[2], Words[3]);
            _longitude = new LatitudeLongitude(Words[4], Words[5]);
            if(Words[6] != string.Empty)
                _positionFix = (PositionFix) int.Parse(Words[6]);
            if(Words[7] != string.Empty)
                _satelitesUsed = int.Parse(Words[7]);
            if(Words[8] != string.Empty)
                _hDOP = double.Parse(Words[8], enUS);
            if(Words[9] != string.Empty)
                _altitude = double.Parse(Words[9], enUS);
            if(Words[11] != string.Empty)
                _geoidSeparation = double.Parse(Words[11], enUS);
        }