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