GlobalPositionInt.parse constructor

GlobalPositionInt.parse(
  1. ByteData data_
)

Implementation

factory GlobalPositionInt.parse(ByteData data_) {
  if (data_.lengthInBytes < GlobalPositionInt.mavlinkEncodedLength) {
    var len = GlobalPositionInt.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 lat = data_.getInt32(4, Endian.little);
  var lon = data_.getInt32(8, Endian.little);
  var alt = data_.getInt32(12, Endian.little);
  var relativeAlt = data_.getInt32(16, Endian.little);
  var vx = data_.getInt16(20, Endian.little);
  var vy = data_.getInt16(22, Endian.little);
  var vz = data_.getInt16(24, Endian.little);
  var hdg = data_.getUint16(26, Endian.little);

  return GlobalPositionInt(
      timeBootMs: timeBootMs,
      lat: lat,
      lon: lon,
      alt: alt,
      relativeAlt: relativeAlt,
      vx: vx,
      vy: vy,
      vz: vz,
      hdg: hdg);
}