CubepilotFirmwareUpdateStart.parse constructor

CubepilotFirmwareUpdateStart.parse(
  1. ByteData data_
)

Implementation

factory CubepilotFirmwareUpdateStart.parse(ByteData data_) {
  if (data_.lengthInBytes <
      CubepilotFirmwareUpdateStart.mavlinkEncodedLength) {
    var len = CubepilotFirmwareUpdateStart.mavlinkEncodedLength -
        data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var size = data_.getUint32(0, Endian.little);
  var crc = data_.getUint32(4, Endian.little);
  var targetSystem = data_.getUint8(8);
  var targetComponent = data_.getUint8(9);

  return CubepilotFirmwareUpdateStart(
      size: size,
      crc: crc,
      targetSystem: targetSystem,
      targetComponent: targetComponent);
}