AvssDronePosition.parse constructor

AvssDronePosition.parse(
  1. ByteData data_
)

Implementation

factory AvssDronePosition.parse(ByteData data_) {
  if (data_.lengthInBytes < AvssDronePosition.mavlinkEncodedLength) {
    var len = AvssDronePosition.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 groundAlt = data_.getFloat32(16, Endian.little);
  var barometerAlt = data_.getFloat32(20, Endian.little);

  return AvssDronePosition(
      timeBootMs: timeBootMs,
      lat: lat,
      lon: lon,
      alt: alt,
      groundAlt: groundAlt,
      barometerAlt: barometerAlt);
}