All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ccsds.sle.transfer.service.raf.outgoing.pdus.RafProviderToUserPdu Maven / Gradle / Ivy

There is a newer version: 1.1.0
Show newest version
/**
 * This class file was automatically generated by jASN1 v1.11.2 (http://www.beanit.com)
 */

package ccsds.sle.transfer.service.raf.outgoing.pdus;

import java.io.IOException;
import java.io.EOFException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.io.Serializable;
import com.beanit.jasn1.ber.*;
import com.beanit.jasn1.ber.types.*;
import com.beanit.jasn1.ber.types.string.*;

import ccsds.sle.transfer.service.bind.types.SleBindInvocation;
import ccsds.sle.transfer.service.bind.types.SleBindReturn;
import ccsds.sle.transfer.service.bind.types.SlePeerAbort;
import ccsds.sle.transfer.service.bind.types.SleUnbindInvocation;
import ccsds.sle.transfer.service.bind.types.SleUnbindReturn;
import ccsds.sle.transfer.service.common.pdus.SleAcknowledgement;
import ccsds.sle.transfer.service.common.pdus.SleScheduleStatusReportReturn;
import ccsds.sle.transfer.service.common.types.Credentials;
import ccsds.sle.transfer.service.common.types.IntUnsignedLong;
import ccsds.sle.transfer.service.common.types.InvokeId;
import ccsds.sle.transfer.service.common.types.SpaceLinkDataUnit;
import ccsds.sle.transfer.service.common.types.Time;
import ccsds.sle.transfer.service.raf.structures.AntennaId;
import ccsds.sle.transfer.service.raf.structures.CarrierLockStatus;
import ccsds.sle.transfer.service.raf.structures.DiagnosticRafGet;
import ccsds.sle.transfer.service.raf.structures.DiagnosticRafStart;
import ccsds.sle.transfer.service.raf.structures.FrameQuality;
import ccsds.sle.transfer.service.raf.structures.FrameSyncLockStatus;
import ccsds.sle.transfer.service.raf.structures.LockStatus;
import ccsds.sle.transfer.service.raf.structures.Notification;
import ccsds.sle.transfer.service.raf.structures.RafGetParameter;
import ccsds.sle.transfer.service.raf.structures.RafProductionStatus;
import ccsds.sle.transfer.service.raf.structures.SymbolLockStatus;

public class RafProviderToUserPdu implements BerType, Serializable {

	private static final long serialVersionUID = 1L;

	public byte[] code = null;
	private SleBindInvocation rafBindInvocation = null;
	private SleBindReturn rafBindReturn = null;
	private SleUnbindInvocation rafUnbindInvocation = null;
	private SleUnbindReturn rafUnbindReturn = null;
	private RafStartReturn rafStartReturn = null;
	private SleAcknowledgement rafStopReturn = null;
	private RafTransferBuffer rafTransferBuffer = null;
	private SleScheduleStatusReportReturn rafScheduleStatusReportReturn = null;
	private RafStatusReportInvocation rafStatusReportInvocation = null;
	private RafGetParameterReturn rafGetParameterReturn = null;
	private SlePeerAbort rafPeerAbortInvocation = null;
	
	public RafProviderToUserPdu() {
	}

	public RafProviderToUserPdu(byte[] code) {
		this.code = code;
	}

	public void setRafBindInvocation(SleBindInvocation rafBindInvocation) {
		this.rafBindInvocation = rafBindInvocation;
	}

	public SleBindInvocation getRafBindInvocation() {
		return rafBindInvocation;
	}

	public void setRafBindReturn(SleBindReturn rafBindReturn) {
		this.rafBindReturn = rafBindReturn;
	}

	public SleBindReturn getRafBindReturn() {
		return rafBindReturn;
	}

	public void setRafUnbindInvocation(SleUnbindInvocation rafUnbindInvocation) {
		this.rafUnbindInvocation = rafUnbindInvocation;
	}

	public SleUnbindInvocation getRafUnbindInvocation() {
		return rafUnbindInvocation;
	}

	public void setRafUnbindReturn(SleUnbindReturn rafUnbindReturn) {
		this.rafUnbindReturn = rafUnbindReturn;
	}

	public SleUnbindReturn getRafUnbindReturn() {
		return rafUnbindReturn;
	}

	public void setRafStartReturn(RafStartReturn rafStartReturn) {
		this.rafStartReturn = rafStartReturn;
	}

	public RafStartReturn getRafStartReturn() {
		return rafStartReturn;
	}

	public void setRafStopReturn(SleAcknowledgement rafStopReturn) {
		this.rafStopReturn = rafStopReturn;
	}

	public SleAcknowledgement getRafStopReturn() {
		return rafStopReturn;
	}

	public void setRafTransferBuffer(RafTransferBuffer rafTransferBuffer) {
		this.rafTransferBuffer = rafTransferBuffer;
	}

	public RafTransferBuffer getRafTransferBuffer() {
		return rafTransferBuffer;
	}

	public void setRafScheduleStatusReportReturn(SleScheduleStatusReportReturn rafScheduleStatusReportReturn) {
		this.rafScheduleStatusReportReturn = rafScheduleStatusReportReturn;
	}

	public SleScheduleStatusReportReturn getRafScheduleStatusReportReturn() {
		return rafScheduleStatusReportReturn;
	}

	public void setRafStatusReportInvocation(RafStatusReportInvocation rafStatusReportInvocation) {
		this.rafStatusReportInvocation = rafStatusReportInvocation;
	}

	public RafStatusReportInvocation getRafStatusReportInvocation() {
		return rafStatusReportInvocation;
	}

	public void setRafGetParameterReturn(RafGetParameterReturn rafGetParameterReturn) {
		this.rafGetParameterReturn = rafGetParameterReturn;
	}

	public RafGetParameterReturn getRafGetParameterReturn() {
		return rafGetParameterReturn;
	}

	public void setRafPeerAbortInvocation(SlePeerAbort rafPeerAbortInvocation) {
		this.rafPeerAbortInvocation = rafPeerAbortInvocation;
	}

	public SlePeerAbort getRafPeerAbortInvocation() {
		return rafPeerAbortInvocation;
	}

	public int encode(OutputStream reverseOS) throws IOException {

		if (code != null) {
			for (int i = code.length - 1; i >= 0; i--) {
				reverseOS.write(code[i]);
			}
			return code.length;
		}

		int codeLength = 0;
		if (rafPeerAbortInvocation != null) {
			codeLength += rafPeerAbortInvocation.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, PRIMITIVE, 104
			reverseOS.write(0x68);
			reverseOS.write(0x9F);
			codeLength += 2;
			return codeLength;
		}
		
		if (rafGetParameterReturn != null) {
			codeLength += rafGetParameterReturn.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 7
			reverseOS.write(0xA7);
			codeLength += 1;
			return codeLength;
		}
		
		if (rafStatusReportInvocation != null) {
			codeLength += rafStatusReportInvocation.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 9
			reverseOS.write(0xA9);
			codeLength += 1;
			return codeLength;
		}
		
		if (rafScheduleStatusReportReturn != null) {
			codeLength += rafScheduleStatusReportReturn.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 5
			reverseOS.write(0xA5);
			codeLength += 1;
			return codeLength;
		}
		
		if (rafTransferBuffer != null) {
			codeLength += rafTransferBuffer.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 8
			reverseOS.write(0xA8);
			codeLength += 1;
			return codeLength;
		}
		
		if (rafStopReturn != null) {
			codeLength += rafStopReturn.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 3
			reverseOS.write(0xA3);
			codeLength += 1;
			return codeLength;
		}
		
		if (rafStartReturn != null) {
			codeLength += rafStartReturn.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 1
			reverseOS.write(0xA1);
			codeLength += 1;
			return codeLength;
		}
		
		if (rafUnbindReturn != null) {
			codeLength += rafUnbindReturn.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 103
			reverseOS.write(0x67);
			reverseOS.write(0xBF);
			codeLength += 2;
			return codeLength;
		}
		
		if (rafUnbindInvocation != null) {
			codeLength += rafUnbindInvocation.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 102
			reverseOS.write(0x66);
			reverseOS.write(0xBF);
			codeLength += 2;
			return codeLength;
		}
		
		if (rafBindReturn != null) {
			codeLength += rafBindReturn.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 101
			reverseOS.write(0x65);
			reverseOS.write(0xBF);
			codeLength += 2;
			return codeLength;
		}
		
		if (rafBindInvocation != null) {
			codeLength += rafBindInvocation.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 100
			reverseOS.write(0x64);
			reverseOS.write(0xBF);
			codeLength += 2;
			return codeLength;
		}
		
		throw new IOException("Error encoding CHOICE: No element of CHOICE was selected.");
	}

	public int decode(InputStream is) throws IOException {
		return decode(is, null);
	}

	public int decode(InputStream is, BerTag berTag) throws IOException {

		int codeLength = 0;
		BerTag passedTag = berTag;

		if (berTag == null) {
			berTag = new BerTag();
			codeLength += berTag.decode(is);
		}

		if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 100)) {
			rafBindInvocation = new SleBindInvocation();
			codeLength += rafBindInvocation.decode(is, false);
			return codeLength;
		}

		if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 101)) {
			rafBindReturn = new SleBindReturn();
			codeLength += rafBindReturn.decode(is, false);
			return codeLength;
		}

		if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 102)) {
			rafUnbindInvocation = new SleUnbindInvocation();
			codeLength += rafUnbindInvocation.decode(is, false);
			return codeLength;
		}

		if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 103)) {
			rafUnbindReturn = new SleUnbindReturn();
			codeLength += rafUnbindReturn.decode(is, false);
			return codeLength;
		}

		if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
			rafStartReturn = new RafStartReturn();
			codeLength += rafStartReturn.decode(is, false);
			return codeLength;
		}

		if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 3)) {
			rafStopReturn = new SleAcknowledgement();
			codeLength += rafStopReturn.decode(is, false);
			return codeLength;
		}

		if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 8)) {
			rafTransferBuffer = new RafTransferBuffer();
			codeLength += rafTransferBuffer.decode(is, false);
			return codeLength;
		}

		if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 5)) {
			rafScheduleStatusReportReturn = new SleScheduleStatusReportReturn();
			codeLength += rafScheduleStatusReportReturn.decode(is, false);
			return codeLength;
		}

		if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 9)) {
			rafStatusReportInvocation = new RafStatusReportInvocation();
			codeLength += rafStatusReportInvocation.decode(is, false);
			return codeLength;
		}

		if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 7)) {
			rafGetParameterReturn = new RafGetParameterReturn();
			codeLength += rafGetParameterReturn.decode(is, false);
			return codeLength;
		}

		if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 104)) {
			rafPeerAbortInvocation = new SlePeerAbort();
			codeLength += rafPeerAbortInvocation.decode(is, false);
			return codeLength;
		}

		if (passedTag != null) {
			return 0;
		}

		throw new IOException("Error decoding CHOICE: Tag " + berTag + " matched to no item.");
	}

	public void encodeAndSave(int encodingSizeGuess) throws IOException {
		ReverseByteArrayOutputStream reverseOS = new ReverseByteArrayOutputStream(encodingSizeGuess);
		encode(reverseOS);
		code = reverseOS.getArray();
	}

	public String toString() {
		StringBuilder sb = new StringBuilder();
		appendAsString(sb, 0);
		return sb.toString();
	}

	public void appendAsString(StringBuilder sb, int indentLevel) {

		if (rafBindInvocation != null) {
			sb.append("rafBindInvocation: ");
			rafBindInvocation.appendAsString(sb, indentLevel + 1);
			return;
		}

		if (rafBindReturn != null) {
			sb.append("rafBindReturn: ");
			rafBindReturn.appendAsString(sb, indentLevel + 1);
			return;
		}

		if (rafUnbindInvocation != null) {
			sb.append("rafUnbindInvocation: ");
			rafUnbindInvocation.appendAsString(sb, indentLevel + 1);
			return;
		}

		if (rafUnbindReturn != null) {
			sb.append("rafUnbindReturn: ");
			rafUnbindReturn.appendAsString(sb, indentLevel + 1);
			return;
		}

		if (rafStartReturn != null) {
			sb.append("rafStartReturn: ");
			rafStartReturn.appendAsString(sb, indentLevel + 1);
			return;
		}

		if (rafStopReturn != null) {
			sb.append("rafStopReturn: ");
			rafStopReturn.appendAsString(sb, indentLevel + 1);
			return;
		}

		if (rafTransferBuffer != null) {
			sb.append("rafTransferBuffer: ");
			rafTransferBuffer.appendAsString(sb, indentLevel + 1);
			return;
		}

		if (rafScheduleStatusReportReturn != null) {
			sb.append("rafScheduleStatusReportReturn: ");
			rafScheduleStatusReportReturn.appendAsString(sb, indentLevel + 1);
			return;
		}

		if (rafStatusReportInvocation != null) {
			sb.append("rafStatusReportInvocation: ");
			rafStatusReportInvocation.appendAsString(sb, indentLevel + 1);
			return;
		}

		if (rafGetParameterReturn != null) {
			sb.append("rafGetParameterReturn: ");
			rafGetParameterReturn.appendAsString(sb, indentLevel + 1);
			return;
		}

		if (rafPeerAbortInvocation != null) {
			sb.append("rafPeerAbortInvocation: ").append(rafPeerAbortInvocation);
			return;
		}

		sb.append("");
	}

}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy