-
Notifications
You must be signed in to change notification settings - Fork 86
Expand file tree
/
Copy pathdbt.go
More file actions
30 lines (27 loc) · 704 Bytes
/
dbt.go
File metadata and controls
30 lines (27 loc) · 704 Bytes
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
package nmea
const (
// TypeDBT type for DBT sentences
TypeDBT = "DBT"
)
// DBT - Depth below transducer
// https://gpsd.gitlab.io/gpsd/NMEA.html#_dbt_depth_below_transducer
//
// Format: $--DBT,x.x,f,x.x,M,x.x,F*hh<CR><LF>
// Example: $IIDBT,032.93,f,010.04,M,005.42,F*2C
type DBT struct {
BaseSentence
DepthFeet float64
DepthMeters float64
DepthFathoms float64
}
// newDBT constructor
func newDBT(s BaseSentence, opts ...ParserOption) (Sentence, error) {
p := NewParser(s, opts...)
p.AssertType(TypeDBT)
return DBT{
BaseSentence: s,
DepthFeet: p.Float64(0, "depth_feet"),
DepthMeters: p.Float64(2, "depth_meters"),
DepthFathoms: p.Float64(4, "depth_fathoms"),
}, p.Err()
}