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

ccsds.sle.transfer.service.fsp.incoming.pdus.FspTransferDataInvocation 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.fsp.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.common.pdus.SleScheduleStatusReportInvocation;
import ccsds.sle.transfer.service.common.pdus.SleStopInvocation;
import ccsds.sle.transfer.service.common.types.Credentials;
import ccsds.sle.transfer.service.common.types.Duration;
import ccsds.sle.transfer.service.common.types.IntPosLong;
import ccsds.sle.transfer.service.common.types.IntPosShort;
import ccsds.sle.transfer.service.common.types.IntUnsignedLong;
import ccsds.sle.transfer.service.common.types.InvokeId;
import ccsds.sle.transfer.service.common.types.SlduStatusNotification;
import ccsds.sle.transfer.service.fsp.structures.BlockingUsage;
import ccsds.sle.transfer.service.fsp.structures.FspData;
import ccsds.sle.transfer.service.fsp.structures.FspParameterName;
import ccsds.sle.transfer.service.fsp.structures.Map;
import ccsds.sle.transfer.service.fsp.structures.MapMuxControl;
import ccsds.sle.transfer.service.fsp.structures.PacketIdentification;
import ccsds.sle.transfer.service.fsp.structures.ProductionTime;
import ccsds.sle.transfer.service.fsp.structures.TransmissionMode;

public class FspTransferDataInvocation implements BerType, Serializable {

	private static final long serialVersionUID = 1L;

	public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);

	public byte[] code = null;
	private Credentials invokerCredentials = null;
	private InvokeId invokeId = null;
	private PacketIdentification packetIdentification = null;
	private ProductionTime earliestProductionTime = null;
	private ProductionTime latestProductionTime = null;
	private Duration delayTime = null;
	private TransmissionMode transmissionMode = null;
	private Map map = null;
	private BlockingUsage blocking = null;
	private SlduStatusNotification processingStartedNotification = null;
	private SlduStatusNotification radiatedNotification = null;
	private SlduStatusNotification acknowledgedNotification = null;
	private FspData fspData = null;
	
	public FspTransferDataInvocation() {
	}

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

	public void setInvokerCredentials(Credentials invokerCredentials) {
		this.invokerCredentials = invokerCredentials;
	}

	public Credentials getInvokerCredentials() {
		return invokerCredentials;
	}

	public void setInvokeId(InvokeId invokeId) {
		this.invokeId = invokeId;
	}

	public InvokeId getInvokeId() {
		return invokeId;
	}

	public void setPacketIdentification(PacketIdentification packetIdentification) {
		this.packetIdentification = packetIdentification;
	}

	public PacketIdentification getPacketIdentification() {
		return packetIdentification;
	}

	public void setEarliestProductionTime(ProductionTime earliestProductionTime) {
		this.earliestProductionTime = earliestProductionTime;
	}

	public ProductionTime getEarliestProductionTime() {
		return earliestProductionTime;
	}

	public void setLatestProductionTime(ProductionTime latestProductionTime) {
		this.latestProductionTime = latestProductionTime;
	}

	public ProductionTime getLatestProductionTime() {
		return latestProductionTime;
	}

	public void setDelayTime(Duration delayTime) {
		this.delayTime = delayTime;
	}

	public Duration getDelayTime() {
		return delayTime;
	}

	public void setTransmissionMode(TransmissionMode transmissionMode) {
		this.transmissionMode = transmissionMode;
	}

	public TransmissionMode getTransmissionMode() {
		return transmissionMode;
	}

	public void setMap(Map map) {
		this.map = map;
	}

	public Map getMap() {
		return map;
	}

	public void setBlocking(BlockingUsage blocking) {
		this.blocking = blocking;
	}

	public BlockingUsage getBlocking() {
		return blocking;
	}

	public void setProcessingStartedNotification(SlduStatusNotification processingStartedNotification) {
		this.processingStartedNotification = processingStartedNotification;
	}

	public SlduStatusNotification getProcessingStartedNotification() {
		return processingStartedNotification;
	}

	public void setRadiatedNotification(SlduStatusNotification radiatedNotification) {
		this.radiatedNotification = radiatedNotification;
	}

	public SlduStatusNotification getRadiatedNotification() {
		return radiatedNotification;
	}

	public void setAcknowledgedNotification(SlduStatusNotification acknowledgedNotification) {
		this.acknowledgedNotification = acknowledgedNotification;
	}

	public SlduStatusNotification getAcknowledgedNotification() {
		return acknowledgedNotification;
	}

	public void setFspData(FspData fspData) {
		this.fspData = fspData;
	}

	public FspData getFspData() {
		return fspData;
	}

	public int encode(OutputStream reverseOS) throws IOException {
		return encode(reverseOS, true);
	}

	public int encode(OutputStream reverseOS, boolean withTag) throws IOException {

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

		int codeLength = 0;
		codeLength += fspData.encode(reverseOS, true);
		
		codeLength += acknowledgedNotification.encode(reverseOS, true);
		
		codeLength += radiatedNotification.encode(reverseOS, true);
		
		codeLength += processingStartedNotification.encode(reverseOS, true);
		
		codeLength += blocking.encode(reverseOS, true);
		
		codeLength += map.encode(reverseOS);
		
		codeLength += transmissionMode.encode(reverseOS, true);
		
		codeLength += delayTime.encode(reverseOS, true);
		
		codeLength += latestProductionTime.encode(reverseOS);
		
		codeLength += earliestProductionTime.encode(reverseOS);
		
		codeLength += packetIdentification.encode(reverseOS, true);
		
		codeLength += invokeId.encode(reverseOS, true);
		
		codeLength += invokerCredentials.encode(reverseOS);
		
		codeLength += BerLength.encodeLength(reverseOS, codeLength);

		if (withTag) {
			codeLength += tag.encode(reverseOS);
		}

		return codeLength;

	}

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

	public int decode(InputStream is, boolean withTag) throws IOException {
		int codeLength = 0;
		int subCodeLength = 0;
		BerTag berTag = new BerTag();

		if (withTag) {
			codeLength += tag.decodeAndCheck(is);
		}

		BerLength length = new BerLength();
		codeLength += length.decode(is);

		int totalLength = length.val;
		codeLength += totalLength;

		subCodeLength += berTag.decode(is);
		invokerCredentials = new Credentials();
		subCodeLength += invokerCredentials.decode(is, berTag);
		subCodeLength += berTag.decode(is);
		
		if (berTag.equals(InvokeId.tag)) {
			invokeId = new InvokeId();
			subCodeLength += invokeId.decode(is, false);
			subCodeLength += berTag.decode(is);
		}
		else {
			throw new IOException("Tag does not match the mandatory sequence element tag.");
		}
		
		if (berTag.equals(PacketIdentification.tag)) {
			packetIdentification = new PacketIdentification();
			subCodeLength += packetIdentification.decode(is, false);
			subCodeLength += berTag.decode(is);
		}
		else {
			throw new IOException("Tag does not match the mandatory sequence element tag.");
		}
		
		earliestProductionTime = new ProductionTime();
		subCodeLength += earliestProductionTime.decode(is, berTag);
		subCodeLength += berTag.decode(is);
		
		latestProductionTime = new ProductionTime();
		subCodeLength += latestProductionTime.decode(is, berTag);
		subCodeLength += berTag.decode(is);
		
		if (berTag.equals(Duration.tag)) {
			delayTime = new Duration();
			subCodeLength += delayTime.decode(is, false);
			subCodeLength += berTag.decode(is);
		}
		else {
			throw new IOException("Tag does not match the mandatory sequence element tag.");
		}
		
		if (berTag.equals(TransmissionMode.tag)) {
			transmissionMode = new TransmissionMode();
			subCodeLength += transmissionMode.decode(is, false);
			subCodeLength += berTag.decode(is);
		}
		else {
			throw new IOException("Tag does not match the mandatory sequence element tag.");
		}
		
		map = new Map();
		subCodeLength += map.decode(is, berTag);
		subCodeLength += berTag.decode(is);
		
		if (berTag.equals(BlockingUsage.tag)) {
			blocking = new BlockingUsage();
			subCodeLength += blocking.decode(is, false);
			subCodeLength += berTag.decode(is);
		}
		else {
			throw new IOException("Tag does not match the mandatory sequence element tag.");
		}
		
		if (berTag.equals(SlduStatusNotification.tag)) {
			processingStartedNotification = new SlduStatusNotification();
			subCodeLength += processingStartedNotification.decode(is, false);
			subCodeLength += berTag.decode(is);
		}
		else {
			throw new IOException("Tag does not match the mandatory sequence element tag.");
		}
		
		if (berTag.equals(SlduStatusNotification.tag)) {
			radiatedNotification = new SlduStatusNotification();
			subCodeLength += radiatedNotification.decode(is, false);
			subCodeLength += berTag.decode(is);
		}
		else {
			throw new IOException("Tag does not match the mandatory sequence element tag.");
		}
		
		if (berTag.equals(SlduStatusNotification.tag)) {
			acknowledgedNotification = new SlduStatusNotification();
			subCodeLength += acknowledgedNotification.decode(is, false);
			subCodeLength += berTag.decode(is);
		}
		else {
			throw new IOException("Tag does not match the mandatory sequence element tag.");
		}
		
		if (berTag.equals(FspData.tag)) {
			fspData = new FspData();
			subCodeLength += fspData.decode(is, false);
			if (subCodeLength == totalLength) {
				return codeLength;
			}
		}
		throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);

		
	}

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

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

	public void appendAsString(StringBuilder sb, int indentLevel) {

		sb.append("{");
		sb.append("\n");
		for (int i = 0; i < indentLevel + 1; i++) {
			sb.append("\t");
		}
		if (invokerCredentials != null) {
			sb.append("invokerCredentials: ");
			invokerCredentials.appendAsString(sb, indentLevel + 1);
		}
		else {
			sb.append("invokerCredentials: ");
		}
		
		sb.append(",\n");
		for (int i = 0; i < indentLevel + 1; i++) {
			sb.append("\t");
		}
		if (invokeId != null) {
			sb.append("invokeId: ").append(invokeId);
		}
		else {
			sb.append("invokeId: ");
		}
		
		sb.append(",\n");
		for (int i = 0; i < indentLevel + 1; i++) {
			sb.append("\t");
		}
		if (packetIdentification != null) {
			sb.append("packetIdentification: ").append(packetIdentification);
		}
		else {
			sb.append("packetIdentification: ");
		}
		
		sb.append(",\n");
		for (int i = 0; i < indentLevel + 1; i++) {
			sb.append("\t");
		}
		if (earliestProductionTime != null) {
			sb.append("earliestProductionTime: ");
			earliestProductionTime.appendAsString(sb, indentLevel + 1);
		}
		else {
			sb.append("earliestProductionTime: ");
		}
		
		sb.append(",\n");
		for (int i = 0; i < indentLevel + 1; i++) {
			sb.append("\t");
		}
		if (latestProductionTime != null) {
			sb.append("latestProductionTime: ");
			latestProductionTime.appendAsString(sb, indentLevel + 1);
		}
		else {
			sb.append("latestProductionTime: ");
		}
		
		sb.append(",\n");
		for (int i = 0; i < indentLevel + 1; i++) {
			sb.append("\t");
		}
		if (delayTime != null) {
			sb.append("delayTime: ").append(delayTime);
		}
		else {
			sb.append("delayTime: ");
		}
		
		sb.append(",\n");
		for (int i = 0; i < indentLevel + 1; i++) {
			sb.append("\t");
		}
		if (transmissionMode != null) {
			sb.append("transmissionMode: ").append(transmissionMode);
		}
		else {
			sb.append("transmissionMode: ");
		}
		
		sb.append(",\n");
		for (int i = 0; i < indentLevel + 1; i++) {
			sb.append("\t");
		}
		if (map != null) {
			sb.append("map: ");
			map.appendAsString(sb, indentLevel + 1);
		}
		else {
			sb.append("map: ");
		}
		
		sb.append(",\n");
		for (int i = 0; i < indentLevel + 1; i++) {
			sb.append("\t");
		}
		if (blocking != null) {
			sb.append("blocking: ").append(blocking);
		}
		else {
			sb.append("blocking: ");
		}
		
		sb.append(",\n");
		for (int i = 0; i < indentLevel + 1; i++) {
			sb.append("\t");
		}
		if (processingStartedNotification != null) {
			sb.append("processingStartedNotification: ").append(processingStartedNotification);
		}
		else {
			sb.append("processingStartedNotification: ");
		}
		
		sb.append(",\n");
		for (int i = 0; i < indentLevel + 1; i++) {
			sb.append("\t");
		}
		if (radiatedNotification != null) {
			sb.append("radiatedNotification: ").append(radiatedNotification);
		}
		else {
			sb.append("radiatedNotification: ");
		}
		
		sb.append(",\n");
		for (int i = 0; i < indentLevel + 1; i++) {
			sb.append("\t");
		}
		if (acknowledgedNotification != null) {
			sb.append("acknowledgedNotification: ").append(acknowledgedNotification);
		}
		else {
			sb.append("acknowledgedNotification: ");
		}
		
		sb.append(",\n");
		for (int i = 0; i < indentLevel + 1; i++) {
			sb.append("\t");
		}
		if (fspData != null) {
			sb.append("fspData: ").append(fspData);
		}
		else {
			sb.append("fspData: ");
		}
		
		sb.append("\n");
		for (int i = 0; i < indentLevel; i++) {
			sb.append("\t");
		}
		sb.append("}");
	}

}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy