blob: 9d473bec8f3ff593aeb5779517df7410e4022bf6 [file] [log] [blame]
slowr13fa5b02017-08-08 16:32:31 -07001/**
2 * This class file was automatically generated by jASN1 v1.8.0 (http://www.openmuc.org)
3 */
4
5package org.onosproject.xran.codecs.api;
6
7import org.openmuc.jasn1.ber.BerByteArrayOutputStream;
8import org.openmuc.jasn1.ber.BerLength;
9import org.openmuc.jasn1.ber.BerTag;
10import org.openmuc.jasn1.ber.types.BerBoolean;
11import org.openmuc.jasn1.ber.types.BerEnum;
12import org.openmuc.jasn1.ber.types.BerInteger;
13
14import java.io.IOException;
15import java.io.InputStream;
16import java.io.Serializable;
17
18
19public class PropScell implements Serializable {
20
21 private static final long serialVersionUID = 1L;
22
23 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
24
25 public byte[] code = null;
26 private PCIARFCN pciArfcn = null;
27 private BerBoolean crossCarrierSchedEnable = null;
28 private BerEnum caDirection = null;
29 private BerInteger deactTimer = null;
30
31 public PropScell() {
32 }
33
34 public PropScell(byte[] code) {
35 this.code = code;
36 }
37
38 public void setPciArfcn(PCIARFCN pciArfcn) {
39 this.pciArfcn = pciArfcn;
40 }
41
42 public PCIARFCN getPciArfcn() {
43 return pciArfcn;
44 }
45
46 public void setCrossCarrierSchedEnable(BerBoolean crossCarrierSchedEnable) {
47 this.crossCarrierSchedEnable = crossCarrierSchedEnable;
48 }
49
50 public BerBoolean getCrossCarrierSchedEnable() {
51 return crossCarrierSchedEnable;
52 }
53
54 public void setCaDirection(BerEnum caDirection) {
55 this.caDirection = caDirection;
56 }
57
58 public BerEnum getCaDirection() {
59 return caDirection;
60 }
61
62 public void setDeactTimer(BerInteger deactTimer) {
63 this.deactTimer = deactTimer;
64 }
65
66 public BerInteger getDeactTimer() {
67 return deactTimer;
68 }
69
70 public int encode(BerByteArrayOutputStream os) throws IOException {
71 return encode(os, true);
72 }
73
74 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
75
76 if (code != null) {
77 for (int i = code.length - 1; i >= 0; i--) {
78 os.write(code[i]);
79 }
80 if (withTag) {
81 return tag.encode(os) + code.length;
82 }
83 return code.length;
84 }
85
86 int codeLength = 0;
87 codeLength += deactTimer.encode(os, false);
88 // write tag: CONTEXT_CLASS, PRIMITIVE, 3
89 os.write(0x83);
90 codeLength += 1;
91
92 codeLength += caDirection.encode(os, false);
93 // write tag: CONTEXT_CLASS, PRIMITIVE, 2
94 os.write(0x82);
95 codeLength += 1;
96
97 codeLength += crossCarrierSchedEnable.encode(os, false);
98 // write tag: CONTEXT_CLASS, PRIMITIVE, 1
99 os.write(0x81);
100 codeLength += 1;
101
102 codeLength += pciArfcn.encode(os, false);
103 // write tag: CONTEXT_CLASS, CONSTRUCTED, 0
104 os.write(0xA0);
105 codeLength += 1;
106
107 codeLength += BerLength.encodeLength(os, codeLength);
108
109 if (withTag) {
110 codeLength += tag.encode(os);
111 }
112
113 return codeLength;
114
115 }
116
117 public int decode(InputStream is) throws IOException {
118 return decode(is, true);
119 }
120
121 public int decode(InputStream is, boolean withTag) throws IOException {
122 int codeLength = 0;
123 int subCodeLength = 0;
124 BerTag berTag = new BerTag();
125
126 if (withTag) {
127 codeLength += tag.decodeAndCheck(is);
128 }
129
130 BerLength length = new BerLength();
131 codeLength += length.decode(is);
132
133 int totalLength = length.val;
134 codeLength += totalLength;
135
136 subCodeLength += berTag.decode(is);
137 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
138 pciArfcn = new PCIARFCN();
139 subCodeLength += pciArfcn.decode(is, false);
140 subCodeLength += berTag.decode(is);
141 }
142 else {
143 throw new IOException("Tag does not match the mandatory sequence element tag.");
144 }
145
146 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
147 crossCarrierSchedEnable = new BerBoolean();
148 subCodeLength += crossCarrierSchedEnable.decode(is, false);
149 subCodeLength += berTag.decode(is);
150 }
151 else {
152 throw new IOException("Tag does not match the mandatory sequence element tag.");
153 }
154
155 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 2)) {
156 caDirection = new BerEnum();
157 subCodeLength += caDirection.decode(is, false);
158 subCodeLength += berTag.decode(is);
159 }
160 else {
161 throw new IOException("Tag does not match the mandatory sequence element tag.");
162 }
163
164 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 3)) {
165 deactTimer = new BerInteger();
166 subCodeLength += deactTimer.decode(is, false);
167 if (subCodeLength == totalLength) {
168 return codeLength;
169 }
170 }
171 throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
172
173
174 }
175
176 public void encodeAndSave(int encodingSizeGuess) throws IOException {
177 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
178 encode(os, false);
179 code = os.getArray();
180 }
181
182 public String toString() {
183 StringBuilder sb = new StringBuilder();
184 appendAsString(sb, 0);
185 return sb.toString();
186 }
187
188 public void appendAsString(StringBuilder sb, int indentLevel) {
189
190 sb.append("{");
191 sb.append("\n");
192 for (int i = 0; i < indentLevel + 1; i++) {
193 sb.append("\t");
194 }
195 if (pciArfcn != null) {
196 sb.append("pciArfcn: ");
197 pciArfcn.appendAsString(sb, indentLevel + 1);
198 }
199 else {
200 sb.append("pciArfcn: <empty-required-field>");
201 }
202
203 sb.append(",\n");
204 for (int i = 0; i < indentLevel + 1; i++) {
205 sb.append("\t");
206 }
207 if (crossCarrierSchedEnable != null) {
208 sb.append("crossCarrierSchedEnable: ").append(crossCarrierSchedEnable);
209 }
210 else {
211 sb.append("crossCarrierSchedEnable: <empty-required-field>");
212 }
213
214 sb.append(",\n");
215 for (int i = 0; i < indentLevel + 1; i++) {
216 sb.append("\t");
217 }
218 if (caDirection != null) {
219 sb.append("caDirection: ").append(caDirection);
220 }
221 else {
222 sb.append("caDirection: <empty-required-field>");
223 }
224
225 sb.append(",\n");
226 for (int i = 0; i < indentLevel + 1; i++) {
227 sb.append("\t");
228 }
229 if (deactTimer != null) {
230 sb.append("deactTimer: ").append(deactTimer);
231 }
232 else {
233 sb.append("deactTimer: <empty-required-field>");
234 }
235
236 sb.append("\n");
237 for (int i = 0; i < indentLevel; i++) {
238 sb.append("\t");
239 }
240 sb.append("}");
241 }
242
243}
244