Added base classes for GST, GGA and RMC for getter GLONASS support

This commit is contained in:
Morten Nielsen 2017-12-20 16:59:17 -08:00
parent da87d930e6
commit 30a79f9a0f
11 changed files with 430 additions and 294 deletions

122
src/NmeaParser/Nmea/Gga.cs Normal file
View file

@ -0,0 +1,122 @@
//
// Copyright (c) 2014 Morten Nielsen
//
// Licensed under the Microsoft Public License (Ms-PL) (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://opensource.org/licenses/Ms-PL.html
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NmeaParser.Nmea
{
/// <summary>
/// Global Positioning System Fix Data
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gpgga")]
public class Gga : NmeaMessage
{
/// <summary>
/// Called when the message is being loaded.
/// </summary>
/// <param name="message">The NMEA message values.</param>
protected override void OnLoadMessage(string[] message)
{
if (message == null || message.Length < 14)
throw new ArgumentException("Invalid GPGGA", "message");
FixTime = StringToTimeSpan(message[0]);
Latitude = NmeaMessage.StringToLatitude(message[1], message[2]);
Longitude = NmeaMessage.StringToLongitude(message[3], message[4]);
Quality = (Gps.Gpgga.FixQuality)int.Parse(message[5], CultureInfo.InvariantCulture);
NumberOfSatellites = int.Parse(message[6], CultureInfo.InvariantCulture);
Hdop = NmeaMessage.StringToDouble(message[7]);
Altitude = NmeaMessage.StringToDouble(message[8]);
AltitudeUnits = message[9];
HeightOfGeoid = NmeaMessage.StringToDouble(message[10]);
HeightOfGeoidUnits = message[11];
var timeInSeconds = StringToDouble(message[12]);
if (!double.IsNaN(timeInSeconds))
TimeSinceLastDgpsUpdate = TimeSpan.FromSeconds(timeInSeconds);
else
TimeSinceLastDgpsUpdate = TimeSpan.MaxValue;
if (message[13].Length > 0)
DgpsStationId = int.Parse(message[13], CultureInfo.InvariantCulture);
else
DgpsStationId = -1;
}
/// <summary>
/// Time of day fix was taken
/// </summary>
public TimeSpan FixTime { get; private set; }
/// <summary>
/// Latitude
/// </summary>
public double Latitude { get; private set; }
/// <summary>
/// Longitude
/// </summary>
public double Longitude { get; private set; }
/// <summary>
/// Fix Quality
/// </summary>
public Gps.Gpgga.FixQuality Quality { get; private set; }
/// <summary>
/// Number of satellites being tracked
/// </summary>
public int NumberOfSatellites { get; private set; }
/// <summary>
/// Horizontal Dilution of Precision
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Hdop")]
public double Hdop { get; private set; }
/// <summary>
/// Altitude
/// </summary>
public double Altitude { get; private set; }
/// <summary>
/// Altitude units ('M' for Meters)
/// </summary>
public string AltitudeUnits { get; private set; }
/// <summary>
/// Height of geoid (mean sea level) above WGS84
/// </summary>
public double HeightOfGeoid { get; private set; }
/// <summary>
/// Altitude units ('M' for Meters)
/// </summary>
public string HeightOfGeoidUnits { get; private set; }
/// <summary>
/// Time since last DGPS update
/// </summary>
public TimeSpan TimeSinceLastDgpsUpdate { get; private set; }
/// <summary>
/// DGPS Station ID Number
/// </summary>
public int DgpsStationId { get; private set; }
}
}

View file

@ -0,0 +1,34 @@
//
// Copyright (c) 2014 Morten Nielsen
//
// Licensed under the Microsoft Public License (Ms-PL) (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://opensource.org/licenses/Ms-PL.html
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NmeaParser.Nmea.Gnss
{
/// <summary>
/// Global Positioning System Fix Data
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gpgga")]
[NmeaMessageType("GNGGA")]
public class Gngga : Gga
{
}
}

View file

@ -7,74 +7,7 @@ namespace NmeaParser.Nmea.Gnss
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gngst")]
[NmeaMessageType("GNGST")]
public class Gngst : NmeaMessage
public class Gngst : Gst
{
/// <summary>
/// Called when the message is being loaded.
/// </summary>
/// <param name="message">The NMEA message values.</param>
protected override void OnLoadMessage(string[] message)
{
if (message == null || message.Length < 8)
throw new ArgumentException("Invalid GNGST", "message");
FixTime = StringToTimeSpan(message[0]);
Rms = NmeaMessage.StringToDouble(message[1]);
SemiMajorError = NmeaMessage.StringToDouble(message[2]);
SemiMinorError = NmeaMessage.StringToDouble(message[3]);
ErrorOrientation = NmeaMessage.StringToDouble(message[4]);
SigmaLatitudeError = NmeaMessage.StringToDouble(message[5]);
SigmaLongitudeError = NmeaMessage.StringToDouble(message[6]);
SigmaHeightError = NmeaMessage.StringToDouble(message[7]);
}
/// <summary>
/// UTC of position fix
/// </summary>
public TimeSpan FixTime { get; private set; }
/// <summary>
/// RMS value of the pseudorange residuals; includes carrier phase residuals during periods of RTK (float) and RTK (fixed) processing
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Rms")]
public double Rms { get; private set; }
/// <summary>
/// Error ellipse semi-major axis 1 sigma error, in meters
/// </summary>
public double SemiMajorError { get; private set; }
/// <summary>
/// Error ellipse semi-minor axis 1 sigma error, in meters
/// </summary>
public double SemiMinorError { get; private set; }
/// <summary>
/// Error ellipse orientation, degrees from true north
/// </summary>
public double ErrorOrientation { get; private set; }
/// <summary>
/// Latitude 1 sigma error, in meters
/// </summary>
/// <remarks>
/// The error expressed as one standard deviation.
/// </remarks>
public double SigmaLatitudeError { get; private set; }
/// <summary >
/// Longitude 1 sigma error, in meters
/// </summary>
/// <remarks>
/// The error expressed as one standard deviation.
/// </remarks>
public double SigmaLongitudeError { get; private set; }
/// <summary >
/// Height 1 sigma error, in meters
/// </summary>
/// <remarks>
/// The error expressed as one standard deviation.
/// </remarks>
public double SigmaHeightError { get; private set; }
}
}

View file

@ -0,0 +1,34 @@
//
// Copyright (c) 2014 Morten Nielsen
//
// Licensed under the Microsoft Public License (Ms-PL) (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://opensource.org/licenses/Ms-PL.html
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NmeaParser.Nmea.Gnss
{
/// <summary>
/// Recommended Minimum
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gprmc")]
[NmeaMessageType("GNRMC")]
public class Gnrmc : Rmc
{
}
}

View file

@ -28,7 +28,7 @@ namespace NmeaParser.Nmea.Gps
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gpgga")]
[NmeaMessageType("GPGGA")]
public class Gpgga : NmeaMessage
public class Gpgga : Gga
{
/// <summary>
/// Fix quality
@ -58,95 +58,5 @@ namespace NmeaParser.Nmea.Gps
/// <summary>Simulation</summary>
Simulation = 8
}
/// <summary>
/// Called when the message is being loaded.
/// </summary>
/// <param name="message">The NMEA message values.</param>
protected override void OnLoadMessage(string[] message)
{
if (message == null || message.Length < 14)
throw new ArgumentException("Invalid GPGGA", "message");
FixTime = StringToTimeSpan(message[0]);
Latitude = NmeaMessage.StringToLatitude(message[1], message[2]);
Longitude = NmeaMessage.StringToLongitude(message[3], message[4]);
Quality = (FixQuality)int.Parse(message[5], CultureInfo.InvariantCulture);
NumberOfSatellites = int.Parse(message[6], CultureInfo.InvariantCulture);
Hdop = NmeaMessage.StringToDouble(message[7]);
Altitude = NmeaMessage.StringToDouble(message[8]);
AltitudeUnits = message[9];
HeightOfGeoid = NmeaMessage.StringToDouble(message[10]);
HeightOfGeoidUnits = message[11];
var timeInSeconds = StringToDouble(message[12]);
if (!double.IsNaN(timeInSeconds))
TimeSinceLastDgpsUpdate = TimeSpan.FromSeconds(timeInSeconds);
else
TimeSinceLastDgpsUpdate = TimeSpan.MaxValue;
if (message[13].Length > 0)
DgpsStationId = int.Parse(message[13], CultureInfo.InvariantCulture);
else
DgpsStationId = -1;
}
/// <summary>
/// Time of day fix was taken
/// </summary>
public TimeSpan FixTime { get; private set; }
/// <summary>
/// Latitude
/// </summary>
public double Latitude { get; private set; }
/// <summary>
/// Longitude
/// </summary>
public double Longitude { get; private set; }
/// <summary>
/// Fix Quality
/// </summary>
public FixQuality Quality { get; private set; }
/// <summary>
/// Number of satellites being tracked
/// </summary>
public int NumberOfSatellites { get; private set; }
/// <summary>
/// Horizontal Dilution of Precision
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Hdop")]
public double Hdop { get; private set; }
/// <summary>
/// Altitude
/// </summary>
public double Altitude { get; private set; }
/// <summary>
/// Altitude units ('M' for Meters)
/// </summary>
public string AltitudeUnits { get; private set; }
/// <summary>
/// Height of geoid (mean sea level) above WGS84
/// </summary>
public double HeightOfGeoid { get; private set; }
/// <summary>
/// Altitude units ('M' for Meters)
/// </summary>
public string HeightOfGeoidUnits { get; private set; }
/// <summary>
/// Time since last DGPS update
/// </summary>
public TimeSpan TimeSinceLastDgpsUpdate { get; private set; }
/// <summary>
/// DGPS Station ID Number
/// </summary>
public int DgpsStationId { get; private set; }
}
}

View file

@ -28,74 +28,7 @@ namespace NmeaParser.Nmea.Gps
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gpgst")]
[NmeaMessageType("GPGST")]
public class Gpgst : NmeaMessage
public class Gpgst : Gst
{
/// <summary>
/// Called when the message is being loaded.
/// </summary>
/// <param name="message">The NMEA message values.</param>
protected override void OnLoadMessage(string[] message)
{
if (message == null || message.Length < 8)
throw new ArgumentException("Invalid GPGST", "message");
FixTime = StringToTimeSpan(message[0]);
Rms = NmeaMessage.StringToDouble(message[1]);
SemiMajorError = NmeaMessage.StringToDouble(message[2]);
SemiMinorError = NmeaMessage.StringToDouble(message[3]);
ErrorOrientation = NmeaMessage.StringToDouble(message[4]);
SigmaLatitudeError = NmeaMessage.StringToDouble(message[5]);
SigmaLongitudeError = NmeaMessage.StringToDouble(message[6]);
SigmaHeightError = NmeaMessage.StringToDouble(message[7]);
}
/// <summary>
/// UTC of position fix
/// </summary>
public TimeSpan FixTime { get; private set; }
/// <summary>
/// RMS value of the pseudorange residuals; includes carrier phase residuals during periods of RTK (float) and RTK (fixed) processing
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Rms")]
public double Rms { get; private set; }
/// <summary>
/// Error ellipse semi-major axis 1 sigma error, in meters
/// </summary>
public double SemiMajorError { get; private set; }
/// <summary>
/// Error ellipse semi-minor axis 1 sigma error, in meters
/// </summary>
public double SemiMinorError { get; private set; }
/// <summary>
/// Error ellipse orientation, degrees from true north
/// </summary>
public double ErrorOrientation { get; private set; }
/// <summary>
/// Latitude 1 sigma error, in meters
/// </summary>
/// <remarks>
/// The error expressed as one standard deviation.
/// </remarks>
public double SigmaLatitudeError { get; private set; }
/// <summary >
/// Longitude 1 sigma error, in meters
/// </summary>
/// <remarks>
/// The error expressed as one standard deviation.
/// </remarks>
public double SigmaLongitudeError { get; private set; }
/// <summary >
/// Height 1 sigma error, in meters
/// </summary>
/// <remarks>
/// The error expressed as one standard deviation.
/// </remarks>
public double SigmaHeightError { get; private set; }
}
}

View file

@ -28,69 +28,7 @@ namespace NmeaParser.Nmea.Gps
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gprmc")]
[NmeaMessageType("GPRMC")]
public class Gprmc : NmeaMessage
public class Gprmc : Rmc
{
/// <summary>
/// Called when the message is being loaded.
/// </summary>
/// <param name="message">The NMEA message values.</param>
protected override void OnLoadMessage(string[] message)
{
if (message == null || message.Length < 11)
throw new ArgumentException("Invalid GPRMC", "message");
if (message[8].Length == 6 && message[0].Length >= 6)
{
FixTime = new DateTime(int.Parse(message[8].Substring(4, 2), CultureInfo.InvariantCulture) + 2000,
int.Parse(message[8].Substring(2, 2), CultureInfo.InvariantCulture),
int.Parse(message[8].Substring(0, 2), CultureInfo.InvariantCulture),
int.Parse(message[0].Substring(0, 2), CultureInfo.InvariantCulture),
int.Parse(message[0].Substring(2, 2), CultureInfo.InvariantCulture),
0, DateTimeKind.Utc).AddSeconds(double.Parse(message[0].Substring(4), CultureInfo.InvariantCulture));
}
Active = (message[1] == "A");
Latitude = NmeaMessage.StringToLatitude(message[2], message[3]);
Longitude = NmeaMessage.StringToLongitude(message[4], message[5]);
Speed = NmeaMessage.StringToDouble(message[6]);
Course = NmeaMessage.StringToDouble(message[7]);
MagneticVariation = NmeaMessage.StringToDouble(message[9]);
if (!double.IsNaN(MagneticVariation) && message[10] == "W")
MagneticVariation *= -1;
}
/// <summary>
/// Fix Time
/// </summary>
public DateTime FixTime { get; private set; }
/// <summary>
/// Gets a value whether the device is active
/// </summary>
public bool Active { get; private set; }
/// <summary>
/// Latitude
/// </summary>
public double Latitude { get; private set; }
/// <summary>
/// Longitude
/// </summary>
public double Longitude { get; private set; }
/// <summary>
/// Speed over the ground in knots
/// </summary>
public double Speed { get; private set; }
/// <summary>
/// Track angle in degrees True
/// </summary>
public double Course { get; private set; }
/// <summary>
/// Magnetic Variation
/// </summary>
public double MagneticVariation { get; private set; }
}
}

100
src/NmeaParser/Nmea/Gst.cs Normal file
View file

@ -0,0 +1,100 @@
//
// Copyright (c) 2014 Morten Nielsen
//
// Licensed under the Microsoft Public License (Ms-PL) (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://opensource.org/licenses/Ms-PL.html
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NmeaParser.Nmea
{
/// <summary>
/// Position error statistics
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gpgst")]
public abstract class Gst : NmeaMessage
{
/// <summary>
/// Called when the message is being loaded.
/// </summary>
/// <param name="message">The NMEA message values.</param>
protected override void OnLoadMessage(string[] message)
{
if (message == null || message.Length < 8)
throw new ArgumentException("Invalid GPGST", "message");
FixTime = StringToTimeSpan(message[0]);
Rms = NmeaMessage.StringToDouble(message[1]);
SemiMajorError = NmeaMessage.StringToDouble(message[2]);
SemiMinorError = NmeaMessage.StringToDouble(message[3]);
ErrorOrientation = NmeaMessage.StringToDouble(message[4]);
SigmaLatitudeError = NmeaMessage.StringToDouble(message[5]);
SigmaLongitudeError = NmeaMessage.StringToDouble(message[6]);
SigmaHeightError = NmeaMessage.StringToDouble(message[7]);
}
/// <summary>
/// UTC of position fix
/// </summary>
public TimeSpan FixTime { get; private set; }
/// <summary>
/// RMS value of the pseudorange residuals; includes carrier phase residuals during periods of RTK (float) and RTK (fixed) processing
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Rms")]
public double Rms { get; private set; }
/// <summary>
/// Error ellipse semi-major axis 1 sigma error, in meters
/// </summary>
public double SemiMajorError { get; private set; }
/// <summary>
/// Error ellipse semi-minor axis 1 sigma error, in meters
/// </summary>
public double SemiMinorError { get; private set; }
/// <summary>
/// Error ellipse orientation, degrees from true north
/// </summary>
public double ErrorOrientation { get; private set; }
/// <summary>
/// Latitude 1 sigma error, in meters
/// </summary>
/// <remarks>
/// The error expressed as one standard deviation.
/// </remarks>
public double SigmaLatitudeError { get; private set; }
/// <summary >
/// Longitude 1 sigma error, in meters
/// </summary>
/// <remarks>
/// The error expressed as one standard deviation.
/// </remarks>
public double SigmaLongitudeError { get; private set; }
/// <summary >
/// Height 1 sigma error, in meters
/// </summary>
/// <remarks>
/// The error expressed as one standard deviation.
/// </remarks>
public double SigmaHeightError { get; private set; }
}
}

View file

@ -0,0 +1,95 @@
//
// Copyright (c) 2014 Morten Nielsen
//
// Licensed under the Microsoft Public License (Ms-PL) (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://opensource.org/licenses/Ms-PL.html
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace NmeaParser.Nmea
{
/// <summary>
/// Recommended Minimum
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gprmc")]
public abstract class Rmc : NmeaMessage
{
/// <summary>
/// Called when the message is being loaded.
/// </summary>
/// <param name="message">The NMEA message values.</param>
protected override void OnLoadMessage(string[] message)
{
if (message == null || message.Length < 11)
throw new ArgumentException("Invalid GPRMC", "message");
if (message[8].Length == 6 && message[0].Length >= 6)
{
FixTime = new DateTime(int.Parse(message[8].Substring(4, 2), CultureInfo.InvariantCulture) + 2000,
int.Parse(message[8].Substring(2, 2), CultureInfo.InvariantCulture),
int.Parse(message[8].Substring(0, 2), CultureInfo.InvariantCulture),
int.Parse(message[0].Substring(0, 2), CultureInfo.InvariantCulture),
int.Parse(message[0].Substring(2, 2), CultureInfo.InvariantCulture),
0, DateTimeKind.Utc).AddSeconds(double.Parse(message[0].Substring(4), CultureInfo.InvariantCulture));
}
Active = (message[1] == "A");
Latitude = NmeaMessage.StringToLatitude(message[2], message[3]);
Longitude = NmeaMessage.StringToLongitude(message[4], message[5]);
Speed = NmeaMessage.StringToDouble(message[6]);
Course = NmeaMessage.StringToDouble(message[7]);
MagneticVariation = NmeaMessage.StringToDouble(message[9]);
if (!double.IsNaN(MagneticVariation) && message[10] == "W")
MagneticVariation *= -1;
}
/// <summary>
/// Fix Time
/// </summary>
public DateTime FixTime { get; private set; }
/// <summary>
/// Gets a value whether the device is active
/// </summary>
public bool Active { get; private set; }
/// <summary>
/// Latitude
/// </summary>
public double Latitude { get; private set; }
/// <summary>
/// Longitude
/// </summary>
public double Longitude { get; private set; }
/// <summary>
/// Speed over the ground in knots
/// </summary>
public double Speed { get; private set; }
/// <summary>
/// Track angle in degrees True
/// </summary>
public double Course { get; private set; }
/// <summary>
/// Magnetic Variation
/// </summary>
public double MagneticVariation { get; private set; }
}
}

View file

@ -11,7 +11,7 @@
<Description>An NMEA stream parser for serial port, bluetooth and file-based nmea simulation.</Description>
<PackageTags>nmea winrt wpf win8 win8.1 wp8.1 uwp xamarin gps serialport bluetooth</PackageTags>
<PackageId>SharpGIS.NmeaParser</PackageId>
<Version>1.7.0</Version>
<Version>1.8.0</Version>
<PackageLicenseUrl>http://opensource.org/licenses/ms-pl.html</PackageLicenseUrl>
<PackageProjectUrl>https://github.com/dotMorten/NmeaParser</PackageProjectUrl>
<RepositoryUrl>https://github.com/dotMorten/NmeaParser</RepositoryUrl>

View file

@ -103,7 +103,24 @@ namespace NmeaParser.Tests
Assert.AreEqual(-11.516666666666667, rmc.Longitude, 0.0000000001);
}
[TestMethod]
[TestMethod]
public void TestGnrmc()
{
string input = "$GNRMC,231011.00,A,3403.47163804,N,11711.80926595,W,0.019,11.218,201217,12.0187,E,D*01";
var msg = NmeaMessage.Parse(input);
Assert.IsInstanceOfType(msg, typeof(Gnrmc));
Gnrmc rmc = (Gnrmc)msg;
Assert.AreEqual("GNRMC", rmc.MessageType);
Assert.AreEqual(new DateTime(2017, 12, 20, 23, 10, 11, DateTimeKind.Utc), rmc.FixTime);
Assert.AreEqual(34.057860634, rmc.Latitude, 0.0000000001);
Assert.AreEqual(-117.19682109916667, rmc.Longitude, 0.0000000001);
Assert.AreEqual(true, rmc.Active);
Assert.AreEqual(11.218, rmc.Course);
Assert.AreEqual(12.0187, rmc.MagneticVariation);
Assert.AreEqual(0.019, rmc.Speed);
}
[TestMethod]
public void TestGpgga()
{
string input = "$GPGGA,235236,3925.9479,N,11945.9211,W,1,10,0.8,1378.0,M,-22.1,M,,*46";
@ -124,7 +141,28 @@ namespace NmeaParser.Tests
Assert.AreEqual(TimeSpan.MaxValue, gga.TimeSinceLastDgpsUpdate);
}
[TestMethod]
[TestMethod]
public void TestGngga()
{
string input = "$GNGGA,231011.00,3403.47163804,N,11711.80926595,W,5,13,0.9,403.641,M,-32.133,M,1.0,0000*6D";
var msg = NmeaMessage.Parse(input);
Assert.IsInstanceOfType(msg, typeof(Gngga));
Gngga gga = (Gngga)msg;
Assert.AreEqual(new TimeSpan(23, 10, 11), gga.FixTime);
Assert.AreEqual(34.057860634, gga.Latitude);
Assert.AreEqual(-117.19682109916667, gga.Longitude, 0.0000000001);
Assert.AreEqual(NmeaParser.Nmea.Gps.Gpgga.FixQuality.FloatRtk, gga.Quality);
Assert.AreEqual(13, gga.NumberOfSatellites);
Assert.AreEqual(.9, gga.Hdop);
Assert.AreEqual(403.641, gga.Altitude);
Assert.AreEqual("M", gga.AltitudeUnits);
Assert.AreEqual(-32.133, gga.HeightOfGeoid);
Assert.AreEqual("M", gga.HeightOfGeoidUnits);
Assert.AreEqual(0, gga.DgpsStationId);
Assert.AreEqual(TimeSpan.FromSeconds(1), gga.TimeSinceLastDgpsUpdate);
}
[TestMethod]
public void TestPtlna()
{
string input = "$PTNLA,HV,002.94,M,288.1,D,008.6,D,002.98,M*74";
@ -359,7 +397,6 @@ namespace NmeaParser.Tests
Assert.AreEqual("BW-198", gsv.Waypoints[8]);
}
[TestMethod]
public void TestGpgst()
{