GimbalControl.parse constructor

GimbalControl.parse(
  1. ByteData data_
)

Implementation

factory GimbalControl.parse(ByteData data_) {
  if (data_.lengthInBytes < GimbalControl.mavlinkEncodedLength) {
    var len = GimbalControl.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var demandedRateX = data_.getFloat32(0, Endian.little);
  var demandedRateY = data_.getFloat32(4, Endian.little);
  var demandedRateZ = data_.getFloat32(8, Endian.little);
  var targetSystem = data_.getUint8(12);
  var targetComponent = data_.getUint8(13);

  return GimbalControl(
      demandedRateX: demandedRateX,
      demandedRateY: demandedRateY,
      demandedRateZ: demandedRateZ,
      targetSystem: targetSystem,
      targetComponent: targetComponent);
}