blob: bb1c59a1ef553b8a27a14965a87d015aff828001 [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.pdu;
6
slowr60d4d102017-08-16 18:33:58 -07007import com.fasterxml.jackson.annotation.JsonIgnore;
8import com.fasterxml.jackson.annotation.JsonValue;
slowr13fa5b02017-08-08 16:32:31 -07009import org.onosproject.xran.codecs.api.ECGI;
slowr60d4d102017-08-16 18:33:58 -070010import org.onosproject.xran.codecs.ber.BerByteArrayOutputStream;
11import org.onosproject.xran.codecs.ber.BerLength;
12import org.onosproject.xran.codecs.ber.BerTag;
13import org.onosproject.xran.codecs.ber.types.BerInteger;
slowr13fa5b02017-08-08 16:32:31 -070014
15import java.io.IOException;
16import java.io.InputStream;
17import java.io.Serializable;
18import java.util.ArrayList;
19import java.util.Iterator;
20import java.util.List;
21
22
23public class RadioMeasReportPerCell implements Serializable {
24
25 private static final long serialVersionUID = 1L;
26
27 public static class PuschIntfPowerHist implements Serializable {
28
29 private static final long serialVersionUID = 1L;
30
31 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
slowr60d4d102017-08-16 18:33:58 -070032 @JsonIgnore
slowr13fa5b02017-08-08 16:32:31 -070033 public byte[] code = null;
34 private List<BerInteger> seqOf = null;
35
36 public PuschIntfPowerHist() {
37 seqOf = new ArrayList<BerInteger>();
38 }
39
40 public PuschIntfPowerHist(byte[] code) {
41 this.code = code;
42 }
43
slowr60d4d102017-08-16 18:33:58 -070044 @JsonValue public List<BerInteger> getBerInteger() {
slowr13fa5b02017-08-08 16:32:31 -070045 if (seqOf == null) {
46 seqOf = new ArrayList<BerInteger>();
47 }
48 return seqOf;
49 }
50
51 public void setBerInteger(BerInteger berInteger) {
52 seqOf.add(berInteger);
53 }
54
55 public int encode(BerByteArrayOutputStream os) throws IOException {
56 return encode(os, true);
57 }
58
59 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
60
61 if (code != null) {
62 for (int i = code.length - 1; i >= 0; i--) {
63 os.write(code[i]);
64 }
65 if (withTag) {
66 return tag.encode(os) + code.length;
67 }
68 return code.length;
69 }
70
71 int codeLength = 0;
72 for (int i = (seqOf.size() - 1); i >= 0; i--) {
73 codeLength += seqOf.get(i).encode(os, true);
74 }
75
76 codeLength += BerLength.encodeLength(os, codeLength);
77
78 if (withTag) {
79 codeLength += tag.encode(os);
80 }
81
82 return codeLength;
83 }
84
85 public int decode(InputStream is) throws IOException {
86 return decode(is, true);
87 }
88
89 public int decode(InputStream is, boolean withTag) throws IOException {
90 int codeLength = 0;
91 int subCodeLength = 0;
92 if (withTag) {
93 codeLength += tag.decodeAndCheck(is);
94 }
95
96 BerLength length = new BerLength();
97 codeLength += length.decode(is);
98 int totalLength = length.val;
99
100 while (subCodeLength < totalLength) {
101 BerInteger element = new BerInteger();
102 subCodeLength += element.decode(is, true);
103 seqOf.add(element);
104 }
105 if (subCodeLength != totalLength) {
106 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
107
108 }
109 codeLength += subCodeLength;
110
111 return codeLength;
112 }
113
114 public void encodeAndSave(int encodingSizeGuess) throws IOException {
115 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
116 encode(os, false);
117 code = os.getArray();
118 }
119
120 public String toString() {
121 StringBuilder sb = new StringBuilder();
122 appendAsString(sb, 0);
123 return sb.toString();
124 }
125
126 public void appendAsString(StringBuilder sb, int indentLevel) {
127
128 sb.append("[\n");
129 for (int i = 0; i < indentLevel + 1; i++) {
130 sb.append("\t");
131 }
132 if (seqOf == null) {
133// sb.append("null");
134 }
135 else {
136 Iterator<BerInteger> it = seqOf.iterator();
137 if (it.hasNext()) {
138 sb.append(it.next());
139 while (it.hasNext()) {
140 sb.append(",\n");
141 for (int i = 0; i < indentLevel + 1; i++) {
142 sb.append("\t");
143 }
144 sb.append(it.next());
145 }
146 }
147 }
148
149 sb.append("\n");
150 for (int i = 0; i < indentLevel; i++) {
151 sb.append("\t");
152 }
153 sb.append("]");
154 }
155
156 }
157
158 public static class PucchIntfPowerHist implements Serializable {
159
160 private static final long serialVersionUID = 1L;
161
162 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
slowr60d4d102017-08-16 18:33:58 -0700163 @JsonIgnore public byte[] code = null;
slowr13fa5b02017-08-08 16:32:31 -0700164 private List<BerInteger> seqOf = null;
165
166 public PucchIntfPowerHist() {
167 seqOf = new ArrayList<BerInteger>();
168 }
169
170 public PucchIntfPowerHist(byte[] code) {
171 this.code = code;
172 }
173
slowr60d4d102017-08-16 18:33:58 -0700174 @JsonValue
slowr13fa5b02017-08-08 16:32:31 -0700175 public List<BerInteger> getBerInteger() {
176 if (seqOf == null) {
177 seqOf = new ArrayList<BerInteger>();
178 }
179 return seqOf;
180 }
181
182 public int encode(BerByteArrayOutputStream os) throws IOException {
183 return encode(os, true);
184 }
185
186 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
187
188 if (code != null) {
189 for (int i = code.length - 1; i >= 0; i--) {
190 os.write(code[i]);
191 }
192 if (withTag) {
193 return tag.encode(os) + code.length;
194 }
195 return code.length;
196 }
197
198 int codeLength = 0;
199 for (int i = (seqOf.size() - 1); i >= 0; i--) {
200 codeLength += seqOf.get(i).encode(os, true);
201 }
202
203 codeLength += BerLength.encodeLength(os, codeLength);
204
205 if (withTag) {
206 codeLength += tag.encode(os);
207 }
208
209 return codeLength;
210 }
211
212 public int decode(InputStream is) throws IOException {
213 return decode(is, true);
214 }
215
216 public int decode(InputStream is, boolean withTag) throws IOException {
217 int codeLength = 0;
218 int subCodeLength = 0;
219 if (withTag) {
220 codeLength += tag.decodeAndCheck(is);
221 }
222
223 BerLength length = new BerLength();
224 codeLength += length.decode(is);
225 int totalLength = length.val;
226
227 while (subCodeLength < totalLength) {
228 BerInteger element = new BerInteger();
229 subCodeLength += element.decode(is, true);
230 seqOf.add(element);
231 }
232 if (subCodeLength != totalLength) {
233 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
234
235 }
236 codeLength += subCodeLength;
237
238 return codeLength;
239 }
240
241 public void encodeAndSave(int encodingSizeGuess) throws IOException {
242 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
243 encode(os, false);
244 code = os.getArray();
245 }
246
247 public String toString() {
248 StringBuilder sb = new StringBuilder();
249 appendAsString(sb, 0);
250 return sb.toString();
251 }
252
253 public void appendAsString(StringBuilder sb, int indentLevel) {
254
255 sb.append("[\n");
256 for (int i = 0; i < indentLevel + 1; i++) {
257 sb.append("\t");
258 }
259 if (seqOf == null) {
260// sb.append("null");
261 }
262 else {
263 Iterator<BerInteger> it = seqOf.iterator();
264 if (it.hasNext()) {
265 sb.append(it.next());
266 while (it.hasNext()) {
267 sb.append(",\n");
268 for (int i = 0; i < indentLevel + 1; i++) {
269 sb.append("\t");
270 }
271 sb.append(it.next());
272 }
273 }
274 }
275
276 sb.append("\n");
277 for (int i = 0; i < indentLevel; i++) {
278 sb.append("\t");
279 }
280 sb.append("]");
281 }
282
283 public void setBerInteger(BerInteger berInteger) {
284 seqOf.add(berInteger);
285 }
286 }
287
288 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
289
slowr60d4d102017-08-16 18:33:58 -0700290 @JsonIgnore public byte[] code = null;
slowr13fa5b02017-08-08 16:32:31 -0700291 private ECGI ecgi = null;
292 private PuschIntfPowerHist puschIntfPowerHist = null;
293 private PucchIntfPowerHist pucchIntfPowerHist = null;
294
295 public RadioMeasReportPerCell() {
296 }
297
298 public RadioMeasReportPerCell(byte[] code) {
299 this.code = code;
300 }
301
302 public void setEcgi(ECGI ecgi) {
303 this.ecgi = ecgi;
304 }
305
306 public ECGI getEcgi() {
307 return ecgi;
308 }
309
310 public void setPuschIntfPowerHist(PuschIntfPowerHist puschIntfPowerHist) {
311 this.puschIntfPowerHist = puschIntfPowerHist;
312 }
313
314 public PuschIntfPowerHist getPuschIntfPowerHist() {
315 return puschIntfPowerHist;
316 }
317
318 public void setPucchIntfPowerHist(PucchIntfPowerHist pucchIntfPowerHist) {
319 this.pucchIntfPowerHist = pucchIntfPowerHist;
320 }
321
322 public PucchIntfPowerHist getPucchIntfPowerHist() {
323 return pucchIntfPowerHist;
324 }
325
326 public int encode(BerByteArrayOutputStream os) throws IOException {
327 return encode(os, true);
328 }
329
330 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
331
332 if (code != null) {
333 for (int i = code.length - 1; i >= 0; i--) {
334 os.write(code[i]);
335 }
336 if (withTag) {
337 return tag.encode(os) + code.length;
338 }
339 return code.length;
340 }
341
342 int codeLength = 0;
343 codeLength += pucchIntfPowerHist.encode(os, false);
344 // write tag: CONTEXT_CLASS, CONSTRUCTED, 2
345 os.write(0xA2);
346 codeLength += 1;
347
348 codeLength += puschIntfPowerHist.encode(os, false);
349 // write tag: CONTEXT_CLASS, CONSTRUCTED, 1
350 os.write(0xA1);
351 codeLength += 1;
352
353 codeLength += ecgi.encode(os, false);
354 // write tag: CONTEXT_CLASS, CONSTRUCTED, 0
355 os.write(0xA0);
356 codeLength += 1;
357
358 codeLength += BerLength.encodeLength(os, codeLength);
359
360 if (withTag) {
361 codeLength += tag.encode(os);
362 }
363
364 return codeLength;
365
366 }
367
368 public int decode(InputStream is) throws IOException {
369 return decode(is, true);
370 }
371
372 public int decode(InputStream is, boolean withTag) throws IOException {
373 int codeLength = 0;
374 int subCodeLength = 0;
375 BerTag berTag = new BerTag();
376
377 if (withTag) {
378 codeLength += tag.decodeAndCheck(is);
379 }
380
381 BerLength length = new BerLength();
382 codeLength += length.decode(is);
383
384 int totalLength = length.val;
385 codeLength += totalLength;
386
387 subCodeLength += berTag.decode(is);
388 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
389 ecgi = new ECGI();
390 subCodeLength += ecgi.decode(is, false);
391 subCodeLength += berTag.decode(is);
392 }
393 else {
394 throw new IOException("Tag does not match the mandatory sequence element tag.");
395 }
396
397 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
398 puschIntfPowerHist = new PuschIntfPowerHist();
399 subCodeLength += puschIntfPowerHist.decode(is, false);
400 subCodeLength += berTag.decode(is);
401 }
402 else {
403 throw new IOException("Tag does not match the mandatory sequence element tag.");
404 }
405
406 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
407 pucchIntfPowerHist = new PucchIntfPowerHist();
408 subCodeLength += pucchIntfPowerHist.decode(is, false);
409 if (subCodeLength == totalLength) {
410 return codeLength;
411 }
412 }
413 throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
414
415
416 }
417
418 public void encodeAndSave(int encodingSizeGuess) throws IOException {
419 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
420 encode(os, false);
421 code = os.getArray();
422 }
423
424 public String toString() {
425 StringBuilder sb = new StringBuilder();
426 appendAsString(sb, 0);
427 return sb.toString();
428 }
429
430 public void appendAsString(StringBuilder sb, int indentLevel) {
431
432 sb.append("{");
433 sb.append("\n");
434 for (int i = 0; i < indentLevel + 1; i++) {
435 sb.append("\t");
436 }
437 if (ecgi != null) {
slowr60d4d102017-08-16 18:33:58 -0700438 sb.append("ecgi: ");
slowr13fa5b02017-08-08 16:32:31 -0700439 ecgi.appendAsString(sb, indentLevel + 1);
440 }
441
442 sb.append(",\n");
443 for (int i = 0; i < indentLevel + 1; i++) {
444 sb.append("\t");
445 }
446 if (puschIntfPowerHist != null) {
slowr60d4d102017-08-16 18:33:58 -0700447 sb.append("puschIntfPowerHist: ");
slowr13fa5b02017-08-08 16:32:31 -0700448 puschIntfPowerHist.appendAsString(sb, indentLevel + 1);
449 }
450
451 sb.append(",\n");
452 for (int i = 0; i < indentLevel + 1; i++) {
453 sb.append("\t");
454 }
455 if (pucchIntfPowerHist != null) {
slowr60d4d102017-08-16 18:33:58 -0700456 sb.append("pucchIntfPowerHist: ");
slowr13fa5b02017-08-08 16:32:31 -0700457 pucchIntfPowerHist.appendAsString(sb, indentLevel + 1);
458 }
459
460 sb.append("\n");
461 for (int i = 0; i < indentLevel; i++) {
462 sb.append("\t");
463 }
464 sb.append("}");
465 }
466
467}
468