HighLatency.parse constructor

HighLatency.parse(
  1. ByteData data_
)

Implementation

factory HighLatency.parse(ByteData data_) {
  if (data_.lengthInBytes < HighLatency.mavlinkEncodedLength) {
    var len = HighLatency.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var customMode = data_.getUint32(0, Endian.little);
  var latitude = data_.getInt32(4, Endian.little);
  var longitude = data_.getInt32(8, Endian.little);
  var roll = data_.getInt16(12, Endian.little);
  var pitch = data_.getInt16(14, Endian.little);
  var heading = data_.getUint16(16, Endian.little);
  var headingSp = data_.getInt16(18, Endian.little);
  var altitudeAmsl = data_.getInt16(20, Endian.little);
  var altitudeSp = data_.getInt16(22, Endian.little);
  var wpDistance = data_.getUint16(24, Endian.little);
  var baseMode = data_.getUint8(26);
  var landedState = data_.getUint8(27);
  var throttle = data_.getInt8(28);
  var airspeed = data_.getUint8(29);
  var airspeedSp = data_.getUint8(30);
  var groundspeed = data_.getUint8(31);
  var climbRate = data_.getInt8(32);
  var gpsNsat = data_.getUint8(33);
  var gpsFixType = data_.getUint8(34);
  var batteryRemaining = data_.getUint8(35);
  var temperature = data_.getInt8(36);
  var temperatureAir = data_.getInt8(37);
  var failsafe = data_.getUint8(38);
  var wpNum = data_.getUint8(39);

  return HighLatency(
      customMode: customMode,
      latitude: latitude,
      longitude: longitude,
      roll: roll,
      pitch: pitch,
      heading: heading,
      headingSp: headingSp,
      altitudeAmsl: altitudeAmsl,
      altitudeSp: altitudeSp,
      wpDistance: wpDistance,
      baseMode: baseMode,
      landedState: landedState,
      throttle: throttle,
      airspeed: airspeed,
      airspeedSp: airspeedSp,
      groundspeed: groundspeed,
      climbRate: climbRate,
      gpsNsat: gpsNsat,
      gpsFixType: gpsFixType,
      batteryRemaining: batteryRemaining,
      temperature: temperature,
      temperatureAir: temperatureAir,
      failsafe: failsafe,
      wpNum: wpNum);
}