Added ITimestampedMessage

Added ITimestampedMessage interface to easily get time stamps from any message that supports it
This commit is contained in:
Morten Nielsen 2020-07-22 10:50:21 -07:00
parent adef7b83c4
commit 2b4462f187
8 changed files with 38 additions and 8 deletions

View file

@ -26,7 +26,7 @@ namespace NmeaParser.Messages
/// </remarks>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gpgga")]
[NmeaMessageType("--GGA")]
public class Gga : NmeaMessage
public class Gga : NmeaMessage, ITimestampedMessage
{
/// <summary>
/// Initializes a new instance of the <see cref="Gga"/> class.
@ -123,6 +123,8 @@ namespace NmeaParser.Messages
/// </summary>
public int DgpsStationId { get; }
TimeSpan ITimestampedMessage.Timestamp => FixTime;
/// <summary>
/// Fix quality indicater
/// </summary>

View file

@ -24,7 +24,7 @@ namespace NmeaParser.Messages
/// </remarks>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gll")]
[NmeaMessageType("--GLL")]
public class Gll : NmeaMessage
public class Gll : NmeaMessage, ITimestampedMessage
{
/// <summary>
/// Initializes a new instance of the <see cref="Gll"/> class.
@ -85,6 +85,8 @@ namespace NmeaParser.Messages
/// </summary>
public Mode ModeIndicator { get; }
TimeSpan ITimestampedMessage.Timestamp => FixTime;
/// <summary>
/// Positioning system Mode Indicator
/// </summary>

View file

@ -38,7 +38,7 @@ namespace NmeaParser.Messages
/// </remarks>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gns")]
[NmeaMessageType("--GNS")]
public class Gns : NmeaMessage
public class Gns : NmeaMessage, ITimestampedMessage
{
/*
* Example of GNS messages:
@ -258,5 +258,7 @@ namespace NmeaParser.Messages
/// Navigational status
/// </summary>
public NavigationalStatus Status { get; }
TimeSpan ITimestampedMessage.Timestamp => FixTime;
}
}

View file

@ -21,7 +21,7 @@ namespace NmeaParser.Messages
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gpgst")]
[NmeaMessageType("--GST")]
public class Gst : NmeaMessage
public class Gst : NmeaMessage, ITimestampedMessage
{
/// <summary>
/// Initializes a new instance of the <see cref="Gst"/> class.
@ -82,5 +82,7 @@ namespace NmeaParser.Messages
/// Standard deviation of altitude error in meters.
/// </summary>
public double SigmaHeightError { get; }
TimeSpan ITimestampedMessage.Timestamp => FixTime;
}
}

View file

@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace NmeaParser.Messages
{
/// <summary>
/// Indicates this message has a time stamp
/// </summary>
public interface ITimestampedMessage
{
/// <summary>
/// Gets the time of day for the message
/// </summary>
TimeSpan Timestamp { get; }
}
}

View file

@ -28,7 +28,7 @@ namespace NmeaParser.Messages
/// </remarks>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Gprmc")]
[NmeaMessageType("--RMC")]
public class Rmc : NmeaMessage
public class Rmc : NmeaMessage, ITimestampedMessage
{
/// <summary>
/// Initializes a new instance of the <see cref="Rmc"/> class.
@ -93,5 +93,7 @@ namespace NmeaParser.Messages
/// Magnetic Variation
/// </summary>
public double MagneticVariation { get; }
TimeSpan ITimestampedMessage.Timestamp => FixTime.TimeOfDay;
}
}

View file

@ -22,7 +22,7 @@ namespace NmeaParser.Messages
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1704:IdentifiersShouldBeSpelledCorrectly", MessageId = "Zda")]
[NmeaMessageType("--ZDA")]
public class Zda : NmeaMessage
public class Zda : NmeaMessage, ITimestampedMessage
{
/// <summary>
/// Initializes a new instance of the <see cref="Zda"/> class.
@ -53,5 +53,7 @@ namespace NmeaParser.Messages
/// Gets the time of fix
/// </summary>
public DateTimeOffset FixDateTime { get; }
TimeSpan ITimestampedMessage.Timestamp => FixDateTime.TimeOfDay;
}
}

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 uwp xamarin gps serialport bluetooth</PackageTags>
<PackageId>SharpGIS.NmeaParser</PackageId>
<Version>2.0</Version>
<Version>2.1</Version>
<Product>NMEA Parser</Product>
<PackageLicenseExpression>Apache-2.0</PackageLicenseExpression>
<PackageProjectUrl>https://dotmorten.github.io/NmeaParser/</PackageProjectUrl>
@ -20,7 +20,7 @@
<Copyright>Copyright © Morten Nielsen 2015-2020</Copyright>
<OutputPath>$(MSBuildThisFileDirectory)..\..\artifacts\NmeaParser\$(Configuration)</OutputPath>
<PackageOutputPath>..\..\artifacts\NuGet\$(Configuration)\</PackageOutputPath>
<PackageReleaseNotes>New refined and easier to use v2 API</PackageReleaseNotes>
<PackageReleaseNotes>Added ITimestampedMessage interface to easily get time stamps from any message that supports it</PackageReleaseNotes>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
@ -30,6 +30,7 @@
<Nullable>enable</Nullable>
<PackageIcon>logo.png</PackageIcon>
<PackageIconUrl />
<AssemblyVersion>2.1.0.0</AssemblyVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard1.4'">