RawPressure.parse constructor

RawPressure.parse(
  1. ByteData data_
)

Implementation

factory RawPressure.parse(ByteData data_) {
  if (data_.lengthInBytes < RawPressure.mavlinkEncodedLength) {
    var len = RawPressure.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 pressAbs = data_.getInt16(8, Endian.little);
  var pressDiff1 = data_.getInt16(10, Endian.little);
  var pressDiff2 = data_.getInt16(12, Endian.little);
  var temperature = data_.getInt16(14, Endian.little);

  return RawPressure(
      timeUsec: timeUsec,
      pressAbs: pressAbs,
      pressDiff1: pressDiff1,
      pressDiff2: pressDiff2,
      temperature: temperature);
}