Documentation
¶
Index ¶
- Constants
- Variables
- func PrependToFloatXZero(value float64, expected uint) string
- func PrependToIntXZero(value int, expected uint) string
- func PrependXZero(value float64, formatString string, expected uint) string
- func Round(value float64, expected int, threshold float64) float64
- type CardinalPoint
- type DataValid
- type FixStatus
- type GPGGA
- type GPGLL
- type GPGSA
- type GPGSV
- type GPRMC
- type GPTXT
- type GPVTG
- type Header
- type LatLong
- type Message
- type Mode
- type MtkTypeID
- type NMEA
- type PositioningMode
- type QualityIndicator
- type Satellite
- type Severity
- type TalkerID
- type TypeID
Constants ¶
const ( InvalidIndicator = iota GNSSS DGPS )
const ( FixStatusNoFix FixStatus2D FixStatus3D )
Variables ¶
var (
DMFormat = regexp.MustCompile(`^([0-9]*\.?[0-9]+)\ ?([NSEW])?$`)
)
var TypeIDs map[string]Header
TypeIDs is a dictionary of all kind of NMEA message header by full-code
Functions ¶
func PrependToFloatXZero ¶
PrependToFloatXZero doing same thing that PrependXZeroFloat but with float as input
func PrependToIntXZero ¶
PrependToIntXZero doing same thing that PrependXZeroFloat but with int as input
func PrependXZero ¶
PrependXZero return string with expected number of zero (as prefix) to have X number before coma
Types ¶
type CardinalPoint ¶
type CardinalPoint string
const ( // Allowed cardinal points North CardinalPoint = "N" South CardinalPoint = "S" East CardinalPoint = "E" West CardinalPoint = "W" )
func ParseCardinalPoint ¶
func ParseCardinalPoint(raw string) (cp CardinalPoint, err error)
func (CardinalPoint) String ¶
func (c CardinalPoint) String() string
type GPGGA ¶
type GPGLL ¶
type GPGSA ¶
type GPGSV ¶
type GPRMC ¶
type GPRMC struct {
Message
DateTimeUTC time.Time // Aggregation of TimeUTC+Date data field
IsValid DataValid // 'V' =Invalid / 'A' = Valid
Latitude LatLong // In decimal format
Longitude LatLong // In decimal format
Speed float64 // Speed over ground in knots
COG float64 // Course over ground in degree
MagneticVariation float64 // Magnetic variation in degree, not being output
PositioningMode PositioningMode
}
type GPTXT ¶
type GPTXT struct {
Message
TotalNbMsgInTx int // Total number of messages in this transmission. (01~99)
MsgNumInTx int // Message number in this transmission. (01~99)
Severity Severity
/*
L80 module supports automatic antenna switching function.
The GPTXT sentence can be used to identify the status of external active antenna. The status of external active antenna is listed as below:
1. If ANTSTATUS=OK, it means external active antenna is connected and the module will use external active antenna.
2. If ANTSTATUS=OPEN, it means open-circuit state is dectected and the internal antenna is used at this time.
3. If ANTSTATUS=SHORT, it means short circuit state is dectected and the internal antenna is used.
*/
TxtMsg string
}
func (GPTXT) AntennaStatus ¶
type GPVTG ¶
type GPVTG struct {
Message
COG float64 // Course over ground (true) in degree
SpeedKnots float64 // Speed over ground in knots
SpeedKmh float64 // Speed over ground in km/h
PositioningMode PositioningMode
}
type LatLong ¶
type LatLong float64
func NewLatLong ¶
NewLatLong parses input has coordinate or return error
Allowed format: - DMS (Degrees, Minutes, Secondes), ie: "N 31° 50' 72.38'" - DD (Decimal Degree), ie: "31.8534389" "22.870216666666668"
func ParseDM ¶
ParseDM return LatLong from provided format from GPS module (in format ‘ddmm.mmmm’: degree and minutes) Allowed format: "3150.7238N" or "3150.7238 N" @see https://fr.wikipedia.org/wiki/Coordonn%C3%A9es_g%C3%A9ographiques => 1 degree = 60 minutes => 1 minute = 60 secondes Example: Baltimore (United state) => latitude = 39,28° N, longitude = 76,60° O (39° 17′ N, 76° 36′ O). 0.28° = (0.28°*60min)/1° = 16.8min => ~17 minutes
func (LatLong) CardinalPoint ¶
func (l LatLong) CardinalPoint(isLatitude bool) CardinalPoint
CardinalPoint return the cardinal point related to the kind of coordinate (long or lat)
type Message ¶
Message is the base aand low-level struct (envelope) without advanced dissection for each NMEA message
func (Message) ComputeChecksum ¶
ComputeChecksum recompute checksum from extracted payload
func (Message) GetMessage ¶
GetMessage return base Message to respect interface
type PositioningMode ¶
type PositioningMode string
const ( NoFixMode PositioningMode = "N" AutonomousGNSSFix PositioningMode = "A" DifferentialGNSSFix PositioningMode = "D" )
func ParsePositioningMode ¶
func ParsePositioningMode(raw string) (pm PositioningMode, err error)
func (PositioningMode) Serialize ¶
func (p PositioningMode) Serialize() string
func (PositioningMode) String ¶
func (p PositioningMode) String() string
type QualityIndicator ¶
type QualityIndicator int
func ParseQualityIndicator ¶
func ParseQualityIndicator(raw string) (qi QualityIndicator, err error)
func (QualityIndicator) String ¶
func (s QualityIndicator) String() string
type TalkerID ¶
type TalkerID string
const ( // NMEA special-chars // Prefix is special char to begin NMEA message Prefix = "$" // FieldDelimiter is special char to delimit a field in NMEA message FieldDelimiter = "," // Suffix is special char to finish NMEA message Suffix = "*" // Talker IDs TalkerIDProprietary TalkerID = "P" // P for pro proprietary message TalkerIDGPS TalkerID = "GP" // Global Positioning System receiver TalkerIDLC TalkerID = "LC" // Loran-C receiver TalkerIDII TalkerID = "II" // Integrated Instrumentation TalkerIDIN TalkerID = "IN" // Integrated Navigation TalkerIDEC TalkerID = "EC" // Electronic Chart Display & Information System (ECDIS) TalkerIDCD TalkerID = "CD" // Digital Selective Calling (DSC) TalkerIDGA TalkerID = "GA" // Galileo Positioning System TalkerIDGL TalkerID = "GL" // GLONASS, according to IEIC 61162-1 TalkerIDGN TalkerID = "GN" // Mixed GPS and GLONASS data, according to IEIC 61162-1 TalkerIDGB TalkerID = "GB" // BeiDou (China) TalkerIDBD TalkerID = "BD" // BeiDou (China) TalkerIDQZ TalkerID = "QZ" // QZSS regional GPS augmentation system (Japan) )