diff --git a/src/NmeaParser/Nmea/Hdt.cs b/src/NmeaParser/Nmea/Hdt.cs
new file mode 100644
index 0000000..8aebaf2
--- /dev/null
+++ b/src/NmeaParser/Nmea/Hdt.cs
@@ -0,0 +1,64 @@
+// *******************************************************************************
+// * Licensed under the Apache License, Version 2.0 (the "License");
+// * you may not use this file except in compliance with the License.
+// * You may obtain a copy of the License at
+// *
+// * http://www.apache.org/licenses/LICENSE-2.0
+// *
+// * 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.Globalization;
+
+namespace NmeaParser.Messages
+{
+ ///
+ /// Heading from True North
+ ///
+ ///
+ ///
+ /// 1.: Heading in degrees
+ /// 2.: Indicates heading relative to True North
+ ///
+ ///
+ /// Actual vessel heading in degrees True produced by any device or system producing true heading
+ ///
+ ///
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "HeHdt")]
+ [NmeaMessageType("--HDT")]
+ public class Hdt : NmeaMessage
+ {
+ ///
+ /// Initializes a new instance of the class.
+ ///
+ /// The message type
+ /// The NMEA message values.
+ public Hdt(string type, string[] message) : base(type, message)
+ {
+ if (message == null || message.Length < 2)
+ throw new ArgumentException("Invalid Hdt", "message");
+
+ // Extract the heading in degrees
+ HeadingInDeg = double.TryParse(message[0], NumberStyles.Float, CultureInfo.InvariantCulture, out var heading)
+ ? heading
+ : double.NaN;
+
+ HeadingRelToTrueNorth = message[1] == "T";
+ }
+
+ ///
+ /// Heading in degrees
+ ///
+ public double HeadingInDeg { get; }
+
+ ///
+ /// T: Indicates heading relative to True North
+ ///
+ public bool HeadingRelToTrueNorth { get; }
+ }
+}
\ No newline at end of file
diff --git a/src/UnitTests/NmeaParser.Tests/NmeaMessages.cs b/src/UnitTests/NmeaParser.Tests/NmeaMessages.cs
index b6cbc1c..1467fa6 100644
--- a/src/UnitTests/NmeaParser.Tests/NmeaMessages.cs
+++ b/src/UnitTests/NmeaParser.Tests/NmeaMessages.cs
@@ -296,6 +296,17 @@ namespace NmeaParser.Tests
Assert.AreEqual(-1, gga.DgpsStationId);
}
+ [TestMethod]
+ public void TestHEHDT()
+ {
+ const string input = "$HEHDT,13.37,T*29";
+ var msg = NmeaMessage.Parse(input);
+ Assert.IsInstanceOfType(msg, typeof(Hdt));
+ Hdt hdt = (Hdt)msg;
+ Assert.AreEqual(13.37, hdt.HeadingInDeg);
+ Assert.IsTrue(hdt.HeadingRelToTrueNorth);
+ }
+
[TestMethod]
public void TestPtlna()
{