Airspeeds.parse constructor

Airspeeds.parse(
  1. ByteData data_
)

Implementation

factory Airspeeds.parse(ByteData data_) {
  if (data_.lengthInBytes < Airspeeds.mavlinkEncodedLength) {
    var len = Airspeeds.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 airspeedImu = data_.getInt16(4, Endian.little);
  var airspeedPitot = data_.getInt16(6, Endian.little);
  var airspeedHotWire = data_.getInt16(8, Endian.little);
  var airspeedUltrasonic = data_.getInt16(10, Endian.little);
  var aoa = data_.getInt16(12, Endian.little);
  var aoy = data_.getInt16(14, Endian.little);

  return Airspeeds(
      timeBootMs: timeBootMs,
      airspeedImu: airspeedImu,
      airspeedPitot: airspeedPitot,
      airspeedHotWire: airspeedHotWire,
      airspeedUltrasonic: airspeedUltrasonic,
      aoa: aoa,
      aoy: aoy);
}