nmeanano

package
v0.1.24 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2023 License: BSD-3-Clause, MIT Imports: 6 Imported by: 0

Documentation

Overview

package nmeanano ... This is a [minimal|static|optimize] fork of the great github.com/adrianmo/go-nmea pkg! This fork is adapted and optimized for an specific use-case and *IS NOT* api/result compatible with the original, please DO NOT use outside very specific use cases!.PLEASE USE ALWAYS THE ORIGINAL!

github.com/adrianmo/go-nmea

Copyright (c) 2015 Adrian Moreno - The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy (of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Index

Constants

View Source
const (
	// TypeGGA ...
	TypeGGA = "GGA"
	// Invalid ...
	Invalid = "0"
	// GPS ...
	GPS = "1"
	// DGPS ...
	DGPS = "2"
	// PPS ...
	PPS = "3"
	// RTK ...
	RTK = "4"
	// FRTK ...
	FRTK = "5"
	// EST ...
	EST = "6"
)
View Source
const (
	// TypeGNS ...
	TypeGNS              = "GNS"
	NoFixGNS             = "N"
	AutonomousGNS        = "A"
	DifferentialGNS      = "D"
	PreciseGNS           = "P"
	RealTimeKinematicGNS = "R"
	FloatRTKGNS          = "F"
	EstimatedGNS         = "E"
	ManualGNS            = "M"
	SimulatorGNS         = "S"
)
View Source
const (
	// TypeGSA
	TypeGSA = "GSA"
	TypeGSV = "GSV"
	Auto    = "A"
	Manual  = "M"
	FixNone = "1"
	Fix2D   = "2"
	Fix3D   = "3"
)
View Source
const (
	TypeRMC    = "RMC"
	ValidRMC   = "A"
	InvalidRMC = "V"
)
View Source
const (
	SentenceStart             = "$"
	SentenceStartEncapsulated = "!"
	FieldSep                  = ","
	ChecksumSep               = "*"
)
View Source
const (
	Degrees = '\u00B0'
	Minutes = '\''
	Seconds = '"'
	Point   = '.'
	North   = "N"
	South   = "S"
	East    = "E"
	West    = "W"
)
View Source
const (
	TypeVDM = "VDM"
	TypeVDO = "VDO"
)
View Source
const (
	TypeVTG = "VTG"
)

Variables

This section is empty.

Functions

func Checksum

func Checksum(s string) string

func FormatDMS

func FormatDMS(l float64) string

func FormatGPS

func FormatGPS(l float64) string

func GetTimeStamp

func GetTimeStamp(x RMC) time.Time

GetTimeStamp returns an validated go time.Time timestamp

func LatDir

func LatDir(l float64) string

func LonDir

func LonDir(l float64) string

func MustRegisterParser

func MustRegisterParser(sentenceType string, parser ParserFunc)

func ParseDMS

func ParseDMS(_ string) (float64, error)

func ParseDecimal

func ParseDecimal(s string) (float64, error)

func ParseGPS

func ParseGPS(s string) (float64, error)

func ParseLatLong

func ParseLatLong(s string) (float64, error)

func RegisterParser

func RegisterParser(sentenceType string, parser ParserFunc) error

Types

type BaseSentence

type BaseSentence struct {
	Talker   string
	Type     string
	Fields   []string
	Checksum string
	Raw      string
	TagBlock TagBlock
}

BaseSentence ...

func (BaseSentence) DataType

func (s BaseSentence) DataType() string

func (BaseSentence) Prefix

func (s BaseSentence) Prefix() string

func (BaseSentence) String

func (s BaseSentence) String() string

func (BaseSentence) TalkerID

func (s BaseSentence) TalkerID() string

type Date

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

func ParseDate

func ParseDate(ddmmyy string) (Date, error)

func (Date) String

func (d Date) String() string

type GGA

type GGA struct {
	BaseSentence
	Time          Time
	Latitude      float64
	Longitude     float64
	FixQuality    string
	NumSatellites int64
	HDOP          float64
	Altitude      float64
	Separation    float64
	DGPSAge       string
	DGPSId        string
}

GGA ...

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

type GSA

type GSA struct {
	BaseSentence
	Mode    string
	FixType string
	SV      []string
	PDOP    float64
	HDOP    float64
	VDOP    float64
}

GSA ...

type GSV

type GSV struct {
	BaseSentence
	TotalMessages   int64
	MessageNumber   int64
	NumberSVsInView int64
	Info            []GSVInfo
}

GSV ...

type GSVInfo

type GSVInfo struct {
	SVPRNNumber int64
	Elevation   int64
	Azimuth     int64
	SNR         int64
}

GGSVInfo ...

type Parser

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

Parser ...

func NewParser

func NewParser(s BaseSentence) *Parser

NewParser ...

func (*Parser) AssertType

func (p *Parser) AssertType(typ string)

func (*Parser) Date

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

Date ...

func (*Parser) EnumChars

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

EnumChars ...

func (*Parser) EnumString

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

EnumString ...

func (*Parser) Err

func (p *Parser) Err() error

Err ...

func (*Parser) Float64

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

Float64 ...

func (*Parser) Int64

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

Int64 ...

func (*Parser) LatLong

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

LatLong ...

func (*Parser) ListString

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

ListString ...

func (*Parser) SetErr

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

SetErr ...

func (*Parser) SixBitASCIIArmour

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

SixBitASCIIArmour ..

func (*Parser) String

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

String ...

func (*Parser) Time

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

Time ...

type ParserFunc

type ParserFunc func(BaseSentence) (Sentence, error)

type RMC

type RMC struct {
	BaseSentence
	Time      Time
	Validity  string
	Latitude  float64
	Longitude float64
	Speed     float64
	Course    float64
	Date      Date
	Variation float64
}

RMC ...

type Sentence

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

func Parse

func Parse(raw string) (Sentence, error)

type TagBlock

type TagBlock struct {
	Time         int64
	RelativeTime int64
	Destination  string
	Grouping     string
	LineCount    int64
	Source       string
	Text         string
}

type Time

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

func ParseTime

func ParseTime(s string) (Time, error)

func (Time) String

func (t Time) String() string

type VDMVDO

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

type VTG

type VTG struct {
	BaseSentence
	TrueTrack        float64
	MagneticTrack    float64
	GroundSpeedKnots float64
	GroundSpeedKPH   float64
}

Jump to

Keyboard shortcuts

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