nmea

package module
Version: v1.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2022 License: MIT Imports: 8 Imported by: 44

README

go-nmea

CI Go Report Card Coverage Status GoDoc

This is a NMEA library for the Go programming language (Golang).

Features

  • Parse individual NMEA 0183 sentences
  • Support for sentences with NMEA 4.10 "TAG Blocks"
  • Register custom parser for unsupported sentence types
  • User-friendly MIT license

Installing

To install go-nmea use go get:

go get github.com/adrianmo/go-nmea

This will then make the github.com/adrianmo/go-nmea package available to you.

Staying up to date

To update go-nmea to the latest version, use go get -u github.com/adrianmo/go-nmea.

Supported sentences

At this moment, this library supports the following sentence types:

Sentence type Description
AAM Waypoint Arrival Alarm
ALA System Faults and Alarms
APB Autopilot Sentence "B"
BEC Bearing and distance to waypoint (dead reckoning)
BOD Bearing waypoint to waypoint (origin to destination)
BWC Bearing and distance to waypoint (great circle)
BWR Bearing and distance to waypoint (Rhumb Line)
BWW Bearing from destination waypoint to origin waypoint
DBK Depth Below Keel (obsolete, use DPT instead)
DBS Depth Below Surface (obsolete, use DPT instead)
DBT Depth below transducer
DOR Door Status Detection
DPT Depth of Water
DSC Digital Selective Calling Information
DSE Expanded digital selective calling
DTM Datum Reference
EVE General Event Message
FIR Fire Detection event with time and location
GGA GPS Positioning System Fix Data
GLL Geographic Position, Latitude / Longitude and time
GNS Combined GPS fix for GPS, Glonass, Galileo, and BeiDou
GSA GPS DOP and active satellites
GSV GPS Satellites in view
HDG Heading, Deviation & Variation
HDM Heading - Magnetic
HDT Actual vessel heading in degrees True
HSC Heading steering command
MDA Meteorological Composite
MTA Air Temperature (obsolete, use XDR instead)
MTW Mean Temperature of Water
MWD Wind Direction and Speed
MWV Wind Speed and Angle
OSD Own Ship Data
RMB Recommended Minimum Navigation Information
RMC Recommended Minimum Specific GPS/Transit data
ROT Rate of turn
RPM Engine or Shaft revolutions and pitch
RSA Rudder Sensor Angle
RSD RADAR System Data
RTE Route
THS Actual vessel heading in degrees True and status
TLL Target latitude and longitude
TTM Tracked Target Message
TXT Sentence is for the transmission of text messages
VBW Dual Ground/Water Speed
VDM/VDO Encapsulated binary payload (commonly used with AIS data)
VDR Set and Drift
VHW Water Speed and Heading
VLW Distance Traveled through Water
VPW Speed Measured Parallel to Wind
VTG Track Made Good and Ground Speed
VWR Relative Wind Speed and Angle
VWT True Wind Speed and Angle
WPL Waypoint location
XDR Transducer Measurement
ZDA Date & time data
Proprietary sentence type Description
PGRME Estimated Position Error (Garmin proprietary sentence)
PHTRO Vessel pitch and roll (Xsens IMU/VRU/AHRS)
PMTK Messages for setting and reading commands for MediaTek gps modules.
PRDID Vessel pitch, roll and heading (Xsens IMU/VRU/AHRS)
PSONCMS Quaternion, acceleration, rate of turn, magnetic field, sensor temperature (Xsens IMU/VRU/AHRS)

If you need to parse a message that contains an unsupported sentence type you can implement and register your own message parser and get yourself unblocked immediately. Check the example below to know how to implement and register a custom message parser. However, if you think your custom message parser could be beneficial to other users we encourage you to contribute back to the library by submitting a PR and get it included in the list of supported sentences.

Examples

Built-in message parsing
package main

import (
	"fmt"
	"log"
	"github.com/adrianmo/go-nmea"
)

func main() {
	sentence := "$GPRMC,220516,A,5133.82,N,00042.24,W,173.8,231.8,130694,004.2,W*70"
	s, err := nmea.Parse(sentence)
	if err != nil {
		log.Fatal(err)
	}
	if s.DataType() == nmea.TypeRMC {
		m := s.(nmea.RMC)
		fmt.Printf("Raw sentence: %v\n", m)
		fmt.Printf("Time: %s\n", m.Time)
		fmt.Printf("Validity: %s\n", m.Validity)
		fmt.Printf("Latitude GPS: %s\n", nmea.FormatGPS(m.Latitude))
		fmt.Printf("Latitude DMS: %s\n", nmea.FormatDMS(m.Latitude))
		fmt.Printf("Longitude GPS: %s\n", nmea.FormatGPS(m.Longitude))
		fmt.Printf("Longitude DMS: %s\n", nmea.FormatDMS(m.Longitude))
		fmt.Printf("Speed: %f\n", m.Speed)
		fmt.Printf("Course: %f\n", m.Course)
		fmt.Printf("Date: %s\n", m.Date)
		fmt.Printf("Variation: %f\n", m.Variation)
	}
}

Output:

$ go run main/main.go

Raw sentence: $GPRMC,220516,A,5133.82,N,00042.24,W,173.8,231.8,130694,004.2,W*70
Time: 22:05:16.0000
Validity: A
Latitude GPS: 5133.8200
Latitude DMS: 51° 33' 49.200000"
Longitude GPS: 042.2400
Longitude DMS: 0° 42' 14.400000"
Speed: 173.800000
Course: 231.800000
Date: 13/06/94
Variation: -4.200000
TAG Blocks

NMEA 4.10 TAG Block values can be accessed via the message's TagBlock struct:

package main

import (
	"fmt"
	"log"
	"time"
	"github.com/adrianmo/go-nmea"
)

func main() {
	sentence := "\\s:Satelite_1,c:1553390539*62\\!AIVDM,1,1,,A,13M@ah0025QdPDTCOl`K6`nV00Sv,0*52"
	s, err := nmea.Parse(sentence)
	if err != nil {
		log.Fatal(err)
	}
	parsed := s.(nmea.VDMVDO)
	fmt.Printf("TAG Block timestamp: %v\n", time.Unix(parsed.TagBlock.Time, 0))
	fmt.Printf("TAG Block source:    %v\n", parsed.TagBlock.Source)
}

Output (locale/time zone dependent):

$  go run main/main.go

TAG Block timestamp: 2019-03-24 14:22:19 +1300 NZDT
TAG Block source:    Satelite_1
Custom message parsing

If you need to parse a message not supported by the library you can implement your own message parsing. The following example implements a parser for the hypothetical XYZ NMEA sentence type.

package main

import (
	"fmt"

	"github.com/adrianmo/go-nmea"
)

// A type to hold the parsed record
type XYZType struct {
	nmea.BaseSentence
	Time    nmea.Time
	Counter int64
	Label   string
	Value   float64
}

func main() {
	// Do this once it will error if you register the same type multiple times
	err := nmea.RegisterParser("XYZ", func(s nmea.BaseSentence) (nmea.Sentence, error) {
		// This example uses the package builtin parsing helpers
		// you can implement your own parsing logic also
		p := nmea.NewParser(s)
		return XYZType{
			BaseSentence: s,
			Time:         p.Time(0, "time"),
			Label:        p.String(1, "label"),
			Counter:      p.Int64(2, "counter"),
			Value:        p.Float64(3, "value"),
		}, p.Err()
	})

	if err != nil {
		panic(err)
	}

	sentence := "$00XYZ,220516,A,23,5133.82,W*42"
	s, err := nmea.Parse(sentence)
	if err != nil {
		panic(err)
	}

	switch m := s.(type) {
	case XYZType:
		fmt.Printf("Raw sentence: %v\n", m)
		fmt.Printf("Time: %s\n", m.Time)
		fmt.Printf("Label: %s\n", m.Label)
		fmt.Printf("Counter: %d\n", m.Counter)
		fmt.Printf("Value: %f\n", m.Value)
	default:
		panic("Could not parse XYZ sentence")
	}
}

Output:

$ go run main/main.go

Raw sentence: $AAXYZ,220516,A,23,5133.82,W*42
Time: 22:05:16.0000
Label: A
Counter: 23
Value: 5133.820000

Contributing

Please feel free to submit issues or fork the repository and send pull requests to update the library and fix bugs, implement support for new sentence types, refactor code, etc.

License

Check LICENSE.

Documentation

Index

Constants

View Source
const (
	// TypeAPB type of APB sentence for Autopilot Sentence "B"
	TypeAPB = "APB"

	// StatusWarningASetAPB indicates LORAN-C Blink or SNR warning
	StatusWarningASetAPB = "V"
	// StatusWarningAClearORNotUsedAPB general warning flag or other navigation systems when a reliable fix is not available
	StatusWarningAClearORNotUsedAPB = "A"

	// StatusWarningBSetAPB means Loran-C Cycle Lock warning OK or not used
	StatusWarningBSetAPB = "A"
	// StatusWarningBClearAPB means Loran-C Cycle Lock warning flag
	StatusWarningBClearAPB = "V"
)
View Source
const (
	// WPStatusPerpendicularPassedA is warning for passing the perpendicular of the course line of waypoint
	WPStatusPerpendicularPassedA = "A"
	// WPStatusPerpendicularPassedV indicates for not passing of the perpendicular of the course line of waypoint
	WPStatusPerpendicularPassedV = "V"

	// WPStatusArrivalCircleEnteredA is warning of entering to waypoint circle
	WPStatusArrivalCircleEnteredA = "A"
	// WPStatusArrivalCircleEnteredV indicates of not yet entered into waypoint circle
	WPStatusArrivalCircleEnteredV = "V"
)

Autopilot related constants (used in APB, APA, AAM)

View Source
const (
	// PrefixGNGNS prefix
	//
	// Deprecated: Use TypeGNS instead
	PrefixGNGNS = "GNGNS"

	// PrefixGPGGA prefix
	//
	// Deprecated: Use TypeGGA instead
	PrefixGPGGA = "GPGGA"

	// PrefixGPGLL prefix for GPGLL sentence type
	//
	// Deprecated: Use TypeGLL instead
	PrefixGPGLL = "GPGLL"

	// PrefixGPGSA prefix of GPGSA sentence type
	//
	// Deprecated: Use TypeGSA instead
	PrefixGPGSA = "GPGSA"

	// PrefixGPRMC prefix of GPRMC sentence type
	//
	// Deprecated: Use TypeRMC instead
	PrefixGPRMC = "GPRMC"

	// PrefixPGRME prefix for PGRME sentence type
	//
	// Deprecated: Use TypePGRME instead
	PrefixPGRME = "PGRME"

	// PrefixGLGSV prefix
	//
	// Deprecated: Use TypeGSV instead
	PrefixGLGSV = "GLGSV"

	// PrefixGNGGA prefix
	//
	// Deprecated: Use TypeGGA instead
	PrefixGNGGA = "GNGGA"

	// PrefixGNRMC prefix of GNRMC sentence type
	//
	// Deprecated: Use TypeRMC instead
	PrefixGNRMC = "GNRMC"

	// PrefixGPGSV prefix
	//
	// Deprecated: Use TypeGSV instead
	PrefixGPGSV = "GPGSV"

	// PrefixGPHDT prefix of GPHDT sentence type
	//
	// Deprecated: Use TypeHDT instead
	PrefixGPHDT = "GPHDT"

	// PrefixGPVTG prefix
	//
	// Deprecated: Use TypeVTG instead
	PrefixGPVTG = "GPVTG"

	// PrefixGPZDA prefix
	//
	// Deprecated: Use TypeZDA instead
	PrefixGPZDA = "GPZDA"
)
View Source
const (
	// TypeDOR type of DOR sentence for Door Status Detection
	TypeDOR = "DOR"

	// TypeSingleDoorDOR is type for single door related event
	TypeSingleDoorDOR = "E"
	// TypeFaultDOR is type for fault with door
	TypeFaultDOR = "F"
	// TypeSectionDOR is type for section of doors related event
	TypeSectionDOR = "S"

	// DoorStatusOpenDOR is status for open door
	DoorStatusOpenDOR = "O"
	// DoorStatusClosedDOR is status for closed door
	DoorStatusClosedDOR = "C"
	// DoorStatusFaultDOR is status for fault with door
	DoorStatusFaultDOR = "X"

	// SwitchSettingHarbourModeDOR is setting for Harbour mode (allowed open)
	SwitchSettingHarbourModeDOR = "O"
	// SwitchSettingSeaModeDOR is setting for Sea mode (ordered closed)
	SwitchSettingSeaModeDOR = "C"
)
View Source
const (
	// TypeDSC type of DSC sentence for Digital Selective Calling Information
	TypeDSC = "DSC"

	// AcknowledgementRequestDSC is type for Acknowledge request
	AcknowledgementRequestDSC = "R"
	// AcknowledgementDSC is type for Acknowledgement
	AcknowledgementDSC = "B"
	// AcknowledgementNeitherDSC is type for Neither (end of sequence)
	AcknowledgementNeitherDSC = "S"
)
View Source
const (
	// TypeDSE type of DSE sentence for Expanded digital selective calling
	TypeDSE = "DSE"

	// AcknowledgementAutomaticDSE is type for automatic
	AcknowledgementAutomaticDSE = "A"
	// AcknowledgementRequestDSE is type for request
	AcknowledgementRequestDSE = "R"
	// AcknowledgementQueryDSE is type for query
	AcknowledgementQueryDSE = "Q"
)
View Source
const (
	// TypeFIR type of FIR sentence for Fire Detection
	TypeFIR = "FIR"

	// TypeEventOrAlarmFIR is Event, Fire Alarm type
	TypeEventOrAlarmFIR = "E"
	// TypeFaultFIR is type for Fault
	TypeFaultFIR = "F"
	// TypeDisablementFIR is type for detector disablement
	TypeDisablementFIR = "D"

	// ConditionActivationFIR is activation condition
	ConditionActivationFIR = "A"
	// ConditionNonActivationFIR is non-activation condition
	ConditionNonActivationFIR = "V"
	// ConditionUnknownFIR is unknown condition
	ConditionUnknownFIR = "X"

	// AlarmStateAcknowledgedFIR is value for alarm acknowledgement
	AlarmStateAcknowledgedFIR = "A"
	// AlarmStateNotAcknowledgedFIR is value for alarm being not acknowledged
	AlarmStateNotAcknowledgedFIR = "V"
)
View Source
const (
	// TypeGGA type for GGA sentences
	TypeGGA = "GGA"
	// Invalid fix quality.
	Invalid = "0"
	// GPS fix quality
	GPS = "1"
	// DGPS fix quality
	DGPS = "2"
	// PPS fix
	PPS = "3"
	// RTK real time kinematic fix
	RTK = "4"
	// FRTK float RTK fix
	FRTK = "5"
	// EST estimated fix.
	EST = "6"
)
View Source
const (
	// TypeGLL type for GLL sentences
	TypeGLL = "GLL"
	// ValidGLL character
	ValidGLL = "A"
	// InvalidGLL character
	InvalidGLL = "V"
)
View Source
const (
	// NoFixGNS Character
	NoFixGNS = "N"
	// AutonomousGNS Character
	AutonomousGNS = "A"
	// DifferentialGNS Character
	DifferentialGNS = "D"
	// PreciseGNS Character
	PreciseGNS = "P"
	// RealTimeKinematicGNS Character
	RealTimeKinematicGNS = "R"
	// FloatRTKGNS RealTime Kinematic Character
	FloatRTKGNS = "F"
	// EstimatedGNS Fix Character
	EstimatedGNS = "E"
	// ManualGNS Fix Character
	ManualGNS = "M"
	// SimulatorGNS Character
	SimulatorGNS = "S"
)

GNS mode values. These are same values ans GLL/RMC FAAMode* values. Note: there can be other values (proprietary).

View Source
const (
	// TypeGSA type for GSA sentences
	TypeGSA = "GSA"
	// Auto - Field 1, auto or manual fix.
	Auto = "A"
	// Manual - Field 1, auto or manual fix.
	Manual = "M"
	// FixNone - Field 2, fix type.
	FixNone = "1"
	// Fix2D - Field 2, fix type.
	Fix2D = "2"
	// Fix3D - Field 2, fix type.
	Fix3D = "3"
)
View Source
const (
	// TypeHDM type of HDM sentence for vessel heading in degrees with respect to magnetic north
	TypeHDM = "HDM"
	// MagneticHDM for valid Magnetic heading
	MagneticHDM = "M"
)
View Source
const (
	// TypeMDA type for MDA sentences
	TypeMDA = "MDA"
	// InchMDA for valid pressure in Inches of mercury
	InchMDA = "I"
	// BarsMDA for valid pressure in Bars
	BarsMDA = "B"
	// DegreesCMDA for valid data in degrees C
	DegreesCMDA = "C"
	// TrueMDA for valid data in True direction
	TrueMDA = "T"
	// MagneticMDA for valid data in Magnetic direction
	MagneticMDA = "M"
	// KnotsMDA for valid data in Knots
	KnotsMDA = "N"
	// MetersSecondMDA for valid data in Meters per Second
	MetersSecondMDA = "M"
)
View Source
const (
	// TypeMTW type of MWT sentence describing mean temperature of water
	TypeMTW = "MTW"
	// CelsiusMTW is MTW unit of measurement in celsius
	CelsiusMTW = "C"
)
View Source
const (
	// TypeMWD type for MWD sentences
	TypeMWD = "MWD"
	// TrueMWD for valid True Direction
	TrueMWD = "T"
	// MagneticMWD for valid Magnetic direction
	MagneticMWD = "M"
	// KnotsMWD for valid Knots
	KnotsMWD = "N"
	// MetersSecondMWD for valid Meters per Second
	MetersSecondMWD = "M"
)
View Source
const (
	// TypeMWV type for MWV sentences
	TypeMWV = "MWV"
	// RelativeMWV for Valid Relative angle data
	RelativeMWV = "R"
	// TheoreticalMWV for valid Theoretical angle data
	TheoreticalMWV = "T"
	// UnitKMHMWV unit for Kilometer per hour (KM/H)
	UnitKMHMWV = "K" // KM/H
	// UnitMSMWV unit for Meters per second (M/S)
	UnitMSMWV = "M" // M/S
	// UnitKnotsMWV unit for knots
	UnitKnotsMWV = "N" // knots
	// UnitSMilesHMWV unit for Miles per hour (M/H)
	UnitSMilesHMWV = "S"
	// ValidMWV data is valid
	ValidMWV = "A"
	// InvalidMWV data is invalid
	InvalidMWV = "V"
)
View Source
const (
	// TypeOSD type for OSD sentence for Own Ship Data
	TypeOSD = "OSD"

	// OSDReferenceBottomTrackingLog is reference for bottom tracking log
	OSDReferenceBottomTrackingLog = "B"
	// OSDReferenceManual is reference for manually entered
	OSDReferenceManual = "M"
	// OSDReferenceWaterReferenced is reference for water referenced
	OSDReferenceWaterReferenced = "W"
	// OSDReferenceRadarTracking is reference for radar tracking of fixed target
	OSDReferenceRadarTracking = "R"
	// OSDReferencePositioningSystemGroundReference is reference for positioning system ground reference
	OSDReferencePositioningSystemGroundReference = "P"
)
View Source
const (
	// TypePGRME type for PGRME sentences
	TypePGRME = "GRME"
	// ErrorUnit must be meters (M)
	ErrorUnit = "M"
)
View Source
const (
	// TypePHTRO type of PHTRO sentence for vessel pitch and roll
	TypePHTRO = "HTRO"
	// PHTROBowUP for bow up
	PHTROBowUP = "M"
	// PHTROBowDown for bow down
	PHTROBowDown = "P"
	// PHTROPortUP for port up
	PHTROPortUP = "T"
	// PHTROPortDown for port down
	PHTROPortDown = "B"
)
View Source
const (
	// TypeRMB type of RMB sentence for recommended minimum navigation information
	TypeRMB = "RMB"

	// DataStatusWarningClearRMB means data is OK
	DataStatusWarningClearRMB = "A"
	// DataStatusWarningSetRMB means warning flag set
	DataStatusWarningSetRMB = "V"
)
View Source
const (
	// TypeRMC type for RMC sentences
	TypeRMC = "RMC"
	// ValidRMC character
	ValidRMC = "A"
	// InvalidRMC character
	InvalidRMC = "V"
)
View Source
const (
	// TypeROT type of ROT sentence for vessel rate of turn
	TypeROT = "ROT"
	// ValidROT data is valid
	ValidROT = "A"
	// InvalidROT data is invalid
	InvalidROT = "V"
)
View Source
const (
	// TypeRPM type of RPM sentence for Engine or Shaft revolutions and pitch
	TypeRPM = "RPM"

	// SourceEngineRPM is value for case when source is Engine
	SourceEngineRPM = "E"
	// SourceShaftRPM is value for case when source is Shaft
	SourceShaftRPM = "S"
)
View Source
const (
	// TypeRSD type of RSD sentence for RADAR System Data
	TypeRSD = "RSD"

	// RSDDisplayRotationCourseUp is when display rotation is course up
	RSDDisplayRotationCourseUp = "C"
	// RSDDisplayRotationHeadingUp is when display rotation is ship heading up
	RSDDisplayRotationHeadingUp = "H"
	// RSDDisplayRotationNorthUp is when display rotation is (true) north up
	RSDDisplayRotationNorthUp = "N"
)
View Source
const (
	// TypeRTE type for RTE sentences
	TypeRTE = "RTE"

	// ActiveRoute active route
	ActiveRoute = "c"

	// WaypointList list containing waypoints
	WaypointList = "w"
)
View Source
const (
	// SentenceStart is the token to indicate the start of a sentence.
	SentenceStart = "$"

	// SentenceStartEncapsulated is the token to indicate the start of encapsulated data.
	SentenceStartEncapsulated = "!"

	// FieldSep is the token to delimit fields of a sentence.
	FieldSep = ","

	// ChecksumSep is the token to delimit the checksum of a sentence.
	ChecksumSep = "*"
)
View Source
const (
	// TypeTHS type for THS sentences
	TypeTHS = "THS"
	// AutonomousTHS autonomous ths heading
	AutonomousTHS = "A"
	// EstimatedTHS estimated (dead reckoning) THS heading
	EstimatedTHS = "E"
	// ManualTHS manual input THS heading
	ManualTHS = "M"
	// SimulatorTHS simulated THS heading
	SimulatorTHS = "S"
	// InvalidTHS not valid THS heading (or standby)
	InvalidTHS = "V"
)
View Source
const (
	// TypeTLL type of TLL sentence for Target latitude and longitude
	TypeTLL = "TLL"

	// RadarTargetLost is used when target is lost
	RadarTargetLost = "L"
	// RadarTargetAcquisition is used when target is acquired
	RadarTargetAcquisition = "Q"
	// RadarTargetTracking is used when tracking target
	RadarTargetTracking = "T"
)
View Source
const (
	// StatusValid indicated status having valid value
	StatusValid = "A"
	// StatusInvalid indicated status having invalid value
	StatusInvalid = "V"
)
View Source
const (
	// UnitAmpere is unit for current in Amperes
	UnitAmpere = "A"
	// UnitBars is unit for pressure in Bars
	UnitBars = "B"
	// UnitBinary is unit for binary data
	UnitBinary = "B"
	// UnitCelsius is unit for temperature in Celsius
	UnitCelsius = TemperatureCelsius
	// UnitFahrenheit is unit for temperature in Fahrenheit
	UnitFahrenheit = TemperatureFahrenheit
	// UnitDegrees is unit for angular displacement in Degrees
	UnitDegrees = "D"
	// UnitHertz is unit for frequency in Hertz
	UnitHertz = "H"
	// UnitLitresPerSecond is unit for volumetric flow in Litres per second
	UnitLitresPerSecond = "I"
	// UnitKelvin is unit of temperature in Kelvin
	UnitKelvin = TemperatureKelvin
	// UnitKilogramPerCubicMetre is unit of density in kilogram per cubic metre
	UnitKilogramPerCubicMetre = "K"
	// UnitMeters is unit of distance in Meters
	UnitMeters = DistanceUnitMetre
	// UnitCubicMeters is unit of volume in cubic meters
	UnitCubicMeters = "M"
	// UnitRevolutionsPerMinute is unit of rotational speed or the frequency of rotation around a fixed axis in revolutions per minute (RPM)
	UnitRevolutionsPerMinute = "R"
	// UnitPercent is percent of full range
	UnitPercent = "P"
	// UnitPascal is unit of pressure in Pascals
	UnitPascal = "P"
	// UnitPartsPerThousand is in parts-per notation set of pseudo-unit to describe small values of miscellaneous dimensionless quantities, e.g. mole fraction or mass fraction.
	UnitPartsPerThousand = "S"
	// UnitVolts is unit of voltage in Volts
	UnitVolts = "V"
)
View Source
const (
	// SpeedKnots is a unit of speed equal to one nautical mile per hour, exactly 1.852 km/h (approximately 1.151 mph or 0.514 m/s)
	SpeedKnots = "N"
	// SpeedMeterPerSecond is unit of speed of 1 meter per second
	SpeedMeterPerSecond = "M"
	// SpeedKilometerPerHour is unit of speed of 1 kilometer per hour
	SpeedKilometerPerHour = "K"
)
View Source
const (
	// TemperatureCelsius is unit of temperature measured in celsius. °C = (°F − 32) / 1,8
	TemperatureCelsius = "C"
	// TemperatureFahrenheit is unit of temperature measured in fahrenheits. °F = °C * 1,8 + 32
	TemperatureFahrenheit = "F"
	// TemperatureKelvin is unit of temperature measured in kelvins. K = °C + 273,15
	TemperatureKelvin = "K"
)
View Source
const (
	// HeadingMagnetic - Magnetic heading is your direction relative to magnetic north, read from your magnetic compass.
	// Magnetic north is the point on the Earth's surface where its magnetic field points directly downwards.
	HeadingMagnetic = "M"
	// HeadingTrue - True heading is your direction relative to true north, or the geographic north pole.
	// True north is the northern axis of rotation of the Earth. It is the point where the lines of longitude converge
	// on maps.
	HeadingTrue = "T"
)

In navigation, the heading of a vessel or object is the compass direction in which the craft's bow or nose is pointed. Note that the heading may not necessarily be the direction that the vehicle actually travels, which is known as its course or track. https://en.wikipedia.org/wiki/Heading_(navigation)

View Source
const (
	// BearingMagnetic is the clockwise angle between Earth's magnetic north and an object observed from the vessel.
	BearingMagnetic = "M"
	// BearingTrue  is the clockwise angle between Earth's true (geographical) north and an object observed from the vessel.
	BearingTrue = "T"
)

In nautical navigation the absolute bearing is the clockwise angle between north and an object observed from the vessel. https://en.wikipedia.org/wiki/Bearing_(angle)

View Source
const (
	// FAAModeAutonomous is Autonomous mode
	FAAModeAutonomous = "A"
	// FAAModeDifferential is Differential Mode
	FAAModeDifferential = "D"
	// FAAModeEstimated is Estimated (dead-reckoning) mode
	FAAModeEstimated = "E"
	// FAAModeRTKFloat is RTK Float mode
	FAAModeRTKFloat = "F"
	// FAAModeManualInput is Manual Input Mode
	FAAModeManualInput = "M"
	// FAAModeDataNotValid is Data Not Valid
	FAAModeDataNotValid = "N"
	// FAAModePrecise is Precise (NMEA4.00+)
	FAAModePrecise = "P"
	// FAAModeRTKInteger is RTK Integer mode
	FAAModeRTKInteger = "R"
	// FAAModeSimulated is Simulated Mode
	FAAModeSimulated = "S"
)

FAAMode is type for FAA mode indicator (NMEA 2.3 and later). In NMEA 2.3, several sentences (APB, BWC, BWR, GLL, RMA, RMB, RMC, VTG, WCV, and XTE) got a new last field carrying the signal integrity information needed by the FAA. Source: https://www.xj3.nl/dokuwiki/doku.php?id=nmea Note: there can be other values (proprietary).

View Source
const (
	// NavStatusAutonomous is Autonomous mode
	NavStatusAutonomous = "A"
	// NavStatusDifferential is Differential Mode
	NavStatusDifferential = "D"
	// NavStatusEstimated is Estimated (dead-reckoning) mode
	NavStatusEstimated = "E"
	// NavStatusManualInput is Manual Input Mode
	NavStatusManualInput = "M"
	// NavStatusSimulated is Simulated Mode
	NavStatusSimulated = "S"
	// NavStatusDataNotValid is Data Not Valid
	NavStatusDataNotValid = "N"
	// NavStatusDataValid is valid
	NavStatusDataValid = "V"
)

Navigation Status (NMEA 4.1 and later)

View Source
const (
	// DistanceUnitKilometre is unit for distance in kilometres (1km = 1000m)
	DistanceUnitKilometre = "K"
	// DistanceUnitNauticalMile is unit for distance in nautical miles (1nmi = 1852m)
	DistanceUnitNauticalMile = "N"
	// DistanceUnitStatuteMile is unit for distance in statute miles (1smi = 5,280 feet = 1609.344m)
	DistanceUnitStatuteMile = "S"
	// DistanceUnitMetre is unit for distance in metres
	DistanceUnitMetre = "M"
	// DistanceUnitFeet is unit for distance in feets (1f = 0.3048m)
	DistanceUnitFeet = "f"
	// DistanceUnitFathom is unit for distance in fathoms (1fm = 6ft = 1,8288m)
	DistanceUnitFathom = "F"
)
View Source
const (
	// Degrees value
	Degrees = '\u00B0'
	// Minutes value
	Minutes = '\''
	// Seconds value
	Seconds = '"'
	// Point value
	Point = '.'
	// North value
	North = "N"
	// South value
	South = "S"
	// East value
	East = "E"
	// West value
	West = "W"
	// Left value
	Left = "L"
	// Right value
	Right = "R"
)
View Source
const (
	// TypeVDM type for VDM sentences
	TypeVDM = "VDM"

	// TypeVDO type for VDO sentences
	TypeVDO = "VDO"
)
View Source
const (
	// TransducerAngularDisplacementXDR is transducer type for Angular displacement
	TransducerAngularDisplacementXDR = "A"
	// TransducerTemperatureXDR is transducer type for Temperature
	TransducerTemperatureXDR = "C"
	// TransducerDepthXDR is transducer type for Depth
	TransducerDepthXDR = "D"
	// TransducerFrequencyXDR is transducer type for Frequency
	TransducerFrequencyXDR = "F"
	// TransducerHumidityXDR is transducer type for Humidity
	TransducerHumidityXDR = "H"
	// TransducerForceXDR is transducer type for Force
	TransducerForceXDR = "N"
	// TransducerPressureXDR is transducer type for Pressure
	TransducerPressureXDR = "P"
	// TransducerFlowXDR is transducer type for Flow
	TransducerFlowXDR = "R"
	// TransducerAbsoluteHumidityXDR is transducer type for Absolute humidity
	TransducerAbsoluteHumidityXDR = "B"
	// TransducerGenericXDR is transducer type for Generic
	TransducerGenericXDR = "G"
	// TransducerCurrentXDR is transducer type for Current
	TransducerCurrentXDR = "I"
	// TransducerSalinityXDR is transducer type for Salinity
	TransducerSalinityXDR = "L"
	// TransducerSwitchValveXDR is transducer type for Switch, valve
	TransducerSwitchValveXDR = "S"
	// TransducerTachometerXDR is transducer type for Tachometer
	TransducerTachometerXDR = "T"
	// TransducerVoltageXDR is transducer type for Voltage
	TransducerVoltageXDR = "U"
	// TransducerVolumeXDR is transducer type for Volume
	TransducerVolumeXDR = "V"
)
View Source
const (
	// TypeAAM type of AAM sentence for Waypoint Arrival Alarm
	TypeAAM = "AAM"
)
View Source
const (
	// TypeALA type of ALA sentence for System Faults and alarms
	TypeALA = "ALA"
)
View Source
const (
	// TypeBEC type of BEC sentence for bearing and distance to waypoint (dead reckoning)
	TypeBEC = "BEC"
)
View Source
const (
	// TypeBOD type of BOD sentence for bearing waypoint to waypoint
	TypeBOD = "BOD"
)
View Source
const (
	// TypeBWC type of BWC sentence for bearing and distance to waypoint, great circle
	TypeBWC = "BWC"
)
View Source
const (
	// TypeBWR type of BWR sentence for bearing and distance to waypoint (Rhumb Line)
	TypeBWR = "BWR"
)
View Source
const (
	// TypeBWW type of BWW sentence for bearing (from destination) destination waypoint to origin waypoint
	TypeBWW = "BWW"
)
View Source
const (
	// TypeDBK type of DBK sentence for Depth Below Keel
	TypeDBK = "DBK"
)
View Source
const (
	// TypeDBS is type of DBS sentence for Depth Below Surface
	TypeDBS = "DBS"
)
View Source
const (
	// TypeDBT type for DBT sentences
	TypeDBT = "DBT"
)
View Source
const (
	// TypeDPT type for DPT sentences
	TypeDPT = "DPT"
)
View Source
const (
	// TypeDTM type of DTM sentence for Datum Reference
	TypeDTM = "DTM"
)
View Source
const (
	// TypeEVE type of EVE sentence for General Event Message
	TypeEVE = "EVE"
)
View Source
const (
	// TypeGNS type for GNS sentences
	TypeGNS = "GNS"
)
View Source
const (
	// TypeGSV type of GSV sentences for satellites in view
	TypeGSV = "GSV"
)
View Source
const (
	// TypeHDG type of HDG sentence for vessel heading, deviation and variation with respect to magnetic north.
	TypeHDG = "HDG"
)
View Source
const (
	// TypeHDT type for HDT sentences
	TypeHDT = "HDT"
)
View Source
const (
	// TypeHSC type of HSC sentence for Heading steering command
	TypeHSC = "HSC"
)
View Source
const (
	// TypeMTA type of MTA sentence for Air Temperature
	TypeMTA = "MTA"
)
View Source
const (
	// TypeMTK type for PMTK sentences
	TypeMTK = "PMTK"
)
View Source
const (
	// TypePRDID type of PRDID sentence for vessel pitch, roll and heading
	TypePRDID = "RDID"
)
View Source
const (
	// TypePSONCMS is type of PSONCMS sentence for proprietary Xsens IMU/VRU/AHRS device
	TypePSONCMS = "SONCMS"
)
View Source
const (
	// TypeRSA type of RSA sentence for Rudder Sensor Angle
	TypeRSA = "RSA"
)
View Source
const (
	// TypeTTM type of TTM sentence for Tracked Target Message
	TypeTTM = "TTM"
)
View Source
const (
	// TypeTXT type for TXT sentences for the transmission of text messages
	TypeTXT = "TXT"
)
View Source
const (
	// TypeVBW type of VBW sentence for Dual Ground/Water Speed
	TypeVBW = "VBW"
)
View Source
const (
	// TypeVDR type of VDR sentence for Set and Drift
	TypeVDR = "VDR"
)
View Source
const (
	// TypeVHW type for VHW sentences
	TypeVHW = "VHW"
)
View Source
const (
	// TypeVLW type of VLW sentence for Distance Traveled through Water
	TypeVLW = "VLW"
)
View Source
const (
	// TypeVPW type of VPW sentence for Speed Measured Parallel to Wind
	TypeVPW = "VPW"
)
View Source
const (
	// TypeVTG type for VTG sentences
	TypeVTG = "VTG"
)
View Source
const (
	// TypeVWR type of VWR sentence for Relative Wind Speed and Angle
	TypeVWR = "VWR"
)
View Source
const (
	// TypeVWT type of VWT sentence for True Wind Speed and Angle
	TypeVWT = "VWT"
)
View Source
const (
	// TypeWPL type for WPL sentences
	TypeWPL = "WPL"
)
View Source
const (
	// TypeXDR type of XDR sentence for Transducer Measurement
	TypeXDR = "XDR"
)
View Source
const (
	// TypeXTE type of XTE sentence for Cross-track error, measured
	TypeXTE = "XTE"
)
View Source
const (
	// TypeZDA type for ZDA sentences
	TypeZDA = "ZDA"
)

Variables

This section is empty.

Functions

func Checksum added in v1.2.0

func Checksum(s string) string

Checksum xor all the bytes in a string an return it as an uppercase hex string

func FormatDMS

func FormatDMS(l float64) string

FormatDMS returns the degrees, minutes, seconds format for the given LatLong.

func FormatGPS

func FormatGPS(l float64) string

FormatGPS formats a GPS/NMEA coordinate

func LatDir added in v1.2.0

func LatDir(l float64) string

LatDir returns the latitude direction symbol

func LonDir added in v1.2.0

func LonDir(l float64) string

LonDir returns the longitude direction symbol

func MustRegisterParser added in v1.2.0

func MustRegisterParser(sentenceType string, parser ParserFunc)

MustRegisterParser register a custom parser or panic

func ParseDMS

func ParseDMS(s string) (float64, error)

ParseDMS parses a coordinate in degrees, minutes, seconds. - e.g. 33° 23' 22"

func ParseDecimal

func ParseDecimal(s string) (float64, error)

ParseDecimal parses a decimal format coordinate. e.g: 151.196019

func ParseGPS

func ParseGPS(s string) (float64, error)

ParseGPS parses a GPS/NMEA coordinate. e.g `15113.4322 S`

func ParseLatLong

func ParseLatLong(s string) (float64, error)

ParseLatLong parses the supplied string into the LatLong.

Supported formats are: - DMS (e.g. 33° 23' 22") - Decimal (e.g. 33.23454) - GPS (e.g 15113.4322 S)

func RegisterParser added in v1.2.0

func RegisterParser(sentenceType string, parser ParserFunc) error

RegisterParser register a custom parser

Types

type AAM added in v1.6.0

type AAM struct {
	BaseSentence
	// StatusArrivalCircleEntered is warning of arrival to waypoint circle
	// * A = Arrival Circle Entered
	// * V = not entered
	StatusArrivalCircleEntered string

	// StatusPerpendicularPassed is warning for perpendicular passing of waypoint
	// * A = Perpendicular passed at waypoint
	// * V = not passed
	StatusPerpendicularPassed string

	// ArrivalCircleRadius is radius for arrival circle
	ArrivalCircleRadius float64

	// ArrivalCircleRadiusUnit is unit for arrival circle radius
	ArrivalCircleRadiusUnit string

	// DestinationWaypointID is destination waypoint ID
	DestinationWaypointID string
}

AAM - Waypoint Arrival Alarm This sentence is generated by some units to indicate the status of arrival (entering the arrival circle, or passing the perpendicular of the course line) at the destination waypoint (source: GPSD). https://gpsd.gitlab.io/gpsd/NMEA.html#_aam_waypoint_arrival_alarm

Format: $--AAM,A,A,x.x,N,c--c*hh<CR><LF> Example: $GPAAM,A,A,0.10,N,WPTNME*43

type ALA added in v1.6.0

type ALA struct {
	BaseSentence

	// Time is Event Time
	Time Time

	// SystemIndicator is system indicator of original alarm source. Detector system type with 2 char identifier.
	// Values not known
	// https://www.nmea.org/Assets/20190303%20nmea%200183%20talker%20identifier%20mnemonics.pdf
	SystemIndicator string

	// SubSystemIndicator is sub system equipment indicator of original alarm source
	SubSystemIndicator string

	// InstanceNumber is instance number of equipment/unit/item (00-99)
	InstanceNumber int64

	// Type is alarm type (000-999)
	Type int64

	// Condition describes the condition triggering current message
	// * N – Normal state (OK)
	// * H - Alarm state (fault);
	// could be more
	Condition string

	// AlarmAckState is Alarm's acknowledge state
	// * A – Acknowledged
	// * H - Harbour mode
	// * V – Not acknowledged
	// * O - Override
	// could be more
	AlarmAckState string

	// Message's description text (could be cut to fit max packet length)
	Message string
}

ALA - System Faults and alarms Source: "Interfacing Voyage Data Recorder Systems, AutroSafe Interactive Fire-Alarm System, 116-P-BSL336/EE, RevA 2007-01-25, Autronica Fire and Security AS " (page 31 | p.8.1.3) https://product.autronicafire.com/fileshare/fileupload/14251/bsl336_ee.pdf

Format: $FRALA,hhmmss,aa,aa,xx,xxx,a,a,c-cc*hh<CR><LF> Example: $FRALA,143955,FR,OT,00,901,N,V,Syst Fault : AutroSafe comm. OK*4F

type APB added in v1.6.0

type APB struct {
	BaseSentence

	// StatusGeneralWarning is used for warnings
	//  * V = LORAN-C Blink or SNR warning
	//  * A = general warning flag or other navigation systems when a reliable fix is not available
	StatusGeneralWarning string

	// StatusLockWarning is used for lock warning
	//  * V = Loran-C Cycle Lock warning flag
	//  * A = OK or not used
	StatusLockWarning string

	// CrossTrackErrorMagnitude is Cross Track Error Magnitude
	CrossTrackErrorMagnitude float64

	// DirectionToSteer is Direction to steer,
	//  * L = left
	//  * R = right
	DirectionToSteer string

	// CrossTrackUnits is cross track units
	// * N = nautical miles
	// * K = for kilometers
	CrossTrackUnits string

	// StatusArrivalCircleEntered is warning of arrival to waypoint circle
	// * A = Arrival Circle Entered
	// * V = not entered
	StatusArrivalCircleEntered string

	// StatusPerpendicularPassed is warning for perpendicular passing of waypoint
	// * A = Perpendicular passed at waypoint
	// * V = not passed
	StatusPerpendicularPassed string

	// BearingOriginToDest is Bearing origin to destination
	BearingOriginToDest float64

	// BearingOriginToDestType is Bearing origin to dest type
	// * M = Magnetic
	// * T = True
	BearingOriginToDestType string

	// DestinationWaypointID is Destination waypoint ID
	DestinationWaypointID string

	// BearingPresentToDest is Bearing, present position to Destination
	BearingPresentToDest float64

	// BearingPresentToDestType is Bearing present to dest type
	// * M = Magnetic
	// * T = True
	BearingPresentToDestType string

	// Heading is heading to steer to destination waypoint
	Heading float64

	// HeadingType is Heading type
	// * M = Magnetic
	// * T = True
	HeadingType string

	// FAA mode indicator (filled in NMEA 2.3 and later)
	FFAMode string
}

APB - Autopilot Sentence "B" for heading/tracking https://gpsd.gitlab.io/gpsd/NMEA.html#_apb_autopilot_sentence_b https://www.tronico.fi/OH6NT/docs/NMEA0183.pdf (page 5)

Format: $--APB,A,A,x.x,a,N,A,A,x.x,a,c--c,x.x,a,x.x,a*hh<CR><LF> Format NMEA 2.3+: $--APB,A,A,x.x,a,N,A,A,x.x,a,c--c,x.x,a,x.x,a,a*hh<CR><LF> Example: $GPAPB,A,A,0.10,R,N,V,V,011,M,DEST,011,M,011,M*82

$ECAPB,A,A,0.0,L,M,V,V,175.2,T,Antechamber_Bay,175.2,T,175.2,T*48

type BEC added in v1.6.0

type BEC struct {
	BaseSentence
	Time                       Time    // UTC Time
	Latitude                   float64 // latitude of waypoint
	Longitude                  float64 // longitude of waypoint
	BearingTrue                float64 // true bearing in degrees
	BearingTrueValid           bool    // is unit of true bearing valid
	BearingMagnetic            float64 // magnetic bearing in degrees
	BearingMagneticValid       bool    // is unit of magnetic bearing valid
	DistanceNauticalMiles      float64 // distance to waypoint in nautical miles
	DistanceNauticalMilesValid bool    // is unit of distance to waypoint nautical miles valid
	DestinationWaypointID      string  // destination waypoint ID
}

BEC - bearing and distance to waypoint (dead reckoning) http://www.nmea.de/nmea0183datensaetze.html#bec https://www.eye4software.com/hydromagic/documentation/nmea0183/

Format: $--BEC,hhmmss.ss,llll.ll,a,yyyyy.yy,a,x.x,T,x.x,M,x.x,N,c--c*hh<CR><LF> Example: $GPBEC,220516,5130.02,N,00046.34,W,213.8,T,218.0,M,0004.6,N,EGLM*33

type BOD added in v1.6.0

type BOD struct {
	BaseSentence
	BearingTrue           float64 // true bearing in degrees
	BearingTrueType       string  // is type of true bearing
	BearingMagnetic       float64 // magnetic bearing in degrees
	BearingMagneticType   string  // is type of magnetic bearing
	DestinationWaypointID string  // destination waypoint ID
	OriginWaypointID      string  // origin waypoint ID
}

BOD - bearing waypoint to waypoint (origin to destination). Replaced by BWW in NMEA4+ (according to GPSD docs) If your system supports RMB it is better to use RMB as it is more common (according to OpenCPN docs) https://gpsd.gitlab.io/gpsd/NMEA.html#_bod_bearing_waypoint_to_waypoint

Format: $--BOD,x.x,T,x.x,M,c--c,c--c*hh<CR><LF> Example: $GPBOD,099.3,T,105.6,M,POINTB*64

$GPBOD,097.0,T,103.2,M,POINTB,POINTA*4A

type BWC added in v1.6.0

type BWC struct {
	BaseSentence
	Time                      Time    // UTC Time
	Latitude                  float64 // latitude of waypoint
	Longitude                 float64 // longitude of waypoint
	BearingTrue               float64 // true bearing in degrees
	BearingTrueType           string  // is type of true bearing
	BearingMagnetic           float64 // magnetic bearing in degrees
	BearingMagneticType       string  // is type of magnetic bearing
	DistanceNauticalMiles     float64 // distance to waypoint in nautical miles
	DistanceNauticalMilesUnit string  // is unit of distance to waypoint nautical miles
	DestinationWaypointID     string  // destination waypoint ID
	FFAMode                   string  // FAA mode indicator (filled in NMEA 2.3 and later)
}

BWC - bearing and distance to waypoint, great circle https://gpsd.gitlab.io/gpsd/NMEA.html#_bwc_bearing_distance_to_waypoint_great_circle http://aprs.gids.nl/nmea/#bwc

Format: $--BWC,hhmmss.ss,llll.ll,a,yyyyy.yy,a,x.x,T,x.x,M,x.x,N,c--c*hh<CR><LF> Format (NMEA 2.3+): $--BWC,hhmmss.ss,llll.ll,a,yyyyy.yy,a,x.x,T,x.x,M,x.x,N,c--c,m*hh<CR><LF> Example: $GPBWC,081837,,,,,,T,,M,,N,*13

$GPBWC,220516,5130.02,N,00046.34,W,213.8,T,218.0,M,0004.6,N,EGLM*21

type BWR added in v1.6.0

type BWR struct {
	BaseSentence
	Time                      Time    // UTC Time
	Latitude                  float64 // latitude of waypoint
	Longitude                 float64 // longitude of waypoint
	BearingTrue               float64 // true bearing in degrees
	BearingTrueType           string  // is type of true bearing
	BearingMagnetic           float64 // magnetic bearing in degrees
	BearingMagneticType       string  // is type of magnetic bearing
	DistanceNauticalMiles     float64 // distance to waypoint in nautical miles
	DistanceNauticalMilesUnit string  // is unit of distance to waypoint nautical miles
	DestinationWaypointID     string  // destination waypoint ID
	FFAMode                   string  // FAA mode indicator (filled in NMEA 2.3 and later)
}

BWR - bearing and distance to waypoint (Rhumb Line). This is calculated along rumb line instead of along the great circle. https://gpsd.gitlab.io/gpsd/NMEA.html#_bwr_bearing_and_distance_to_waypoint_rhumb_line

Format: $--BWR,hhmmss.ss,llll.ll,a,yyyyy.yy,a,x.x,T,x.x,M,x.x,N,c--c*hh<CR><LF> Format (NMEA 2.3+): $--BWR,hhmmss.ss,llll.ll,a,yyyyy.yy,a,x.x,T,x.x,M,x.x,N,c--c,m*hh<CR><LF> Example: $GPBWR,081837,,,,,,T,,M,,N,*02

$GPBWR,220516,5130.02,N,00046.34,W,213.8,T,218.0,M,0004.6,N,EGLM*30

type BWW added in v1.6.0

type BWW struct {
	BaseSentence
	BearingTrue           float64 // true bearing in degrees
	BearingTrueType       string  // is type of true bearing
	BearingMagnetic       float64 // magnetic bearing in degrees
	BearingMagneticType   string  // is type of magnetic bearing
	DestinationWaypointID string  // destination waypoint ID
	OriginWaypointID      string  // origin waypoint ID
}

BWW - bearing (from destination) destination waypoint to origin waypoint Replaces by BOD in NMEA4+ (according to GPSD docs) If your system supports RMB it is better to use RMB as it is more common (according to OpenCPN docs) https://gpsd.gitlab.io/gpsd/NMEA.html#_bww_bearing_waypoint_to_waypoint http://www.nmea.de/nmea0183datensaetze.html#bww

Format: $--BWW,x.x,T,x.x,M,c--c,c--c*hh<CR><LF> Example: $GPBWW,097.0,T,103.2,M,POINTB,POINTA*41

type BaseSentence

type BaseSentence struct {
	Talker   string   // The talker id (e.g GP)
	Type     string   // The data type (e.g GSA)
	Fields   []string // Array of fields
	Checksum string   // The Checksum
	Raw      string   // The raw NMEA sentence received
	TagBlock TagBlock // NMEA tagblock
}

BaseSentence contains the information about the NMEA sentence

func (BaseSentence) DataType added in v1.2.0

func (s BaseSentence) DataType() string

DataType returns the type of the message

func (BaseSentence) Prefix

func (s BaseSentence) Prefix() string

Prefix returns the talker and type of message

func (BaseSentence) String

func (s BaseSentence) String() string

String formats the sentence into a string

func (BaseSentence) TalkerID added in v1.2.0

func (s BaseSentence) TalkerID() string

TalkerID returns the talker of the message

type DBK added in v1.6.0

type DBK struct {
	BaseSentence
	DepthFeet        float64 // Depth, feet
	DepthFeetUnit    string  // f = feet
	DepthMeters      float64 // Depth, meters
	DepthMetersUnit  string  // M = meters
	DepthFathoms     float64 // Depth, Fathoms
	DepthFathomsUnit string  // F = Fathoms
}

DBK - Depth Below Keel (obsolete, use DPT instead) https://gpsd.gitlab.io/gpsd/NMEA.html#_dbk_depth_below_keel https://wiki.openseamap.org/wiki/OpenSeaMap-dev:NMEA#DBK_-_Depth_below_keel

Format: $--DBK,x.x,f,x.x,M,x.x,F*hh<CR><LF> Example: $SDDBK,12.3,f,3.7,M,2.0,F*2F

type DBS added in v1.2.0

type DBS struct {
	BaseSentence
	DepthFeet       float64 // Depth, feet
	DepthFeetUnit   string  // f = feet
	DepthMeters     float64 // Depth, meters
	DepthMeterUnit  string  // M = meters
	DepthFathoms    float64 // Depth, Fathoms
	DepthFathomUnit string  // F = Fathoms
}

DBS - Depth Below Surface (obsolete, use DPT instead) https://gpsd.gitlab.io/gpsd/NMEA.html#_dbs_depth_below_surface https://wiki.openseamap.org/wiki/OpenSeaMap-dev:NMEA#DBS_-_Depth_below_surface

Format: $--DBS,x.x,f,x.x,M,x.x,F*hh<CR><LF> Example: $23DBS,01.9,f,0.58,M,00.3,F*21

type DBT added in v1.2.0

type DBT struct {
	BaseSentence
	DepthFeet    float64
	DepthMeters  float64
	DepthFathoms float64
}

DBT - Depth below transducer https://gpsd.gitlab.io/gpsd/NMEA.html#_dbt_depth_below_transducer

Format: $--DBT,x.x,f,x.x,M,x.x,F*hh<CR><LF> Example: $IIDBT,032.93,f,010.04,M,005.42,F*2C

type DOR added in v1.6.0

type DOR struct {
	BaseSentence

	// Type is type of the message
	// * E – Single door
	// * F – Fault
	// * S – Section (whole or part of section)
	Type string

	// Time is Event Time
	Time Time

	// SystemIndicator is system indicator. Detector system type with 2 char identifier.
	// * WT - watertight
	// * WS - semi watertight
	// * FD - fire door
	// * HD - hull door
	// * OT - other
	// could be more
	// https://www.nmea.org/Assets/20190303%20nmea%200183%20talker%20identifier%20mnemonics.pdf
	SystemIndicator string

	// DivisionIndicator1 is first division indicator for locating origin detector for this message
	DivisionIndicator1 string

	// DivisionIndicator2 is second division indicator for locating origin detector for this message
	DivisionIndicator2 int64

	// DoorNumberOrCount is Door number or activated door count (seems to be field with overloaded meaning)
	DoorNumberOrCount int64

	// DoorStatus is Door status
	// * O – Open
	// * C – Closed
	// * X – Fault
	// could be more
	DoorStatus string

	// SwitchSetting is  Mode switch setting
	// * O – Harbour mode (allowed open)
	// * C – Sea mode (ordered closed)
	SwitchSetting string

	// Message's description text (could be cut to fit max packet length)
	Message string
}

DOR - Door Status Detection Source: "Interfacing Voyage Data Recorder Systems, AutroSafe Interactive Fire-Alarm System, 116-P-BSL336/EE, RevA 2007-01-25, Autronica Fire and Security AS " (page 32 | p.8.1.4) https://product.autronicafire.com/fileshare/fileupload/14251/bsl336_ee.pdf

Format: $FRDOR,a,hhmmss,aa,aa,xxx,xxx,a,a,c--c*hh<CR><LF> Example: $FRDOR,E,233042,FD,FP,000,010,C,C,Door Closed : TEST FPA Name*4D

type DPT added in v1.2.0

type DPT struct {
	BaseSentence
	Depth      float64 // Water depth relative to transducer, meters
	Offset     float64 // offset from transducer
	RangeScale float64 // OPTIONAL, Maximum range scale in use (NMEA 3.0 and above)
}

DPT - Depth of Water https://gpsd.gitlab.io/gpsd/NMEA.html#_dpt_depth_of_water

Format: $--DPT,x.x,x.x,x.x*hh<CR><LF> Example: $SDDPT,0.5,0.5,*7B

$INDPT,2.3,0.0*46

type DSC added in v1.6.0

type DSC struct {
	BaseSentence

	// FormatSpecifier is Format specifier (2 digits)
	// > The call content is first described by a "format specifier" element. The format specifier is explained in
	// > ITU-Rec. M.493-13 Section 4, with various symbol codes in the "service command" range of symbols representing
	// > various message formats, as shown in Table 3 (by symbol number, then meaning of symbol) as follows:
	// > * 102 = selective call to a group of ships in particular geographic area
	// > * 112 = distress alert call
	// > * 114 = selective call to a group of ships having common interest
	// > * 116 = all ships call
	// > * 120 = selective call to particular individual station
	// > * 123 = selective call to a particular individual using automatic service
	FormatSpecifier string

	// Address (10 digits)
	Address string

	// Category (2 digits or empty)
	// > The call content is next described by a "category element" in Section 6. Again, various symbol codes in the
	// > "service command" range of symbols represent various categories, as follows from Table 3 (by symbol number,
	// > then meaning of symbol):
	// > * 100 = routine
	// > * 108 = safety
	// > * 110 = urgency
	// > * 112 = distress
	Category string

	// DistressCauseOrTeleCommand1 is The cause of the distress or first telecommand (2 digits or empty)
	// > Nature of Distress is to be encoded, again using Table 3, as follows
	// > * 100 = Fire, explosion
	// > * 101 = Flooding
	// > * 102 = Collision
	// > * 103 = Grounding
	// > * 104 = Listing, in danger of capsize
	// > * 105 = Sinking
	// > * 106 = Disabled and adrift
	// > * 107 = Undesignated distres
	// > * 108 = Abandoning ship
	// > * 109 = Piracy/armed robbery attack
	// > * 110 = Man overboard
	// > * 111 = unassigned symbol; take no action
	// > * 112 = EPRIB emission
	// > * 113 through 27 = unassigned symbol; take no action
	DistressCauseOrTeleCommand1 string

	// CommandTypeOrTeleCommand2 is Type of communication or second telecommand (2 digits)
	CommandTypeOrTeleCommand2 string

	// PositionOrCanal is Position (lat+lon) or Canal/frequency (Maximum 16 digits)
	// > Distress coordinates are to be encoded five parts, sent as a string of ten digits. The first digit indicates
	// > the direction of the latitude and longitude, with "0" for North and East, "1" for North and West,
	// > "2" for South and East, and "3" for South and West. The next two digits are the latitude in degrees.
	// > The next two digits are the latitude in whole minutes. The next three digits are the longitude in degrees.
	// > The next two digits are longitude in whole minutes.
	PositionOrCanal string // Position (lat+lon) or Canal/frequency (Maximum 16 digits)

	// TimeOrTelephoneNumber is Time or Telephone Number (Maximum 16 digits)
	// > The time in universal coordinated time is to be sent in 24-hour format in two parts, a total of four digits.
	// > The first two digits are the hours. The next two are the minutes.
	TimeOrTelephoneNumber string

	// MMSI of ship in distress (10 digits or empty)
	// > The call content is next described as having a "self-identification" element. This is simply the sending
	// > station's MMSI, encoded like the address element. This identifies who sent the message.
	MMSI string

	// DistressCause is The cause of the distress (2 digits or empty)
	DistressCause string

	// Acknowledgement (R=Acknowledge request, B=Acknowledgement, S=Neither (end of sequence))
	Acknowledgement string

	// Expansion indicator (E or empty)
	ExpansionIndicator string
}

DSC – Digital Selective Calling Information https://opencpn.org/wiki/dokuwiki/doku.php?id=opencpn:opencpn_user_manual:advanced_features:nmea_sentences https://web.archive.org/web/20190303170916/http://continuouswave.com/whaler/reference/DSC_Datagrams.html http://www.busse-yachtshop.de/pdf/icom-GM600-handbuch.pdf https://github.com/mariokonrad/marnav/blob/master/src/marnav/nmea/dsc.cpp (marnav has interesting enums worth checking)

Note: many fields of DSC are conditional with double meaning and we only map raw sentence to fields without any logic/checking of those conditions. We could have specific fields if we only knew the rules to populate them.

Format: $--DSC,xx,xxxxxxxxxx,xx,xx,xx,x.x, x.x,xxxxxxxxxx,xx, a,a*hh<CR><LF> Example: $CDDSC,20,3380400790,00,21,26,1423108312,2021,,,B, E*73

type DSE added in v1.6.0

type DSE struct {
	BaseSentence
	TotalNumber     int64  // total number of sentences, 01 to 99
	Number          int64  // number of current sentence, 01 to 99
	Acknowledgement string // Acknowledgement (R=Acknowledge request, B=Acknowledgement, S=Neither (end of sequence))
	MMSI            string // MMSI of vessel (10 digits)
	DataSets        []DSEDataSet
}

DSE – Expanded digital selective calling. Is sentence that follows DSC sentence to provide additional (extended) data. https://opencpn.org/wiki/dokuwiki/doku.php?id=opencpn:opencpn_user_manual:advanced_features:nmea_sentences http://www.busse-yachtshop.de/pdf/icom-GM600-handbuch.pdf

Format: $CDDSE, x, x, a, xxxxxxxxxx, xx, c--c, .........., xx, c--c*hh<CR><LF> Example: $CDDSE,1,1,A,3380400790,00,46504437*15

type DSEDataSet added in v1.6.0

type DSEDataSet struct {
	// Code is code field, 2 digits
	// From OpenCPN wiki:
	// > 00–this field of two-digits appears to be the expansion data specifier described in Table 1 of ITU-Rec.M821-1,
	// > but with the symbol representation in two-digits instead of three-digits. The leading “1” seems to not be used.
	// > (See modified table, above.) This field identifies the data that will follow in the next field. In this message,
	// > the data will be “enhanced position resolution.”
	Code string
	// Data is data field, Enhanced position resolution, Maximum 8 characters, could be empty
	// From OpenCPN wiki:
	// > 45894494–the data payload, which is eight digits. The first four are the decimal portion of the latitude
	// > minutes; the last four are the decimal portion of the longitude minutes. The latitude and longitude whole
	// > minutes were sent in the immediately preceding datagram. This is as specified in the ITU-Rec. M.821-1 in
	// > section 2.1.2.1
	Data string
}

DSEDataSet is pair of DSE sets of data containing code + its data

type DTM added in v1.7.0

type DTM struct {
	BaseSentence
	LocalDatumCode    string // Local datum code (W84,W72,S85,P90,999)
	LocalDatumSubcode string // Local datum subcode. May be blank.

	LatitudeOffsetMinute  float64 // Latitude offset (minutes) (negative if south)
	LongitudeOffsetMinute float64 // Longitude offset (minutes) (negative if west)

	AltitudeOffsetMeters float64 // Altitude offset in meters
	DatumName            string  // Reference datum name. What’s usually seen here is "W84", the standard WGS84 datum used by GPS.
}

DTM - Datum Reference https://gpsd.gitlab.io/gpsd/NMEA.html#_dtm_datum_reference

Format: $--DTM,ref,x,llll,c,llll,c,aaa,ref*hh<CR><LF> Example: $GPDTM,W84,,0.0,N,0.0,E,0.0,W84*6F Example: $GPDTM,W84,,00.0000,N,00.0000,W,,W84*53

type Date

type Date struct {
	Valid bool
	DD    int
	MM    int
	YY    int
}

Date type

func ParseDate

func ParseDate(ddmmyy string) (Date, error)

ParseDate field ddmmyy format

func (Date) String

func (d Date) String() string

String representation of date

type EVE added in v1.6.0

type EVE struct {
	BaseSentence
	Time    Time   // Event Time
	TagCode string // Tag code
	Message string // Event text
}

EVE - General Event Message Source: "Interfacing Voyage Data Recorder Systems, AutroSafe Interactive Fire-Alarm System, 116-P-BSL336/EE, RevA 2007-01-25, Autronica Fire and Security AS " (page 34 | p.8.1.5) https://product.autronicafire.com/fileshare/fileupload/14251/bsl336_ee.pdf

Format: $FREVE,hhmmss,c--c,c--c*hh<CR><LF> Example: $FREVE,000001,DZ00513,Fire Alarm On: TEST DZ201 Name*0A

type FIR added in v1.6.0

type FIR struct {
	BaseSentence

	// Type is type of the message
	// * E – Event, Fire Alarm
	// * F – Fault
	// * D – Disablement
	Type string

	// Time is Event Time
	Time Time

	// SystemIndicator is system indicator. Detector system type with 2 char identifier.
	// * FD Generic fire detector
	// * FH Heat detector
	// * FS Smoke detector
	// * FD Smoke and heat detector
	// * FM Manual call point
	// * GD Any gas detector
	// * GO Oxygen gas detector
	// * GS Hydrogen sulphide gas detector
	// * GH Hydro-carbon gas detector
	// * SF Sprinkler flow switch
	// * SV Sprinkler manual valve release
	// * CO CO2 manual release
	// * OT Other
	SystemIndicator string

	// DivisionIndicator1 is first division indicator for locating origin detector for this message
	DivisionIndicator1 string

	// DivisionIndicator2 is second division indicator for locating origin detector for this message
	DivisionIndicator2 int64

	// FireDetectorNumberOrCount is Fire detector number or activated detectors count (seems to be field with overloaded meaning)
	FireDetectorNumberOrCount int64

	// Condition describes the condition triggering current message
	// * A – Activation
	// * V – Non-activation
	// * X – State unknown
	Condition string

	// AlarmAckState is Alarm's acknowledge state
	// * A – Acknowledged
	// * V – Not acknowledged
	AlarmAckState string

	// Message's description text (could be cut to fit max packet length)
	Message string
}

FIR - Fire Detection event with time and location Source: "Interfacing Voyage Data Recorder Systems, AutroSafe Interactive Fire-Alarm System, 116-P-BSL336/EE, RevA 2007-01-25, Autronica Fire and Security AS " (page 39 | p.8.1.6) https://product.autronicafire.com/fileshare/fileupload/14251/bsl336_ee.pdf

Format: $FRFIR,a,hhmmss,aa,aa,xxx,xxx,a,a,c--c*hh<CR><LF> Example: $FRFIR,E,103000,FD,PT,000,007,A,V,Fire Alarm : TEST PT7 Name TEST DZ2 Name*7A

type GGA added in v1.2.0

type GGA struct {
	BaseSentence
	Time          Time    // Time of fix.
	Latitude      float64 // Latitude.
	Longitude     float64 // Longitude.
	FixQuality    string  // Quality of fix.
	NumSatellites int64   // Number of satellites in use.
	HDOP          float64 // Horizontal dilution of precision.
	Altitude      float64 // Altitude.
	Separation    float64 // Geoidal separation
	DGPSAge       string  // Age of differential GPD data.
	DGPSId        string  // DGPS reference station ID.
}

GGA is the Time, position, and fix related data of the receiver. http://aprs.gids.nl/nmea/#gga https://gpsd.gitlab.io/gpsd/NMEA.html#_gga_global_positioning_system_fix_data

Format: $--GGA,hhmmss.ss,ddmm.mm,a,ddmm.mm,a,x,xx,x.x,x.x,M,x.x,M,x.x,xxxx*hh<CR><LF> Example: $GNGGA,203415.000,6325.6138,N,01021.4290,E,1,8,2.42,72.5,M,41.5,M,,*7C

type GLGSV deprecated

type GLGSV = GSV

GLGSV represents the GPS Satellites in view http://aprs.gids.nl/nmea/#glgsv

Deprecated: Use GSV instead

type GLGSVInfo deprecated

type GLGSVInfo = GSVInfo

GLGSVInfo represents information about a visible satellite

Deprecated: Use GSVInfo instead

type GLL added in v1.2.0

type GLL struct {
	BaseSentence
	Latitude  float64 // Latitude
	Longitude float64 // Longitude
	Time      Time    // Time Stamp
	Validity  string  // validity - A=valid, V=invalid
	FFAMode   string  // FAA mode indicator (filled in NMEA 2.3 and later)
}

GLL is Geographic Position, Latitude / Longitude and time. http://aprs.gids.nl/nmea/#gll https://gpsd.gitlab.io/gpsd/NMEA.html#_gll_geographic_position_latitudelongitude

Format : $--GLL,ddmm.mm,a,dddmm.mm,a,hhmmss.ss,a*hh<CR><LF> Format (NMEA 2.3+): $--GLL,ddmm.mm,a,dddmm.mm,a,hhmmss.ss,a,m*hh<CR><LF> Example: $IIGLL,5924.462,N,01030.048,E,062216,A*38 Example: $GNGLL,4404.14012,N,12118.85993,W,001037.00,A,A*67

type GNGGA deprecated

type GNGGA = GGA

GNGGA is the Time, position, and fix related data of the receiver.

Deprecated: Use GGA instead

type GNGNS deprecated added in v1.2.0

type GNGNS = GNS

GNGNS is standard GNSS sentance that combined multiple constellations

Deprecated: Use GNS instead

type GNRMC deprecated

type GNRMC = RMC

GNRMC is the Recommended Minimum Specific GNSS data. http://aprs.gids.nl/nmea/#rmc

Deprecated: Use RCM instead

type GNS added in v1.2.0

type GNS struct {
	BaseSentence
	Time      Time // UTC of position
	Latitude  float64
	Longitude float64
	// FAA mode indicator for each satellite navigation system (constellation) supported by device.
	//
	// May be up to six characters (according to GPSD).
	// '1' - GPS
	// '2' - GLONASS
	// '3' - Galileo
	// '4' - BDS
	// '5' - QZSS
	// '6' - NavIC (IRNSS)
	Mode       []string
	SVs        int64   // Total number of satellites in use, 00-99
	HDOP       float64 // Horizontal Dilution of Precision
	Altitude   float64 // Antenna altitude, meters, re:mean-sea-level(geoid).
	Separation float64 // Geoidal separation meters
	Age        float64 // Age of differential data
	Station    int64   // Differential reference station ID
	NavStatus  string  // Navigation status (NMEA 4.1+). See NavStats* (`NavStatusAutonomous` etc) constants for possible values.
}

GNS is standard GNSS sentance that combined multiple constellations https://gpsd.gitlab.io/gpsd/NMEA.html#_gns_fix_data

Format: $--GNS,hhmmss.ss,ddmm.mm,a,dddmm.mm,a,c--c,xx,x.x,x.x,x.x,x.x,x.x*hh<CR><LF> Example: $GNGNS,014035.00,4332.69262,S,17235.48549,E,RR,13,0.9,25.63,11.24,,*70

$GPGNS,224749.00,3333.4268304,N,11153.3538273,W,D,19,0.6,406.110,-26.294,6.0,0138,S*6A

type GPGGA deprecated

type GPGGA = GGA

GPGGA represents fix data. http://aprs.gids.nl/nmea/#gga

Deprecated: Use GGA instead

type GPGLL deprecated

type GPGLL = GLL

GPGLL is Geographic Position, Latitude / Longitude and time. http://aprs.gids.nl/nmea/#gll

Deprecated: Use GLL instead

type GPGSA deprecated

type GPGSA = GSA

GPGSA represents overview satellite data. http://aprs.gids.nl/nmea/#gsa

Deprecated: Use GSA instead

type GPGSV deprecated

type GPGSV = GSV

GPGSV represents the GPS Satellites in view http://aprs.gids.nl/nmea/#gpgsv

Deprecated: Use GSV instead

type GPGSVInfo deprecated

type GPGSVInfo = GSVInfo

GPGSVInfo represents information about a visible satellite

Deprecated: Use GSVInfo instead

type GPHDT deprecated added in v1.1.0

type GPHDT = HDT

GPHDT is the Actual vessel heading in degrees True. http://aprs.gids.nl/nmea/#hdt

Deprecated: Use HDT instead

type GPRMC deprecated

type GPRMC = RMC

GPRMC is the Recommended Minimum Specific GNSS data. http://aprs.gids.nl/nmea/#rmc

Deprecated: Use RMC instead

type GPVTG deprecated

type GPVTG = VTG

GPVTG represents track & speed data. http://aprs.gids.nl/nmea/#vtg

Deprecated: Use VTG instead

type GPZDA deprecated

type GPZDA = ZDA

GPZDA represents date & time data. http://aprs.gids.nl/nmea/#zda

Deprecated: Use ZDA instead

type GSA added in v1.2.0

type GSA struct {
	BaseSentence
	Mode    string   // The selection mode.
	FixType string   // The fix type.
	SV      []string // List of satellite PRNs used for this fix.
	PDOP    float64  // Dilution of precision.
	HDOP    float64  // Horizontal dilution of precision.
	VDOP    float64  // Vertical dilution of precision.
	// SystemID is (GNSS) System ID (NMEA 4.1+)
	// 1 - GPS
	// 2 - GLONASS
	// 3 - Galileo
	// 4 - BeiDou
	// 5 - QZSS
	// 6 - NavID (IRNSS)
	SystemID int64
}

GSA represents overview satellite data. http://aprs.gids.nl/nmea/#gsa https://gpsd.gitlab.io/gpsd/NMEA.html#_gsa_gps_dop_and_active_satellites

Format: $--GSA,a,a,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x.x,x.x,x.x*hh<CR><LF> Format (NMEA 4.1+): $--GSA,a,a,x,x,x,x,x,x,x,x,x,x,x,x,x,x,x.x,x.x,x.x,x*hh<CR><LF> Example: $GNGSA,A,3,80,71,73,79,69,,,,,,,,1.83,1.09,1.47*17 Example (NMEA 4.1+): $GNGSA,A,3,13,12,22,19,08,21,,,,,,,1.05,0.64,0.83,4*0B

type GSV added in v1.2.0

type GSV struct {
	BaseSentence
	TotalMessages   int64     // Total number of messages of this type in this cycle
	MessageNumber   int64     // Message number
	NumberSVsInView int64     // Total number of SVs in view
	Info            []GSVInfo // visible satellite info (0-4 of these)
	// SystemID is (GNSS) System ID (NMEA 4.1+)
	// 1 - GPS
	// 2 - GLONASS
	// 3 - Galileo
	// 4 - BeiDou
	// 5 - QZSS
	// 6 - NavID (IRNSS)
	SystemID int64
}

GSV represents the GPS Satellites in view http://aprs.gids.nl/nmea/#glgsv https://gpsd.gitlab.io/gpsd/NMEA.html#_gsv_satellites_in_view

Format: $--GSV,x,x,x,x,x,x,x,...*hh<CR><LF> Format (NMEA 4.1+): $--GSV,x,x,x,x,x,x,x,...,x*hh<CR><LF> Example: $GPGSV,3,1,11,09,76,148,32,05,55,242,29,17,33,054,30,14,27,314,24*71 Example (NMEA 4.1+): $GAGSV,3,1,09,02,00,179,,04,09,321,,07,11,134,11,11,10,227,,7*7F

type GSVInfo added in v1.2.0

type GSVInfo struct {
	SVPRNNumber int64 // SV PRN number, pseudo-random noise or gold code
	Elevation   int64 // Elevation in degrees, 90 maximum
	Azimuth     int64 // Azimuth, degrees from true north, 000 to 359
	SNR         int64 // SNR, 00-99 dB (null when not tracking)
}

GSVInfo represents information about a visible satellite

type HDG added in v1.5.0

type HDG struct {
	BaseSentence
	Heading            float64 // Heading in degrees
	Deviation          float64 //  Magnetic Deviation in degrees
	DeviationDirection string  // Magnetic Deviation direction, E = Easterly, W = Westerly
	Variation          float64 //  Magnetic Variation in degrees
	VariationDirection string  // Magnetic Variation direction, E = Easterly, W = Westerly
}

HDG is vessel heading (in degrees), deviation and variation with respect to magnetic north produced by any device or system producing magnetic reading. https://gpsd.gitlab.io/gpsd/NMEA.html#_hdg_heading_deviation_variation

Format: $--HDG,x.x,y.y,a,z.z,a*hr<CR><LF> Example: $HCHDG,98.3,0.0,E,12.6,W*57

type HDM added in v1.5.0

type HDM struct {
	BaseSentence
	Heading       float64 // Heading in degrees
	MagneticValid bool    // Heading is respect to magnetic north
}

HDM is vessel heading in degrees with respect to magnetic north produced by any device or system producing magnetic heading. https://gpsd.gitlab.io/gpsd/NMEA.html#_hdm_heading_magnetic

Format: $--HDM,xxx.xx,M*hh<CR><LF> Example: $HCHDM,093.8,M*2B

type HDT added in v1.2.0

type HDT struct {
	BaseSentence
	Heading float64 // Heading in degrees
	True    bool    // Heading is relative to true north
}

HDT is the Actual vessel heading in degrees True. http://aprs.gids.nl/nmea/#hdt https://gpsd.gitlab.io/gpsd/NMEA.html#_gsv_satellites_in_view

Format: $--HDT,x.x,T*hh<CR><LF> Example: $GPHDT,274.07,T*03

type HSC added in v1.6.0

type HSC struct {
	BaseSentence
	TrueHeading         float64 //  Heading Degrees, True
	TrueHeadingType     string  //  T = True
	MagneticHeading     float64 // Heading Degrees, Magnetic
	MagneticHeadingType string  // M = Magnetic
}

HSC - Heading steering command https://gpsd.gitlab.io/gpsd/NMEA.html#_hsc_heading_steering_command https://www.tronico.fi/OH6NT/docs/NMEA0183.pdf (page 11)

Format: $--HSC, x.x, T, x.x, M,a*hh<CR><LF> Example: $FTHSC,40.12,T,39.11,M*5E

type MDA added in v1.4.0

type MDA struct {
	BaseSentence
	PressureInch          float64
	InchesValid           bool // I
	PressureBar           float64
	BarsValid             bool // B
	AirTemp               float64
	AirTempValid          bool // C or empty if no data
	WaterTemp             float64
	WaterTempValid        bool    // C or empty if no data
	RelativeHum           float64 // percent to .1
	AbsoluteHum           float64 // percent to .1
	DewPoint              float64
	DewPointValid         bool // C or empty if no data
	WindDirectionTrue     float64
	TrueValid             bool // T
	WindDirectionMagnetic float64
	MagneticValid         bool // M
	WindSpeedKnots        float64
	KnotsValid            bool // N
	WindSpeedMeters       float64
	MetersValid           bool // M
}

MDA is the Meteorological Composite Data of air pressure, air and water temperatures and wind speed and direction https://gpsd.gitlab.io/gpsd/NMEA.html#_mda_meteorological_composite https://opencpn.org/wiki/dokuwiki/doku.php?id=opencpn:opencpn_user_manual:advanced_features:nmea_sentences#mda

Format: $--MDA,n.nn,I,n.nnn,B,n.n,C,n.C,n.n,n,n.n,C,n.n,T,n.n,M,n.n,N,n.n,M*hh<CR><LF> Example: $WIMDA,3.02,I,1.01,B,23.4,C,,,40.2,,12.1,C,19.3,T,20.1,M,13.1,N,1.1,M*62

type MTA added in v1.6.0

type MTA struct {
	BaseSentence
	Temperature float64 // temperature
	Unit        string  // unit of temperature, should be degrees Celsius
}

MTA - Air Temperature (obsolete, use XDR instead) https://www.nmea.org/Assets/100108_nmea_0183_sentences_not_recommended_for_new_designs.pdf (page 7)

Format: $--MTA,x.x,C*hh<CR><LF> Example: $IIMTA,13.3,C*04

type MTK added in v1.2.0

type MTK struct {
	BaseSentence
	Cmd,

	Flag int64
}

MTK is sentence for NMEA embedded command packet protocol. https://www.rhydolabz.com/documents/25/PMTK_A11.pdf https://www.sparkfun.com/datasheets/GPS/Modules/PMTK_Protocol.pdf

The maximum length of each packet is restricted to 255 bytes which is longer than NMEA0183 82 bytes.

Format: $PMTKxxx,c-c*hh<CR><LF> Example: $PMTK000*32<CR><LF>

$PMTK001,101,0*33<CR><LF>

type MTW added in v1.5.0

type MTW struct {
	BaseSentence
	Temperature  float64 // Temperature, degrees
	CelsiusValid bool    // Is unit of measurement Celsius
}

MTW is sentence for mean temperature of water. https://gpsd.gitlab.io/gpsd/NMEA.html#_mtw_mean_temperature_of_water

Format: $--MTW,TT.T,C*hh<CR><LF> Example: $INMTW,17.9,C*1B

type MWD added in v1.4.0

type MWD struct {
	BaseSentence
	WindDirectionTrue     float64
	TrueValid             bool
	WindDirectionMagnetic float64
	MagneticValid         bool
	WindSpeedKnots        float64
	KnotsValid            bool
	WindSpeedMeters       float64
	MetersValid           bool
}

MWD Wind Direction and Speed, with respect to north. https://www.tronico.fi/OH6NT/docs/NMEA0183.pdf http://gillinstruments.com/data/manuals/OMC-140_Operator_Manual_v1.04_131117.pdf

Format: $--MWD,x.x,T,x.x,M,x.x,N,x.x,M*hh<CR><LF> Example: $WIMWD,10.1,T,10.1,M,12,N,40,M*5D

type MWV added in v1.4.0

type MWV struct {
	BaseSentence
	WindAngle     float64
	Reference     string
	WindSpeed     float64
	WindSpeedUnit string
	StatusValid   bool
}

MWV is the Wind Speed and Angle, in relation to the vessel’s bow/centerline. https://gpsd.gitlab.io/gpsd/NMEA.html#_mwv_wind_speed_and_angle

Format: $--MWV,x.x,a,x.x,a*hh<CR><LF> Example: $WIMWV,12.1,T,10.1,N,A*27

type NotSupportedError added in v1.4.2

type NotSupportedError struct {
	Prefix string
}

NotSupportedError is returned when parsed sentence is not supported

func (*NotSupportedError) Error added in v1.4.2

func (p *NotSupportedError) Error() string

Error returns error message

type OSD added in v1.7.0

type OSD struct {
	BaseSentence
	// Heading is Heading in degrees
	Heading float64

	// HeadingStatus is Heading status
	// * A - data valid
	// * V - data invalid
	HeadingStatus string

	// VesselTrueCourse is Vessel Course, degrees True
	VesselTrueCourse float64

	// CourseReference is Course Reference, B/M/W/R/P
	// * B - bottom tracking log
	// * M - manually entered
	// * W - water referenced
	// * R - radar tracking of fixed target
	// * P - positioning system ground reference
	CourseReference string

	// VesselSpeed is Vessel Speed
	VesselSpeed float64

	// SpeedReference is Speed Reference, B/M/W/R/P
	// * B - bottom tracking log
	// * M - manually entered
	// * W - water referenced
	// * R - radar tracking of fixed target
	// * P - positioning system ground reference.
	SpeedReference string

	// VesselSetTrue is Vessel Set, degrees True - Manually entered
	VesselSetTrue float64

	// VesselDrift is Vessel drift (speed) - Manually entered
	VesselDrift float64

	// SpeedUnits is Speed Units
	// * K - km/h
	// * N - Knots
	// * S - statute miles/h
	SpeedUnits string
}

OSD - Own Ship Data https://gpsd.gitlab.io/gpsd/NMEA.html#_osd_own_ship_data https://github.com/nohal/OpenCPN/wiki/ARPA-targets-tracking-implementation#osd---own-ship-data

Format: $--OSD,x.x,A,x.x,a,x.x,a,x.x,x.x,a*hh<CR><LF> Example: $RAOSD,179.0,A,179.0,M,00.0,M,,,N*76

type PGRME

type PGRME struct {
	BaseSentence
	Horizontal float64 // Estimated horizontal position error (HPE) in metres
	Vertical   float64 // Estimated vertical position error (VPE) in metres
	Spherical  float64 // Overall spherical equivalent position error in meters
}

PGRME is Estimated Position Error (Garmin proprietary sentence) http://aprs.gids.nl/nmea/#rme https://gpsd.gitlab.io/gpsd/NMEA.html#_pgrme_garmin_estimated_error

Format: $PGRME,hhh,M,vvv,M,ttt,M*hh<CR><LF> Example: $PGRME,3.3,M,4.9,M,6.0,M*25

type PHTRO added in v1.5.0

type PHTRO struct {
	BaseSentence
	Pitch float64 // Pitch in degrees
	Bow   string  // "M" for bow up and "P" for bow down (2 digits after the decimal point)
	Roll  float64 // Roll in degrees
	Port  string  // "B" for port down and "T" for port up (2 digits after the decimal point)
}

PHTRO is proprietary sentence for vessel pitch and roll. https://www.igp.de/manuals/7-INS-InterfaceLibrary_MU-INSIII-AN-001-O.pdf (page 172)

Format: $PHTRO,x.xx,a,y.yy,b*hh<CR><LF> Example: $PHTRO,10.37,P,177.62,T*65

type PRDID added in v1.5.0

type PRDID struct {
	BaseSentence
	Pitch   float64 // Pitch in degrees (positive bow up)
	Roll    float64 // Roll in degrees (positive port up)
	Heading float64 // True heading in degrees
}

PRDID is proprietary sentence for vessel pitch, roll and heading. https://www.xsens.com/hubfs/Downloads/Manuals/MT_Low-Level_Documentation.pdf (page 37)

Format: $PRDID,aPPP.PP,bRRR.RR,HHH.HH*hh<CR><LF> Example: $PRDID,-10.37,2.34,230.34*AA

type PSONCMS added in v1.5.0

type PSONCMS struct {
	BaseSentence
	Quaternion0       float64 // q0 from quaternions
	Quaternion1       float64 // q1 from quaternions
	Quaternion2       float64 // q2 from quaternions
	Quaternion3       float64 // q3 from quaternions
	AccelerationX     float64 // acceleration X in m/s2
	AccelerationY     float64 // acceleration Y in m/s2
	AccelerationZ     float64 // acceleration Z in m/s2
	RateOfTurnX       float64 // rate of turn X in rad/s
	RateOfTurnY       float64 // rate of turn Y in rad/s
	RateOfTurnZ       float64 // rate of turn Z in rad/s
	MagneticFieldX    float64 // magnetic field X in a.u.
	MagneticFieldY    float64 // magnetic field Y in a.u.
	MagneticFieldZ    float64 // magnetic field Z in a.u.
	SensorTemperature float64 // sensor temperature in degrees Celsius
}

PSONCMS is proprietary Xsens IMU/VRU/AHRS device sentence for quaternion, acceleration, rate of turn, magnetic Field, sensor temperature. https://www.xsens.com/hubfs/Downloads/Manuals/MT_Low-Level_Documentation.pdf (page 37)

Format: $PSONCMS,Q.QQQQ,P.PPPP,R.RRRR,S.SSSS,XX.XXXX,YY.YYYY,ZZ.ZZZZ,

FF.FFFF,GG.GGGG,HH.HHHH,NN.NNNN,MM,MMMM,PP.PPPP,TT.T*hh<CR><LF>

Example: $PSONCMS,0.0905,0.4217,0.9020,-0.0196,-1.7685,0.3861,-9.6648,-0.0116,0.0065,-0.0080,0.0581,0.3846,0.7421,33.1*76

type Parser added in v1.2.0

type Parser struct {
	BaseSentence
	// contains filtered or unexported fields
}

Parser provides a simple way of accessing and parsing sentence fields

func NewParser added in v1.2.0

func NewParser(s BaseSentence) *Parser

NewParser constructor

func (*Parser) AssertType added in v1.2.0

func (p *Parser) AssertType(typ string)

AssertType makes sure the sentence's type matches the provided one.

func (*Parser) Date added in v1.2.0

func (p *Parser) Date(i int, context string) Date

Date returns the Date value at the specified index. If the value is empty, the Date is marked as invalid.

func (*Parser) EnumChars added in v1.2.0

func (p *Parser) EnumChars(i int, context string, options ...string) []string

EnumChars returns an array of strings that are matched in the Mode field. It will only match the number of characters that are in the Mode field. If the value is empty, it will return an empty array

func (*Parser) EnumString added in v1.2.0

func (p *Parser) EnumString(i int, context string, options ...string) string

EnumString returns the field value at the specified index. An error occurs if the value is not one of the options and not empty.

func (*Parser) Err added in v1.2.0

func (p *Parser) Err() error

Err returns the first error encountered during the parser's usage.

func (*Parser) Float64 added in v1.2.0

func (p *Parser) Float64(i int, context string) float64

Float64 returns the float64 value at the specified index. If the value is an empty string, 0 is returned.

func (*Parser) Int64 added in v1.2.0

func (p *Parser) Int64(i int, context string) int64

Int64 returns the int64 value at the specified index. If the value is an empty string, 0 is returned.

func (*Parser) LatLong added in v1.2.0

func (p *Parser) LatLong(i, j int, context string) float64

LatLong returns the coordinate value of the specified fields.

func (*Parser) ListString added in v1.2.0

func (p *Parser) ListString(from int, context string) (list []string)

ListString returns a list of all fields from the given start index. An error occurs if there is no fields after the given start index.

func (*Parser) SetErr added in v1.2.0

func (p *Parser) SetErr(context, value string)

SetErr assigns an error. Calling this method has no effect if there is already an error.

func (*Parser) SixBitASCIIArmour added in v1.2.0

func (p *Parser) SixBitASCIIArmour(i int, fillBits int, context string) []byte

SixBitASCIIArmour decodes the 6-bit ascii armor used for VDM and VDO messages

func (*Parser) String added in v1.2.0

func (p *Parser) String(i int, context string) string

String returns the field value at the specified index.

func (*Parser) Time added in v1.2.0

func (p *Parser) Time(i int, context string) Time

Time returns the Time value at the specified index. If the value is empty, the Time is marked as invalid.

type ParserFunc added in v1.2.0

type ParserFunc func(BaseSentence) (Sentence, error)

ParserFunc callback used to parse specific sentence variants

type RMB added in v1.6.0

type RMB struct {
	BaseSentence

	// DataStatus is status of data,
	// * A = OK
	// * V = Navigation receiver warning
	DataStatus string

	// Cross Track error (nautical miles, 9.9 max)
	CrossTrackErrorNauticalMiles float64

	// DirectionToSteer is Direction to steer,
	//  * L = left
	//  * R = right
	DirectionToSteer string

	// OriginWaypointID is origin (FROM) waypoint ID
	OriginWaypointID string

	// DestinationWaypointID is destination (TO) waypoint ID
	DestinationWaypointID string

	// DestinationLatitude is destination waypoint latitude
	DestinationLatitude float64

	// DestinationLongitude is destination waypoint longitude
	DestinationLongitude float64

	// RangeToDestinationNauticalMiles is range to destination, nautical miles (999,9 max)
	RangeToDestinationNauticalMiles float64

	// TrueBearingToDestination is true bearing to destination, degrees
	TrueBearingToDestination float64

	// VelocityToDestinationKnots is velocity towards destination, knots
	VelocityToDestinationKnots float64

	// ArrivalStatus is Arrival Status
	// * A = arrival circle entered
	// * V = not arrived
	ArrivalStatus string

	// FAA mode indicator (filled in NMEA 2.3 and later)
	FFAMode string
}

RMB - Recommended Minimum Navigation Information. To be sent by a navigation receiver when a destination waypoint is active. Alternative to BOD and BWW sentences. https://gpsd.gitlab.io/gpsd/NMEA.html#_rmb_recommended_minimum_navigation_information http://aprs.gids.nl/nmea/#rmb

Format: $--RMB,A,x.x,a,c--c,c--c,llll.ll,a,yyyyy.yy,a,x.x,x.x,x.x,A*hh<CR><LF> Format (NMEA2.3+): $--RMB,A,x.x,a,c--c,c--c,llll.ll,a,yyyyy.yy,a,x.x,x.x,x.x,A,m*hh<CR><LF> Example: $GPRMB,A,0.66,L,003,004,4917.24,N,12309.57,W,001.3,052.5,000.5,V*0B

type RMC added in v1.2.0

type RMC struct {
	BaseSentence
	Time      Time    // Time Stamp
	Validity  string  // validity - A-ok, V-invalid
	Latitude  float64 // Latitude
	Longitude float64 // Longitude
	Speed     float64 // Speed in knots
	Course    float64 // True course
	Date      Date    // Date
	Variation float64 // Magnetic variation
	FFAMode   string  // FAA mode indicator (filled in NMEA 2.3 and later)
	NavStatus string  // Nav Status (NMEA 4.1 and later)
}

RMC is the Recommended Minimum Specific GNSS data. http://aprs.gids.nl/nmea/#rmc https://gpsd.gitlab.io/gpsd/NMEA.html#_rmc_recommended_minimum_navigation_information

Format: $--RMC,hhmmss.ss,A,ddmm.mm,a,dddmm.mm,a,x.x,x.x,xxxx,x.x,a*hh<CR><LF> Format NMEA 2.3: $--RMC,hhmmss.ss,A,ddmm.mm,a,dddmm.mm,a,x.x,x.x,xxxx,x.x,a,m*hh<CR><LF> Format NMEA 4.1: $--RMC,hhmmss.ss,A,ddmm.mm,a,dddmm.mm,a,x.x,x.x,xxxx,x.x,a,m,s*hh<CR><LF> Example: $GNRMC,220516,A,5133.82,N,00042.24,W,173.8,231.8,130694,004.2,W*6E

$GNRMC,142754.0,A,4302.539570,N,07920.379823,W,0.0,,070617,0.0,E,A*21
$GNRMC,102014.00,A,5550.6082,N,03732.2488,E,000.00000,092.9,300518,,,A,V*3B

type ROT added in v1.5.0

type ROT struct {
	BaseSentence
	RateOfTurn float64 // rate of turn Z in deg/min (- means bow turns to port)
	Valid      bool    // "A" data valid,  "V" invalid data
}

ROT is sentence for rate of turn. https://gpsd.gitlab.io/gpsd/NMEA.html#_rot_rate_of_turn

Format: $HEROT,-xxx.x,A*hh<CR><LF> Example: $HEROT,-11.23,A*07

type RPM added in v1.6.0

type RPM struct {
	BaseSentence
	Source       string  // Source, S = Shaft, E = Engine
	EngineNumber int64   // Engine or shaft number
	SpeedRPM     float64 // Speed, Revolutions per minute
	PitchPercent float64 // Propeller pitch, % of maximum, "-" means astern
	Status       string  // Status, A = Valid, V = Invalid
}

RPM - Engine or Shaft revolutions and pitch https://gpsd.gitlab.io/gpsd/NMEA.html#_rpm_revolutions

Format: $--RPM,a,x,x.x,x.x,A*hh<CR><LF> Example: $RCRPM,S,0,74.6,30.0,A*56

type RSA added in v1.6.0

type RSA struct {
	BaseSentence
	StarboardRudderAngle       float64 // Starboard (or single) rudder sensor, "-" means Turn To Port
	StarboardRudderAngleStatus string  // Status, A = valid, V = Invalid
	PortRudderAngle            float64 // Port rudder sensor
	PortRudderAngleStatus      string  // Status, A = valid, V = Invalid
}

RSA - Rudder Sensor Angle https://gpsd.gitlab.io/gpsd/NMEA.html#_rsa_rudder_sensor_angle

Format: $--RSA,x.x,A,x.x,A*hh<CR><LF> Example: $IIRSA,10.5,A,,V*4D

type RSD added in v1.7.0

type RSD struct {
	BaseSentence
	Origin1Range         float64 // Origin 1 range
	Origin1Bearing       float64 // Origin 1 bearing (degrees from 0°)
	VariableRangeMarker1 float64 // Variable Range Marker 1
	BearingLine1         float64 // Bearing Line 1

	Origin2Range         float64 // Origin 2 range
	Origin2Bearing       float64 // Origin 2 bearing (degrees from 0°)
	VariableRangeMarker2 float64 // Variable Range Marker 2
	BearingLine2         float64 // Bearing Line 2

	CursorRangeFromOwnShip float64 // Cursor Range From Own Ship
	CursorBearingDegrees   float64 // Cursor Bearing (degrees clockwise from 0°)

	RangeScale      float64 // Range scale
	RangeUnit       string  // Range units (K = kilometers, N = nautical miles, S = statute miles)
	DisplayRotation string  // Display rotation (C = course up, H = heading up, N - North up)
}

RSD - RADAR System Data https://gpsd.gitlab.io/gpsd/NMEA.html#_rsd_radar_system_data https://github.com/nohal/OpenCPN/wiki/ARPA-targets-tracking-implementation#rsd---radar-system-data

Format: $--RSD,x.x,x.x,x.x,x.x,x.x,x.x,x.x,x.x,x.x,x.x,x.x,a,a*hh<CR><LF> Example: $RARSD,0.00,,2.50,005.0,0.00,,4.50,355.0,,,3.0,N,H*51 Example: $RARSD,,,,,,,,,0.808,326.9,0.750,N,N*58 Example: $RARSD,0.00,,0.40,,,,,,,,3.0,N,N*53

type RTE added in v1.2.0

type RTE struct {
	BaseSentence
	NumberOfSentences         int64    // Number of sentences in sequence
	SentenceNumber            int64    // Sentence number
	ActiveRouteOrWaypointList string   // Current active route or waypoint list
	Name                      string   // Name or number of active route
	Idents                    []string // List of ident of waypoints
}

RTE is a route of waypoints http://aprs.gids.nl/nmea/#rte https://gpsd.gitlab.io/gpsd/NMEA.html#_rte_routes

Format: $--RTE,x.x,x.x,a,c--c,c--c, ..... c--c*hh<CR><LF> Example: $GPRTE,2,1,c,0,PBRCPK,PBRTO,PTELGR,PPLAND,PYAMBU,PPFAIR,PWARRN,PMORTL,PLISMR*73

type Sentence

type Sentence interface {
	fmt.Stringer
	Prefix() string
	DataType() string
	TalkerID() string
}

Sentence interface for all NMEA sentence

func Parse

func Parse(raw string) (Sentence, error)

Parse parses the given string into the correct sentence type.

type THS added in v1.2.0

type THS struct {
	BaseSentence
	Heading float64 // Heading in degrees
	Status  string  // Heading status
}

THS is the Actual vessel heading in degrees True with status. http://www.nuovamarea.net/pytheas_9.html http://manuals.spectracom.com/VSP/Content/VSP/NMEA_THSmess.htm

Format: $--THS,xxx.xx,c*hh<CR><LF> Example: $GPTHS,338.01,A*36

type TLL added in v1.7.0

type TLL struct {
	BaseSentence
	TargetNumber    int64   // Target number 00 – 99
	TargetLatitude  float64 // Target latitude + N/S
	TargetLongitude float64 // Target longitude + E/W
	TargetName      string  // Target name
	TimeUTC         Time    // UTC of data, hh is hours, mm is minutes, ss.ss is seconds.
	TargetStatus    string  // Target status (L=lost, Q=acquisition, T=tracking)
	ReferenceTarget string  // Reference target, R= reference target; null (,,)= otherwise
}

TLL - Target latitude and longitude https://gpsd.gitlab.io/gpsd/NMEA.html#_tll_target_latitude_and_longitude https://github.com/nohal/OpenCPN/wiki/ARPA-targets-tracking-implementation#tll---target-latitude-and-longitude

Format: $--TLL,xx,llll.ll,a,yyyyy.yy,a,c--c,hhmmss.ss,a,a*hh<CR><LF> Example: $RATLL,,3647.422,N,01432.592,E,,,,*58

type TTM added in v1.7.0

type TTM struct {
	BaseSentence
	TargetNumber      int64   // Target number 00 – 99
	TargetDistance    float64 // Target Distance
	Bearing           float64 // Bearing from own ship, degrees
	BearingType       string  // Type of target Bearing, T = True, R = Relative
	TargetSpeed       float64 // Target Speed
	TargetCourse      float64 // Target Course
	CourseType        string  // target course type,  T = True, R = Relative
	DistanceCPA       float64 // Distance of closest-point-of-approach
	TimeCPA           float64 // Time until closest-point-of-approach "-" means increasing
	SpeedUnits        string  // Speed/distance units, K/N/S
	TargetName        string  // Target name
	TargetStatus      string  // Target status (L=lost, Q=acquisition, T=tracking)
	ReferenceTarget   string  // Reference target, R= reference target; null (,,)= otherwise
	TimeUTC           Time    // UTC of data, hh is hours, mm is minutes, ss.ss is seconds.
	TypeOfAcquisition string  // Type, A = Auto, M = Manual, R = Reported
}

TTM - Tracked Target Message https://gpsd.gitlab.io/gpsd/NMEA.html#_ttm_tracked_target_message https://github.com/nohal/OpenCPN/wiki/ARPA-targets-tracking-implementation#ttm---tracked-target-message

Format: $--TTM,xx,x.x,x.x,a,x.x,x.x,a,x.x,x.x,a,c--c,a,a*hh<CR><LF> Format: $--TTM,xx,x.x,x.x,a,x.x,x.x,a,x.x,x.x,a,c--c,a,a,hhmmss.ss,a*hh<CR><LF> Example: $RATTM,02,1.43,170.5,T,0.16,264.4,T,1.42,36.9,N,,T,,,M*2A

type TXT added in v1.5.0

type TXT struct {
	BaseSentence
	TotalNumber int64 // total number of sentences, 01 to 99
	Number      int64 // number of current sentences, 01 to 99
	ID          int64 // identifier of the text message, 01 to 99
	// Message contains ASCII characters, and code delimiters if needed, up to the maximum permitted sentence length
	// (i.e., up to 61 characters including any code delimiters)
	Message string
}

TXT is sentence for the transmission of short text messages, longer text messages may be transmitted by using multiple sentences. This sentence is intended to convey human readable textual information for display purposes. The TXT sentence shall not be used for sending commands and making device configuration changes. https://www.nmea.org/Assets/20160520%20txt%20amendment.pdf

Format: $--TXT,xx,xx,xx,c-c*hh<CR><LF> Example: $GNTXT,01,01,02,u-blox AG - www.u-blox.com*4E

type TagBlock added in v1.3.0

type TagBlock struct {
	Time         int64  // TypeUnixTime unix timestamp (unit is likely to be s, but might be ms, YMMV), parameter: -c
	RelativeTime int64  // TypeRelativeTime relative time, parameter: -r
	Destination  string // TypeDestinationID destination identification 15 char max, parameter: -d
	Grouping     string // TypeGrouping sentence grouping, parameter: -g
	LineCount    int64  // TypeLineCount line count, parameter: -n
	Source       string // TypeSourceID source identification 15 char max, parameter: -s
	Text         string // TypeTextString valid character string, parameter -t
}

TagBlock struct

type Time

type Time struct {
	Valid       bool
	Hour        int
	Minute      int
	Second      int
	Millisecond int
}

Time type

func ParseTime

func ParseTime(s string) (Time, error)

ParseTime parses wall clock time. e.g. hhmmss.ssss An empty time string will result in an invalid time.

func (Time) String

func (t Time) String() string

String representation of Time

type VBW added in v1.7.0

type VBW struct {
	BaseSentence
	LongitudinalWaterSpeedKnots float64 // longitudinal water speed, "-" means astern, knots
	TransverseWaterSpeedKnots   float64 // transverse water speed, "-" means port, knots
	WaterSpeedStatusValid       bool    // A = true
	WaterSpeedStatus            string  // A = valid, V = invalid

	LongitudinalGroundSpeedKnots float64 // longitudinal ground speed, "-" means astern, knots
	TransverseGroundSpeedKnots   float64 // transverse ground speed, "-" means port, knots
	GroundSpeedStatusValid       bool    // A = true
	GroundSpeedStatus            string  // A = valid, V = invalid

	SternTraverseWaterSpeedKnots       float64 // Stern traverse water speed, knots (NMEA 3 and above)
	SternTraverseWaterSpeedStatusValid bool    // A = true
	SternTraverseWaterSpeedStatus      string  // A = valid, V = invalid (NMEA 3 and above)

	SternTraverseGroundSpeedKnots       float64 // Stern traverse ground speed, knots (NMEA 3 and above)
	SternTraverseGroundSpeedStatusValid bool    // A = true
	SternTraverseGroundSpeedStatus      string  // A = valid, V = invalid (NMEA 3 and above)
}

VBW - Dual Ground/Water Speed https://gpsd.gitlab.io/gpsd/NMEA.html#_vbw_dual_groundwater_speed

Format: $--VBW,x.x,x.x,A,x.x,x.x,A,x.x,A,x.x,A*hh<CR><LF> Example: $VMVBW,-7.1,0.1,A,,,V,,V,,V*65

type VDMVDO added in v1.2.0

type VDMVDO struct {
	BaseSentence
	NumFragments   int64
	FragmentNumber int64
	MessageID      int64
	Channel        string
	Payload        []byte
}

VDMVDO is sentence ($--VDM or $--VDO) used to encapsulate generic binary payloads. It is most commonly used with AIS data. https://gpsd.gitlab.io/gpsd/AIVDM.html

Example: !AIVDM,1,1,,B,177KQJ5000G?tO`K>RA1wUbN0TKH,0*5C

type VDR added in v1.6.0

type VDR struct {
	BaseSentence
	SetDegreesTrue         float64 // Direction degrees, True
	SetDegreesTrueUnit     string  // T = True
	SetDegreesMagnetic     float64 // Direction degrees, True
	SetDegreesMagneticUnit string  // M = Magnetic
	DriftKnots             float64 // Current speed, knots
	DriftUnit              string  // N = Knots
}

VDR - Set and Drift In navigation, set and drift are characteristics of the current and velocity of water over the ground in which a ship is sailing. Set is the bearing the current is flowing. Drift is the magnitude of the current. https://gpsd.gitlab.io/gpsd/NMEA.html#_vdr_set_and_drift

Format: $--VDR,x.x,T,x.x,M,x.x,N*hh<CR><LF> Example: $IIVDR,10.1,T,12.3,M,1.2,N*3A

type VHW added in v1.2.0

type VHW struct {
	BaseSentence
	TrueHeading            float64
	MagneticHeading        float64
	SpeedThroughWaterKnots float64
	SpeedThroughWaterKPH   float64
}

VHW contains information about water speed and heading https://gpsd.gitlab.io/gpsd/NMEA.html#_vhw_water_speed_and_heading

Format: $--VHW,x.x,T,x.x,M,x.x,N,x.x,K*hh<CR><LF> Example: $VWVHW,45.0,T,43.0,M,3.5,N,6.4,K*56

type VLW added in v1.6.0

type VLW struct {
	BaseSentence
	TotalInWater           float64 // Total cumulative water distance, nm
	TotalInWaterUnit       string  // N = Nautical Miles
	SinceResetInWater      float64 // Water distance since Reset, nm
	SinceResetInWaterUnit  string  // N = Nautical Miles
	TotalOnGround          float64 // Total cumulative ground distance, nm (NMEA 3 and above)
	TotalOnGroundUnit      string  // N = Nautical Miles (NMEA 3 and above)
	SinceResetOnGround     float64 // Ground distance since reset, nm (NMEA 3 and above)
	SinceResetOnGroundUnit string  // N = Nautical Miles (NMEA 3 and above)
}

VLW - Distance Traveled through Water https://gpsd.gitlab.io/gpsd/NMEA.html#_vlw_distance_traveled_through_water

Format: $--VLW,x.x,N,x.x,N*hh<CR><LF> Format (NMEA 3+): $--VLW,x.x,N,x.x,N,x.x,N,x.x,N*hh<CR><LF> Example: $IIVLW,10.1,N,3.2,N*7C Example: $IIVLW,10.1,N,3.2,N,0,N,0,N*7C

type VPW added in v1.6.0

type VPW struct {
	BaseSentence
	SpeedKnots     float64 // Speed, "-" means downwind, knots
	SpeedKnotsUnit string  // N = knots
	SpeedMPS       float64 // Speed, "-" means downwind, m/s
	SpeedMPSUnit   string  // M = m/s
}

VPW - Speed Measured Parallel to Wind https://gpsd.gitlab.io/gpsd/NMEA.html#_vpw_speed_measured_parallel_to_wind

Format: $--VPW,x.x,N,x.x,M*hh<CR><LF> Example: $IIVPW,4.5,N,6.7,M*52

type VTG added in v1.2.0

type VTG struct {
	BaseSentence
	TrueTrack        float64
	MagneticTrack    float64
	GroundSpeedKnots float64
	GroundSpeedKPH   float64
	FFAMode          string // FAA mode indicator (filled in NMEA 2.3 and later)
}

VTG represents track & speed data. http://aprs.gids.nl/nmea/#vtg https://gpsd.gitlab.io/gpsd/NMEA.html#_vtg_track_made_good_and_ground_speed

Format: $--VTG,x.x,T,x.x,M,x.x,N,x.x,K*hh<CR><LF> Format (NMEA 2.3+): $--VTG,x.x,T,x.x,M,x.x,N,x.x,K,m*hh<CR><LF> Example: $GPVTG,45.5,T,67.5,M,30.45,N,56.40,K*4B

$GPVTG,220.86,T,,M,2.550,N,4.724,K,A*34

type VWR added in v1.6.0

type VWR struct {
	BaseSentence
	MeasuredAngle        float64 // Measured Wind direction magnitude in degrees (0 to 180 deg)
	MeasuredDirectionBow string  // Measured Wind direction Left/Right of bow
	SpeedKnots           float64 // Measured wind Speed, knots
	SpeedKnotsUnit       string  // N = knots
	SpeedMPS             float64 // Wind speed, meters/second
	SpeedMPSUnit         string  // M = m/s
	SpeedKPH             float64 // Wind speed, km/hour
	SpeedKPHUnit         string  // M = km/h
}

VWR - Relative Wind Speed and Angle. Speed is measured relative to the moving vessel. According to NMEA: use of $--MWV is recommended. https://gpsd.gitlab.io/gpsd/NMEA.html#_vwr_relative_wind_speed_and_angle https://www.nmea.org/Assets/100108_nmea_0183_sentences_not_recommended_for_new_designs.pdf (page 16)

Format: $--VWR,x.x,a,x.x,N,x.x,M,x.x,K*hh<CR><LF> Example: $IIVWR,75,R,1.0,N,0.51,M,1.85,K*6C

$IIVWR,024,L,018,N,,,,*5e
$IIVWR,,,,,,,,*53

type VWT added in v1.6.0

type VWT struct {
	BaseSentence
	TrueAngle        float64 // true Wind direction magnitude in degrees (0 to 180 deg)
	TrueDirectionBow string  // true Wind direction Left/Right of bow
	SpeedKnots       float64 // true wind Speed, knots
	SpeedKnotsUnit   string  // N = knots
	SpeedMPS         float64 // Wind speed, meters/second
	SpeedMPSUnit     string  // M = m/s
	SpeedKPH         float64 // Wind speed, km/hour
	SpeedKPHUnit     string  // M = km/h
}

VWT - True Wind Speed and Angle https://www.nmea.org/Assets/100108_nmea_0183_sentences_not_recommended_for_new_designs.pdf https://www.rubydoc.info/gems/nmea_plus/1.0.20/NMEAPlus/Message/NMEA/VWT https://lists.gnu.org/archive/html/gpsd-dev/2012-04/msg00048.html

Format: $--VWT,x.x,a,x.x,N,x.x,M,x.x,K*hh<CR><LF> Example: $IIVWT,75,x,1.0,N,0.51,M,1.85,K*40

type WPL added in v1.2.0

type WPL struct {
	BaseSentence
	Latitude  float64 // Latitude
	Longitude float64 // Longitude
	Ident     string  // Ident of nth waypoint
}

WPL contains information about a waypoint location http://aprs.gids.nl/nmea/#wpl https://gpsd.gitlab.io/gpsd/NMEA.html#_wpl_waypoint_location

Format: $--WPL,llll.ll,a,yyyyy.yy,a,c--c*hh<CR><LF> Example: $IIWPL,5503.4530,N,01037.2742,E,411*6F

type XDR added in v1.6.0

type XDR struct {
	BaseSentence
	Measurements []XDRMeasurement
}

XDR - Transducer Measurement https://gpsd.gitlab.io/gpsd/NMEA.html#_xdr_transducer_measurement https://www.eye4software.com/hydromagic/documentation/articles-and-howtos/handling-nmea0183-xdr/

Format: $--XDR,a,x.x,a,c--c, ..... *hh<CR><LF> Example: $HCXDR,A,171,D,PITCH,A,-37,D,ROLL,G,367,,MAGX,G,2420,,MAGY,G,-8984,,MAGZ*41

$SDXDR,C,23.15,C,WTHI*70

type XDRMeasurement added in v1.6.0

type XDRMeasurement struct {
	// TransducerType is type of transducer
	// * A - Angular displacement
	// * C - Temperature
	// * D - Depth
	// * F - Frequency
	// * H - Humidity
	// * N - Force
	// * P - Pressure
	// * R - Flow
	// * B - Absolute humidity
	// * G - Generic
	// * I - Current
	// * L - Salinity
	// * S - Switch, valve
	// * T - Tachometer
	// * U - Voltage
	// * V - Volume
	// could be more
	TransducerType string

	// Value of measurement
	Value float64

	// Unit of measurement
	// * "" - could be empty!
	// * A - Amperes
	// * B - Bars | Binary
	// * C - Celsius
	// * D - Degrees
	// * H - Hertz
	// * I - liters/second
	// * K - Kelvin | Density, kg/m3 kilogram per cubic metre
	// * M - Meters | Cubic Meters (m3)
	// * N - Newton
	// * P - percent of full range | Pascal
	// * R - RPM
	// * S - Parts per thousand
	// * V - Volts
	// could be more
	Unit string

	// TransducerName is name of transducer where measurement was recorded
	TransducerName string
}

XDRMeasurement is measurement recorded by transducer

type XTE added in v1.6.0

type XTE struct {
	BaseSentence

	// StatusGeneralWarning is used for warnings
	//  * V = LORAN-C Blink or SNR warning
	//  * A = general warning flag or other navigation systems when a reliable fix is not available
	StatusGeneralWarning string

	// StatusLockWarning is used for lock warning
	//  * V = Loran-C Cycle Lock warning flag
	//  * A = OK or not used
	StatusLockWarning string

	// CrossTrackErrorMagnitude is Cross Track Error Magnitude
	CrossTrackErrorMagnitude float64

	// DirectionToSteer is Direction to steer,
	//  * L = left
	//  * R = right
	DirectionToSteer string

	// CrossTrackUnits is cross track units
	// * N = nautical miles
	// * K = for kilometers
	CrossTrackUnits string

	// FAA mode indicator (filled in NMEA 2.3 and later)
	FFAMode string
}

XTE - Cross-track error, measured https://gpsd.gitlab.io/gpsd/NMEA.html#_xte_cross_track_error_measured

Format: $--XTE,A,A,x.x,a,N*hh<CR><LF> Format (NMEA 2.3): $--XTE,A,A,x.x,a,N,m*hh<CR><LF> Example: $GPXTE,V,V,,,N,S*43

type ZDA added in v1.2.0

type ZDA struct {
	BaseSentence
	Time          Time
	Day           int64
	Month         int64
	Year          int64
	OffsetHours   int64 // Local time zone offset from GMT, hours
	OffsetMinutes int64 // Local time zone offset from GMT, minutes
}

ZDA represents date & time data. http://aprs.gids.nl/nmea/#zda https://gpsd.gitlab.io/gpsd/NMEA.html#_zda_time_date_utc_day_month_year_and_local_time_zone

Format: $--ZDA,hhmmss.ss,xx,xx,xxxx,xx,xx*hh<CR><LF> Example: $GPZDA,172809.456,12,07,1996,00,00*57

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL