GimbalTorqueCmdReport.parse constructor

GimbalTorqueCmdReport.parse(
  1. ByteData data_
)

Implementation

factory GimbalTorqueCmdReport.parse(ByteData data_) {
  if (data_.lengthInBytes < GimbalTorqueCmdReport.mavlinkEncodedLength) {
    var len =
        GimbalTorqueCmdReport.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var rlTorqueCmd = data_.getInt16(0, Endian.little);
  var elTorqueCmd = data_.getInt16(2, Endian.little);
  var azTorqueCmd = data_.getInt16(4, Endian.little);
  var targetSystem = data_.getUint8(6);
  var targetComponent = data_.getUint8(7);

  return GimbalTorqueCmdReport(
      rlTorqueCmd: rlTorqueCmd,
      elTorqueCmd: elTorqueCmd,
      azTorqueCmd: azTorqueCmd,
      targetSystem: targetSystem,
      targetComponent: targetComponent);
}