gnssview_old/plugins/gnss/lib/nmea/gga.dart

76 lines
1.8 KiB
Dart
Raw Permalink Normal View History

2024-07-31 19:04:11 +08:00
// ignore_for_file: constant_identifier_names
import 'parser.dart';
import 'sentence.dart';
const TypeGGA = "GGA";
// Invalid fix quality.
const Invalid = "0";
// GPS fix quality
const GPS = "1";
// DGPS fix quality
const DGPS = "2";
// PPS fix
const PPS = "3";
// RTK real time kinematic fix
const RTK = "4";
// FRTK float RTK fix
const FRTK = "5";
// EST estimated fix.
const EST = "6";
class GGA {
// Time of fix.
Time time;
// Latitude.
double latitude;
// Longitude.
double longitude;
// Quality of fix.
int quality;
// Number of satellites in use.
int numSatellites;
// Horizontal dilution of precision.
double hdop;
// Altitude.
double altitude;
// Geoidal separation.
double separation;
// Age of differential GPD data.
String dgpsAge;
// DGPS reference station ID.
String dgpsId;
// Constructor
GGA(
{required this.time,
required this.latitude,
required this.longitude,
required this.quality,
required this.numSatellites,
required this.hdop,
required this.altitude,
required this.separation,
required this.dgpsAge,
required this.dgpsId});
// Factory method to create GGA from parser
static GGA newGGA(BaseSentence s) {
var p = Parser(s);
return GGA(
time: p.time(0, "time"),
latitude: p.latLong(1, 2, "latitude"),
longitude: p.latLong(3, 4, "longitude"),
// fixQuality: p.enumString(
// 5, "fix quality", [Invalid, GPS, DGPS, PPS, RTK, FRTK, EST]),
quality: p.int64(5, "quality"),
numSatellites: p.int64(6, "number of satellites"),
hdop: p.float64(7, "hdop"),
altitude: p.float64(8, "altitude"),
separation: p.float64(10, "separation"),
dgpsAge: p.string(12, "dgps age"),
dgpsId: p.string(13, "dgps id"),
);
}
}