blob: 61616f44325e1ed4dee7f5cd4eec6e178999888c [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;
5
slowr60d4d102017-08-16 18:33:58 -07006import com.fasterxml.jackson.annotation.JsonIgnore;
7import com.fasterxml.jackson.annotation.JsonValue;
slowr13fa5b02017-08-08 16:32:31 -07008import org.onosproject.xran.codecs.api.CRNTI;
9import org.onosproject.xran.codecs.api.ECGI;
10import org.onosproject.xran.codecs.api.SchedMeasRepPerServCell;
slowr60d4d102017-08-16 18:33:58 -070011import org.onosproject.xran.codecs.ber.BerByteArrayOutputStream;
12import org.onosproject.xran.codecs.ber.BerLength;
13import org.onosproject.xran.codecs.ber.BerTag;
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
22public class SchedMeasReportPerUE implements Serializable {
23
24 private static final long serialVersionUID = 1L;
25
26 public static class SchedReportServCells 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<SchedMeasRepPerServCell> seqOf = null;
34
35 public SchedReportServCells() {
36 seqOf = new ArrayList<SchedMeasRepPerServCell>();
37 }
38
39 public SchedReportServCells(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<SchedMeasRepPerServCell> getSchedMeasRepPerServCell() {
45 if (seqOf == null) {
46 seqOf = new ArrayList<SchedMeasRepPerServCell>();
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 SchedMeasRepPerServCell element = new SchedMeasRepPerServCell();
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<SchedMeasRepPerServCell> it = seqOf.iterator();
133 if (it.hasNext()) {
134 it.next().appendAsString(sb, indentLevel + 1);
135 while (it.hasNext()) {
136 sb.append(",\n");
137 for (int i = 0; i < indentLevel + 1; i++) {
138 sb.append("\t");
139 }
140 it.next().appendAsString(sb, indentLevel + 1);
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 setSchedMeasRepPerServCell(SchedMeasRepPerServCell schedMeasRepPerServCell) {
153 seqOf.add(schedMeasRepPerServCell);
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 CRNTI crnti = null;
162 private SchedReportServCells schedReportServCells = null;
163
164 public SchedMeasReportPerUE() {
165 }
166
167 public SchedMeasReportPerUE(byte[] code) {
168 this.code = code;
169 }
170
171 public void setEcgi(ECGI ecgi) {
172 this.ecgi = ecgi;
173 }
174
175 public ECGI getEcgi() {
176 return ecgi;
177 }
178
179 public void setCrnti(CRNTI crnti) {
180 this.crnti = crnti;
181 }
182
183 public CRNTI getCrnti() {
184 return crnti;
185 }
186
187 public void setSchedReportServCells(SchedReportServCells schedReportServCells) {
188 this.schedReportServCells = schedReportServCells;
189 }
190
191 public SchedReportServCells getSchedReportServCells() {
192 return schedReportServCells;
193 }
194
195 public int encode(BerByteArrayOutputStream os) throws IOException {
196 return encode(os, true);
197 }
198
199 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
200
201 if (code != null) {
202 for (int i = code.length - 1; i >= 0; i--) {
203 os.write(code[i]);
204 }
205 if (withTag) {
206 return tag.encode(os) + code.length;
207 }
208 return code.length;
209 }
210
211 int codeLength = 0;
212 codeLength += schedReportServCells.encode(os, false);
213 // write tag: CONTEXT_CLASS, CONSTRUCTED, 2
214 os.write(0xA2);
215 codeLength += 1;
216
217 codeLength += crnti.encode(os, false);
218 // write tag: CONTEXT_CLASS, PRIMITIVE, 1
219 os.write(0x81);
220 codeLength += 1;
221
222 codeLength += ecgi.encode(os, false);
223 // write tag: CONTEXT_CLASS, CONSTRUCTED, 0
224 os.write(0xA0);
225 codeLength += 1;
226
227 codeLength += BerLength.encodeLength(os, codeLength);
228
229 if (withTag) {
230 codeLength += tag.encode(os);
231 }
232
233 return codeLength;
234
235 }
236
237 public int decode(InputStream is) throws IOException {
238 return decode(is, true);
239 }
240
241 public int decode(InputStream is, boolean withTag) throws IOException {
242 int codeLength = 0;
243 int subCodeLength = 0;
244 BerTag berTag = new BerTag();
245
246 if (withTag) {
247 codeLength += tag.decodeAndCheck(is);
248 }
249
250 BerLength length = new BerLength();
251 codeLength += length.decode(is);
252
253 int totalLength = length.val;
254 codeLength += totalLength;
255
256 subCodeLength += berTag.decode(is);
257 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
258 ecgi = new ECGI();
259 subCodeLength += ecgi.decode(is, false);
260 subCodeLength += berTag.decode(is);
261 }
262 else {
263 throw new IOException("Tag does not match the mandatory sequence element tag.");
264 }
265
266 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
267 crnti = new CRNTI();
268 subCodeLength += crnti.decode(is, false);
269 subCodeLength += berTag.decode(is);
270 }
271 else {
272 throw new IOException("Tag does not match the mandatory sequence element tag.");
273 }
274
275 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
276 schedReportServCells = new SchedReportServCells();
277 subCodeLength += schedReportServCells.decode(is, false);
278 if (subCodeLength == totalLength) {
279 return codeLength;
280 }
281 }
282 throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
283
284
285 }
286
287 public void encodeAndSave(int encodingSizeGuess) throws IOException {
288 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
289 encode(os, false);
290 code = os.getArray();
291 }
292
293 public String toString() {
294 StringBuilder sb = new StringBuilder();
295 appendAsString(sb, 0);
296 return sb.toString();
297 }
298
299 public void appendAsString(StringBuilder sb, int indentLevel) {
300
301 sb.append("{");
302 sb.append("\n");
303 for (int i = 0; i < indentLevel + 1; i++) {
304 sb.append("\t");
305 }
306 if (ecgi != null) {
slowr60d4d102017-08-16 18:33:58 -0700307 sb.append("ecgi: ");
slowr13fa5b02017-08-08 16:32:31 -0700308 ecgi.appendAsString(sb, indentLevel + 1);
309 }
310
311 sb.append(",\n");
312 for (int i = 0; i < indentLevel + 1; i++) {
313 sb.append("\t");
314 }
315 if (crnti != null) {
slowr60d4d102017-08-16 18:33:58 -0700316 sb.append("crnti: ").append(crnti);
slowr13fa5b02017-08-08 16:32:31 -0700317 }
318
319 sb.append(",\n");
320 for (int i = 0; i < indentLevel + 1; i++) {
321 sb.append("\t");
322 }
323 if (schedReportServCells != null) {
slowr60d4d102017-08-16 18:33:58 -0700324 sb.append("schedReportServCells: ");
slowr13fa5b02017-08-08 16:32:31 -0700325 schedReportServCells.appendAsString(sb, indentLevel + 1);
326 }
327
328 sb.append("\n");
329 for (int i = 0; i < indentLevel; i++) {
330 sb.append("\t");
331 }
332 sb.append("}");
333 }
334
335}
336