AutopilotVersion.parse constructor

AutopilotVersion.parse(
  1. ByteData data_
)

Implementation

factory AutopilotVersion.parse(ByteData data_) {
  if (data_.lengthInBytes < AutopilotVersion.mavlinkEncodedLength) {
    var len = AutopilotVersion.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var capabilities = data_.getUint64(0, Endian.little);
  var uid = data_.getUint64(8, Endian.little);
  var flightSwVersion = data_.getUint32(16, Endian.little);
  var middlewareSwVersion = data_.getUint32(20, Endian.little);
  var osSwVersion = data_.getUint32(24, Endian.little);
  var boardVersion = data_.getUint32(28, Endian.little);
  var vendorId = data_.getUint16(32, Endian.little);
  var productId = data_.getUint16(34, Endian.little);
  var flightCustomVersion = MavlinkMessage.asUint8List(data_, 36, 8);
  var middlewareCustomVersion = MavlinkMessage.asUint8List(data_, 44, 8);
  var osCustomVersion = MavlinkMessage.asUint8List(data_, 52, 8);
  var uid2 = MavlinkMessage.asUint8List(data_, 60, 18);

  return AutopilotVersion(
      capabilities: capabilities,
      uid: uid,
      flightSwVersion: flightSwVersion,
      middlewareSwVersion: middlewareSwVersion,
      osSwVersion: osSwVersion,
      boardVersion: boardVersion,
      vendorId: vendorId,
      productId: productId,
      flightCustomVersion: flightCustomVersion,
      middlewareCustomVersion: middlewareCustomVersion,
      osCustomVersion: osCustomVersion,
      uid2: uid2);
}