AdsbVehicle.parse constructor

AdsbVehicle.parse(
  1. ByteData data_
)

Implementation

factory AdsbVehicle.parse(ByteData data_) {
  if (data_.lengthInBytes < AdsbVehicle.mavlinkEncodedLength) {
    var len = AdsbVehicle.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var icaoAddress = data_.getUint32(0, Endian.little);
  var lat = data_.getInt32(4, Endian.little);
  var lon = data_.getInt32(8, Endian.little);
  var altitude = data_.getInt32(12, Endian.little);
  var heading = data_.getUint16(16, Endian.little);
  var horVelocity = data_.getUint16(18, Endian.little);
  var verVelocity = data_.getInt16(20, Endian.little);
  var flags = data_.getUint16(22, Endian.little);
  var squawk = data_.getUint16(24, Endian.little);
  var altitudeType = data_.getUint8(26);
  var callsign = MavlinkMessage.asInt8List(data_, 27, 9);
  var emitterType = data_.getUint8(36);
  var tslc = data_.getUint8(37);

  return AdsbVehicle(
      icaoAddress: icaoAddress,
      lat: lat,
      lon: lon,
      altitude: altitude,
      heading: heading,
      horVelocity: horVelocity,
      verVelocity: verVelocity,
      flags: flags,
      squawk: squawk,
      altitudeType: altitudeType,
      callsign: callsign,
      emitterType: emitterType,
      tslc: tslc);
}