Added new sentences

Added following sentences
CUR
HDT
MDA
MWV
ROT
This commit is contained in:
JesperSOGT 2020-12-10 17:22:37 +01:00
parent 5d4686c059
commit 7b360ed216
8 changed files with 865 additions and 1 deletions

View file

@ -0,0 +1,197 @@
namespace NmeaParser.Nmea.Class
{
/// <summary>
/// Data reference in use
/// </summary>
public enum Reference
{
/// <summary>
/// True
/// </summary>
True,
/// <summary>
/// Relative
/// </summary>
Relative,
/// <summary>
/// Magnetic
/// </summary>
Magnetic,
/// <summary>
/// No data available
/// </summary>
NaN
}
/// <summary>
/// Speed reference in use
/// </summary>
public enum SpeedReference
{
/// <summary>
/// Bottom track
/// </summary>
BottomTrack,
/// <summary>
/// Wather track
/// </summary>
WatherTrack,
/// <summary>
/// Positioning System
/// </summary>
PosSystem,
/// <summary>
/// No data available
/// </summary>
NaN
}
/// <summary>
/// Data status
/// </summary>
public enum Validation
{
/// <summary>
/// Ok
/// </summary>
Ok,
/// <summary>
/// Warning
/// </summary>
Warning,
/// <summary>
/// Invalid
/// </summary>
Invalid,
/// <summary>
/// No data available
/// </summary>
NaN
}
/// <summary>
/// Unit
/// </summary>
public enum Unit
{
/// <summary>
/// Km/h
/// </summary>
Kmh,
/// <summary>
/// Meter
/// </summary>
M,
/// <summary>
/// Meters per second
/// </summary>
Msec,
/// <summary>
/// Miles
/// </summary>
Mile,
/// <summary>
/// Knot
/// </summary>
Knot,
/// <summary>
/// Inches of mercury
/// </summary>
Inc,
/// <summary>
/// Barometric pressure, bars
/// </summary>
Bar,
/// <summary>
/// Air temperature, degrees C
/// </summary>
C,
/// <summary>
/// Degrees
/// </summary>
Degrees,
/// <summary>
/// Newtons
/// </summary>
Newtons,
/// <summary>
/// Percent
/// </summary>
Percent,
/// <summary>
/// No data available
/// </summary>
NaN
}
/// <summary>
/// TransducerTypes
/// </summary>
public enum TransducerTypes
{
/// <summary>
/// Angular displacement
/// </summary>
AngularDisplacement,
/// <summary>
/// Temperature
/// </summary>
Temperature,
/// <summary>
/// Depth
/// </summary>
Depth,
/// <summary>
/// Frequency
/// </summary>
Frequency,
/// <summary>
/// Humidity
/// </summary>
Humidity,
/// <summary>
/// Force
/// </summary>
Force,
/// <summary>
/// Pressure
/// </summary>
Pressure,
/// <summary>
/// Flow
/// </summary>
Flow,
/// <summary>
/// No data available
/// </summary>
NaN
}
}

153
src/NmeaParser/Nmea/Cur.cs Normal file
View file

@ -0,0 +1,153 @@
// *******************************************************************************
// * 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.Diagnostics.CodeAnalysis;
using System.Globalization;
using NmeaParser.Nmea.Class;
namespace NmeaParser.Messages
{
/// <summary>
/// Water Current Layer
/// </summary>
/// <remarks>
/// <para>
/// 1.: Validity of the data, A= Valid, V= not valid
/// 2.: Data set number, 0 to 9
/// 3.: Layer number
/// 4.: Current depth in meters
/// 5.: Current direction in degrees
/// 6.: Direction reference in use, True/Relative T/R
/// 7.: Current Speed in Knots
/// 8.: Reference layer depth in meters
/// 9.: Heading
/// 10.:Heading reference in use, True/Magnetic T/M
/// 11.:Speed reference, B : Bottom track, W: Water track, P : Positioning System
/// </para>
/// </remarks>
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "StCur")]
[NmeaMessageType("--CUR")]
public class Cur : NmeaMessage
{
/// <summary>
/// Initializes a new instance of the <see cref="Cur" /> class.
/// </summary>
/// <param name="type">The message type</param>
/// <param name="message">The NMEA message values.</param>
public Cur(string type, string[] message) : base(type, message)
{
if (message == null || message.Length < 9)
throw new ArgumentException("Invalid Cur", "message");
Validation = message[0] == "A" ? Validation.Ok : Validation.Warning;
DataSetNo = double.TryParse(message[1], NumberStyles.Float, CultureInfo.InvariantCulture, out var tmp)
? tmp
: double.NaN;
LayerNo = double.TryParse(message[2], NumberStyles.Float, CultureInfo.InvariantCulture, out tmp)
? tmp
: double.NaN;
CurrentDepthMeter = double.TryParse(message[3], NumberStyles.Float, CultureInfo.InvariantCulture, out tmp)
? tmp
: double.NaN;
CurrentDirDeg = double.TryParse(message[4], NumberStyles.Float, CultureInfo.InvariantCulture, out tmp)
? tmp
: double.NaN;
DirectionRefInUse =
message[5] == "T" ? Reference.True : Reference.Relative;
CurrentSpeedKnots = double.TryParse(message[6], NumberStyles.Float, CultureInfo.InvariantCulture, out tmp)
? tmp
: double.NaN;
RefLayerDepthMeters = double.TryParse(message[7], NumberStyles.Float, CultureInfo.InvariantCulture, out tmp)
? tmp
: double.NaN;
Heading = double.TryParse(message[8], NumberStyles.Float, CultureInfo.InvariantCulture, out tmp)
? tmp
: double.NaN;
HeadingRefInUse = message[9] == "T" ? Reference.True : Reference.Magnetic;
SpeedRefInUse = message[10] switch
{
"B" => SpeedReference.BottomTrack,
"W" => SpeedReference.WatherTrack,
"P" => SpeedReference.PosSystem,
_ => SpeedRefInUse
};
}
/// <summary>
/// Data Validation
/// </summary>
public Validation Validation { get; }
/// <summary>
/// Data set number, 0 to 9
/// </summary>
public double DataSetNo { get; }
/// <summary>
/// Layer number
/// </summary>
public double LayerNo { get; }
/// <summary>
/// Current depth in meters
/// </summary>
public double CurrentDepthMeter { get; }
/// <summary>
/// Current direction in degrees
/// </summary>
public double CurrentDirDeg { get; }
/// <summary>
/// Direction reference in use, True/Relative T/R
/// </summary>
public Reference DirectionRefInUse { get; }
/// <summary>
/// Range to destination in nautical miles
/// </summary>
public double CurrentSpeedKnots { get; }
/// <summary>
/// Reference layer depth in meters
/// </summary>
public double RefLayerDepthMeters { get; }
/// <summary>
/// Heading
/// </summary>
public double Heading { get; }
/// <summary>
/// Heading reference in use, True/Magnetic T/M
/// </summary>
public Reference HeadingRefInUse { get; }
/// <summary>
/// Speed reference, B : Bottom track, W: Water track, P : Positioning System
/// </summary>
public SpeedReference SpeedRefInUse { get; }
}
}

View file

@ -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.Diagnostics.CodeAnalysis;
using System.Globalization;
namespace NmeaParser.Messages
{
/// <summary>
/// Heading from True North
/// </summary>
/// <remarks>
/// <para>
/// 1.: Heading in degrees
/// 2.: Indicates heading relative to True North
/// </para>
/// <para>
/// Actual vessel heading in degrees True produced by any device or system producing true heading
/// </para>
/// </remarks>
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "HeHdt")]
[NmeaMessageType("--HDT")]
public class Hdt : NmeaMessage
{
/// <summary>
///
/// </summary>
/// <param name="type"></param>
/// <param name="message"></param>
/// <exception cref="ArgumentException"></exception>
public Hdt(string type, string[] message) : base(type, message)
{
if (message == null || message.Length < 2)
throw new ArgumentException("Invalid Hdt", "message");
HeadingInDeg = double.TryParse(message[0], NumberStyles.Float, CultureInfo.InvariantCulture, out var tmp)
? tmp
: double.NaN;
HeadingRelToTrueNorth = message[1] == "T";
}
/// <summary>
/// Heading in degrees
/// </summary>
public double HeadingInDeg { get; }
/// <summary>
/// Indicates heading relative to True North
/// </summary>
public bool HeadingRelToTrueNorth { get; }
}
}

221
src/NmeaParser/Nmea/Mda.cs Normal file
View file

@ -0,0 +1,221 @@
// *******************************************************************************
// * 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.Diagnostics.CodeAnalysis;
using System.Globalization;
using NmeaParser.Nmea.Class;
namespace NmeaParser.Messages
{
/// <summary>
/// Meteorological Composite.
/// </summary>
/// <remarks>
/// <para>
/// 1.: Barometric pressure, inches of mercury, to the nearest 0.01 inch
/// 2.: I = inches of mercury
/// 3.: Barometric pressure, bars, to the nearest .001 bar
/// 4.: B = bars
/// 5.: Air temperature, degrees C, to the nearest 0.1 degree C
/// 6.: C = degrees C
/// 7.: Water temperature, degrees C (this field left blank by WeatherStation)
/// 8.: C = degrees C(this field left blank by WeatherStation)
/// 9.: Relative humidity, percent, to the nearest 0.1 percent
/// 10.:Absolute humidity, percent(this field left blank by WeatherStation)
/// 11.:Dew point, degrees C, to the nearest 0.1 degree C
/// 12.:C = degrees C
/// 13.:Wind direction, degrees True, to the nearest 0.1 degree
/// 14.:T = true
/// 15.:Wind direction, degrees Magnetic, to the nearest 0.1 degree
/// 16.:M = magnetic
/// 17.:Wind speed, knots, to the nearest 0.1 knot
/// 18.:N = knots
/// 19.:Wind speed, meters per second, to the nearest 0.1 m/s
/// 20.:M = meters per second
/// </para>
/// <para>
/// Barometric pressure, air and water temperature, humidity, dew point and wind speed and direction relative to the surface of the earth.
/// </para>
/// </remarks>
///
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "GpMda")][NmeaMessageType("--MDA")]
public class Mda : NmeaMessage
{
/// <summary>
/// Initializes a new instance of the <see cref="Mda" /> class.
/// </summary>
/// <param name="type">The message type</param>
/// <param name="message">The NMEA message values.</param>
public Mda(string type, string[] message) : base(type, message)
{
if (message == null || message.Length < 20)
throw new ArgumentException("Invalid Mda", "message");
BarometricPresI = double.TryParse(message[0], NumberStyles.Float, CultureInfo.InvariantCulture, out var tmp)
? tmp
: double.NaN;
BarometricPresIUnit = message[1] == "I" ? Unit.Inc : Unit.NaN;
BarometricPresBar = double.TryParse(message[2], NumberStyles.Float, CultureInfo.InvariantCulture, out tmp)
? tmp
: double.NaN;
BarometricPresBarUnit = message[3] == "B" ? Unit.Bar : Unit.NaN;
AirTemp = double.TryParse(message[4], NumberStyles.Float, CultureInfo.InvariantCulture, out tmp)
? tmp
: double.NaN;
AirTempUnit = message[5] == "C" ? Unit.C : Unit.NaN;
WaterTemp = double.TryParse(message[6], NumberStyles.Float, CultureInfo.InvariantCulture, out tmp)
? tmp
: double.NaN;
WaterTempUnit = message[7] == "C" ? Unit.C : Unit.NaN;
RelativeHumidity = double.TryParse(message[8], NumberStyles.Float, CultureInfo.InvariantCulture, out tmp)
? tmp
: double.NaN;
AbsoluteHumidity = double.TryParse(message[9], NumberStyles.Float, CultureInfo.InvariantCulture, out tmp)
? tmp
: double.NaN;
DewPoint = double.TryParse(message[10], NumberStyles.Float, CultureInfo.InvariantCulture, out tmp)
? tmp
: double.NaN;
DewPointUnit = message[11] == "C" ? Unit.C : Unit.NaN;
WindDirTrue = double.TryParse(message[12], NumberStyles.Float, CultureInfo.InvariantCulture, out tmp)
? tmp
: double.NaN;
WindDirTrueReference = message[13] == "T" ? Reference.True : Reference.NaN;
WindDirMag = double.TryParse(message[14], NumberStyles.Float, CultureInfo.InvariantCulture, out tmp)
? tmp
: double.NaN;
WindDirMegReference = message[15] == "M" ? Reference.Magnetic : Reference.NaN;
WindSpeedKnot = double.TryParse(message[16], NumberStyles.Float, CultureInfo.InvariantCulture, out tmp)
? tmp
: double.NaN;
WindSpeedKnotUnit = message[17] == "N" ? Unit.Knot : Unit.NaN;
WindSpeedMsec = double.TryParse(message[18], NumberStyles.Float, CultureInfo.InvariantCulture, out tmp)
? tmp
: double.NaN;
WindSpeedMsecUnit = message[19] == "M" ? Unit.Msec : Unit.NaN;
}
/// <summary>
/// Barometric pressure, inches of mercury, to the nearest 0.01 inch
/// </summary>
public double BarometricPresI { get; }
/// <summary>
/// Barometric pressure I = inches of mercury
/// </summary>
public Unit BarometricPresIUnit { get; }
/// <summary>
/// Barometric pressure, bars, to the nearest .001 bar
/// </summary>
public double BarometricPresBar { get; }
/// <summary>
/// Barometric pressure, bars, to the nearest .001 bar = bar
/// </summary>
public Unit BarometricPresBarUnit { get; }
/// <summary>
/// Air temperature, degrees C, to the nearest 0.1 degree C
/// </summary>
public double AirTemp { get; }
/// <summary>
/// Air temperature, degrees C, to the nearest 0.1 degree C C = degrees C
/// </summary>
public Unit AirTempUnit { get; }
/// <summary>
/// Water temperature, degrees C (this field left blank by WeatherStation)
/// </summary>
public double WaterTemp { get; }
/// <summary>
/// Water temperature, degrees C (this field left blank by WeatherStation) C = degrees C (this field left blank by WeatherStation)
/// </summary>
public Unit WaterTempUnit { get; }
/// <summary>
/// Relative humidity, percent, to the nearest 0.1 percent
/// </summary>
public double RelativeHumidity { get; }
/// <summary>
/// Absolute humidity, percent (this field left blank by WeatherStation)
/// </summary>
public double AbsoluteHumidity { get; }
/// <summary>
/// Dew point, degrees C, to the nearest 0.1 degree C
/// </summary>
public double DewPoint { get; }
/// <summary>
/// Dew point, degrees C, to the nearest 0.1 degree C C = degrees C
/// </summary>
public Unit DewPointUnit { get; }
/// <summary>
/// Wind direction, degrees True, to the nearest 0.1 degree
/// </summary>
public double WindDirTrue { get; }
/// <summary>
/// Wind direction, degrees True, to the nearest 0.1 degree Reference, R = Relative, T = True
/// </summary>
public Reference WindDirTrueReference { get; }
/// <summary>
/// Wind direction, degrees Magnetic, to the nearest 0.1 degree
/// </summary>
public double WindDirMag { get; }
/// <summary>
/// Wind direction, degrees True, to the nearest 0.1 degree Reference, R = Relative, T = True
/// </summary>
public Reference WindDirMegReference { get; }
/// <summary>
/// Wind Speed N = knots
/// </summary>
public double WindSpeedKnot { get; }
/// <summary>
/// Wind Speed Units, N = knots
/// </summary>
public Unit WindSpeedKnotUnit { get; }
/// <summary>
/// Wind Speed M = meters per second
/// </summary>
public double WindSpeedMsec { get; }
/// <summary>
/// Wind Speed Units, M = meters per second
/// </summary>
public Unit WindSpeedMsecUnit { get; }
}
}

View file

@ -0,0 +1,96 @@
// *******************************************************************************
// * 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.Diagnostics.CodeAnalysis;
using System.Globalization;
using NmeaParser.Nmea.Class;
namespace NmeaParser.Messages
{
/// <summary>
/// Relative (Apparent) Wind Speed and Angle
/// </summary>
/// <remarks>
/// <para>
/// 1.: Wind Angle, 0 to 360 degrees
/// 2.: Reference, R = Relative, T = True
/// 3.: Wind Speed
/// 4.: Wind Speed Units, K/M/N
/// 5.: Validation, A = Data Valid
/// 6.: Checksum
/// </para>
/// <para>
/// Wind angle in relation to the vessel's heading and wind speed measured relative to the moving vessel
/// </para>
/// </remarks>
///
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "GpMwv")][NmeaMessageType("--MWV")]
public class Mwv : NmeaMessage
{
/// <summary>
/// Initializes a new instance of the <see cref="Mwv" /> class.
/// </summary>
/// <param name="type">The message type</param>
/// <param name="message">The NMEA message values.</param>
public Mwv(string type, string[] message) : base(type, message)
{
if (message == null || message.Length < 5)
throw new ArgumentException("Invalid Mwv", "message");
WindAngle = double.TryParse(message[0], NumberStyles.Float, CultureInfo.InvariantCulture, out var tmp)
? tmp
: double.NaN;
Reference = message[1] == "R" ? Reference.Relative : Reference.True;
WindSpeed = double.TryParse(message[2], NumberStyles.Float, CultureInfo.InvariantCulture, out tmp)
? tmp
: double.NaN;
WindSpeedUnit = message[3] switch
{
"K" => Unit.Kmh,
"M" => Unit.Mile,
"N" => Unit.Knot,
_ => WindSpeedUnit
};
Validation = message[4] == "A" ? Validation.Ok : Validation.Warning;
}
/// <summary>
/// Wind Angle, 0 to 360 degrees
/// </summary>
public double WindAngle { get; }
/// <summary>
/// Reference, R = Relative, T = True
/// </summary>
public Reference Reference { get; }
/// <summary>
/// Wind Speed
/// </summary>
public double WindSpeed { get; }
/// <summary>
/// Wind Speed Units, K/M/N
/// </summary>
public Unit WindSpeedUnit { get; }
/// <summary>
/// Validation, A = Data Valid
/// </summary>
public Validation Validation { get; }
}
}

View file

@ -0,0 +1,66 @@
// *******************************************************************************
// * 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.Diagnostics.CodeAnalysis;
using System.Globalization;
using NmeaParser.Nmea.Class;
namespace NmeaParser.Messages
{
/// <summary>
/// Rate and direction of turn
/// </summary>
/// <remarks>
/// <para>
/// 1.: Rate of turn, degrees/minute, "-" = bow turns to port
/// 2.: Status A = Data valid, V = Data invalid
/// </para>
/// <para>
/// Rate of turn and direction of turn.
/// </para>
/// <para><see cref="Rot" /> and <see cref="Rot" /> are the recommended minimum data to be provided by a GNSS receiver.</para>
/// </remarks>
///
[SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "GpRot")][NmeaMessageType("--ROT")]
public class Rot : NmeaMessage
{
/// <summary>
/// Initializes a new instance of the <see cref="Rot" /> class.
/// </summary>
/// <param name="type">The message type</param>
/// <param name="message">The NMEA message values.</param>
public Rot(string type, string[] message) : base(type, message)
{
if (message == null || message.Length < 2)
throw new ArgumentException("Invalid Rot", "message");
RateOfTurn = double.TryParse(message[0], NumberStyles.Float, CultureInfo.InvariantCulture, out var tmp)
? tmp
: double.NaN;
Validation = message[1] == "A" ? Validation.Ok : Validation.Warning;
}
/// <summary>
/// Rate of turn, degrees/minutes, “–” indicates bow turns to port
/// </summary>
public double RateOfTurn { get; }
/// <summary>
/// Status A = Data valid, V = Data invalid
/// </summary>
public Validation Validation { get; }
}
}

View file

@ -1,7 +1,7 @@
<Project Sdk="MSBuild.Sdk.Extras/2.0.54">
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard1.4;netcoreapp2.1;net451;monoandroid50;monoandroid70;xamarinios10;uap10.0.16299</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard1.4;netcoreapp2.1;net451;uap10.0.16299</TargetFrameworks>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Configurations>Debug;Release</Configurations>

View file

@ -21,8 +21,10 @@ using System.Text;
using NmeaParser.Messages;
using System.Threading.Tasks;
using System.IO;
using System.IO.MemoryMappedFiles;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Reflection;
using NmeaParser.Nmea.Class;
namespace NmeaParser.Tests
{
@ -838,6 +840,71 @@ namespace NmeaParser.Tests
Assert.AreEqual(new DateTimeOffset(2015, 09, 21, 22, 56, 27, 00, TimeSpan.Zero), zda.FixDateTime);
}
[TestMethod]
public void TestHdt()
{
const string input = "$HEHDT,11.8,T*17";
var msg = NmeaMessage.Parse(input);
Assert.IsInstanceOfType(msg, typeof(Hdt));
Hdt hdt = (Hdt)msg;
Assert.AreEqual(11.8, hdt.HeadingInDeg);
Assert.IsTrue(hdt.HeadingRelToTrueNorth);
}
[TestMethod]
public void TestMda()
{
const string input = "$WIMDA,30.3332,I,1.0272,B,5.5,C,1.2,C,22,33,2,C,172.7,T,170.2,M,3.8,N,2.0,M*0F";
var msg = NmeaMessage.Parse(input);
Assert.IsInstanceOfType(msg, typeof(Mda));
Mda mda = (Mda)msg;
Assert.AreEqual(30.3332, mda.BarometricPresI);
Assert.AreEqual(Unit.Inc, mda.BarometricPresIUnit);
Assert.AreEqual(1.0272, mda.BarometricPresBar);
Assert.AreEqual(Unit.Bar, mda.BarometricPresBarUnit);
Assert.AreEqual(5.5, mda.AirTemp);
Assert.AreEqual(Unit.C, mda.AirTempUnit);
Assert.AreEqual(1.2, mda.WaterTemp);
Assert.AreEqual(Unit.C, mda.WaterTempUnit);
Assert.AreEqual(22, mda.RelativeHumidity);
Assert.AreEqual(33, mda.AbsoluteHumidity);
Assert.AreEqual(2, mda.DewPoint);
Assert.AreEqual(Unit.C, mda.DewPointUnit);
Assert.AreEqual(172.7, mda.WindDirTrue);
Assert.AreEqual(Reference.True, mda.WindDirTrueReference);
Assert.AreEqual(170.2, mda.WindDirMag);
Assert.AreEqual(Reference.Magnetic, mda.WindDirMegReference);
Assert.AreEqual(3.8, mda.WindSpeedKnot);
Assert.AreEqual(Unit.Knot, mda.WindSpeedKnotUnit);
Assert.AreEqual(2.0, mda.WindSpeedMsec);
Assert.AreEqual(Unit.Msec, mda.WindSpeedMsecUnit);
}
[TestMethod]
public void TestMwv()
{
const string input = "$WIMWV,132.8,R,1.2,N,A*28";
var msg = NmeaMessage.Parse(input);
Assert.IsInstanceOfType(msg, typeof(Mwv));
Mwv mwv = (Mwv)msg;
Assert.AreEqual(132.8, mwv.WindAngle);
Assert.AreEqual(Reference.Relative, mwv.Reference);
Assert.AreEqual(1.2, mwv.WindSpeed);
Assert.AreEqual(Unit.Knot, mwv.WindSpeedUnit);
Assert.AreEqual(Validation.Ok, mwv.Validation);
}
[TestMethod]
public void TestRot()
{
const string input = "$TIROT,1.69,A*05";
var msg = NmeaMessage.Parse(input);
Assert.IsInstanceOfType(msg, typeof(Rot));
Rot rot = (Rot)msg;
Assert.AreEqual(1.69, rot.RateOfTurn);
Assert.AreEqual(Validation.Ok,rot.Validation);
}
[TestMethod]
public void TestCustomMessageRegistration()
{