Altitude.parse constructor

Altitude.parse(
  1. ByteData data_
)

Implementation

factory Altitude.parse(ByteData data_) {
  if (data_.lengthInBytes < Altitude.mavlinkEncodedLength) {
    var len = Altitude.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var timeUsec = data_.getUint64(0, Endian.little);
  var altitudeMonotonic = data_.getFloat32(8, Endian.little);
  var altitudeAmsl = data_.getFloat32(12, Endian.little);
  var altitudeLocal = data_.getFloat32(16, Endian.little);
  var altitudeRelative = data_.getFloat32(20, Endian.little);
  var altitudeTerrain = data_.getFloat32(24, Endian.little);
  var bottomClearance = data_.getFloat32(28, Endian.little);

  return Altitude(
      timeUsec: timeUsec,
      altitudeMonotonic: altitudeMonotonic,
      altitudeAmsl: altitudeAmsl,
      altitudeLocal: altitudeLocal,
      altitudeRelative: altitudeRelative,
      altitudeTerrain: altitudeTerrain,
      bottomClearance: bottomClearance);
}