UavionixAdsbOutDynamic.parse constructor

UavionixAdsbOutDynamic.parse(
  1. ByteData data_
)

Implementation

factory UavionixAdsbOutDynamic.parse(ByteData data_) {
  if (data_.lengthInBytes < UavionixAdsbOutDynamic.mavlinkEncodedLength) {
    var len =
        UavionixAdsbOutDynamic.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var utctime = data_.getUint32(0, Endian.little);
  var gpslat = data_.getInt32(4, Endian.little);
  var gpslon = data_.getInt32(8, Endian.little);
  var gpsalt = data_.getInt32(12, Endian.little);
  var baroaltmsl = data_.getInt32(16, Endian.little);
  var accuracyhor = data_.getUint32(20, Endian.little);
  var accuracyvert = data_.getUint16(24, Endian.little);
  var accuracyvel = data_.getUint16(26, Endian.little);
  var velvert = data_.getInt16(28, Endian.little);
  var velns = data_.getInt16(30, Endian.little);
  var velew = data_.getInt16(32, Endian.little);
  var state = data_.getUint16(34, Endian.little);
  var squawk = data_.getUint16(36, Endian.little);
  var gpsfix = data_.getUint8(38);
  var numsats = data_.getUint8(39);
  var emergencystatus = data_.getUint8(40);

  return UavionixAdsbOutDynamic(
      utctime: utctime,
      gpslat: gpslat,
      gpslon: gpslon,
      gpsalt: gpsalt,
      baroaltmsl: baroaltmsl,
      accuracyhor: accuracyhor,
      accuracyvert: accuracyvert,
      accuracyvel: accuracyvel,
      velvert: velvert,
      velns: velns,
      velew: velew,
      state: state,
      squawk: squawk,
      gpsfix: gpsfix,
      numsats: numsats,
      emergencystatus: emergencystatus);
}