gnssview/lib/quality/config/model.dart
2024-08-06 17:41:15 +08:00

101 lines
2.0 KiB
Dart

class GpsSignal {
double hdop;
List<SvItem> bsv;
List<SvItem> esv;
int status;
int? direction;
double? speed;
List<SvItem> gsv;
double lat;
double lon;
int view;
int use;
int time;
List<SvItem> rsv;
GpsSignal({
required this.bsv,
required this.esv,
required this.gsv,
required this.rsv,
this.direction,
required this.hdop,
required this.lat,
required this.lon,
this.speed,
required this.status,
required this.time,
required this.use,
required this.view,
});
factory GpsSignal.fromJson(Map<dynamic, dynamic> json) {
return GpsSignal(
bsv: SVList.fromJson(json['BSV']).data,
rsv: SVList.fromJson(json['RSV']).data,
gsv: SVList.fromJson(json['GSV']).data,
esv: SVList.fromJson(json['ESV']).data,
direction: json['direction'],
hdop: json['hdop'],
lat: json['lat'],
lon: json['lon'],
speed: json['speed'],
status: json['status'],
time: json['time'],
use: json['use'],
view: json['view'],
);
}
}
class SvItem {
int ea;
int use;
int sn;
int aa;
int l1;
int l2;
int l3;
int l4;
int l5;
String name;
SvItem(
{required this.aa,
required this.ea,
required this.l1,
required this.l2,
required this.l3,
required this.l4,
required this.l5,
required this.sn,
required this.use,
this.name = ''});
factory SvItem.fromJson(Map<dynamic, dynamic> json) {
return SvItem(
ea: json['EA'],
aa: json['AA'],
use: json['use'],
sn: json['SN'],
l1: json['L1'],
name: '',
l2: json['L2'],
l3: json['L3'],
l4: json['L4'],
l5: json['L5']);
}
}
class SVList {
List<SvItem> data;
SVList(this.data);
factory SVList.fromJson(List<dynamic> json) {
List<SvItem> list = [];
for (int i = 0; i < json.length; i++) {
var item = json[i];
list.add(SvItem.fromJson(item));
}
return SVList(list);
}
}