SetHomePosition.parse constructor

SetHomePosition.parse(
  1. ByteData data_
)

Implementation

factory SetHomePosition.parse(ByteData data_) {
  if (data_.lengthInBytes < SetHomePosition.mavlinkEncodedLength) {
    var len = SetHomePosition.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var latitude = data_.getInt32(0, Endian.little);
  var longitude = data_.getInt32(4, Endian.little);
  var altitude = data_.getInt32(8, Endian.little);
  var x = data_.getFloat32(12, Endian.little);
  var y = data_.getFloat32(16, Endian.little);
  var z = data_.getFloat32(20, Endian.little);
  var q = MavlinkMessage.asFloat32List(data_, 24, 4);
  var approachX = data_.getFloat32(40, Endian.little);
  var approachY = data_.getFloat32(44, Endian.little);
  var approachZ = data_.getFloat32(48, Endian.little);
  var targetSystem = data_.getUint8(52);
  var timeUsec = data_.getUint64(53, Endian.little);

  return SetHomePosition(
      latitude: latitude,
      longitude: longitude,
      altitude: altitude,
      x: x,
      y: y,
      z: z,
      q: q,
      approachX: approachX,
      approachY: approachY,
      approachZ: approachZ,
      targetSystem: targetSystem,
      timeUsec: timeUsec);
}