CameraImageCaptured.parse constructor

CameraImageCaptured.parse(
  1. ByteData data_
)

Implementation

factory CameraImageCaptured.parse(ByteData data_) {
  if (data_.lengthInBytes < CameraImageCaptured.mavlinkEncodedLength) {
    var len = CameraImageCaptured.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var timeUtc = data_.getUint64(0, Endian.little);
  var timeBootMs = data_.getUint32(8, Endian.little);
  var lat = data_.getInt32(12, Endian.little);
  var lon = data_.getInt32(16, Endian.little);
  var alt = data_.getInt32(20, Endian.little);
  var relativeAlt = data_.getInt32(24, Endian.little);
  var q = MavlinkMessage.asFloat32List(data_, 28, 4);
  var imageIndex = data_.getInt32(44, Endian.little);
  var cameraId = data_.getUint8(48);
  var captureResult = data_.getInt8(49);
  var fileUrl = MavlinkMessage.asInt8List(data_, 50, 205);

  return CameraImageCaptured(
      timeUtc: timeUtc,
      timeBootMs: timeBootMs,
      lat: lat,
      lon: lon,
      alt: alt,
      relativeAlt: relativeAlt,
      q: q,
      imageIndex: imageIndex,
      cameraId: cameraId,
      captureResult: captureResult,
      fileUrl: fileUrl);
}