nmea

package module
v0.0.0-...-21b0e41 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2022 License: MIT Imports: 8 Imported by: 1

README

go-nmea

This is a NMEA library for the Go programming language (Golang). Forked from https://github.com/adrianmo/go-nmea

Documentation

Index

Constants

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 (
	// 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 (
	// 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 (
	// 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 (
	// 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 (
	// 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 (
	// 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"
)
View Source
const (
	// TypeVDM type for VDM sentences
	TypeVDM = "VDM"

	// TypeVDO type for VDO sentences
	TypeVDO = "VDO"
)
View Source
const (
	// TypeDBS type for DBS sentences
	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 (
	// 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 (
	// 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 (
	// TypeTXT type for TXT sentences for the transmission of text messages
	TypeTXT = "TXT"
)
View Source
const (
	// TypeVHW type for VHW sentences
	TypeVHW = "VHW"
)
View Source
const (
	// TypeVTG type for VTG sentences
	TypeVTG = "VTG"
)
View Source
const (
	// TypeWPL type for WPL sentences
	TypeWPL = "WPL"
)
View Source
const (
	// TypeZDA type for ZDA sentences
	TypeZDA = "ZDA"
)

Variables

This section is empty.

Functions

func Checksum

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

func LatDir(l float64) string

LatDir returns the latitude direction symbol

func LonDir

func LonDir(l float64) string

LonDir returns the longitude direction symbol

func MustRegisterParser

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.4322S

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.4322S)

func RegisterParser

func RegisterParser(sentenceType string, parser ParserFunc) error

RegisterParser register a custom parser

Types

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

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

func (s BaseSentence) TalkerID() string

TalkerID returns the talker of the message

type DBS

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

DBS - Depth Below Surface https://gpsd.gitlab.io/gpsd/NMEA.html#_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

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 DPT

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 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 GGA

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

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

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

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

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

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

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

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

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

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

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 MDA

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 MTK

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

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

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

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

type NotSupportedError struct {
	Prefix string
}

NotSupportedError is returned when parsed sentence is not supported

func (*NotSupportedError) Error

func (p *NotSupportedError) Error() string

Error returns error message

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

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

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

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

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

Parser provides a simple way of accessing and parsing sentence fields

func NewParser

func NewParser(s BaseSentence) *Parser

NewParser constructor

func (*Parser) AssertType

func (p *Parser) AssertType(typ string)

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

func (*Parser) Date

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

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

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

func (p *Parser) Err() error

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

func (*Parser) Float64

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

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

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

LatLong returns the coordinate value of the specified fields.

func (*Parser) ListString

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

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

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

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

String returns the field value at the specified index.

func (*Parser) Time

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

type ParserFunc func(BaseSentence) (Sentence, error)

ParserFunc callback used to parse specific sentence variants

type RMC

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

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 RTE

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

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 TXT

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

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 VDMVDO

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 VHW

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 VTG

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 WPL

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 ZDA

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