forked from adrianmo/go-nmea
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wpl.go
31 lines (28 loc) · 783 Bytes
/
wpl.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package nmea
const (
// TypeWPL type for WPL sentences
TypeWPL = "WPL"
)
// 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 WPL struct {
BaseSentence
Latitude float64 // Latitude
Longitude float64 // Longitude
Ident string // Ident of nth waypoint
}
// newWPL constructor
func newWPL(s BaseSentence) (Sentence, error) {
p := NewParser(s)
p.AssertType(TypeWPL)
return WPL{
BaseSentence: s,
Latitude: p.LatLong(0, 1, "latitude"),
Longitude: p.LatLong(2, 3, "longitude"),
Ident: p.String(4, "ident of nth waypoint"),
}, p.Err()
}