MagCalProgress.parse constructor

MagCalProgress.parse(
  1. ByteData data_
)

Implementation

factory MagCalProgress.parse(ByteData data_) {
  if (data_.lengthInBytes < MagCalProgress.mavlinkEncodedLength) {
    var len = MagCalProgress.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var directionX = data_.getFloat32(0, Endian.little);
  var directionY = data_.getFloat32(4, Endian.little);
  var directionZ = data_.getFloat32(8, Endian.little);
  var compassId = data_.getUint8(12);
  var calMask = data_.getUint8(13);
  var calStatus = data_.getUint8(14);
  var attempt = data_.getUint8(15);
  var completionPct = data_.getUint8(16);
  var completionMask = MavlinkMessage.asUint8List(data_, 17, 10);

  return MagCalProgress(
      directionX: directionX,
      directionY: directionY,
      directionZ: directionZ,
      compassId: compassId,
      calMask: calMask,
      calStatus: calStatus,
      attempt: attempt,
      completionPct: completionPct,
      completionMask: completionMask);
}