ScaledPressure2.parse constructor

ScaledPressure2.parse(
  1. ByteData data_
)

Implementation

factory ScaledPressure2.parse(ByteData data_) {
  if (data_.lengthInBytes < ScaledPressure2.mavlinkEncodedLength) {
    var len = ScaledPressure2.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 pressAbs = data_.getFloat32(4, Endian.little);
  var pressDiff = data_.getFloat32(8, Endian.little);
  var temperature = data_.getInt16(12, Endian.little);
  var temperaturePressDiff = data_.getInt16(14, Endian.little);

  return ScaledPressure2(
      timeBootMs: timeBootMs,
      pressAbs: pressAbs,
      pressDiff: pressDiff,
      temperature: temperature,
      temperaturePressDiff: temperaturePressDiff);
}