blob: e926702453c0145679c7515c2afa3c0cd1604ecc [file] [log] [blame]
slowr13fa5b02017-08-08 16:32:31 -07001/**
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -08002 * This class file was automatically generated by jASN1 v1.8.2 (http://www.openmuc.org)
slowr13fa5b02017-08-08 16:32:31 -07003 */
4
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -08005package org.onosproject.xran.asn1lib.pdu;
slowr13fa5b02017-08-08 16:32:31 -07006
slowr60d4d102017-08-16 18:33:58 -07007import com.fasterxml.jackson.annotation.JsonIgnore;
8import com.fasterxml.jackson.annotation.JsonValue;
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -08009import org.onosproject.xran.asn1lib.api.ECGI;
10import org.onosproject.xran.asn1lib.api.PRBUsage;
11import org.onosproject.xran.asn1lib.api.QCI;
12import org.onosproject.xran.asn1lib.ber.BerByteArrayOutputStream;
13import org.onosproject.xran.asn1lib.ber.BerLength;
14import org.onosproject.xran.asn1lib.ber.BerTag;
slowr13fa5b02017-08-08 16:32:31 -070015
16import java.io.IOException;
17import java.io.InputStream;
18import java.io.Serializable;
19import java.util.ArrayList;
20import java.util.Iterator;
21import java.util.List;
22
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080023public class SchedMeasReportPerCell implements Serializable {
slowr13fa5b02017-08-08 16:32:31 -070024
slowr89c2ac12017-08-15 16:20:06 -070025 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
26 private static final long serialVersionUID = 1L;
slowr60d4d102017-08-16 18:33:58 -070027 @JsonIgnore
slowr89c2ac12017-08-15 16:20:06 -070028 public byte[] code = null;
slowr89c2ac12017-08-15 16:20:06 -070029 private ECGI ecgi = null;
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080030 private QciVals qciVals = null;
31 private PRBUsage prbUsagePcell = null;
32 private PRBUsage prbUsageScell = null;
33
34 public SchedMeasReportPerCell() {
slowr89c2ac12017-08-15 16:20:06 -070035 }
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080036
37 public SchedMeasReportPerCell(byte[] code) {
slowr89c2ac12017-08-15 16:20:06 -070038 this.code = code;
39 }
slowr13fa5b02017-08-08 16:32:31 -070040
slowr89c2ac12017-08-15 16:20:06 -070041 public ECGI getEcgi() {
42 return ecgi;
43 }
slowr13fa5b02017-08-08 16:32:31 -070044
slowr89c2ac12017-08-15 16:20:06 -070045 public void setEcgi(ECGI ecgi) {
46 this.ecgi = ecgi;
47 }
slowr13fa5b02017-08-08 16:32:31 -070048
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080049 public QciVals getQciVals() {
50 return qciVals;
slowr89c2ac12017-08-15 16:20:06 -070051 }
slowr13fa5b02017-08-08 16:32:31 -070052
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080053 public void setQciVals(QciVals qciVals) {
54 this.qciVals = qciVals;
55 }
56
57 public PRBUsage getPrbUsagePcell() {
58 return prbUsagePcell;
59 }
60
61 public void setPrbUsagePcell(PRBUsage prbUsagePcell) {
62 this.prbUsagePcell = prbUsagePcell;
63 }
64
65 public PRBUsage getPrbUsageScell() {
66 return prbUsageScell;
67 }
68
69 public void setPrbUsageScell(PRBUsage prbUsageScell) {
70 this.prbUsageScell = prbUsageScell;
slowr89c2ac12017-08-15 16:20:06 -070071 }
slowr13fa5b02017-08-08 16:32:31 -070072
slowr89c2ac12017-08-15 16:20:06 -070073 public int encode(BerByteArrayOutputStream os) throws IOException {
74 return encode(os, true);
75 }
slowr13fa5b02017-08-08 16:32:31 -070076
slowr89c2ac12017-08-15 16:20:06 -070077 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
slowr13fa5b02017-08-08 16:32:31 -070078
slowr89c2ac12017-08-15 16:20:06 -070079 if (code != null) {
80 for (int i = code.length - 1; i >= 0; i--) {
81 os.write(code[i]);
82 }
83 if (withTag) {
84 return tag.encode(os) + code.length;
85 }
86 return code.length;
87 }
slowr13fa5b02017-08-08 16:32:31 -070088
slowr89c2ac12017-08-15 16:20:06 -070089 int codeLength = 0;
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080090 codeLength += prbUsageScell.encode(os, false);
91 // write tag: CONTEXT_CLASS, CONSTRUCTED, 3
92 os.write(0xA3);
93 codeLength += 1;
94
95 codeLength += prbUsagePcell.encode(os, false);
slowr89c2ac12017-08-15 16:20:06 -070096 // write tag: CONTEXT_CLASS, CONSTRUCTED, 2
97 os.write(0xA2);
98 codeLength += 1;
slowr13fa5b02017-08-08 16:32:31 -070099
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800100 codeLength += qciVals.encode(os, false);
slowr89c2ac12017-08-15 16:20:06 -0700101 // write tag: CONTEXT_CLASS, CONSTRUCTED, 1
102 os.write(0xA1);
103 codeLength += 1;
slowr13fa5b02017-08-08 16:32:31 -0700104
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800105 codeLength += ecgi.encode(os, false);
106 // write tag: CONTEXT_CLASS, CONSTRUCTED, 0
107 os.write(0xA0);
slowr89c2ac12017-08-15 16:20:06 -0700108 codeLength += 1;
slowr13fa5b02017-08-08 16:32:31 -0700109
slowr89c2ac12017-08-15 16:20:06 -0700110 codeLength += BerLength.encodeLength(os, codeLength);
slowr13fa5b02017-08-08 16:32:31 -0700111
slowr89c2ac12017-08-15 16:20:06 -0700112 if (withTag) {
113 codeLength += tag.encode(os);
114 }
slowr13fa5b02017-08-08 16:32:31 -0700115
slowr89c2ac12017-08-15 16:20:06 -0700116 return codeLength;
slowr13fa5b02017-08-08 16:32:31 -0700117
slowr89c2ac12017-08-15 16:20:06 -0700118 }
119
120 public int decode(InputStream is) throws IOException {
121 return decode(is, true);
122 }
123
124 public int decode(InputStream is, boolean withTag) throws IOException {
125 int codeLength = 0;
126 int subCodeLength = 0;
127 BerTag berTag = new BerTag();
128
129 if (withTag) {
130 codeLength += tag.decodeAndCheck(is);
131 }
132
133 BerLength length = new BerLength();
134 codeLength += length.decode(is);
135
136 int totalLength = length.val;
137 codeLength += totalLength;
138
139 subCodeLength += berTag.decode(is);
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800140 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
slowr89c2ac12017-08-15 16:20:06 -0700141 ecgi = new ECGI();
142 subCodeLength += ecgi.decode(is, false);
143 subCodeLength += berTag.decode(is);
144 } else {
145 throw new IOException("Tag does not match the mandatory sequence element tag.");
146 }
147
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800148 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) {
149 qciVals = new QciVals();
150 subCodeLength += qciVals.decode(is, false);
151 subCodeLength += berTag.decode(is);
152 } else {
153 throw new IOException("Tag does not match the mandatory sequence element tag.");
154 }
155
slowr89c2ac12017-08-15 16:20:06 -0700156 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800157 prbUsagePcell = new PRBUsage();
158 subCodeLength += prbUsagePcell.decode(is, false);
159 subCodeLength += berTag.decode(is);
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.CONSTRUCTED, 3)) {
165 prbUsageScell = new PRBUsage();
166 subCodeLength += prbUsageScell.decode(is, false);
slowr89c2ac12017-08-15 16:20:06 -0700167 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 }
slowr89c2ac12017-08-15 16:20:06 -0700195 if (ecgi != null) {
slowr60d4d102017-08-16 18:33:58 -0700196 sb.append("ecgi: ");
slowr89c2ac12017-08-15 16:20:06 -0700197 ecgi.appendAsString(sb, indentLevel + 1);
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800198 } else {
199 sb.append("ecgi: <empty-required-field>");
slowr89c2ac12017-08-15 16:20:06 -0700200 }
201
202 sb.append(",\n");
203 for (int i = 0; i < indentLevel + 1; i++) {
204 sb.append("\t");
205 }
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800206 if (qciVals != null) {
207 sb.append("qciVals: ");
208 qciVals.appendAsString(sb, indentLevel + 1);
209 } else {
210 sb.append("qciVals: <empty-required-field>");
211 }
212
213 sb.append(",\n");
214 for (int i = 0; i < indentLevel + 1; i++) {
215 sb.append("\t");
216 }
217 if (prbUsagePcell != null) {
218 sb.append("prbUsagePcell: ");
219 prbUsagePcell.appendAsString(sb, indentLevel + 1);
220 } else {
221 sb.append("prbUsagePcell: <empty-required-field>");
222 }
223
224 sb.append(",\n");
225 for (int i = 0; i < indentLevel + 1; i++) {
226 sb.append("\t");
227 }
228 if (prbUsageScell != null) {
229 sb.append("prbUsageScell: ");
230 prbUsageScell.appendAsString(sb, indentLevel + 1);
231 } else {
232 sb.append("prbUsageScell: <empty-required-field>");
slowr89c2ac12017-08-15 16:20:06 -0700233 }
234
235 sb.append("\n");
236 for (int i = 0; i < indentLevel; i++) {
237 sb.append("\t");
238 }
239 sb.append("}");
240 }
241
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800242 public static class QciVals implements Serializable {
slowr89c2ac12017-08-15 16:20:06 -0700243
244 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
245 private static final long serialVersionUID = 1L;
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800246 @JsonIgnore
247 public byte[] code = null;
248 private List<QCI> seqOf = null;
slowr89c2ac12017-08-15 16:20:06 -0700249
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800250 public QciVals() {
251 seqOf = new ArrayList<QCI>();
slowr89c2ac12017-08-15 16:20:06 -0700252 }
253
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800254 public QciVals(byte[] code) {
slowr89c2ac12017-08-15 16:20:06 -0700255 this.code = code;
256 }
257
slowr60d4d102017-08-16 18:33:58 -0700258 @JsonValue
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800259 public List<QCI> getQCI() {
slowr89c2ac12017-08-15 16:20:06 -0700260 if (seqOf == null) {
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800261 seqOf = new ArrayList<QCI>();
slowr89c2ac12017-08-15 16:20:06 -0700262 }
263 return seqOf;
264 }
265
266 public int encode(BerByteArrayOutputStream os) throws IOException {
267 return encode(os, true);
268 }
269
270 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
271
272 if (code != null) {
273 for (int i = code.length - 1; i >= 0; i--) {
274 os.write(code[i]);
275 }
276 if (withTag) {
277 return tag.encode(os) + code.length;
278 }
279 return code.length;
280 }
281
282 int codeLength = 0;
283 for (int i = (seqOf.size() - 1); i >= 0; i--) {
284 codeLength += seqOf.get(i).encode(os, true);
285 }
286
287 codeLength += BerLength.encodeLength(os, codeLength);
288
289 if (withTag) {
290 codeLength += tag.encode(os);
291 }
292
293 return codeLength;
294 }
295
296 public int decode(InputStream is) throws IOException {
297 return decode(is, true);
298 }
299
300 public int decode(InputStream is, boolean withTag) throws IOException {
301 int codeLength = 0;
302 int subCodeLength = 0;
303 if (withTag) {
304 codeLength += tag.decodeAndCheck(is);
305 }
306
307 BerLength length = new BerLength();
308 codeLength += length.decode(is);
309 int totalLength = length.val;
310
311 while (subCodeLength < totalLength) {
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800312 QCI element = new QCI();
slowr89c2ac12017-08-15 16:20:06 -0700313 subCodeLength += element.decode(is, true);
314 seqOf.add(element);
315 }
316 if (subCodeLength != totalLength) {
317 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
318
319 }
320 codeLength += subCodeLength;
321
322 return codeLength;
323 }
324
325 public void encodeAndSave(int encodingSizeGuess) throws IOException {
326 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
327 encode(os, false);
328 code = os.getArray();
329 }
330
331 public String toString() {
332 StringBuilder sb = new StringBuilder();
333 appendAsString(sb, 0);
334 return sb.toString();
335 }
336
337 public void appendAsString(StringBuilder sb, int indentLevel) {
338
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800339 sb.append("{\n");
slowr89c2ac12017-08-15 16:20:06 -0700340 for (int i = 0; i < indentLevel + 1; i++) {
341 sb.append("\t");
342 }
343 if (seqOf == null) {
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800344 sb.append("null");
slowr89c2ac12017-08-15 16:20:06 -0700345 } else {
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800346 Iterator<QCI> it = seqOf.iterator();
slowr89c2ac12017-08-15 16:20:06 -0700347 if (it.hasNext()) {
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800348 sb.append(it.next());
slowr89c2ac12017-08-15 16:20:06 -0700349 while (it.hasNext()) {
350 sb.append(",\n");
351 for (int i = 0; i < indentLevel + 1; i++) {
352 sb.append("\t");
353 }
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800354 sb.append(it.next());
slowr89c2ac12017-08-15 16:20:06 -0700355 }
356 }
357 }
slowr13fa5b02017-08-08 16:32:31 -0700358
slowr89c2ac12017-08-15 16:20:06 -0700359 sb.append("\n");
360 for (int i = 0; i < indentLevel; i++) {
361 sb.append("\t");
362 }
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800363 sb.append("}");
slowr89c2ac12017-08-15 16:20:06 -0700364 }
slowr13fa5b02017-08-08 16:32:31 -0700365
slowr89c2ac12017-08-15 16:20:06 -0700366 }
slowr13fa5b02017-08-08 16:32:31 -0700367
368}
369