gnssview_old/plugins/gnss/lib/nmea/dpt.dart
tanlinxing 553bde932c getx
2024-07-31 19:04:11 +08:00

26 lines
582 B
Dart

// ignore_for_file: constant_identifier_names
import 'parser.dart';
import 'sentence.dart';
const TypeDPT = "DPT";
class DPT {
double depth;
double offset;
double? rangeScale; // Optional property
DPT({required this.depth, required this.offset, this.rangeScale});
static DPT newDPT(BaseSentence s) {
var p = Parser(s);
double rangeScale = 0;
if (s.fields.length > 2) {
rangeScale = p.float64(2, "range scale");
}
return DPT(
depth: p.float64(0, "depth"),
offset: p.float64(1, "offset"),
rangeScale: rangeScale);
}
}