CameraFeedback.parse constructor

CameraFeedback.parse(
  1. ByteData data_
)

Implementation

factory CameraFeedback.parse(ByteData data_) {
  if (data_.lengthInBytes < CameraFeedback.mavlinkEncodedLength) {
    var len = CameraFeedback.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var timeUsec = data_.getUint64(0, Endian.little);
  var lat = data_.getInt32(8, Endian.little);
  var lng = data_.getInt32(12, Endian.little);
  var altMsl = data_.getFloat32(16, Endian.little);
  var altRel = data_.getFloat32(20, Endian.little);
  var roll = data_.getFloat32(24, Endian.little);
  var pitch = data_.getFloat32(28, Endian.little);
  var yaw = data_.getFloat32(32, Endian.little);
  var focLen = data_.getFloat32(36, Endian.little);
  var imgIdx = data_.getUint16(40, Endian.little);
  var targetSystem = data_.getUint8(42);
  var camIdx = data_.getUint8(43);
  var flags = data_.getUint8(44);
  var completedCaptures = data_.getUint16(45, Endian.little);

  return CameraFeedback(
      timeUsec: timeUsec,
      lat: lat,
      lng: lng,
      altMsl: altMsl,
      altRel: altRel,
      roll: roll,
      pitch: pitch,
      yaw: yaw,
      focLen: focLen,
      imgIdx: imgIdx,
      targetSystem: targetSystem,
      camIdx: camIdx,
      flags: flags,
      completedCaptures: completedCaptures);
}