36 lines
1.2 KiB
Dart
36 lines
1.2 KiB
Dart
import 'package:nmea/nmea.dart';
|
|
|
|
class Gngga extends TalkerSentence {
|
|
static const String id = "GNGGA";
|
|
Gngga({required super.raw});
|
|
|
|
@override
|
|
bool get valid => super.valid && fields.length == 15;
|
|
|
|
String get utcOfPositionFix => fields[1];
|
|
int get gpsQualityIndicator => int.parse(fields[6]);
|
|
double get latitude => _getCoordinateFromGpsLatitude(fields[2]);
|
|
String get latitudeDirection => fields[3];
|
|
double get longitude => _getCoordinateFromGpsLongitude(fields[4]);
|
|
String get longitudeDirection => fields[5];
|
|
int get numberOfSvsInUse => int.parse(fields[7]);
|
|
double get hdop => double.parse(fields[8]);
|
|
double get altitudeAboveMeanSeaLevel => double.parse(fields[9]);
|
|
double get geoidSeparation => double.parse(fields[11]);
|
|
|
|
double _getCoordinateFromGpsLongitude(String coordinate) {
|
|
double result =
|
|
double.parse("${coordinate[0]}${coordinate[1]}${coordinate[2]}") +
|
|
double.parse(coordinate.substring(3)) / 60;
|
|
|
|
return result;
|
|
}
|
|
|
|
double _getCoordinateFromGpsLatitude(String coordinate) {
|
|
double result = double.parse("${coordinate[0]}${coordinate[1]}") +
|
|
double.parse(coordinate.substring(2)) / 60;
|
|
|
|
return result;
|
|
}
|
|
}
|