GimbalReport.parse constructor

GimbalReport.parse(
  1. ByteData data_
)

Implementation

factory GimbalReport.parse(ByteData data_) {
  if (data_.lengthInBytes < GimbalReport.mavlinkEncodedLength) {
    var len = GimbalReport.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var deltaTime = data_.getFloat32(0, Endian.little);
  var deltaAngleX = data_.getFloat32(4, Endian.little);
  var deltaAngleY = data_.getFloat32(8, Endian.little);
  var deltaAngleZ = data_.getFloat32(12, Endian.little);
  var deltaVelocityX = data_.getFloat32(16, Endian.little);
  var deltaVelocityY = data_.getFloat32(20, Endian.little);
  var deltaVelocityZ = data_.getFloat32(24, Endian.little);
  var jointRoll = data_.getFloat32(28, Endian.little);
  var jointEl = data_.getFloat32(32, Endian.little);
  var jointAz = data_.getFloat32(36, Endian.little);
  var targetSystem = data_.getUint8(40);
  var targetComponent = data_.getUint8(41);

  return GimbalReport(
      deltaTime: deltaTime,
      deltaAngleX: deltaAngleX,
      deltaAngleY: deltaAngleY,
      deltaAngleZ: deltaAngleZ,
      deltaVelocityX: deltaVelocityX,
      deltaVelocityY: deltaVelocityY,
      deltaVelocityZ: deltaVelocityZ,
      jointRoll: jointRoll,
      jointEl: jointEl,
      jointAz: jointAz,
      targetSystem: targetSystem,
      targetComponent: targetComponent);
}