CompassmotStatus.parse constructor

CompassmotStatus.parse(
  1. ByteData data_
)

Implementation

factory CompassmotStatus.parse(ByteData data_) {
  if (data_.lengthInBytes < CompassmotStatus.mavlinkEncodedLength) {
    var len = CompassmotStatus.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var current = data_.getFloat32(0, Endian.little);
  var compensationx = data_.getFloat32(4, Endian.little);
  var compensationy = data_.getFloat32(8, Endian.little);
  var compensationz = data_.getFloat32(12, Endian.little);
  var throttle = data_.getUint16(16, Endian.little);
  var interference = data_.getUint16(18, Endian.little);

  return CompassmotStatus(
      current: current,
      compensationx: compensationx,
      compensationy: compensationy,
      compensationz: compensationz,
      throttle: throttle,
      interference: interference);
}