SafetyAllowedArea.parse constructor

SafetyAllowedArea.parse(
  1. ByteData data_
)

Implementation

factory SafetyAllowedArea.parse(ByteData data_) {
  if (data_.lengthInBytes < SafetyAllowedArea.mavlinkEncodedLength) {
    var len = SafetyAllowedArea.mavlinkEncodedLength - data_.lengthInBytes;
    var d = data_.buffer.asUint8List() + List<int>.filled(len, 0);
    data_ = Uint8List.fromList(d).buffer.asByteData();
  }
  var p1x = data_.getFloat32(0, Endian.little);
  var p1y = data_.getFloat32(4, Endian.little);
  var p1z = data_.getFloat32(8, Endian.little);
  var p2x = data_.getFloat32(12, Endian.little);
  var p2y = data_.getFloat32(16, Endian.little);
  var p2z = data_.getFloat32(20, Endian.little);
  var frame = data_.getUint8(24);

  return SafetyAllowedArea(
      p1x: p1x,
      p1y: p1y,
      p1z: p1z,
      p2x: p2x,
      p2y: p2y,
      p2z: p2z,
      frame: frame);
}