Altitudes.parse constructor

Altitudes.parse(
  1. ByteData data_
)

Implementation

factory Altitudes.parse(ByteData data_) {
  if (data_.lengthInBytes < Altitudes.mavlinkEncodedLength) {
    var len = Altitudes.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var timeBootMs = data_.getUint32(0, Endian.little);
  var altGps = data_.getInt32(4, Endian.little);
  var altImu = data_.getInt32(8, Endian.little);
  var altBarometric = data_.getInt32(12, Endian.little);
  var altOpticalFlow = data_.getInt32(16, Endian.little);
  var altRangeFinder = data_.getInt32(20, Endian.little);
  var altExtra = data_.getInt32(24, Endian.little);

  return Altitudes(
      timeBootMs: timeBootMs,
      altGps: altGps,
      altImu: altImu,
      altBarometric: altBarometric,
      altOpticalFlow: altOpticalFlow,
      altRangeFinder: altRangeFinder,
      altExtra: altExtra);
}