CommandInt.parse constructor

CommandInt.parse(
  1. ByteData data_
)

Implementation

factory CommandInt.parse(ByteData data_) {
  if (data_.lengthInBytes < CommandInt.mavlinkEncodedLength) {
    var len = CommandInt.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var param1 = data_.getFloat32(0, Endian.little);
  var param2 = data_.getFloat32(4, Endian.little);
  var param3 = data_.getFloat32(8, Endian.little);
  var param4 = data_.getFloat32(12, Endian.little);
  var x = data_.getInt32(16, Endian.little);
  var y = data_.getInt32(20, Endian.little);
  var z = data_.getFloat32(24, Endian.little);
  var command = data_.getUint16(28, Endian.little);
  var targetSystem = data_.getUint8(30);
  var targetComponent = data_.getUint8(31);
  var frame = data_.getUint8(32);
  var current = data_.getUint8(33);
  var autocontinue = data_.getUint8(34);

  return CommandInt(
      param1: param1,
      param2: param2,
      param3: param3,
      param4: param4,
      x: x,
      y: y,
      z: z,
      command: command,
      targetSystem: targetSystem,
      targetComponent: targetComponent,
      frame: frame,
      current: current,
      autocontinue: autocontinue);
}