slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 1 | /** |
| 2 | * This class file was automatically generated by jASN1 v1.8.0 (http://www.openmuc.org) |
| 3 | */ |
| 4 | |
| 5 | package org.onosproject.xran.codecs.api; |
| 6 | |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 7 | import com.fasterxml.jackson.annotation.JsonIgnore; |
| 8 | import com.fasterxml.jackson.annotation.JsonValue; |
| 9 | import org.onosproject.xran.codecs.ber.BerByteArrayOutputStream; |
| 10 | import org.onosproject.xran.codecs.ber.BerLength; |
| 11 | import org.onosproject.xran.codecs.ber.BerTag; |
| 12 | import org.onosproject.xran.codecs.ber.types.BerInteger; |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 13 | |
| 14 | import java.io.IOException; |
| 15 | import java.io.InputStream; |
| 16 | import java.io.Serializable; |
| 17 | import java.util.ArrayList; |
| 18 | import java.util.Iterator; |
| 19 | import java.util.List; |
| 20 | |
| 21 | |
| 22 | public class RadioRepPerServCell implements Serializable { |
| 23 | |
| 24 | private static final long serialVersionUID = 1L; |
| 25 | |
| 26 | public static class CqiHist 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); |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 31 | @JsonIgnore |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 32 | public byte[] code = null; |
| 33 | private List<BerInteger> seqOf = null; |
| 34 | |
| 35 | public CqiHist() { |
| 36 | seqOf = new ArrayList<BerInteger>(); |
| 37 | } |
| 38 | |
| 39 | public CqiHist(byte[] code) { |
| 40 | this.code = code; |
| 41 | } |
| 42 | |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 43 | @JsonValue public List<BerInteger> getBerInteger() { |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 44 | if (seqOf == null) { |
| 45 | seqOf = new ArrayList<BerInteger>(); |
| 46 | } |
| 47 | return seqOf; |
| 48 | } |
| 49 | |
| 50 | public void setBerInteger(BerInteger berInteger) { |
| 51 | seqOf.add(berInteger); |
| 52 | } |
| 53 | |
| 54 | public int encode(BerByteArrayOutputStream os) throws IOException { |
| 55 | return encode(os, true); |
| 56 | } |
| 57 | |
| 58 | public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException { |
| 59 | |
| 60 | if (code != null) { |
| 61 | for (int i = code.length - 1; i >= 0; i--) { |
| 62 | os.write(code[i]); |
| 63 | } |
| 64 | if (withTag) { |
| 65 | return tag.encode(os) + code.length; |
| 66 | } |
| 67 | return code.length; |
| 68 | } |
| 69 | |
| 70 | int codeLength = 0; |
| 71 | for (int i = (seqOf.size() - 1); i >= 0; i--) { |
| 72 | codeLength += seqOf.get(i).encode(os, true); |
| 73 | } |
| 74 | |
| 75 | codeLength += BerLength.encodeLength(os, codeLength); |
| 76 | |
| 77 | if (withTag) { |
| 78 | codeLength += tag.encode(os); |
| 79 | } |
| 80 | |
| 81 | return codeLength; |
| 82 | } |
| 83 | |
| 84 | public int decode(InputStream is) throws IOException { |
| 85 | return decode(is, true); |
| 86 | } |
| 87 | |
| 88 | public int decode(InputStream is, boolean withTag) throws IOException { |
| 89 | int codeLength = 0; |
| 90 | int subCodeLength = 0; |
| 91 | if (withTag) { |
| 92 | codeLength += tag.decodeAndCheck(is); |
| 93 | } |
| 94 | |
| 95 | BerLength length = new BerLength(); |
| 96 | codeLength += length.decode(is); |
| 97 | int totalLength = length.val; |
| 98 | |
| 99 | while (subCodeLength < totalLength) { |
| 100 | BerInteger element = new BerInteger(); |
| 101 | subCodeLength += element.decode(is, true); |
| 102 | seqOf.add(element); |
| 103 | } |
| 104 | if (subCodeLength != totalLength) { |
| 105 | throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); |
| 106 | |
| 107 | } |
| 108 | codeLength += subCodeLength; |
| 109 | |
| 110 | return codeLength; |
| 111 | } |
| 112 | |
| 113 | public void encodeAndSave(int encodingSizeGuess) throws IOException { |
| 114 | BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess); |
| 115 | encode(os, false); |
| 116 | code = os.getArray(); |
| 117 | } |
| 118 | |
| 119 | public String toString() { |
| 120 | StringBuilder sb = new StringBuilder(); |
| 121 | appendAsString(sb, 0); |
| 122 | return sb.toString(); |
| 123 | } |
| 124 | |
| 125 | public void appendAsString(StringBuilder sb, int indentLevel) { |
| 126 | |
| 127 | sb.append("[\n"); |
| 128 | for (int i = 0; i < indentLevel + 1; i++) { |
| 129 | sb.append("\t"); |
| 130 | } |
| 131 | if (seqOf == null) { |
| 132 | // sb.append("null"); |
| 133 | } |
| 134 | else { |
| 135 | Iterator<BerInteger> it = seqOf.iterator(); |
| 136 | if (it.hasNext()) { |
| 137 | sb.append(it.next()); |
| 138 | while (it.hasNext()) { |
| 139 | sb.append(",\n"); |
| 140 | for (int i = 0; i < indentLevel + 1; i++) { |
| 141 | sb.append("\t"); |
| 142 | } |
| 143 | sb.append(it.next()); |
| 144 | } |
| 145 | } |
| 146 | } |
| 147 | |
| 148 | sb.append("\n"); |
| 149 | for (int i = 0; i < indentLevel; i++) { |
| 150 | sb.append("\t"); |
| 151 | } |
| 152 | sb.append("]"); |
| 153 | } |
| 154 | |
| 155 | } |
| 156 | |
| 157 | public static class RiHist implements Serializable { |
| 158 | |
| 159 | private static final long serialVersionUID = 1L; |
| 160 | |
| 161 | public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 162 | @JsonIgnore public byte[] code = null; |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 163 | private List<BerInteger> seqOf = null; |
| 164 | |
| 165 | public RiHist() { |
| 166 | seqOf = new ArrayList<BerInteger>(); |
| 167 | } |
| 168 | |
| 169 | public RiHist(byte[] code) { |
| 170 | this.code = code; |
| 171 | } |
| 172 | |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 173 | @JsonValue public List<BerInteger> getBerInteger() { |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 174 | if (seqOf == null) { |
| 175 | seqOf = new ArrayList<BerInteger>(); |
| 176 | } |
| 177 | return seqOf; |
| 178 | } |
| 179 | |
| 180 | |
| 181 | |
| 182 | public int encode(BerByteArrayOutputStream os) throws IOException { |
| 183 | return encode(os, true); |
| 184 | } |
| 185 | |
| 186 | public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException { |
| 187 | |
| 188 | if (code != null) { |
| 189 | for (int i = code.length - 1; i >= 0; i--) { |
| 190 | os.write(code[i]); |
| 191 | } |
| 192 | if (withTag) { |
| 193 | return tag.encode(os) + code.length; |
| 194 | } |
| 195 | return code.length; |
| 196 | } |
| 197 | |
| 198 | int codeLength = 0; |
| 199 | for (int i = (seqOf.size() - 1); i >= 0; i--) { |
| 200 | codeLength += seqOf.get(i).encode(os, true); |
| 201 | } |
| 202 | |
| 203 | codeLength += BerLength.encodeLength(os, codeLength); |
| 204 | |
| 205 | if (withTag) { |
| 206 | codeLength += tag.encode(os); |
| 207 | } |
| 208 | |
| 209 | return codeLength; |
| 210 | } |
| 211 | |
| 212 | public int decode(InputStream is) throws IOException { |
| 213 | return decode(is, true); |
| 214 | } |
| 215 | |
| 216 | public int decode(InputStream is, boolean withTag) throws IOException { |
| 217 | int codeLength = 0; |
| 218 | int subCodeLength = 0; |
| 219 | if (withTag) { |
| 220 | codeLength += tag.decodeAndCheck(is); |
| 221 | } |
| 222 | |
| 223 | BerLength length = new BerLength(); |
| 224 | codeLength += length.decode(is); |
| 225 | int totalLength = length.val; |
| 226 | |
| 227 | while (subCodeLength < totalLength) { |
| 228 | BerInteger element = new BerInteger(); |
| 229 | subCodeLength += element.decode(is, true); |
| 230 | seqOf.add(element); |
| 231 | } |
| 232 | if (subCodeLength != totalLength) { |
| 233 | throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); |
| 234 | |
| 235 | } |
| 236 | codeLength += subCodeLength; |
| 237 | |
| 238 | return codeLength; |
| 239 | } |
| 240 | |
| 241 | public void encodeAndSave(int encodingSizeGuess) throws IOException { |
| 242 | BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess); |
| 243 | encode(os, false); |
| 244 | code = os.getArray(); |
| 245 | } |
| 246 | |
| 247 | public String toString() { |
| 248 | StringBuilder sb = new StringBuilder(); |
| 249 | appendAsString(sb, 0); |
| 250 | return sb.toString(); |
| 251 | } |
| 252 | |
| 253 | public void appendAsString(StringBuilder sb, int indentLevel) { |
| 254 | |
| 255 | sb.append("[\n"); |
| 256 | for (int i = 0; i < indentLevel + 1; i++) { |
| 257 | sb.append("\t"); |
| 258 | } |
| 259 | if (seqOf == null) { |
| 260 | // sb.append("null"); |
| 261 | } |
| 262 | else { |
| 263 | Iterator<BerInteger> it = seqOf.iterator(); |
| 264 | if (it.hasNext()) { |
| 265 | sb.append(it.next()); |
| 266 | while (it.hasNext()) { |
| 267 | sb.append(",\n"); |
| 268 | for (int i = 0; i < indentLevel + 1; i++) { |
| 269 | sb.append("\t"); |
| 270 | } |
| 271 | sb.append(it.next()); |
| 272 | } |
| 273 | } |
| 274 | } |
| 275 | |
| 276 | sb.append("\n"); |
| 277 | for (int i = 0; i < indentLevel; i++) { |
| 278 | sb.append("\t"); |
| 279 | } |
| 280 | sb.append("]"); |
| 281 | } |
| 282 | |
| 283 | public void setBerInteger(BerInteger berInteger) { |
| 284 | seqOf.add(berInteger); |
| 285 | } |
| 286 | } |
| 287 | |
| 288 | public static class PuschSinrHist implements Serializable { |
| 289 | |
| 290 | private static final long serialVersionUID = 1L; |
| 291 | |
| 292 | public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 293 | @JsonIgnore public byte[] code = null; |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 294 | private List<BerInteger> seqOf = null; |
| 295 | |
| 296 | public PuschSinrHist() { |
| 297 | seqOf = new ArrayList<BerInteger>(); |
| 298 | } |
| 299 | |
| 300 | public PuschSinrHist(byte[] code) { |
| 301 | this.code = code; |
| 302 | } |
| 303 | |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 304 | @JsonValue public List<BerInteger> getBerInteger() { |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 305 | if (seqOf == null) { |
| 306 | seqOf = new ArrayList<BerInteger>(); |
| 307 | } |
| 308 | return seqOf; |
| 309 | } |
| 310 | |
| 311 | public void setBerInteger(BerInteger berInteger) { |
| 312 | seqOf.add(berInteger); |
| 313 | } |
| 314 | |
| 315 | |
| 316 | public int encode(BerByteArrayOutputStream os) throws IOException { |
| 317 | return encode(os, true); |
| 318 | } |
| 319 | |
| 320 | public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException { |
| 321 | |
| 322 | if (code != null) { |
| 323 | for (int i = code.length - 1; i >= 0; i--) { |
| 324 | os.write(code[i]); |
| 325 | } |
| 326 | if (withTag) { |
| 327 | return tag.encode(os) + code.length; |
| 328 | } |
| 329 | return code.length; |
| 330 | } |
| 331 | |
| 332 | int codeLength = 0; |
| 333 | for (int i = (seqOf.size() - 1); i >= 0; i--) { |
| 334 | codeLength += seqOf.get(i).encode(os, true); |
| 335 | } |
| 336 | |
| 337 | codeLength += BerLength.encodeLength(os, codeLength); |
| 338 | |
| 339 | if (withTag) { |
| 340 | codeLength += tag.encode(os); |
| 341 | } |
| 342 | |
| 343 | return codeLength; |
| 344 | } |
| 345 | |
| 346 | public int decode(InputStream is) throws IOException { |
| 347 | return decode(is, true); |
| 348 | } |
| 349 | |
| 350 | public int decode(InputStream is, boolean withTag) throws IOException { |
| 351 | int codeLength = 0; |
| 352 | int subCodeLength = 0; |
| 353 | if (withTag) { |
| 354 | codeLength += tag.decodeAndCheck(is); |
| 355 | } |
| 356 | |
| 357 | BerLength length = new BerLength(); |
| 358 | codeLength += length.decode(is); |
| 359 | int totalLength = length.val; |
| 360 | |
| 361 | while (subCodeLength < totalLength) { |
| 362 | BerInteger element = new BerInteger(); |
| 363 | subCodeLength += element.decode(is, true); |
| 364 | seqOf.add(element); |
| 365 | } |
| 366 | if (subCodeLength != totalLength) { |
| 367 | throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); |
| 368 | |
| 369 | } |
| 370 | codeLength += subCodeLength; |
| 371 | |
| 372 | return codeLength; |
| 373 | } |
| 374 | |
| 375 | public void encodeAndSave(int encodingSizeGuess) throws IOException { |
| 376 | BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess); |
| 377 | encode(os, false); |
| 378 | code = os.getArray(); |
| 379 | } |
| 380 | |
| 381 | public String toString() { |
| 382 | StringBuilder sb = new StringBuilder(); |
| 383 | appendAsString(sb, 0); |
| 384 | return sb.toString(); |
| 385 | } |
| 386 | |
| 387 | public void appendAsString(StringBuilder sb, int indentLevel) { |
| 388 | |
| 389 | sb.append("[\n"); |
| 390 | for (int i = 0; i < indentLevel + 1; i++) { |
| 391 | sb.append("\t"); |
| 392 | } |
| 393 | if (seqOf == null) { |
| 394 | // sb.append("null"); |
| 395 | } |
| 396 | else { |
| 397 | Iterator<BerInteger> it = seqOf.iterator(); |
| 398 | if (it.hasNext()) { |
| 399 | sb.append(it.next()); |
| 400 | while (it.hasNext()) { |
| 401 | sb.append(",\n"); |
| 402 | for (int i = 0; i < indentLevel + 1; i++) { |
| 403 | sb.append("\t"); |
| 404 | } |
| 405 | sb.append(it.next()); |
| 406 | } |
| 407 | } |
| 408 | } |
| 409 | |
| 410 | sb.append("\n"); |
| 411 | for (int i = 0; i < indentLevel; i++) { |
| 412 | sb.append("\t"); |
| 413 | } |
| 414 | sb.append("]"); |
| 415 | } |
| 416 | |
| 417 | } |
| 418 | |
| 419 | public static class PucchSinrHist implements Serializable { |
| 420 | |
| 421 | private static final long serialVersionUID = 1L; |
| 422 | |
| 423 | public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 424 | @JsonIgnore public byte[] code = null; |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 425 | private List<BerInteger> seqOf = null; |
| 426 | |
| 427 | public PucchSinrHist() { |
| 428 | seqOf = new ArrayList<BerInteger>(); |
| 429 | } |
| 430 | |
| 431 | public PucchSinrHist(byte[] code) { |
| 432 | this.code = code; |
| 433 | } |
| 434 | |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 435 | @JsonValue |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 436 | public List<BerInteger> getBerInteger() { |
| 437 | if (seqOf == null) { |
| 438 | seqOf = new ArrayList<BerInteger>(); |
| 439 | } |
| 440 | return seqOf; |
| 441 | } |
| 442 | public void setBerInteger(BerInteger berInteger) { |
| 443 | seqOf.add(berInteger); |
| 444 | } |
| 445 | |
| 446 | |
| 447 | public int encode(BerByteArrayOutputStream os) throws IOException { |
| 448 | return encode(os, true); |
| 449 | } |
| 450 | |
| 451 | public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException { |
| 452 | |
| 453 | if (code != null) { |
| 454 | for (int i = code.length - 1; i >= 0; i--) { |
| 455 | os.write(code[i]); |
| 456 | } |
| 457 | if (withTag) { |
| 458 | return tag.encode(os) + code.length; |
| 459 | } |
| 460 | return code.length; |
| 461 | } |
| 462 | |
| 463 | int codeLength = 0; |
| 464 | for (int i = (seqOf.size() - 1); i >= 0; i--) { |
| 465 | codeLength += seqOf.get(i).encode(os, true); |
| 466 | } |
| 467 | |
| 468 | codeLength += BerLength.encodeLength(os, codeLength); |
| 469 | |
| 470 | if (withTag) { |
| 471 | codeLength += tag.encode(os); |
| 472 | } |
| 473 | |
| 474 | return codeLength; |
| 475 | } |
| 476 | |
| 477 | public int decode(InputStream is) throws IOException { |
| 478 | return decode(is, true); |
| 479 | } |
| 480 | |
| 481 | public int decode(InputStream is, boolean withTag) throws IOException { |
| 482 | int codeLength = 0; |
| 483 | int subCodeLength = 0; |
| 484 | if (withTag) { |
| 485 | codeLength += tag.decodeAndCheck(is); |
| 486 | } |
| 487 | |
| 488 | BerLength length = new BerLength(); |
| 489 | codeLength += length.decode(is); |
| 490 | int totalLength = length.val; |
| 491 | |
| 492 | while (subCodeLength < totalLength) { |
| 493 | BerInteger element = new BerInteger(); |
| 494 | subCodeLength += element.decode(is, true); |
| 495 | seqOf.add(element); |
| 496 | } |
| 497 | if (subCodeLength != totalLength) { |
| 498 | throw new IOException("Decoded SequenceOf or SetOf has wrong length. Expected " + totalLength + " but has " + subCodeLength); |
| 499 | |
| 500 | } |
| 501 | codeLength += subCodeLength; |
| 502 | |
| 503 | return codeLength; |
| 504 | } |
| 505 | |
| 506 | public void encodeAndSave(int encodingSizeGuess) throws IOException { |
| 507 | BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess); |
| 508 | encode(os, false); |
| 509 | code = os.getArray(); |
| 510 | } |
| 511 | |
| 512 | public String toString() { |
| 513 | StringBuilder sb = new StringBuilder(); |
| 514 | appendAsString(sb, 0); |
| 515 | return sb.toString(); |
| 516 | } |
| 517 | |
| 518 | public void appendAsString(StringBuilder sb, int indentLevel) { |
| 519 | |
| 520 | sb.append("[\n"); |
| 521 | for (int i = 0; i < indentLevel + 1; i++) { |
| 522 | sb.append("\t"); |
| 523 | } |
| 524 | if (seqOf == null) { |
| 525 | // sb.append("null"); |
| 526 | } |
| 527 | else { |
| 528 | Iterator<BerInteger> it = seqOf.iterator(); |
| 529 | if (it.hasNext()) { |
| 530 | sb.append(it.next()); |
| 531 | while (it.hasNext()) { |
| 532 | sb.append(",\n"); |
| 533 | for (int i = 0; i < indentLevel + 1; i++) { |
| 534 | sb.append("\t"); |
| 535 | } |
| 536 | sb.append(it.next()); |
| 537 | } |
| 538 | } |
| 539 | } |
| 540 | |
| 541 | sb.append("\n"); |
| 542 | for (int i = 0; i < indentLevel; i++) { |
| 543 | sb.append("\t"); |
| 544 | } |
| 545 | sb.append("]"); |
| 546 | } |
| 547 | |
| 548 | } |
| 549 | |
| 550 | public static final BerTag tag = new BerTag(BerTag.UNIVERSAL_CLASS, BerTag.CONSTRUCTED, 16); |
| 551 | |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 552 | @JsonIgnore public byte[] code = null; |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 553 | private PCIARFCN pciArfcn = null; |
| 554 | private CqiHist cqiHist = null; |
| 555 | private RiHist riHist = null; |
| 556 | private PuschSinrHist puschSinrHist = null; |
| 557 | private PucchSinrHist pucchSinrHist = null; |
| 558 | |
| 559 | public RadioRepPerServCell() { |
| 560 | } |
| 561 | |
| 562 | public RadioRepPerServCell(byte[] code) { |
| 563 | this.code = code; |
| 564 | } |
| 565 | |
| 566 | public void setPciArfcn(PCIARFCN pciArfcn) { |
| 567 | this.pciArfcn = pciArfcn; |
| 568 | } |
| 569 | |
| 570 | public PCIARFCN getPciArfcn() { |
| 571 | return pciArfcn; |
| 572 | } |
| 573 | |
| 574 | public void setCqiHist(CqiHist cqiHist) { |
| 575 | this.cqiHist = cqiHist; |
| 576 | } |
| 577 | |
| 578 | public CqiHist getCqiHist() { |
| 579 | return cqiHist; |
| 580 | } |
| 581 | |
| 582 | public void setRiHist(RiHist riHist) { |
| 583 | this.riHist = riHist; |
| 584 | } |
| 585 | |
| 586 | public RiHist getRiHist() { |
| 587 | return riHist; |
| 588 | } |
| 589 | |
| 590 | public void setPuschSinrHist(PuschSinrHist puschSinrHist) { |
| 591 | this.puschSinrHist = puschSinrHist; |
| 592 | } |
| 593 | |
| 594 | public PuschSinrHist getPuschSinrHist() { |
| 595 | return puschSinrHist; |
| 596 | } |
| 597 | |
| 598 | public void setPucchSinrHist(PucchSinrHist pucchSinrHist) { |
| 599 | this.pucchSinrHist = pucchSinrHist; |
| 600 | } |
| 601 | |
| 602 | public PucchSinrHist getPucchSinrHist() { |
| 603 | return pucchSinrHist; |
| 604 | } |
| 605 | |
| 606 | public int encode(BerByteArrayOutputStream os) throws IOException { |
| 607 | return encode(os, true); |
| 608 | } |
| 609 | |
| 610 | public int encode(BerByteArrayOutputStream os, boolean withTag) throws IOException { |
| 611 | |
| 612 | if (code != null) { |
| 613 | for (int i = code.length - 1; i >= 0; i--) { |
| 614 | os.write(code[i]); |
| 615 | } |
| 616 | if (withTag) { |
| 617 | return tag.encode(os) + code.length; |
| 618 | } |
| 619 | return code.length; |
| 620 | } |
| 621 | |
| 622 | int codeLength = 0; |
| 623 | codeLength += pucchSinrHist.encode(os, false); |
| 624 | // write tag: CONTEXT_CLASS, CONSTRUCTED, 4 |
| 625 | os.write(0xA4); |
| 626 | codeLength += 1; |
| 627 | |
| 628 | codeLength += puschSinrHist.encode(os, false); |
| 629 | // write tag: CONTEXT_CLASS, CONSTRUCTED, 3 |
| 630 | os.write(0xA3); |
| 631 | codeLength += 1; |
| 632 | |
| 633 | codeLength += riHist.encode(os, false); |
| 634 | // write tag: CONTEXT_CLASS, CONSTRUCTED, 2 |
| 635 | os.write(0xA2); |
| 636 | codeLength += 1; |
| 637 | |
| 638 | codeLength += cqiHist.encode(os, false); |
| 639 | // write tag: CONTEXT_CLASS, CONSTRUCTED, 1 |
| 640 | os.write(0xA1); |
| 641 | codeLength += 1; |
| 642 | |
| 643 | codeLength += pciArfcn.encode(os, false); |
| 644 | // write tag: CONTEXT_CLASS, CONSTRUCTED, 0 |
| 645 | os.write(0xA0); |
| 646 | codeLength += 1; |
| 647 | |
| 648 | codeLength += BerLength.encodeLength(os, codeLength); |
| 649 | |
| 650 | if (withTag) { |
| 651 | codeLength += tag.encode(os); |
| 652 | } |
| 653 | |
| 654 | return codeLength; |
| 655 | |
| 656 | } |
| 657 | |
| 658 | public int decode(InputStream is) throws IOException { |
| 659 | return decode(is, true); |
| 660 | } |
| 661 | |
| 662 | public int decode(InputStream is, boolean withTag) throws IOException { |
| 663 | int codeLength = 0; |
| 664 | int subCodeLength = 0; |
| 665 | BerTag berTag = new BerTag(); |
| 666 | |
| 667 | if (withTag) { |
| 668 | codeLength += tag.decodeAndCheck(is); |
| 669 | } |
| 670 | |
| 671 | BerLength length = new BerLength(); |
| 672 | codeLength += length.decode(is); |
| 673 | |
| 674 | int totalLength = length.val; |
| 675 | codeLength += totalLength; |
| 676 | |
| 677 | subCodeLength += berTag.decode(is); |
| 678 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 0)) { |
| 679 | pciArfcn = new PCIARFCN(); |
| 680 | subCodeLength += pciArfcn.decode(is, false); |
| 681 | subCodeLength += berTag.decode(is); |
| 682 | } |
| 683 | else { |
| 684 | throw new IOException("Tag does not match the mandatory sequence element tag."); |
| 685 | } |
| 686 | |
| 687 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 1)) { |
| 688 | cqiHist = new CqiHist(); |
| 689 | subCodeLength += cqiHist.decode(is, false); |
| 690 | subCodeLength += berTag.decode(is); |
| 691 | } |
| 692 | else { |
| 693 | throw new IOException("Tag does not match the mandatory sequence element tag."); |
| 694 | } |
| 695 | |
| 696 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 2)) { |
| 697 | riHist = new RiHist(); |
| 698 | subCodeLength += riHist.decode(is, false); |
| 699 | subCodeLength += berTag.decode(is); |
| 700 | } |
| 701 | else { |
| 702 | throw new IOException("Tag does not match the mandatory sequence element tag."); |
| 703 | } |
| 704 | |
| 705 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 3)) { |
| 706 | puschSinrHist = new PuschSinrHist(); |
| 707 | subCodeLength += puschSinrHist.decode(is, false); |
| 708 | subCodeLength += berTag.decode(is); |
| 709 | } |
| 710 | else { |
| 711 | throw new IOException("Tag does not match the mandatory sequence element tag."); |
| 712 | } |
| 713 | |
| 714 | if (berTag.equals(BerTag.CONTEXT_CLASS, BerTag.CONSTRUCTED, 4)) { |
| 715 | pucchSinrHist = new PucchSinrHist(); |
| 716 | subCodeLength += pucchSinrHist.decode(is, false); |
| 717 | if (subCodeLength == totalLength) { |
| 718 | return codeLength; |
| 719 | } |
| 720 | } |
| 721 | throw new IOException("Unexpected end of sequence, length tag: " + totalLength + ", actual sequence length: " + subCodeLength); |
| 722 | |
| 723 | |
| 724 | } |
| 725 | |
| 726 | public void encodeAndSave(int encodingSizeGuess) throws IOException { |
| 727 | BerByteArrayOutputStream os = new BerByteArrayOutputStream(encodingSizeGuess); |
| 728 | encode(os, false); |
| 729 | code = os.getArray(); |
| 730 | } |
| 731 | |
| 732 | public String toString() { |
| 733 | StringBuilder sb = new StringBuilder(); |
| 734 | appendAsString(sb, 0); |
| 735 | return sb.toString(); |
| 736 | } |
| 737 | |
| 738 | public void appendAsString(StringBuilder sb, int indentLevel) { |
| 739 | |
| 740 | sb.append("{"); |
| 741 | sb.append("\n"); |
| 742 | for (int i = 0; i < indentLevel + 1; i++) { |
| 743 | sb.append("\t"); |
| 744 | } |
| 745 | if (pciArfcn != null) { |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 746 | sb.append("pciArfcn: "); |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 747 | pciArfcn.appendAsString(sb, indentLevel + 1); |
| 748 | } |
| 749 | |
| 750 | sb.append(",\n"); |
| 751 | for (int i = 0; i < indentLevel + 1; i++) { |
| 752 | sb.append("\t"); |
| 753 | } |
| 754 | if (cqiHist != null) { |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 755 | sb.append("cqiHist: "); |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 756 | cqiHist.appendAsString(sb, indentLevel + 1); |
| 757 | } |
| 758 | |
| 759 | sb.append(",\n"); |
| 760 | for (int i = 0; i < indentLevel + 1; i++) { |
| 761 | sb.append("\t"); |
| 762 | } |
| 763 | if (riHist != null) { |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 764 | sb.append("riHist: "); |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 765 | riHist.appendAsString(sb, indentLevel + 1); |
| 766 | } |
| 767 | |
| 768 | sb.append(",\n"); |
| 769 | for (int i = 0; i < indentLevel + 1; i++) { |
| 770 | sb.append("\t"); |
| 771 | } |
| 772 | if (puschSinrHist != null) { |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 773 | sb.append("puschSinrHist: "); |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 774 | puschSinrHist.appendAsString(sb, indentLevel + 1); |
| 775 | } |
| 776 | |
| 777 | sb.append(",\n"); |
| 778 | for (int i = 0; i < indentLevel + 1; i++) { |
| 779 | sb.append("\t"); |
| 780 | } |
| 781 | if (pucchSinrHist != null) { |
slowr | 60d4d10 | 2017-08-16 18:33:58 -0700 | [diff] [blame] | 782 | sb.append("pucchSinrHist: "); |
slowr | 13fa5b0 | 2017-08-08 16:32:31 -0700 | [diff] [blame] | 783 | pucchSinrHist.appendAsString(sb, indentLevel + 1); |
| 784 | } |
| 785 | |
| 786 | sb.append("\n"); |
| 787 | for (int i = 0; i < indentLevel; i++) { |
| 788 | sb.append("\t"); |
| 789 | } |
| 790 | sb.append("}"); |
| 791 | } |
| 792 | |
| 793 | } |
| 794 | |