MagCalReport.parse constructor

MagCalReport.parse(
  1. ByteData data_
)

Implementation

factory MagCalReport.parse(ByteData data_) {
  if (data_.lengthInBytes < MagCalReport.mavlinkEncodedLength) {
    var len = MagCalReport.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var fitness = data_.getFloat32(0, Endian.little);
  var ofsX = data_.getFloat32(4, Endian.little);
  var ofsY = data_.getFloat32(8, Endian.little);
  var ofsZ = data_.getFloat32(12, Endian.little);
  var diagX = data_.getFloat32(16, Endian.little);
  var diagY = data_.getFloat32(20, Endian.little);
  var diagZ = data_.getFloat32(24, Endian.little);
  var offdiagX = data_.getFloat32(28, Endian.little);
  var offdiagY = data_.getFloat32(32, Endian.little);
  var offdiagZ = data_.getFloat32(36, Endian.little);
  var compassId = data_.getUint8(40);
  var calMask = data_.getUint8(41);
  var calStatus = data_.getUint8(42);
  var autosaved = data_.getUint8(43);
  var orientationConfidence = data_.getFloat32(44, Endian.little);
  var oldOrientation = data_.getUint8(48);
  var newOrientation = data_.getUint8(49);
  var scaleFactor = data_.getFloat32(50, Endian.little);

  return MagCalReport(
      fitness: fitness,
      ofsX: ofsX,
      ofsY: ofsY,
      ofsZ: ofsZ,
      diagX: diagX,
      diagY: diagY,
      diagZ: diagZ,
      offdiagX: offdiagX,
      offdiagY: offdiagY,
      offdiagZ: offdiagZ,
      compassId: compassId,
      calMask: calMask,
      calStatus: calStatus,
      autosaved: autosaved,
      orientationConfidence: orientationConfidence,
      oldOrientation: oldOrientation,
      newOrientation: newOrientation,
      scaleFactor: scaleFactor);
}