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

ccsds.sle.transfer.service.cltu.incoming.pdus.CltuUserToProviderPdu 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.cltu.incoming.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.SlePeerAbort;
import ccsds.sle.transfer.service.bind.types.SleUnbindInvocation;
import ccsds.sle.transfer.service.cltu.structures.CltuData;
import ccsds.sle.transfer.service.cltu.structures.CltuIdentification;
import ccsds.sle.transfer.service.cltu.structures.CltuParameterName;
import ccsds.sle.transfer.service.cltu.structures.EventInvocationId;
import ccsds.sle.transfer.service.common.pdus.SleScheduleStatusReportInvocation;
import ccsds.sle.transfer.service.common.pdus.SleStopInvocation;
import ccsds.sle.transfer.service.common.types.ConditionalTime;
import ccsds.sle.transfer.service.common.types.Credentials;
import ccsds.sle.transfer.service.common.types.Duration;
import ccsds.sle.transfer.service.common.types.IntPosShort;
import ccsds.sle.transfer.service.common.types.InvokeId;
import ccsds.sle.transfer.service.common.types.SlduStatusNotification;

public class CltuUserToProviderPdu implements BerType, Serializable {

	private static final long serialVersionUID = 1L;

	public byte[] code = null;
	private SleBindInvocation cltuBindInvocation = null;
	private SleUnbindInvocation cltuUnbindInvocation = null;
	private CltuStartInvocation cltuStartInvocation = null;
	private SleStopInvocation cltuStopInvocation = null;
	private SleScheduleStatusReportInvocation cltuScheduleStatusReportInvocation = null;
	private CltuGetParameterInvocation cltuGetParameterInvocation = null;
	private CltuThrowEventInvocation cltuThrowEventInvocation = null;
	private CltuTransferDataInvocation cltuTransferDataInvocation = null;
	private SlePeerAbort cltuPeerAbortInvocation = null;
	
	public CltuUserToProviderPdu() {
	}

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

	public void setCltuBindInvocation(SleBindInvocation cltuBindInvocation) {
		this.cltuBindInvocation = cltuBindInvocation;
	}

	public SleBindInvocation getCltuBindInvocation() {
		return cltuBindInvocation;
	}

	public void setCltuUnbindInvocation(SleUnbindInvocation cltuUnbindInvocation) {
		this.cltuUnbindInvocation = cltuUnbindInvocation;
	}

	public SleUnbindInvocation getCltuUnbindInvocation() {
		return cltuUnbindInvocation;
	}

	public void setCltuStartInvocation(CltuStartInvocation cltuStartInvocation) {
		this.cltuStartInvocation = cltuStartInvocation;
	}

	public CltuStartInvocation getCltuStartInvocation() {
		return cltuStartInvocation;
	}

	public void setCltuStopInvocation(SleStopInvocation cltuStopInvocation) {
		this.cltuStopInvocation = cltuStopInvocation;
	}

	public SleStopInvocation getCltuStopInvocation() {
		return cltuStopInvocation;
	}

	public void setCltuScheduleStatusReportInvocation(SleScheduleStatusReportInvocation cltuScheduleStatusReportInvocation) {
		this.cltuScheduleStatusReportInvocation = cltuScheduleStatusReportInvocation;
	}

	public SleScheduleStatusReportInvocation getCltuScheduleStatusReportInvocation() {
		return cltuScheduleStatusReportInvocation;
	}

	public void setCltuGetParameterInvocation(CltuGetParameterInvocation cltuGetParameterInvocation) {
		this.cltuGetParameterInvocation = cltuGetParameterInvocation;
	}

	public CltuGetParameterInvocation getCltuGetParameterInvocation() {
		return cltuGetParameterInvocation;
	}

	public void setCltuThrowEventInvocation(CltuThrowEventInvocation cltuThrowEventInvocation) {
		this.cltuThrowEventInvocation = cltuThrowEventInvocation;
	}

	public CltuThrowEventInvocation getCltuThrowEventInvocation() {
		return cltuThrowEventInvocation;
	}

	public void setCltuTransferDataInvocation(CltuTransferDataInvocation cltuTransferDataInvocation) {
		this.cltuTransferDataInvocation = cltuTransferDataInvocation;
	}

	public CltuTransferDataInvocation getCltuTransferDataInvocation() {
		return cltuTransferDataInvocation;
	}

	public void setCltuPeerAbortInvocation(SlePeerAbort cltuPeerAbortInvocation) {
		this.cltuPeerAbortInvocation = cltuPeerAbortInvocation;
	}

	public SlePeerAbort getCltuPeerAbortInvocation() {
		return cltuPeerAbortInvocation;
	}

	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 (cltuPeerAbortInvocation != null) {
			codeLength += cltuPeerAbortInvocation.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, PRIMITIVE, 104
			reverseOS.write(0x68);
			reverseOS.write(0x9F);
			codeLength += 2;
			return codeLength;
		}
		
		if (cltuTransferDataInvocation != null) {
			codeLength += cltuTransferDataInvocation.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 10
			reverseOS.write(0xAA);
			codeLength += 1;
			return codeLength;
		}
		
		if (cltuThrowEventInvocation != null) {
			codeLength += cltuThrowEventInvocation.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 8
			reverseOS.write(0xA8);
			codeLength += 1;
			return codeLength;
		}
		
		if (cltuGetParameterInvocation != null) {
			codeLength += cltuGetParameterInvocation.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 6
			reverseOS.write(0xA6);
			codeLength += 1;
			return codeLength;
		}
		
		if (cltuScheduleStatusReportInvocation != null) {
			codeLength += cltuScheduleStatusReportInvocation.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 4
			reverseOS.write(0xA4);
			codeLength += 1;
			return codeLength;
		}
		
		if (cltuStopInvocation != null) {
			codeLength += cltuStopInvocation.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 2
			reverseOS.write(0xA2);
			codeLength += 1;
			return codeLength;
		}
		
		if (cltuStartInvocation != null) {
			codeLength += cltuStartInvocation.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 0
			reverseOS.write(0xA0);
			codeLength += 1;
			return codeLength;
		}
		
		if (cltuUnbindInvocation != null) {
			codeLength += cltuUnbindInvocation.encode(reverseOS, false);
			// write tag: CONTEXT_CLASS, CONSTRUCTED, 102
			reverseOS.write(0x66);
			reverseOS.write(0xBF);
			codeLength += 2;
			return codeLength;
		}
		
		if (cltuBindInvocation != null) {
			codeLength += cltuBindInvocation.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)) {
			cltuBindInvocation = new SleBindInvocation();
			codeLength += cltuBindInvocation.decode(is, false);
			return codeLength;
		}

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

		if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
			cltuStartInvocation = new CltuStartInvocation();
			codeLength += cltuStartInvocation.decode(is, false);
			return codeLength;
		}

		if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
			cltuStopInvocation = new SleStopInvocation();
			codeLength += cltuStopInvocation.decode(is, false);
			return codeLength;
		}

		if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 4)) {
			cltuScheduleStatusReportInvocation = new SleScheduleStatusReportInvocation();
			codeLength += cltuScheduleStatusReportInvocation.decode(is, false);
			return codeLength;
		}

		if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 6)) {
			cltuGetParameterInvocation = new CltuGetParameterInvocation();
			codeLength += cltuGetParameterInvocation.decode(is, false);
			return codeLength;
		}

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

		if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 10)) {
			cltuTransferDataInvocation = new CltuTransferDataInvocation();
			codeLength += cltuTransferDataInvocation.decode(is, false);
			return codeLength;
		}

		if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 104)) {
			cltuPeerAbortInvocation = new SlePeerAbort();
			codeLength += cltuPeerAbortInvocation.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 (cltuBindInvocation != null) {
			sb.append("cltuBindInvocation: ");
			cltuBindInvocation.appendAsString(sb, indentLevel + 1);
			return;
		}

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

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

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

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

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

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

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

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

		sb.append("");
	}

}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy