blob: 80821b83cd412cae3dafe9da30301ed85f1067e6 [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 */
4package org.onosproject.xran.codecs.pdu;
slowr60d4d102017-08-16 18:33:58 -07005import com.fasterxml.jackson.annotation.JsonIgnore;
6import com.fasterxml.jackson.annotation.JsonValue;
slowr13fa5b02017-08-08 16:32:31 -07007import org.onosproject.xran.codecs.api.ECGI;
8import org.onosproject.xran.codecs.api.PRBUsage;
9import org.onosproject.xran.codecs.api.QCI;
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;
slowr13fa5b02017-08-08 16:32:31 -070013
14import java.io.IOException;
15import java.io.InputStream;
16import java.io.Serializable;
17import java.util.ArrayList;
18import java.util.Iterator;
19import java.util.List;
20
21
22public class SchedMeasReportPerCell implements Serializable {
23
24 private static final long serialVersionUID = 1L;
25
26 public static class QciVals implements Serializable {
27
28 private static final long serialVersionUID = 1L;
29
30 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
slowr60d4d102017-08-16 18:33:58 -070031 @JsonIgnore
slowr13fa5b02017-08-08 16:32:31 -070032 public byte[] code = null;
33 private List<QCI> seqOf = null;
34
35 public QciVals() {
36 seqOf = new ArrayList<QCI>();
37 }
38
39 public QciVals(byte[] code) {
40 this.code = code;
41 }
42
slowr60d4d102017-08-16 18:33:58 -070043 @JsonValue
slowr13fa5b02017-08-08 16:32:31 -070044 public List<QCI> getQCI() {
45 if (seqOf == null) {
46 seqOf = new ArrayList<QCI>();
47 }
48 return seqOf;
49 }
50
51 public int encode(BerByteArrayOutputStream os) throws IOException {
52 return encode(os, true);
53 }
54
55 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
56
57 if (code != null) {
58 for (int i = code.length - 1; i >= 0; i--) {
59 os.write(code[i]);
60 }
61 if (withTag) {
62 return tag.encode(os) + code.length;
63 }
64 return code.length;
65 }
66
67 int codeLength = 0;
68 for (int i = (seqOf.size() - 1); i >= 0; i--) {
69 codeLength += seqOf.get(i).encode(os, true);
70 }
71
72 codeLength += BerLength.encodeLength(os, codeLength);
73
74 if (withTag) {
75 codeLength += tag.encode(os);
76 }
77
78 return codeLength;
79 }
80
81 public int decode(InputStream is) throws IOException {
82 return decode(is, true);
83 }
84
85 public int decode(InputStream is, boolean withTag) throws IOException {
86 int codeLength = 0;
87 int subCodeLength = 0;
88 if (withTag) {
89 codeLength += tag.decodeAndCheck(is);
90 }
91
92 BerLength length = new BerLength();
93 codeLength += length.decode(is);
94 int totalLength = length.val;
95
96 while (subCodeLength < totalLength) {
97 QCI element = new QCI();
98 subCodeLength += element.decode(is, true);
99 seqOf.add(element);
100 }
101 if (subCodeLength != totalLength) {
102 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
103
104 }
105 codeLength += subCodeLength;
106
107 return codeLength;
108 }
109
110 public void encodeAndSave(int encodingSizeGuess) throws IOException {
111 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
112 encode(os, false);
113 code = os.getArray();
114 }
115
116 public String toString() {
117 StringBuilder sb = new StringBuilder();
118 appendAsString(sb, 0);
119 return sb.toString();
120 }
121
122 public void appendAsString(StringBuilder sb, int indentLevel) {
123
124 sb.append("[\n");
125 for (int i = 0; i < indentLevel + 1; i++) {
126 sb.append("\t");
127 }
128 if (seqOf == null) {
129// sb.append("null");
130 }
131 else {
132 Iterator<QCI> it = seqOf.iterator();
133 if (it.hasNext()) {
134 sb.append(it.next());
135 while (it.hasNext()) {
136 sb.append(",\n");
137 for (int i = 0; i < indentLevel + 1; i++) {
138 sb.append("\t");
139 }
140 sb.append(it.next());
141 }
142 }
143 }
144
145 sb.append("\n");
146 for (int i = 0; i < indentLevel; i++) {
147 sb.append("\t");
148 }
149 sb.append("]");
150 }
151
152 public void setQCI(QCI qci) {
153 seqOf.add(qci);
154 }
155 }
156
157 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
158
slowr60d4d102017-08-16 18:33:58 -0700159 @JsonIgnore public byte[] code = null;
slowr13fa5b02017-08-08 16:32:31 -0700160 private ECGI ecgi = null;
161 private QciVals qciVals = null;
162 private PRBUsage prbUsagePcell = null;
163 private PRBUsage prbUsageScell = null;
164
165 public SchedMeasReportPerCell() {
166 }
167
168 public SchedMeasReportPerCell(byte[] code) {
169 this.code = code;
170 }
171
172 public void setEcgi(ECGI ecgi) {
173 this.ecgi = ecgi;
174 }
175
176 public ECGI getEcgi() {
177 return ecgi;
178 }
179
180 public void setQciVals(QciVals qciVals) {
181 this.qciVals = qciVals;
182 }
183
184 public QciVals getQciVals() {
185 return qciVals;
186 }
187
188 public void setPrbUsagePcell(PRBUsage prbUsagePcell) {
189 this.prbUsagePcell = prbUsagePcell;
190 }
191
192 public PRBUsage getPrbUsagePcell() {
193 return prbUsagePcell;
194 }
195
196 public void setPrbUsageScell(PRBUsage prbUsageScell) {
197 this.prbUsageScell = prbUsageScell;
198 }
199
200 public PRBUsage getPrbUsageScell() {
201 return prbUsageScell;
202 }
203
204 public int encode(BerByteArrayOutputStream os) throws IOException {
205 return encode(os, true);
206 }
207
208 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
209
210 if (code != null) {
211 for (int i = code.length - 1; i >= 0; i--) {
212 os.write(code[i]);
213 }
214 if (withTag) {
215 return tag.encode(os) + code.length;
216 }
217 return code.length;
218 }
219
220 int codeLength = 0;
221 codeLength += prbUsageScell.encode(os, false);
222 // write tag: CONTEXT_CLASS, CONSTRUCTED, 3
223 os.write(0xA3);
224 codeLength += 1;
225
226 codeLength += prbUsagePcell.encode(os, false);
227 // write tag: CONTEXT_CLASS, CONSTRUCTED, 2
228 os.write(0xA2);
229 codeLength += 1;
230
231 codeLength += qciVals.encode(os, false);
232 // write tag: CONTEXT_CLASS, CONSTRUCTED, 1
233 os.write(0xA1);
234 codeLength += 1;
235
236 codeLength += ecgi.encode(os, false);
237 // write tag: CONTEXT_CLASS, CONSTRUCTED, 0
238 os.write(0xA0);
239 codeLength += 1;
240
241 codeLength += BerLength.encodeLength(os, codeLength);
242
243 if (withTag) {
244 codeLength += tag.encode(os);
245 }
246
247 return codeLength;
248
249 }
250
251 public int decode(InputStream is) throws IOException {
252 return decode(is, true);
253 }
254
255 public int decode(InputStream is, boolean withTag) throws IOException {
256 int codeLength = 0;
257 int subCodeLength = 0;
258 BerTag berTag = new BerTag();
259
260 if (withTag) {
261 codeLength += tag.decodeAndCheck(is);
262 }
263
264 BerLength length = new BerLength();
265 codeLength += length.decode(is);
266
267 int totalLength = length.val;
268 codeLength += totalLength;
269
270 subCodeLength += berTag.decode(is);
271 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
272 ecgi = new ECGI();
273 subCodeLength += ecgi.decode(is, false);
274 subCodeLength += berTag.decode(is);
275 }
276 else {
277 throw new IOException("Tag does not match the mandatory sequence element tag.");
278 }
279
280 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
281 qciVals = new QciVals();
282 subCodeLength += qciVals.decode(is, false);
283 subCodeLength += berTag.decode(is);
284 }
285 else {
286 throw new IOException("Tag does not match the mandatory sequence element tag.");
287 }
288
289 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
290 prbUsagePcell = new PRBUsage();
291 subCodeLength += prbUsagePcell.decode(is, false);
292 subCodeLength += berTag.decode(is);
293 }
294 else {
295 throw new IOException("Tag does not match the mandatory sequence element tag.");
296 }
297
298 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 3)) {
299 prbUsageScell = new PRBUsage();
300 subCodeLength += prbUsageScell.decode(is, false);
301 if (subCodeLength == totalLength) {
302 return codeLength;
303 }
304 }
305 throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
306
307
308 }
309
310 public void encodeAndSave(int encodingSizeGuess) throws IOException {
311 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
312 encode(os, false);
313 code = os.getArray();
314 }
315
316 public String toString() {
317 StringBuilder sb = new StringBuilder();
318 appendAsString(sb, 0);
319 return sb.toString();
320 }
321
322 public void appendAsString(StringBuilder sb, int indentLevel) {
323
324 sb.append("{");
325 sb.append("\n");
326 for (int i = 0; i < indentLevel + 1; i++) {
327 sb.append("\t");
328 }
329 if (ecgi != null) {
slowr60d4d102017-08-16 18:33:58 -0700330 sb.append("ecgi: ");
slowr13fa5b02017-08-08 16:32:31 -0700331 ecgi.appendAsString(sb, indentLevel + 1);
332 }
333
334 sb.append(",\n");
335 for (int i = 0; i < indentLevel + 1; i++) {
336 sb.append("\t");
337 }
338 if (qciVals != null) {
slowr60d4d102017-08-16 18:33:58 -0700339 sb.append("qciVals: ");
slowr13fa5b02017-08-08 16:32:31 -0700340 qciVals.appendAsString(sb, indentLevel + 1);
341 }
342
343 sb.append(",\n");
344 for (int i = 0; i < indentLevel + 1; i++) {
345 sb.append("\t");
346 }
347 if (prbUsagePcell != null) {
slowr60d4d102017-08-16 18:33:58 -0700348 sb.append("prbUsagePcell: ");
slowr13fa5b02017-08-08 16:32:31 -0700349 prbUsagePcell.appendAsString(sb, indentLevel + 1);
350 }
351
352 sb.append(",\n");
353 for (int i = 0; i < indentLevel + 1; i++) {
354 sb.append("\t");
355 }
356 if (prbUsageScell != null) {
slowr60d4d102017-08-16 18:33:58 -0700357 sb.append("prbUsageScell: ");
slowr13fa5b02017-08-08 16:32:31 -0700358 prbUsageScell.appendAsString(sb, indentLevel + 1);
359 }
360
361 sb.append("\n");
362 for (int i = 0; i < indentLevel; i++) {
363 sb.append("\t");
364 }
365 sb.append("}");
366 }
367
368}
369