SafetySetAllowedArea.parse constructor

SafetySetAllowedArea.parse(
  1. ByteData data_
)

Implementation

factory SafetySetAllowedArea.parse(ByteData data_) {
  if (data_.lengthInBytes < SafetySetAllowedArea.mavlinkEncodedLength) {
    var len = SafetySetAllowedArea.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 targetSystem = data_.getUint8(24);
  var targetComponent = data_.getUint8(25);
  var frame = data_.getUint8(26);

  return SafetySetAllowedArea(
      p1x: p1x,
      p1y: p1y,
      p1z: p1z,
      p2x: p2x,
      p2y: p2y,
      p2z: p2z,
      targetSystem: targetSystem,
      targetComponent: targetComponent,
      frame: frame);
}