File: rsa.go

package info (click to toggle)
golang-github-adrianmo-go-nmea 1.10.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 900 kB
  • sloc: makefile: 15
file content (32 lines) | stat: -rw-r--r-- 1,120 bytes parent folder | download
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
package nmea

const (
	// TypeRSA type of RSA sentence for Rudder Sensor Angle
	TypeRSA = "RSA"
)

// RSA - Rudder Sensor Angle
// https://gpsd.gitlab.io/gpsd/NMEA.html#_rsa_rudder_sensor_angle
//
// Format: $--RSA,x.x,A,x.x,A*hh<CR><LF>
// Example: $IIRSA,10.5,A,,V*4D
type RSA struct {
	BaseSentence
	StarboardRudderAngle       float64 // Starboard (or single) rudder sensor, "-" means Turn To Port
	StarboardRudderAngleStatus string  // Status, A = valid, V = Invalid
	PortRudderAngle            float64 // Port rudder sensor
	PortRudderAngleStatus      string  // Status, A = valid, V = Invalid
}

// newRSA constructor
func newRSA(s BaseSentence) (Sentence, error) {
	p := NewParser(s)
	p.AssertType(TypeRSA)
	return RSA{
		BaseSentence:               s,
		StarboardRudderAngle:       p.Float64(0, "starboard rudder angle"),
		StarboardRudderAngleStatus: p.EnumString(1, "starboard rudder angle status", StatusValid, StatusInvalid),
		PortRudderAngle:            p.Float64(2, "port rudder angle"),
		PortRudderAngleStatus:      p.EnumString(3, "port rudder angle status", StatusValid, StatusInvalid),
	}, p.Err()
}