Skip to main content

Class NmeaSentence

Represents a NMEA data sentence typically used in GPS/GNSS systems.

Assembly: Meadow.Contracts.dll
View Source
Declaration
public class NmeaSentence

Properties

StartingDelimiter

The first character in the sentence. Usually $, but AIVDM/AIVDO sentences might start with !.

View Source
Declaration
public string StartingDelimiter { get; set; }

TalkerID

The first two letters (after the starting delimiter) comprise the Talker ID, which describes the system in use, for instance "GL" means that the data came from the GLONASS system. "BD" means BeiDou, etc.

Default value is "GP".

View Source
Declaration
public string TalkerID { get; set; }

TalkerSystemName

Retrieves the full name associated with the TalkerID via the KnownTalkerIDs property of the Lookups class.

View Source
Declaration
public string TalkerSystemName { get; }

Prefix

The prefix, excluding the $ symbol and first two letters of the sentence, i.e.: RMC.

View Source
Declaration
public string? Prefix { get; set; }

DataElements

A list of strings that represent the data elements within a NMEA sentence, between the prefix and the checksum data.

View Source
Declaration
public List<string> DataElements { get; set; }

Checksum

The checksum data of the data elements. Calculated by XORing all of the data elements.

View Source
Declaration
public byte Checksum { get; }

Methods

GetDataString()

Returns the NMEA sentence string without the checksum digits.

View Source
Declaration
protected string GetDataString()
Returns

System.String

ToString()

Returns a fully-expressed NMEA data string, including the prefix, data elements, and checksum information.

I.e.: $GPRMC,000049.799,V,,,,,0.00,0.00,060180,,,N*48

View Source
Declaration
public override string ToString()
Returns

System.String: A string of the sentence.### From(string) Creates a Meadow.Peripherals.Sensors.Location.Gnss.NmeaSentence from a string. Will parse the prefix, data elements, and also validate the checksum. If the checksum is invalid, it will throw an System.ArgumentException, therefore this should be used in a try/catch block.

View Source
Declaration
public static NmeaSentence From(string sentence)
Returns

Meadow.Peripherals.Sensors.Location.Gnss.NmeaSentence: A NmeaSentence class representing with the NMEA information loaded.

Parameters
TypeNameDescription
System.StringsentenceA NMEA sentence string.