89 lines
2.0 KiB
Dart
89 lines
2.0 KiB
Dart
// ignore_for_file: constant_identifier_names
|
|
|
|
import 'sentence.dart';
|
|
|
|
import 'parser.dart';
|
|
import 'types.dart';
|
|
|
|
const TypeGNS = "GNS";
|
|
// NoFixGNS Character
|
|
const NoFixGNS = "N";
|
|
// AutonomousGNS Character
|
|
const AutonomousGNS = "A";
|
|
// DifferentialGNS Character
|
|
const DifferentialGNS = "D";
|
|
// PreciseGNS Character
|
|
const PreciseGNS = "P";
|
|
// RealTimeKinematicGNS Character
|
|
const RealTimeKinematicGNS = "R";
|
|
// FloatRTKGNS RealTime Kinematic Character
|
|
const FloatRTKGNS = "F";
|
|
// EstimatedGNS Fix Character
|
|
const EstimatedGNS = "E";
|
|
// ManualGNS Fix Character
|
|
const ManualGNS = "M";
|
|
// SimulatorGNS Character
|
|
const SimulatorGNS = "S";
|
|
|
|
class GNS {
|
|
Time time;
|
|
double latitude;
|
|
double longitude;
|
|
List<String> mode;
|
|
int svs;
|
|
double hdop;
|
|
double altitude;
|
|
double separation;
|
|
double age;
|
|
int station;
|
|
String navStatus;
|
|
|
|
GNS(
|
|
{required this.time,
|
|
required this.latitude,
|
|
required this.longitude,
|
|
required this.mode,
|
|
required this.svs,
|
|
required this.hdop,
|
|
required this.altitude,
|
|
required this.separation,
|
|
required this.age,
|
|
required this.station,
|
|
required this.navStatus});
|
|
static GNS newGNS(BaseSentence s) {
|
|
var p = Parser(s);
|
|
var gns = GNS(
|
|
time: p.time(0, "time"),
|
|
latitude: p.latLong(1, 2, "latitude"),
|
|
longitude: p.latLong(3, 4, "longitude"),
|
|
mode: p.enumChars(5, "mode", [
|
|
NoFixGNS,
|
|
AutonomousGNS,
|
|
DifferentialGNS,
|
|
PreciseGNS,
|
|
RealTimeKinematicGNS,
|
|
FloatRTKGNS,
|
|
EstimatedGNS,
|
|
ManualGNS,
|
|
SimulatorGNS
|
|
]),
|
|
svs: p.int64(6, "SVs"),
|
|
hdop: p.float64(7, "HDOP"),
|
|
altitude: p.float64(8, "altitude"),
|
|
separation: p.float64(9, "separation"),
|
|
age: p.float64(10, "age"),
|
|
station: p.int64(11, "station"),
|
|
navStatus: '',
|
|
);
|
|
if (s.fields.length >= 13) {
|
|
gns.navStatus = p.enumString(12, "navigation status", [
|
|
NavStatusSafe,
|
|
NavStatusCaution,
|
|
NavStatusUnsafe,
|
|
NavStatusNotValid,
|
|
]);
|
|
}
|
|
return gns;
|
|
}
|
|
}
|