blob: 7b6b17c887ed701f16500e996d0b6b0b35e66797 [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.CRNTI;
10import org.onosproject.xran.codecs.api.ECGI;
11import org.onosproject.xran.codecs.api.RadioRepPerServCell;
slowr60d4d102017-08-16 18:33:58 -070012import org.onosproject.xran.codecs.ber.BerByteArrayOutputStream;
13import org.onosproject.xran.codecs.ber.BerLength;
14import org.onosproject.xran.codecs.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
23public class RadioMeasReportPerUE implements Serializable {
24
25 private static final long serialVersionUID = 1L;
26
27 public static class RadioReportServCells 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<RadioRepPerServCell> seqOf = null;
35
36 public RadioReportServCells() {
37 seqOf = new ArrayList<RadioRepPerServCell>();
38 }
39
40 public RadioReportServCells(byte[] code) {
41 this.code = code;
42 }
43
slowr60d4d102017-08-16 18:33:58 -070044 @JsonValue
slowr13fa5b02017-08-08 16:32:31 -070045 public List<RadioRepPerServCell> getRadioRepPerServCell() {
46 if (seqOf == null) {
47 seqOf = new ArrayList<RadioRepPerServCell>();
48 }
49 return seqOf;
50 }
51
52 public int encode(BerByteArrayOutputStream os) throws IOException {
53 return encode(os, true);
54 }
55
56 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
57
58 if (code != null) {
59 for (int i = code.length - 1; i >= 0; i--) {
60 os.write(code[i]);
61 }
62 if (withTag) {
63 return tag.encode(os) + code.length;
64 }
65 return code.length;
66 }
67
68 int codeLength = 0;
69 for (int i = (seqOf.size() - 1); i >= 0; i--) {
70 codeLength += seqOf.get(i).encode(os, true);
71 }
72
73 codeLength += BerLength.encodeLength(os, codeLength);
74
75 if (withTag) {
76 codeLength += tag.encode(os);
77 }
78
79 return codeLength;
80 }
81
82 public int decode(InputStream is) throws IOException {
83 return decode(is, true);
84 }
85
86 public int decode(InputStream is, boolean withTag) throws IOException {
87 int codeLength = 0;
88 int subCodeLength = 0;
89 if (withTag) {
90 codeLength += tag.decodeAndCheck(is);
91 }
92
93 BerLength length = new BerLength();
94 codeLength += length.decode(is);
95 int totalLength = length.val;
96
97 while (subCodeLength < totalLength) {
98 RadioRepPerServCell element = new RadioRepPerServCell();
99 subCodeLength += element.decode(is, true);
100 seqOf.add(element);
101 }
102 if (subCodeLength != totalLength) {
103 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
104
105 }
106 codeLength += subCodeLength;
107
108 return codeLength;
109 }
110
111 public void encodeAndSave(int encodingSizeGuess) throws IOException {
112 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
113 encode(os, false);
114 code = os.getArray();
115 }
116
117 public String toString() {
118 StringBuilder sb = new StringBuilder();
119 appendAsString(sb, 0);
120 return sb.toString();
121 }
122
123 public void appendAsString(StringBuilder sb, int indentLevel) {
124
125 sb.append("[\n");
126 for (int i = 0; i < indentLevel + 1; i++) {
127 sb.append("\t");
128 }
129 if (seqOf == null) {
130// sb.append("null");
131 }
132 else {
133 Iterator<RadioRepPerServCell> it = seqOf.iterator();
134 if (it.hasNext()) {
135 it.next().appendAsString(sb, indentLevel + 1);
136 while (it.hasNext()) {
137 sb.append(",\n");
138 for (int i = 0; i < indentLevel + 1; i++) {
139 sb.append("\t");
140 }
141 it.next().appendAsString(sb, indentLevel + 1);
142 }
143 }
144 }
145
146 sb.append("\n");
147 for (int i = 0; i < indentLevel; i++) {
148 sb.append("\t");
149 }
150 sb.append("]");
151 }
152
153 public void setRadioRepPerServCell(RadioRepPerServCell radioRepPerServCell) {
154 seqOf.add(radioRepPerServCell);
155 }
156 }
157
158 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
159
slowr60d4d102017-08-16 18:33:58 -0700160 @JsonIgnore public byte[] code = null;
slowr13fa5b02017-08-08 16:32:31 -0700161 private ECGI ecgi = null;
162 private CRNTI crnti = null;
163 private RadioReportServCells radioReportServCells = null;
164
165 public RadioMeasReportPerUE() {
166 }
167
168 public RadioMeasReportPerUE(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 setCrnti(CRNTI crnti) {
181 this.crnti = crnti;
182 }
183
184 public CRNTI getCrnti() {
185 return crnti;
186 }
187
188 public void setRadioReportServCells(RadioReportServCells radioReportServCells) {
189 this.radioReportServCells = radioReportServCells;
190 }
191
192 public RadioReportServCells getRadioReportServCells() {
193 return radioReportServCells;
194 }
195
196 public int encode(BerByteArrayOutputStream os) throws IOException {
197 return encode(os, true);
198 }
199
200 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
201
202 if (code != null) {
203 for (int i = code.length - 1; i >= 0; i--) {
204 os.write(code[i]);
205 }
206 if (withTag) {
207 return tag.encode(os) + code.length;
208 }
209 return code.length;
210 }
211
212 int codeLength = 0;
213 codeLength += radioReportServCells.encode(os, false);
214 // write tag: CONTEXT_CLASS, CONSTRUCTED, 2
215 os.write(0xA2);
216 codeLength += 1;
217
218 codeLength += crnti.encode(os, false);
219 // write tag: CONTEXT_CLASS, PRIMITIVE, 1
220 os.write(0x81);
221 codeLength += 1;
222
223 codeLength += ecgi.encode(os, false);
224 // write tag: CONTEXT_CLASS, CONSTRUCTED, 0
225 os.write(0xA0);
226 codeLength += 1;
227
228 codeLength += BerLength.encodeLength(os, codeLength);
229
230 if (withTag) {
231 codeLength += tag.encode(os);
232 }
233
234 return codeLength;
235
236 }
237
238 public int decode(InputStream is) throws IOException {
239 return decode(is, true);
240 }
241
242 public int decode(InputStream is, boolean withTag) throws IOException {
243 int codeLength = 0;
244 int subCodeLength = 0;
245 BerTag berTag = new BerTag();
246
247 if (withTag) {
248 codeLength += tag.decodeAndCheck(is);
249 }
250
251 BerLength length = new BerLength();
252 codeLength += length.decode(is);
253
254 int totalLength = length.val;
255 codeLength += totalLength;
256
257 subCodeLength += berTag.decode(is);
258 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
259 ecgi = new ECGI();
260 subCodeLength += ecgi.decode(is, false);
261 subCodeLength += berTag.decode(is);
262 }
263 else {
264 throw new IOException("Tag does not match the mandatory sequence element tag.");
265 }
266
267 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
268 crnti = new CRNTI();
269 subCodeLength += crnti.decode(is, false);
270 subCodeLength += berTag.decode(is);
271 }
272 else {
273 throw new IOException("Tag does not match the mandatory sequence element tag.");
274 }
275
276 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
277 radioReportServCells = new RadioReportServCells();
278 subCodeLength += radioReportServCells.decode(is, false);
279 if (subCodeLength == totalLength) {
280 return codeLength;
281 }
282 }
283 throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
284
285
286 }
287
288 public void encodeAndSave(int encodingSizeGuess) throws IOException {
289 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
290 encode(os, false);
291 code = os.getArray();
292 }
293
294 public String toString() {
295 StringBuilder sb = new StringBuilder();
296 appendAsString(sb, 0);
297 return sb.toString();
298 }
299
300 public void appendAsString(StringBuilder sb, int indentLevel) {
301
302 sb.append("{");
303 sb.append("\n");
304 for (int i = 0; i < indentLevel + 1; i++) {
305 sb.append("\t");
306 }
307 if (ecgi != null) {
slowr60d4d102017-08-16 18:33:58 -0700308 sb.append("ecgi: ");
slowr13fa5b02017-08-08 16:32:31 -0700309 ecgi.appendAsString(sb, indentLevel + 1);
310 }
311
312 sb.append(",\n");
313 for (int i = 0; i < indentLevel + 1; i++) {
314 sb.append("\t");
315 }
316 if (crnti != null) {
slowr60d4d102017-08-16 18:33:58 -0700317 sb.append("crnti: ").append(crnti);
slowr13fa5b02017-08-08 16:32:31 -0700318 }
319
320 sb.append(",\n");
321 for (int i = 0; i < indentLevel + 1; i++) {
322 sb.append("\t");
323 }
324 if (radioReportServCells != null) {
slowr60d4d102017-08-16 18:33:58 -0700325 sb.append("radioReportServCells: ");
slowr13fa5b02017-08-08 16:32:31 -0700326 radioReportServCells.appendAsString(sb, indentLevel + 1);
327 }
328
329 sb.append("\n");
330 for (int i = 0; i < indentLevel; i++) {
331 sb.append("\t");
332 }
333 sb.append("}");
334 }
335
336}
337