Documentation ¶
Index ¶
- Constants
- func Checksum(s string) string
- func FormatDMS(l float64) string
- func FormatGPS(l float64) string
- func LatDir(l float64) string
- func LonDir(l float64) string
- func MustRegisterParser(sentenceType string, parser ParserFunc)
- func ParseDMS(s string) (float64, error)
- func ParseDecimal(s string) (float64, error)
- func ParseGPS(s string) (float64, error)
- func ParseLatLong(s string) (float64, error)
- func RegisterParser(sentenceType string, parser ParserFunc) error
- type BaseSentence
- type DBS
- type DBT
- type DPT
- type Date
- type GGA
- type GLGSVdeprecated
- type GLGSVInfodeprecated
- type GLL
- type GNGGAdeprecated
- type GNGNSdeprecated
- type GNRMCdeprecated
- type GNS
- type GPGGAdeprecated
- type GPGLLdeprecated
- type GPGSAdeprecated
- type GPGSVdeprecated
- type GPGSVInfodeprecated
- type GPHDTdeprecated
- type GPRMCdeprecated
- type GPVTGdeprecated
- type GPZDAdeprecated
- type GSA
- type GSV
- type GSVInfo
- type HDT
- type MTK
- type PGRME
- type Parser
- func (p *Parser) AssertType(typ string)
- func (p *Parser) Date(i int, context string) Date
- func (p *Parser) EnumChars(i int, context string, options ...string) []string
- func (p *Parser) EnumString(i int, context string, options ...string) string
- func (p *Parser) Err() error
- func (p *Parser) Float64(i int, context string) float64
- func (p *Parser) Int64(i int, context string) int64
- func (p *Parser) LatLong(i, j int, context string) float64
- func (p *Parser) ListString(from int, context string) (list []string)
- func (p *Parser) SetErr(context, value string)
- func (p *Parser) SixBitASCIIArmour(i int, fillBits int, context string) []byte
- func (p *Parser) String(i int, context string) string
- func (p *Parser) Time(i int, context string) Time
- type ParserFunc
- type RMC
- type RTE
- type Sentence
- type THS
- type Time
- type VDMVDO
- type VHW
- type VTG
- type WPL
- type ZDA
Constants ¶
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" )
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" )
const ( // TypeGLL type for GLL sentences TypeGLL = "GLL" // ValidGLL character ValidGLL = "A" // InvalidGLL character InvalidGLL = "V" )
const ( // TypeGNS type for GNS sentences TypeGNS = "GNS" // 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" )
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" // GsidGPS - Field 18, GSID GsidGPS = "1" // GsidGPS - Field 18, GSID GsidGLONASS = "2" // GsidGPS - Field 18, GSID GsidGALILEO = "3" // GsidGPS - Field 18, GSID GsidQZSS = "4" // GsidGPS - Field 18, GSID GsidBEIDOU = "5" )
const ( // TypePGRME type for PGRME sentences TypePGRME = "GRME" // ErrorUnit must be meters (M) ErrorUnit = "M" )
const ( // TypeRMC type for RMC sentences TypeRMC = "RMC" // ValidRMC character ValidRMC = "A" // InvalidRMC character InvalidRMC = "V" )
const ( // TypeRTE type for RTE sentences TypeRTE = "RTE" // ActiveRoute active route ActiveRoute = "c" // WaypointList list containing waypoints WaypointList = "w" )
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 = "*" )
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" )
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" )
const ( // TypeVDM type for VDM sentences TypeVDM = "VDM" // TypeVDO type for VDO sentences TypeVDO = "VDO" )
const (
// TypeDBS type for DBS sentences
TypeDBS = "DBS"
)
const (
// TypeDBT type for DBT sentences
TypeDBT = "DBT"
)
const (
// TypeDPT type for DPT sentences
TypeDPT = "DPT"
)
const (
// TypeGSV type for GSV sentences
TypeGSV = "GSV"
)
const (
// TypeHDT type for HDT sentences
TypeHDT = "HDT"
)
const (
// TypeMTK type for PMTK sentences
TypeMTK = "PMTK"
)
const (
// TypeVHW type for VHW sentences
TypeVHW = "VHW"
)
const (
// TypeVTG type for VTG sentences
TypeVTG = "VTG"
)
const (
// TypeWPL type for WPL sentences
TypeWPL = "WPL"
)
const (
// TypeZDA type for ZDA sentences
TypeZDA = "ZDA"
)
Variables ¶
This section is empty.
Functions ¶
func MustRegisterParser ¶
func MustRegisterParser(sentenceType string, parser ParserFunc)
MustRegisterParser register a custom parser or panic
func ParseDecimal ¶
ParseDecimal parses a decimal format coordinate. e.g: 151.196019
func ParseLatLong ¶
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 }
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
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
type DPT ¶
type DPT struct { BaseSentence Depth float64 Offset float64 RangeScale float64 }
DPT - Depth of Water https://gpsd.gitlab.io/gpsd/NMEA.html#_dpt_depth_of_water
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.
type GLGSV
deprecated
type GLGSV = GSV
GLGSV represents the GPS Satellites in view http://aprs.gids.nl/nmea/#glgsv
Deprecated: Use GSV instead
type GLL ¶
type GLL struct { BaseSentence Latitude float64 // Latitude Longitude float64 // Longitude Time Time // Time Stamp Validity string // validity - A-valid }
GLL is Geographic Position, Latitude / Longitude and time. http://aprs.gids.nl/nmea/#gll
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 Latitude float64 Longitude float64 Mode []string SVs int64 HDOP float64 Altitude float64 Separation float64 Age float64 Station int64 }
GNS is standard GNSS sentance that combined multiple constellations
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 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. GSID string // GNSS system ID, 1(GPS),2(GLONASS),3(GALILEO),4(QZSS),5(BEIDOU) }
GSA represents overview satellite data. http://aprs.gids.nl/nmea/#gsa
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) }
GSV represents the GPS Satellites in view http://aprs.gids.nl/nmea/#glgsv
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 float64 // SNR, 00-99 dB (null when not tracking) }
GSVInfo represents information about a visible satellite
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
type MTK ¶
type MTK struct { BaseSentence Cmd, Flag int64 }
MTK is the Time, position, and fix related data of the receiver.
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
type Parser ¶
type Parser struct { BaseSentence // contains filtered or unexported fields }
Parser provides a simple way of accessing and parsing sentence fields
func (*Parser) AssertType ¶
AssertType makes sure the sentence's type matches the provided one.
func (*Parser) Date ¶
Date returns the Date value at the specified index. If the value is empty, the Date is marked as invalid.
func (*Parser) EnumChars ¶
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 ¶
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) Float64 ¶
Float64 returns the float64 value at the specified index. If the value is an empty string, 0 is returned.
func (*Parser) Int64 ¶
Int64 returns the int64 value at the specified index. If the value is an empty string, 0 is returned.
func (*Parser) ListString ¶
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 ¶
SetErr assigns an error. Calling this method has no effect if there is already an error.
func (*Parser) SixBitASCIIArmour ¶
SixBitASCIIArmour decodes the 6-bit ascii armor used for VDM and VDO messages
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 }
RMC is the Recommended Minimum Specific GNSS data. http://aprs.gids.nl/nmea/#rmc
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
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
type Time ¶
Time type
type VDMVDO ¶
type VDMVDO struct { BaseSentence NumFragments int64 FragmentNumber int64 MessageID int64 Channel string Payload []byte }
VDMVDO is a format used to encapsulate generic binary payloads. It is most commonly used with AIS data. http://catb.org/gpsd/AIVDM.html
type VHW ¶
type VHW struct { BaseSentence TrueHeading float64 MagneticHeading float64 SpeedThroughWaterKnots float64 SpeedThroughWaterKPH float64 }
VHW contains information about water speed and heading
type VTG ¶
type VTG struct { BaseSentence TrueTrack float64 MagneticTrack float64 GroundSpeedKnots float64 GroundSpeedKPH float64 }
VTG represents track & speed data. http://aprs.gids.nl/nmea/#vtg
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
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