GpsInput.parse constructor

GpsInput.parse(
  1. ByteData data_
)

Implementation

factory GpsInput.parse(ByteData data_) {
  if (data_.lengthInBytes < GpsInput.mavlinkEncodedLength) {
    var len = GpsInput.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var timeUsec = data_.getUint64(0, Endian.little);
  var timeWeekMs = data_.getUint32(8, Endian.little);
  var lat = data_.getInt32(12, Endian.little);
  var lon = data_.getInt32(16, Endian.little);
  var alt = data_.getFloat32(20, Endian.little);
  var hdop = data_.getFloat32(24, Endian.little);
  var vdop = data_.getFloat32(28, Endian.little);
  var vn = data_.getFloat32(32, Endian.little);
  var ve = data_.getFloat32(36, Endian.little);
  var vd = data_.getFloat32(40, Endian.little);
  var speedAccuracy = data_.getFloat32(44, Endian.little);
  var horizAccuracy = data_.getFloat32(48, Endian.little);
  var vertAccuracy = data_.getFloat32(52, Endian.little);
  var ignoreFlags = data_.getUint16(56, Endian.little);
  var timeWeek = data_.getUint16(58, Endian.little);
  var gpsId = data_.getUint8(60);
  var fixType = data_.getUint8(61);
  var satellitesVisible = data_.getUint8(62);
  var yaw = data_.getUint16(63, Endian.little);

  return GpsInput(
      timeUsec: timeUsec,
      timeWeekMs: timeWeekMs,
      lat: lat,
      lon: lon,
      alt: alt,
      hdop: hdop,
      vdop: vdop,
      vn: vn,
      ve: ve,
      vd: vd,
      speedAccuracy: speedAccuracy,
      horizAccuracy: horizAccuracy,
      vertAccuracy: vertAccuracy,
      ignoreFlags: ignoreFlags,
      timeWeek: timeWeek,
      gpsId: gpsId,
      fixType: fixType,
      satellitesVisible: satellitesVisible,
      yaw: yaw);
}