LandingTarget.parse constructor

LandingTarget.parse(
  1. ByteData data_
)

Implementation

factory LandingTarget.parse(ByteData data_) {
  if (data_.lengthInBytes < LandingTarget.mavlinkEncodedLength) {
    var len = LandingTarget.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 angleX = data_.getFloat32(8, Endian.little);
  var angleY = data_.getFloat32(12, Endian.little);
  var distance = data_.getFloat32(16, Endian.little);
  var sizeX = data_.getFloat32(20, Endian.little);
  var sizeY = data_.getFloat32(24, Endian.little);
  var targetNum = data_.getUint8(28);
  var frame = data_.getUint8(29);
  var x = data_.getFloat32(30, Endian.little);
  var y = data_.getFloat32(34, Endian.little);
  var z = data_.getFloat32(38, Endian.little);
  var q = MavlinkMessage.asFloat32List(data_, 42, 4);
  var type = data_.getUint8(58);
  var positionValid = data_.getUint8(59);

  return LandingTarget(
      timeUsec: timeUsec,
      angleX: angleX,
      angleY: angleY,
      distance: distance,
      sizeX: sizeX,
      sizeY: sizeY,
      targetNum: targetNum,
      frame: frame,
      x: x,
      y: y,
      z: z,
      q: q,
      type: type,
      positionValid: positionValid);
}