diff --git a/src/NmeaParser.Shared/Nmea/Gps/GPGST.cs b/src/NmeaParser.Shared/Nmea/Gps/GPGST.cs
new file mode 100644
index 0000000..6f759aa
--- /dev/null
+++ b/src/NmeaParser.Shared/Nmea/Gps/GPGST.cs
@@ -0,0 +1,105 @@
+//
+// 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.Gps
+{
+ ///
+ /// Position error statistics
+ ///
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gpgst")]
+ [NmeaMessageType("GPGST")]
+ public class Gpgst : NmeaMessage
+ {
+ ///
+ /// Called when the message is being loaded.
+ ///
+ /// The NMEA message values.
+ protected override void OnLoadMessage(string[] message)
+ {
+ if (message == null || message.Length < 8)
+ throw new ArgumentException("Invalid GPGST", "message");
+ if (message[0].Length >= 6)
+ {
+ FixTime = new TimeSpan(int.Parse(message[0].Substring(0, 2), CultureInfo.InvariantCulture),
+ int.Parse(message[0].Substring(2, 2), CultureInfo.InvariantCulture), 0)
+ .Add(TimeSpan.FromSeconds(double.Parse(message[0].Substring(4), CultureInfo.InvariantCulture)));
+ }
+ 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]);
+ }
+
+ ///
+ /// UTC of position fix
+ ///
+ public TimeSpan FixTime { get; private set; }
+
+ ///
+ /// RMS value of the pseudorange residuals; includes carrier phase residuals during periods of RTK (float) and RTK (fixed) processing
+ ///
+ public double Rms { get; private set; }
+
+ ///
+ /// Error ellipse semi-major axis 1 sigma error, in meters
+ ///
+ public double SemiMajorError { get; private set; }
+
+ ///
+ /// Error ellipse semi-minor axis 1 sigma error, in meters
+ ///
+ public double SemiMinorError { get; private set; }
+
+ ///
+ /// Error ellipse orientation, degrees from true north
+ ///
+ public double ErrorOrientation { get; private set; }
+
+ ///
+ /// Latitude 1 sigma error, in meters
+ ///
+ ///
+ /// The error expressed as one standard deviation.
+ ///
+ public double SigmaLatitudeError { get; private set; }
+
+ ///
+ /// Longitude 1 sigma error, in meters
+ ///
+ ///
+ /// The error expressed as one standard deviation.
+ ///
+ public double SigmaLongitudeError { get; private set; }
+
+ ///
+ /// Height 1 sigma error, in meters
+ ///
+ ///
+ /// The error expressed as one standard deviation.
+ ///
+ public double SigmaHeightError { get; private set; }
+ }
+}
diff --git a/src/NmeaParser.Shared/NmeaParser.Shared.projitems b/src/NmeaParser.Shared/NmeaParser.Shared.projitems
index 469d167..8cc777b 100644
--- a/src/NmeaParser.Shared/NmeaParser.Shared.projitems
+++ b/src/NmeaParser.Shared/NmeaParser.Shared.projitems
@@ -17,6 +17,7 @@
+
diff --git a/src/NmeaParser.Tests/NmeaMessages.cs b/src/NmeaParser.Tests/NmeaMessages.cs
index 50c46a1..544dc58 100644
--- a/src/NmeaParser.Tests/NmeaMessages.cs
+++ b/src/NmeaParser.Tests/NmeaMessages.cs
@@ -37,17 +37,17 @@ namespace NmeaParser.Tests
while(!reader.EndOfStream)
{
var line = reader.ReadLine();
- if(line.StartsWith("$"))
+ if (line.StartsWith("$"))
{
- var msg = NmeaMessage.Parse(line);
- Assert.IsNotNull(msg);
+ var msg = NmeaMessage.Parse(line);
+ Assert.IsNotNull(msg);
var idx = line.IndexOf('*');
if (idx >= 0)
{
byte checksum = (byte)Convert.ToInt32(line.Substring(idx + 1), 16);
Assert.AreEqual(checksum, msg.Checksum);
}
- Assert.IsNotInstanceOfType(msg, typeof(Nmea.UnknownMessage), "Type " + msg.MessageType + " not supported");
+ Assert.IsNotInstanceOfType(msg, typeof(Nmea.UnknownMessage), "Type " + msg.MessageType + " not supported");
}
}
}
@@ -356,5 +356,23 @@ namespace NmeaParser.Tests
Assert.AreEqual("32BKLD", gsv.Waypoints[4]);
Assert.AreEqual("BW-198", gsv.Waypoints[8]);
}
+
+
+ [TestMethod]
+ public void TestGpgst()
+ {
+ string input = "$GPGST,172814.0,0.006,0.023,0.020,273.6,0.023,0.020,0.031*6A";
+ var msg = NmeaMessage.Parse(input);
+ Assert.IsInstanceOfType(msg, typeof(Gpgst));
+ Gpgst gst = (Gpgst)msg;
+ Assert.AreEqual(new TimeSpan(17, 28, 14), gst.FixTime);
+ Assert.AreEqual(0.006, gst.Rms);
+ Assert.AreEqual(0.023, gst.SemiMajorError);
+ Assert.AreEqual(0.02, gst.SemiMinorError);
+ Assert.AreEqual(273.6, gst.ErrorOrientation);
+ Assert.AreEqual(0.023, gst.SigmaLatitudeError);
+ Assert.AreEqual(0.020, gst.SigmaLongitudeError);
+ Assert.AreEqual(0.031, gst.SigmaHeightError);
+ }
}
}