CommandLong.parse constructor

CommandLong.parse(
  1. ByteData data_
)

Implementation

factory CommandLong.parse(ByteData data_) {
  if (data_.lengthInBytes < CommandLong.mavlinkEncodedLength) {
    var len = CommandLong.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 param5 = data_.getFloat32(16, Endian.little);
  var param6 = data_.getFloat32(20, Endian.little);
  var param7 = data_.getFloat32(24, Endian.little);
  var command = data_.getUint16(28, Endian.little);
  var targetSystem = data_.getUint8(30);
  var targetComponent = data_.getUint8(31);
  var confirmation = data_.getUint8(32);

  return CommandLong(
      param1: param1,
      param2: param2,
      param3: param3,
      param4: param4,
      param5: param5,
      param6: param6,
      param7: param7,
      command: command,
      targetSystem: targetSystem,
      targetComponent: targetComponent,
      confirmation: confirmation);
}