FwSoaringData.parse constructor

FwSoaringData.parse(
  1. ByteData data_
)

Implementation

factory FwSoaringData.parse(ByteData data_) {
  if (data_.lengthInBytes < FwSoaringData.mavlinkEncodedLength) {
    var len = FwSoaringData.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var timestamp = data_.getUint64(0, Endian.little);
  var timestampmodechanged = data_.getUint64(8, Endian.little);
  var xw = data_.getFloat32(16, Endian.little);
  var xr = data_.getFloat32(20, Endian.little);
  var xlat = data_.getFloat32(24, Endian.little);
  var xlon = data_.getFloat32(28, Endian.little);
  var varw = data_.getFloat32(32, Endian.little);
  var varr = data_.getFloat32(36, Endian.little);
  var varlat = data_.getFloat32(40, Endian.little);
  var varlon = data_.getFloat32(44, Endian.little);
  var loiterradius = data_.getFloat32(48, Endian.little);
  var loiterdirection = data_.getFloat32(52, Endian.little);
  var disttosoarpoint = data_.getFloat32(56, Endian.little);
  var vsinkexp = data_.getFloat32(60, Endian.little);
  var z1Localupdraftspeed = data_.getFloat32(64, Endian.little);
  var z2Deltaroll = data_.getFloat32(68, Endian.little);
  var z1Exp = data_.getFloat32(72, Endian.little);
  var z2Exp = data_.getFloat32(76, Endian.little);
  var thermalgsnorth = data_.getFloat32(80, Endian.little);
  var thermalgseast = data_.getFloat32(84, Endian.little);
  var tseDot = data_.getFloat32(88, Endian.little);
  var debugvar1 = data_.getFloat32(92, Endian.little);
  var debugvar2 = data_.getFloat32(96, Endian.little);
  var controlmode = data_.getUint8(100);
  var valid = data_.getUint8(101);

  return FwSoaringData(
      timestamp: timestamp,
      timestampmodechanged: timestampmodechanged,
      xw: xw,
      xr: xr,
      xlat: xlat,
      xlon: xlon,
      varw: varw,
      varr: varr,
      varlat: varlat,
      varlon: varlon,
      loiterradius: loiterradius,
      loiterdirection: loiterdirection,
      disttosoarpoint: disttosoarpoint,
      vsinkexp: vsinkexp,
      z1Localupdraftspeed: z1Localupdraftspeed,
      z2Deltaroll: z2Deltaroll,
      z1Exp: z1Exp,
      z2Exp: z2Exp,
      thermalgsnorth: thermalgsnorth,
      thermalgseast: thermalgseast,
      tseDot: tseDot,
      debugvar1: debugvar1,
      debugvar2: debugvar2,
      controlmode: controlmode,
      valid: valid);
}