Deepstall.parse constructor

Deepstall.parse(
  1. ByteData data_
)

Implementation

factory Deepstall.parse(ByteData data_) {
  if (data_.lengthInBytes < Deepstall.mavlinkEncodedLength) {
    var len = Deepstall.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var landingLat = data_.getInt32(0, Endian.little);
  var landingLon = data_.getInt32(4, Endian.little);
  var pathLat = data_.getInt32(8, Endian.little);
  var pathLon = data_.getInt32(12, Endian.little);
  var arcEntryLat = data_.getInt32(16, Endian.little);
  var arcEntryLon = data_.getInt32(20, Endian.little);
  var altitude = data_.getFloat32(24, Endian.little);
  var expectedTravelDistance = data_.getFloat32(28, Endian.little);
  var crossTrackError = data_.getFloat32(32, Endian.little);
  var stage = data_.getUint8(36);

  return Deepstall(
      landingLat: landingLat,
      landingLon: landingLon,
      pathLat: pathLat,
      pathLon: pathLon,
      arcEntryLat: arcEntryLat,
      arcEntryLon: arcEntryLon,
      altitude: altitude,
      expectedTravelDistance: expectedTravelDistance,
      crossTrackError: crossTrackError,
      stage: stage);
}