blob: 204060befd1e24fe1c316df01392ea7ac8014aeb [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.CRNTI;
10import org.onosproject.xran.asn1lib.api.ECGI;
11import org.onosproject.xran.asn1lib.api.RadioRepPerServCell;
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 RadioMeasReportPerUE 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 CRNTI crnti = null;
31 private RadioReportServCells radioReportServCells = null;
32
33 public RadioMeasReportPerUE() {
slowr89c2ac12017-08-15 16:20:06 -070034 }
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080035
36 public RadioMeasReportPerUE(byte[] code) {
slowr89c2ac12017-08-15 16:20:06 -070037 this.code = code;
38 }
slowr13fa5b02017-08-08 16:32:31 -070039
slowr89c2ac12017-08-15 16:20:06 -070040 public ECGI getEcgi() {
41 return ecgi;
42 }
slowr13fa5b02017-08-08 16:32:31 -070043
slowr89c2ac12017-08-15 16:20:06 -070044 public void setEcgi(ECGI ecgi) {
45 this.ecgi = ecgi;
46 }
slowr13fa5b02017-08-08 16:32:31 -070047
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080048 public CRNTI getCrnti() {
49 return crnti;
slowr89c2ac12017-08-15 16:20:06 -070050 }
slowr13fa5b02017-08-08 16:32:31 -070051
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080052 public void setCrnti(CRNTI crnti) {
53 this.crnti = crnti;
54 }
55
56 public RadioReportServCells getRadioReportServCells() {
57 return radioReportServCells;
58 }
59
60 public void setRadioReportServCells(RadioReportServCells radioReportServCells) {
61 this.radioReportServCells = radioReportServCells;
slowr89c2ac12017-08-15 16:20:06 -070062 }
slowr13fa5b02017-08-08 16:32:31 -070063
slowr89c2ac12017-08-15 16:20:06 -070064 public int encode(BerByteArrayOutputStream os) throws IOException {
65 return encode(os, true);
66 }
slowr13fa5b02017-08-08 16:32:31 -070067
slowr89c2ac12017-08-15 16:20:06 -070068 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
slowr13fa5b02017-08-08 16:32:31 -070069
slowr89c2ac12017-08-15 16:20:06 -070070 if (code != null) {
71 for (int i = code.length - 1; i >= 0; i--) {
72 os.write(code[i]);
73 }
74 if (withTag) {
75 return tag.encode(os) + code.length;
76 }
77 return code.length;
78 }
slowr13fa5b02017-08-08 16:32:31 -070079
slowr89c2ac12017-08-15 16:20:06 -070080 int codeLength = 0;
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080081 codeLength += radioReportServCells.encode(os, false);
slowr89c2ac12017-08-15 16:20:06 -070082 // write tag: CONTEXT_CLASS, CONSTRUCTED, 2
83 os.write(0xA2);
84 codeLength += 1;
slowr13fa5b02017-08-08 16:32:31 -070085
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080086 codeLength += crnti.encode(os, false);
87 // write tag: CONTEXT_CLASS, PRIMITIVE, 1
88 os.write(0x81);
slowr89c2ac12017-08-15 16:20:06 -070089 codeLength += 1;
slowr13fa5b02017-08-08 16:32:31 -070090
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -080091 codeLength += ecgi.encode(os, false);
92 // write tag: CONTEXT_CLASS, CONSTRUCTED, 0
93 os.write(0xA0);
slowr89c2ac12017-08-15 16:20:06 -070094 codeLength += 1;
slowr13fa5b02017-08-08 16:32:31 -070095
slowr89c2ac12017-08-15 16:20:06 -070096 codeLength += BerLength.encodeLength(os, codeLength);
slowr13fa5b02017-08-08 16:32:31 -070097
slowr89c2ac12017-08-15 16:20:06 -070098 if (withTag) {
99 codeLength += tag.encode(os);
100 }
slowr13fa5b02017-08-08 16:32:31 -0700101
slowr89c2ac12017-08-15 16:20:06 -0700102 return codeLength;
slowr13fa5b02017-08-08 16:32:31 -0700103
slowr89c2ac12017-08-15 16:20:06 -0700104 }
105
106 public int decode(InputStream is) throws IOException {
107 return decode(is, true);
108 }
109
110 public int decode(InputStream is, boolean withTag) throws IOException {
111 int codeLength = 0;
112 int subCodeLength = 0;
113 BerTag berTag = new BerTag();
114
115 if (withTag) {
116 codeLength += tag.decodeAndCheck(is);
117 }
118
119 BerLength length = new BerLength();
120 codeLength += length.decode(is);
121
122 int totalLength = length.val;
123 codeLength += totalLength;
124
125 subCodeLength += berTag.decode(is);
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800126 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) {
slowr89c2ac12017-08-15 16:20:06 -0700127 ecgi = new ECGI();
128 subCodeLength += ecgi.decode(is, false);
129 subCodeLength += berTag.decode(is);
130 } else {
131 throw new IOException("Tag does not match the mandatory sequence element tag.");
132 }
133
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800134 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.PRIMITIVE, 1)) {
135 crnti = new CRNTI();
136 subCodeLength += crnti.decode(is, false);
137 subCodeLength += berTag.decode(is);
138 } else {
139 throw new IOException("Tag does not match the mandatory sequence element tag.");
140 }
141
slowr89c2ac12017-08-15 16:20:06 -0700142 if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) {
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800143 radioReportServCells = new RadioReportServCells();
144 subCodeLength += radioReportServCells.decode(is, false);
slowr89c2ac12017-08-15 16:20:06 -0700145 if (subCodeLength == totalLength) {
146 return codeLength;
147 }
148 }
149 throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength);
150
151
152 }
153
154 public void encodeAndSave(int encodingSizeGuess) throws IOException {
155 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
156 encode(os, false);
157 code = os.getArray();
158 }
159
160 public String toString() {
161 StringBuilder sb = new StringBuilder();
162 appendAsString(sb, 0);
163 return sb.toString();
164 }
165
166 public void appendAsString(StringBuilder sb, int indentLevel) {
167
168 sb.append("{");
169 sb.append("\n");
170 for (int i = 0; i < indentLevel + 1; i++) {
171 sb.append("\t");
172 }
slowr89c2ac12017-08-15 16:20:06 -0700173 if (ecgi != null) {
slowr60d4d102017-08-16 18:33:58 -0700174 sb.append("ecgi: ");
slowr89c2ac12017-08-15 16:20:06 -0700175 ecgi.appendAsString(sb, indentLevel + 1);
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800176 } else {
177 sb.append("ecgi: <empty-required-field>");
slowr89c2ac12017-08-15 16:20:06 -0700178 }
179
180 sb.append(",\n");
181 for (int i = 0; i < indentLevel + 1; i++) {
182 sb.append("\t");
183 }
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800184 if (crnti != null) {
185 sb.append("crnti: ").append(crnti);
186 } else {
187 sb.append("crnti: <empty-required-field>");
188 }
189
190 sb.append(",\n");
191 for (int i = 0; i < indentLevel + 1; i++) {
192 sb.append("\t");
193 }
194 if (radioReportServCells != null) {
195 sb.append("radioReportServCells: ");
196 radioReportServCells.appendAsString(sb, indentLevel + 1);
197 } else {
198 sb.append("radioReportServCells: <empty-required-field>");
slowr89c2ac12017-08-15 16:20:06 -0700199 }
200
201 sb.append("\n");
202 for (int i = 0; i < indentLevel; i++) {
203 sb.append("\t");
204 }
205 sb.append("}");
206 }
207
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800208 public static class RadioReportServCells implements Serializable {
slowr89c2ac12017-08-15 16:20:06 -0700209
210 public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16);
211 private static final long serialVersionUID = 1L;
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800212 @JsonIgnore
213 public byte[] code = null;
214 private List<RadioRepPerServCell> seqOf = null;
slowr89c2ac12017-08-15 16:20:06 -0700215
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800216 public RadioReportServCells() {
217 seqOf = new ArrayList<RadioRepPerServCell>();
slowr89c2ac12017-08-15 16:20:06 -0700218 }
219
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800220 public RadioReportServCells(byte[] code) {
slowr89c2ac12017-08-15 16:20:06 -0700221 this.code = code;
222 }
223
slowr60d4d102017-08-16 18:33:58 -0700224 @JsonValue
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800225 public List<RadioRepPerServCell> getRadioRepPerServCell() {
slowr89c2ac12017-08-15 16:20:06 -0700226 if (seqOf == null) {
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800227 seqOf = new ArrayList<RadioRepPerServCell>();
slowr89c2ac12017-08-15 16:20:06 -0700228 }
229 return seqOf;
230 }
231
232 public int encode(BerByteArrayOutputStream os) throws IOException {
233 return encode(os, true);
234 }
235
236 public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException {
237
238 if (code != null) {
239 for (int i = code.length - 1; i >= 0; i--) {
240 os.write(code[i]);
241 }
242 if (withTag) {
243 return tag.encode(os) + code.length;
244 }
245 return code.length;
246 }
247
248 int codeLength = 0;
249 for (int i = (seqOf.size() - 1); i >= 0; i--) {
250 codeLength += seqOf.get(i).encode(os, true);
251 }
252
253 codeLength += BerLength.encodeLength(os, codeLength);
254
255 if (withTag) {
256 codeLength += tag.encode(os);
257 }
258
259 return codeLength;
260 }
261
262 public int decode(InputStream is) throws IOException {
263 return decode(is, true);
264 }
265
266 public int decode(InputStream is, boolean withTag) throws IOException {
267 int codeLength = 0;
268 int subCodeLength = 0;
269 if (withTag) {
270 codeLength += tag.decodeAndCheck(is);
271 }
272
273 BerLength length = new BerLength();
274 codeLength += length.decode(is);
275 int totalLength = length.val;
276
277 while (subCodeLength < totalLength) {
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800278 RadioRepPerServCell element = new RadioRepPerServCell();
slowr89c2ac12017-08-15 16:20:06 -0700279 subCodeLength += element.decode(is, true);
280 seqOf.add(element);
281 }
282 if (subCodeLength != totalLength) {
283 throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength);
284
285 }
286 codeLength += subCodeLength;
287
288 return codeLength;
289 }
290
291 public void encodeAndSave(int encodingSizeGuess) throws IOException {
292 BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess);
293 encode(os, false);
294 code = os.getArray();
295 }
296
297 public String toString() {
298 StringBuilder sb = new StringBuilder();
299 appendAsString(sb, 0);
300 return sb.toString();
301 }
302
303 public void appendAsString(StringBuilder sb, int indentLevel) {
304
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800305 sb.append("{\n");
slowr89c2ac12017-08-15 16:20:06 -0700306 for (int i = 0; i < indentLevel + 1; i++) {
307 sb.append("\t");
308 }
309 if (seqOf == null) {
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800310 sb.append("null");
slowr89c2ac12017-08-15 16:20:06 -0700311 } else {
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800312 Iterator<RadioRepPerServCell> it = seqOf.iterator();
slowr89c2ac12017-08-15 16:20:06 -0700313 if (it.hasNext()) {
314 it.next().appendAsString(sb, indentLevel + 1);
315 while (it.hasNext()) {
316 sb.append(",\n");
317 for (int i = 0; i < indentLevel + 1; i++) {
318 sb.append("\t");
319 }
320 it.next().appendAsString(sb, indentLevel + 1);
321 }
322 }
323 }
slowr13fa5b02017-08-08 16:32:31 -0700324
slowr89c2ac12017-08-15 16:20:06 -0700325 sb.append("\n");
326 for (int i = 0; i < indentLevel; i++) {
327 sb.append("\t");
328 }
Dimitrios Mavrommatis96b255a2017-12-06 13:09:25 -0800329 sb.append("}");
slowr89c2ac12017-08-15 16:20:06 -0700330 }
slowr13fa5b02017-08-08 16:32:31 -0700331
slowr89c2ac12017-08-15 16:20:06 -0700332 }
slowr13fa5b02017-08-08 16:32:31 -0700333
334}
335