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

35 lines
864 B
Dart

// ignore_for_file: constant_identifier_names
import 'parser.dart';
import 'sentence.dart';
const TypeVTG = "VTG";
class VTG {
double trueTrack;
double magneticTrack;
double groundSpeedKnots;
double groundSpeedKPH;
String ffaMode;
VTG(
{required this.trueTrack,
required this.magneticTrack,
required this.groundSpeedKnots,
required this.groundSpeedKPH,
required this.ffaMode});
static VTG newVTG(BaseSentence s) {
var p = Parser(s);
String ffaMode = "";
if (s.fields.length > 8) {
ffaMode = p.string(8, "FAA mode");
}
return VTG(
trueTrack: p.float64(0, "true track"),
magneticTrack: p.float64(2, "magnetic track"),
groundSpeedKnots: p.float64(4, "ground speed (knots)"),
groundSpeedKPH: p.float64(6, "ground speed (km/h)"),
ffaMode: ffaMode);
}
}