forked from adrianmo/go-nmea
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgngns.go
58 lines (55 loc) · 1.54 KB
/
gngns.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package nmea
const (
// PrefixGNGNS prefix
PrefixGNGNS = "GNGNS"
// NoFixGNGNS Character
NoFixGNGNS = "N"
// AutonomousGNGNS Character
AutonomousGNGNS = "A"
// DifferentialGNGNS Character
DifferentialGNGNS = "D"
// PreciseGNGNS Character
PreciseGNGNS = "P"
// RealTimeKinematicGNGNS Character
RealTimeKinematicGNGNS = "R"
// FloatRTKGNGNS RealTime Kinematic Character
FloatRTKGNGNS = "F"
// EstimatedGNGNS Fix Character
EstimatedGNGNS = "E"
// ManualGNGNS Fix Character
ManualGNGNS = "M"
// SimulatorGNGNS Character
SimulatorGNGNS = "S"
)
// GNGNS is standard GNSS sentance that combined multiple constellations
type GNGNS struct {
BaseSentence
Time Time
Latitude float64
Longitude float64
Mode []string
SVs int64
HDOP float64
Altitude float64
Separation float64
Age float64
Station int64
}
// newGNGNS Constructor
func newGNGNS(s BaseSentence) (GNGNS, error) {
p := newParser(s, PrefixGNGNS)
m := GNGNS{
BaseSentence: s,
Time: p.Time(0, "time"),
Latitude: p.LatLong(1, 2, "latitude"),
Longitude: p.LatLong(3, 4, "longitude"),
Mode: p.EnumChars(5, "mode", NoFixGNGNS, AutonomousGNGNS, DifferentialGNGNS, PreciseGNGNS, RealTimeKinematicGNGNS, FloatRTKGNGNS, EstimatedGNGNS, ManualGNGNS, SimulatorGNGNS),
SVs: p.Int64(6, "SVs"),
HDOP: p.Float64(7, "HDOP"),
Altitude: p.Float64(8, "altitude"),
Separation: p.Float64(9, "separation"),
Age: p.Float64(10, "age"),
Station: p.Int64(11, "station"),
}
return m, p.Err()
}