DKW.NMEA 1.2.135

There is a newer version of this package available.
See the version list below for details.
dotnet add package DKW.NMEA --version 1.2.135                
NuGet\Install-Package DKW.NMEA -Version 1.2.135                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DKW.NMEA" Version="1.2.135" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DKW.NMEA --version 1.2.135                
#r "nuget: DKW.NMEA, 1.2.135"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DKW.NMEA as a Cake Addin
#addin nuget:?package=DKW.NMEA&version=1.2.135

// Install DKW.NMEA as a Cake Tool
#tool nuget:?package=DKW.NMEA&version=1.2.135                

DKW NMEA

Build status

A very fast NMEA parser. The speed is achieved by using System.Buffers, System.IO.Pipelines, Span<T> and related bits and pieces avoiding as many allocations as possible.

(This is my first foray into Buffers and Pipelines... Be Gentle!)

Usage

Synchronous:

using (var nr = new NmeaReader(File.Open("track2.nmea")))
{
  while (true)
  {
    var message = nr.ReadNext();
    if (message == null)
    {
      break;
    }
    Console.WriteLine(message);
  }
}

Asynchronous:

using (var nr = new NmeaReader(File.Open("track2.nmea")))
{
  while (true)
  {
    var message = await nr.ReadNextAsync().ConfigureAwait(false);
    if (message == null)
    {
      break;
    }
    Console.WriteLine(message);
  }
}

Bloody freaking crazy Asynchronous:

var nsr = NmeaStreamReader.Create();
using (var reader = File.Open("track1.nmea"))
{
  await nsr.ParseStreamAsync(reader, (s) =>
  {
    Console.WriteLine(message);
  }).ConfigureAwait(false);
}

Filtering

If you are only interested in a specific NMEA sentence then build the NmeaStreamReader yourself:

var nsr = new NmeaStreamReader().Register(new GGA());

Parsers are available for:

  • GPGGA
  • GPGLL
  • GPGSA
  • GPGSV
  • GPRMC

But don't despair! It's easy to add new sentences.

public class GLL : NmeaMessage
{
  private static readonly ReadOnlyMemory<Byte> KEY = Encoding.UTF8.GetBytes("$GPGLL").AsMemory();
  protected override ReadOnlyMemory<Byte> Key => KEY;

  public Double Latitude { get; private set; }
  public Double Longitude { get; private set; }
  public TimeSpan FixTime { get; private set; }
  public Char DataActive { get; private set; }

  public override String ToString() => $"GPGLL {Latitude} {Longitude} {FixTime} {DataActive}";

  public override NmeaMessage Parse(ReadOnlySequence<Byte> sentence)
  {
    var lexer = new Lexer(sentence);

    if (lexer.NextString() != "GPGLL")
    {
      throw lexer.Error();
    }

    return new GLL()
    {
      Latitude = lexer.NextLatitude(),
      Longitude = lexer.NextLongitude(),
      FixTime = lexer.NextTimeSpan(),
      DataActive = lexer.NextChar(),
      Checksum = lexer.NextChecksum()
    };
  }
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.1 is compatible.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.155 966 4/25/2019
1.2.154 602 4/25/2019
1.2.153 635 4/25/2019
1.2.151 622 4/25/2019
1.2.150 617 4/25/2019
1.2.144 643 3/30/2019
1.2.142 613 3/9/2019
1.2.141 697 1/22/2019
1.2.140 658 1/22/2019
1.2.138 673 12/19/2018
1.2.137 667 12/19/2018
1.2.135 667 12/19/2018
1.2.134 682 12/12/2018
1.2.133 687 12/12/2018
1.1.0 738 12/7/2018
1.1.0-beta0001 586 12/5/2018
1.1.0-alpha0001 651 12/7/2018
1.0.2 681 12/5/2018
1.0.1 718 12/4/2018
0.1.0-alpha0008 578 12/1/2018