UtmGlobalPosition.parse constructor

UtmGlobalPosition.parse(
  1. ByteData data_
)

Implementation

factory UtmGlobalPosition.parse(ByteData data_) {
  if (data_.lengthInBytes < UtmGlobalPosition.mavlinkEncodedLength) {
    var len = UtmGlobalPosition.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var time = data_.getUint64(0, Endian.little);
  var lat = data_.getInt32(8, Endian.little);
  var lon = data_.getInt32(12, Endian.little);
  var alt = data_.getInt32(16, Endian.little);
  var relativeAlt = data_.getInt32(20, Endian.little);
  var nextLat = data_.getInt32(24, Endian.little);
  var nextLon = data_.getInt32(28, Endian.little);
  var nextAlt = data_.getInt32(32, Endian.little);
  var vx = data_.getInt16(36, Endian.little);
  var vy = data_.getInt16(38, Endian.little);
  var vz = data_.getInt16(40, Endian.little);
  var hAcc = data_.getUint16(42, Endian.little);
  var vAcc = data_.getUint16(44, Endian.little);
  var velAcc = data_.getUint16(46, Endian.little);
  var updateRate = data_.getUint16(48, Endian.little);
  var uasId = MavlinkMessage.asUint8List(data_, 50, 18);
  var flightState = data_.getUint8(68);
  var flags = data_.getUint8(69);

  return UtmGlobalPosition(
      time: time,
      lat: lat,
      lon: lon,
      alt: alt,
      relativeAlt: relativeAlt,
      nextLat: nextLat,
      nextLon: nextLon,
      nextAlt: nextAlt,
      vx: vx,
      vy: vy,
      vz: vz,
      hAcc: hAcc,
      vAcc: vAcc,
      velAcc: velAcc,
      updateRate: updateRate,
      uasId: uasId,
      flightState: flightState,
      flags: flags);
}