ManualControl.parse constructor

ManualControl.parse(
  1. ByteData data_
)

Implementation

factory ManualControl.parse(ByteData data_) {
  if (data_.lengthInBytes < ManualControl.mavlinkEncodedLength) {
    var len = ManualControl.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var x = data_.getInt16(0, Endian.little);
  var y = data_.getInt16(2, Endian.little);
  var z = data_.getInt16(4, Endian.little);
  var r = data_.getInt16(6, Endian.little);
  var buttons = data_.getUint16(8, Endian.little);
  var target = data_.getUint8(10);
  var buttons2 = data_.getUint16(11, Endian.little);
  var enabledExtensions = data_.getUint8(13);
  var s = data_.getInt16(14, Endian.little);
  var t = data_.getInt16(16, Endian.little);
  var aux1 = data_.getInt16(18, Endian.little);
  var aux2 = data_.getInt16(20, Endian.little);
  var aux3 = data_.getInt16(22, Endian.little);
  var aux4 = data_.getInt16(24, Endian.little);
  var aux5 = data_.getInt16(26, Endian.little);
  var aux6 = data_.getInt16(28, Endian.little);

  return ManualControl(
      x: x,
      y: y,
      z: z,
      r: r,
      buttons: buttons,
      target: target,
      buttons2: buttons2,
      enabledExtensions: enabledExtensions,
      s: s,
      t: t,
      aux1: aux1,
      aux2: aux2,
      aux3: aux3,
      aux4: aux4,
      aux5: aux5,
      aux6: aux6);
}