1 /* 2 * Copyright (C) 2017 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package android.location.cts.asn1.supl2.supl_triggered_start; 18 19 /* 20 */ 21 22 23 // 24 // 25 import android.location.cts.asn1.base.Asn1Null; 26 import android.location.cts.asn1.base.Asn1Object; 27 import android.location.cts.asn1.base.Asn1Sequence; 28 import android.location.cts.asn1.base.Asn1Tag; 29 import android.location.cts.asn1.base.BitStream; 30 import android.location.cts.asn1.base.BitStreamReader; 31 import android.location.cts.asn1.base.SequenceComponent; 32 import android.location.cts.asn1.supl2.supl_start.SETCapabilities; 33 import android.location.cts.asn1.supl2.ulp_components.LocationId; 34 import android.location.cts.asn1.supl2.ulp_components.Position; 35 import android.location.cts.asn1.supl2.ulp_components.QoP; 36 import android.location.cts.asn1.supl2.ulp_components.Ver; 37 import android.location.cts.asn1.supl2.ver2_ulp_components.ApplicationID; 38 import android.location.cts.asn1.supl2.ver2_ulp_components.CauseCode; 39 import android.location.cts.asn1.supl2.ver2_ulp_components.MultipleLocationIds; 40 import android.location.cts.asn1.supl2.ver2_ulp_components.ReportingCap; 41 import android.location.cts.asn1.supl2.ver2_ulp_components.ThirdParty; 42 import com.google.common.collect.ImmutableList; 43 import java.util.Collection; 44 import javax.annotation.Nullable; 45 46 47 /** 48 */ 49 public class Ver2_SUPLTRIGGEREDSTART extends Asn1Sequence { 50 // 51 52 private static final Asn1Tag TAG_Ver2_SUPLTRIGGEREDSTART 53 = Asn1Tag.fromClassAndNumber(-1, -1); 54 55 public Ver2_SUPLTRIGGEREDSTART() { 56 super(); 57 } 58 59 @Override 60 @Nullable 61 protected Asn1Tag getTag() { 62 return TAG_Ver2_SUPLTRIGGEREDSTART; 63 } 64 65 @Override 66 protected boolean isTagImplicit() { 67 return true; 68 } 69 70 public static Collection<Asn1Tag> getPossibleFirstTags() { 71 if (TAG_Ver2_SUPLTRIGGEREDSTART != null) { 72 return ImmutableList.of(TAG_Ver2_SUPLTRIGGEREDSTART); 73 } else { 74 return Asn1Sequence.getPossibleFirstTags(); 75 } 76 } 77 78 /** 79 * Creates a new Ver2_SUPLTRIGGEREDSTART from encoded stream. 80 */ 81 public static Ver2_SUPLTRIGGEREDSTART fromPerUnaligned(byte[] encodedBytes) { 82 Ver2_SUPLTRIGGEREDSTART result = new Ver2_SUPLTRIGGEREDSTART(); 83 result.decodePerUnaligned(new BitStreamReader(encodedBytes)); 84 return result; 85 } 86 87 /** 88 * Creates a new Ver2_SUPLTRIGGEREDSTART from encoded stream. 89 */ 90 public static Ver2_SUPLTRIGGEREDSTART fromPerAligned(byte[] encodedBytes) { 91 Ver2_SUPLTRIGGEREDSTART result = new Ver2_SUPLTRIGGEREDSTART(); 92 result.decodePerAligned(new BitStreamReader(encodedBytes)); 93 return result; 94 } 95 96 97 98 @Override protected boolean isExtensible() { 99 return true; 100 } 101 102 @Override public boolean containsExtensionValues() { 103 for (SequenceComponent extensionComponent : getExtensionComponents()) { 104 if (extensionComponent.isExplicitlySet()) return true; 105 } 106 return false; 107 } 108 109 110 private SETCapabilities sETCapabilities_; 111 public SETCapabilities getSETCapabilities() { 112 return sETCapabilities_; 113 } 114 /** 115 * @throws ClassCastException if value is not a SETCapabilities 116 */ 117 public void setSETCapabilities(Asn1Object value) { 118 this.sETCapabilities_ = (SETCapabilities) value; 119 } 120 public SETCapabilities setSETCapabilitiesToNewInstance() { 121 sETCapabilities_ = new SETCapabilities(); 122 return sETCapabilities_; 123 } 124 125 private LocationId locationId_; 126 public LocationId getLocationId() { 127 return locationId_; 128 } 129 /** 130 * @throws ClassCastException if value is not a LocationId 131 */ 132 public void setLocationId(Asn1Object value) { 133 this.locationId_ = (LocationId) value; 134 } 135 public LocationId setLocationIdToNewInstance() { 136 locationId_ = new LocationId(); 137 return locationId_; 138 } 139 140 private Ver ver_; 141 public Ver getVer() { 142 return ver_; 143 } 144 /** 145 * @throws ClassCastException if value is not a Ver 146 */ 147 public void setVer(Asn1Object value) { 148 this.ver_ = (Ver) value; 149 } 150 public Ver setVerToNewInstance() { 151 ver_ = new Ver(); 152 return ver_; 153 } 154 155 private QoP qoP_; 156 public QoP getQoP() { 157 return qoP_; 158 } 159 /** 160 * @throws ClassCastException if value is not a QoP 161 */ 162 public void setQoP(Asn1Object value) { 163 this.qoP_ = (QoP) value; 164 } 165 public QoP setQoPToNewInstance() { 166 qoP_ = new QoP(); 167 return qoP_; 168 } 169 170 private MultipleLocationIds multipleLocationIds_; 171 public MultipleLocationIds getMultipleLocationIds() { 172 return multipleLocationIds_; 173 } 174 /** 175 * @throws ClassCastException if value is not a MultipleLocationIds 176 */ 177 public void setMultipleLocationIds(Asn1Object value) { 178 this.multipleLocationIds_ = (MultipleLocationIds) value; 179 } 180 public MultipleLocationIds setMultipleLocationIdsToNewInstance() { 181 multipleLocationIds_ = new MultipleLocationIds(); 182 return multipleLocationIds_; 183 } 184 185 private ThirdParty thirdParty_; 186 public ThirdParty getThirdParty() { 187 return thirdParty_; 188 } 189 /** 190 * @throws ClassCastException if value is not a ThirdParty 191 */ 192 public void setThirdParty(Asn1Object value) { 193 this.thirdParty_ = (ThirdParty) value; 194 } 195 public ThirdParty setThirdPartyToNewInstance() { 196 thirdParty_ = new ThirdParty(); 197 return thirdParty_; 198 } 199 200 private ApplicationID applicationID_; 201 public ApplicationID getApplicationID() { 202 return applicationID_; 203 } 204 /** 205 * @throws ClassCastException if value is not a ApplicationID 206 */ 207 public void setApplicationID(Asn1Object value) { 208 this.applicationID_ = (ApplicationID) value; 209 } 210 public ApplicationID setApplicationIDToNewInstance() { 211 applicationID_ = new ApplicationID(); 212 return applicationID_; 213 } 214 215 private TriggerType triggerType_; 216 public TriggerType getTriggerType() { 217 return triggerType_; 218 } 219 /** 220 * @throws ClassCastException if value is not a TriggerType 221 */ 222 public void setTriggerType(Asn1Object value) { 223 this.triggerType_ = (TriggerType) value; 224 } 225 public TriggerType setTriggerTypeToNewInstance() { 226 triggerType_ = new TriggerType(); 227 return triggerType_; 228 } 229 230 private TriggerParams triggerParams_; 231 public TriggerParams getTriggerParams() { 232 return triggerParams_; 233 } 234 /** 235 * @throws ClassCastException if value is not a TriggerParams 236 */ 237 public void setTriggerParams(Asn1Object value) { 238 this.triggerParams_ = (TriggerParams) value; 239 } 240 public TriggerParams setTriggerParamsToNewInstance() { 241 triggerParams_ = new TriggerParams(); 242 return triggerParams_; 243 } 244 245 private Position position_; 246 public Position getPosition() { 247 return position_; 248 } 249 /** 250 * @throws ClassCastException if value is not a Position 251 */ 252 public void setPosition(Asn1Object value) { 253 this.position_ = (Position) value; 254 } 255 public Position setPositionToNewInstance() { 256 position_ = new Position(); 257 return position_; 258 } 259 260 private ReportingCap reportingCap_; 261 public ReportingCap getReportingCap() { 262 return reportingCap_; 263 } 264 /** 265 * @throws ClassCastException if value is not a ReportingCap 266 */ 267 public void setReportingCap(Asn1Object value) { 268 this.reportingCap_ = (ReportingCap) value; 269 } 270 public ReportingCap setReportingCapToNewInstance() { 271 reportingCap_ = new ReportingCap(); 272 return reportingCap_; 273 } 274 275 private CauseCode causeCode_; 276 public CauseCode getCauseCode() { 277 return causeCode_; 278 } 279 /** 280 * @throws ClassCastException if value is not a CauseCode 281 */ 282 public void setCauseCode(Asn1Object value) { 283 this.causeCode_ = (CauseCode) value; 284 } 285 public CauseCode setCauseCodeToNewInstance() { 286 causeCode_ = new CauseCode(); 287 return causeCode_; 288 } 289 290 291 292 293 294 295 @Override public Iterable<? extends SequenceComponent> getComponents() { 296 ImmutableList.Builder<SequenceComponent> builder = ImmutableList.builder(); 297 298 builder.add(new SequenceComponent() { 299 Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 0); 300 301 @Override public boolean isExplicitlySet() { 302 return getSETCapabilities() != null; 303 } 304 305 @Override public boolean hasDefaultValue() { 306 return false; 307 } 308 309 @Override public boolean isOptional() { 310 return false; 311 } 312 313 @Override public Asn1Object getComponentValue() { 314 return getSETCapabilities(); 315 } 316 317 @Override public void setToNewInstance() { 318 setSETCapabilitiesToNewInstance(); 319 } 320 321 @Override public Collection<Asn1Tag> getPossibleFirstTags() { 322 return tag == null ? SETCapabilities.getPossibleFirstTags() : ImmutableList.of(tag); 323 } 324 325 @Override 326 public Asn1Tag getTag() { 327 return tag; 328 } 329 330 @Override 331 public boolean isImplicitTagging() { 332 return true; 333 } 334 335 @Override public String toIndentedString(String indent) { 336 return "sETCapabilities : " 337 + getSETCapabilities().toIndentedString(indent); 338 } 339 }); 340 341 builder.add(new SequenceComponent() { 342 Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 1); 343 344 @Override public boolean isExplicitlySet() { 345 return getLocationId() != null; 346 } 347 348 @Override public boolean hasDefaultValue() { 349 return false; 350 } 351 352 @Override public boolean isOptional() { 353 return false; 354 } 355 356 @Override public Asn1Object getComponentValue() { 357 return getLocationId(); 358 } 359 360 @Override public void setToNewInstance() { 361 setLocationIdToNewInstance(); 362 } 363 364 @Override public Collection<Asn1Tag> getPossibleFirstTags() { 365 return tag == null ? LocationId.getPossibleFirstTags() : ImmutableList.of(tag); 366 } 367 368 @Override 369 public Asn1Tag getTag() { 370 return tag; 371 } 372 373 @Override 374 public boolean isImplicitTagging() { 375 return true; 376 } 377 378 @Override public String toIndentedString(String indent) { 379 return "locationId : " 380 + getLocationId().toIndentedString(indent); 381 } 382 }); 383 384 builder.add(new SequenceComponent() { 385 Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 2); 386 387 @Override public boolean isExplicitlySet() { 388 return getVer() != null; 389 } 390 391 @Override public boolean hasDefaultValue() { 392 return false; 393 } 394 395 @Override public boolean isOptional() { 396 return true; 397 } 398 399 @Override public Asn1Object getComponentValue() { 400 return getVer(); 401 } 402 403 @Override public void setToNewInstance() { 404 setVerToNewInstance(); 405 } 406 407 @Override public Collection<Asn1Tag> getPossibleFirstTags() { 408 return tag == null ? Ver.getPossibleFirstTags() : ImmutableList.of(tag); 409 } 410 411 @Override 412 public Asn1Tag getTag() { 413 return tag; 414 } 415 416 @Override 417 public boolean isImplicitTagging() { 418 return true; 419 } 420 421 @Override public String toIndentedString(String indent) { 422 return "ver : " 423 + getVer().toIndentedString(indent); 424 } 425 }); 426 427 builder.add(new SequenceComponent() { 428 Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 3); 429 430 @Override public boolean isExplicitlySet() { 431 return getQoP() != null; 432 } 433 434 @Override public boolean hasDefaultValue() { 435 return false; 436 } 437 438 @Override public boolean isOptional() { 439 return true; 440 } 441 442 @Override public Asn1Object getComponentValue() { 443 return getQoP(); 444 } 445 446 @Override public void setToNewInstance() { 447 setQoPToNewInstance(); 448 } 449 450 @Override public Collection<Asn1Tag> getPossibleFirstTags() { 451 return tag == null ? QoP.getPossibleFirstTags() : ImmutableList.of(tag); 452 } 453 454 @Override 455 public Asn1Tag getTag() { 456 return tag; 457 } 458 459 @Override 460 public boolean isImplicitTagging() { 461 return true; 462 } 463 464 @Override public String toIndentedString(String indent) { 465 return "qoP : " 466 + getQoP().toIndentedString(indent); 467 } 468 }); 469 470 builder.add(new SequenceComponent() { 471 Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 4); 472 473 @Override public boolean isExplicitlySet() { 474 return getMultipleLocationIds() != null; 475 } 476 477 @Override public boolean hasDefaultValue() { 478 return false; 479 } 480 481 @Override public boolean isOptional() { 482 return true; 483 } 484 485 @Override public Asn1Object getComponentValue() { 486 return getMultipleLocationIds(); 487 } 488 489 @Override public void setToNewInstance() { 490 setMultipleLocationIdsToNewInstance(); 491 } 492 493 @Override public Collection<Asn1Tag> getPossibleFirstTags() { 494 return tag == null ? MultipleLocationIds.getPossibleFirstTags() : ImmutableList.of(tag); 495 } 496 497 @Override 498 public Asn1Tag getTag() { 499 return tag; 500 } 501 502 @Override 503 public boolean isImplicitTagging() { 504 return true; 505 } 506 507 @Override public String toIndentedString(String indent) { 508 return "multipleLocationIds : " 509 + getMultipleLocationIds().toIndentedString(indent); 510 } 511 }); 512 513 builder.add(new SequenceComponent() { 514 Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 5); 515 516 @Override public boolean isExplicitlySet() { 517 return getThirdParty() != null; 518 } 519 520 @Override public boolean hasDefaultValue() { 521 return false; 522 } 523 524 @Override public boolean isOptional() { 525 return true; 526 } 527 528 @Override public Asn1Object getComponentValue() { 529 return getThirdParty(); 530 } 531 532 @Override public void setToNewInstance() { 533 setThirdPartyToNewInstance(); 534 } 535 536 @Override public Collection<Asn1Tag> getPossibleFirstTags() { 537 return tag == null ? ThirdParty.getPossibleFirstTags() : ImmutableList.of(tag); 538 } 539 540 @Override 541 public Asn1Tag getTag() { 542 return tag; 543 } 544 545 @Override 546 public boolean isImplicitTagging() { 547 return true; 548 } 549 550 @Override public String toIndentedString(String indent) { 551 return "thirdParty : " 552 + getThirdParty().toIndentedString(indent); 553 } 554 }); 555 556 builder.add(new SequenceComponent() { 557 Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 6); 558 559 @Override public boolean isExplicitlySet() { 560 return getApplicationID() != null; 561 } 562 563 @Override public boolean hasDefaultValue() { 564 return false; 565 } 566 567 @Override public boolean isOptional() { 568 return true; 569 } 570 571 @Override public Asn1Object getComponentValue() { 572 return getApplicationID(); 573 } 574 575 @Override public void setToNewInstance() { 576 setApplicationIDToNewInstance(); 577 } 578 579 @Override public Collection<Asn1Tag> getPossibleFirstTags() { 580 return tag == null ? ApplicationID.getPossibleFirstTags() : ImmutableList.of(tag); 581 } 582 583 @Override 584 public Asn1Tag getTag() { 585 return tag; 586 } 587 588 @Override 589 public boolean isImplicitTagging() { 590 return true; 591 } 592 593 @Override public String toIndentedString(String indent) { 594 return "applicationID : " 595 + getApplicationID().toIndentedString(indent); 596 } 597 }); 598 599 builder.add(new SequenceComponent() { 600 Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 7); 601 602 @Override public boolean isExplicitlySet() { 603 return getTriggerType() != null; 604 } 605 606 @Override public boolean hasDefaultValue() { 607 return false; 608 } 609 610 @Override public boolean isOptional() { 611 return true; 612 } 613 614 @Override public Asn1Object getComponentValue() { 615 return getTriggerType(); 616 } 617 618 @Override public void setToNewInstance() { 619 setTriggerTypeToNewInstance(); 620 } 621 622 @Override public Collection<Asn1Tag> getPossibleFirstTags() { 623 return tag == null ? TriggerType.getPossibleFirstTags() : ImmutableList.of(tag); 624 } 625 626 @Override 627 public Asn1Tag getTag() { 628 return tag; 629 } 630 631 @Override 632 public boolean isImplicitTagging() { 633 return true; 634 } 635 636 @Override public String toIndentedString(String indent) { 637 return "triggerType : " 638 + getTriggerType().toIndentedString(indent); 639 } 640 }); 641 642 builder.add(new SequenceComponent() { 643 Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 8); 644 645 @Override public boolean isExplicitlySet() { 646 return getTriggerParams() != null; 647 } 648 649 @Override public boolean hasDefaultValue() { 650 return false; 651 } 652 653 @Override public boolean isOptional() { 654 return true; 655 } 656 657 @Override public Asn1Object getComponentValue() { 658 return getTriggerParams(); 659 } 660 661 @Override public void setToNewInstance() { 662 setTriggerParamsToNewInstance(); 663 } 664 665 @Override public Collection<Asn1Tag> getPossibleFirstTags() { 666 return tag == null ? TriggerParams.getPossibleFirstTags() : ImmutableList.of(tag); 667 } 668 669 @Override 670 public Asn1Tag getTag() { 671 return tag; 672 } 673 674 @Override 675 public boolean isImplicitTagging() { 676 return true; 677 } 678 679 @Override public String toIndentedString(String indent) { 680 return "triggerParams : " 681 + getTriggerParams().toIndentedString(indent); 682 } 683 }); 684 685 builder.add(new SequenceComponent() { 686 Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 9); 687 688 @Override public boolean isExplicitlySet() { 689 return getPosition() != null; 690 } 691 692 @Override public boolean hasDefaultValue() { 693 return false; 694 } 695 696 @Override public boolean isOptional() { 697 return true; 698 } 699 700 @Override public Asn1Object getComponentValue() { 701 return getPosition(); 702 } 703 704 @Override public void setToNewInstance() { 705 setPositionToNewInstance(); 706 } 707 708 @Override public Collection<Asn1Tag> getPossibleFirstTags() { 709 return tag == null ? Position.getPossibleFirstTags() : ImmutableList.of(tag); 710 } 711 712 @Override 713 public Asn1Tag getTag() { 714 return tag; 715 } 716 717 @Override 718 public boolean isImplicitTagging() { 719 return true; 720 } 721 722 @Override public String toIndentedString(String indent) { 723 return "position : " 724 + getPosition().toIndentedString(indent); 725 } 726 }); 727 728 builder.add(new SequenceComponent() { 729 Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 10); 730 731 @Override public boolean isExplicitlySet() { 732 return getReportingCap() != null; 733 } 734 735 @Override public boolean hasDefaultValue() { 736 return false; 737 } 738 739 @Override public boolean isOptional() { 740 return true; 741 } 742 743 @Override public Asn1Object getComponentValue() { 744 return getReportingCap(); 745 } 746 747 @Override public void setToNewInstance() { 748 setReportingCapToNewInstance(); 749 } 750 751 @Override public Collection<Asn1Tag> getPossibleFirstTags() { 752 return tag == null ? ReportingCap.getPossibleFirstTags() : ImmutableList.of(tag); 753 } 754 755 @Override 756 public Asn1Tag getTag() { 757 return tag; 758 } 759 760 @Override 761 public boolean isImplicitTagging() { 762 return true; 763 } 764 765 @Override public String toIndentedString(String indent) { 766 return "reportingCap : " 767 + getReportingCap().toIndentedString(indent); 768 } 769 }); 770 771 builder.add(new SequenceComponent() { 772 Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 11); 773 774 @Override public boolean isExplicitlySet() { 775 return getCauseCode() != null; 776 } 777 778 @Override public boolean hasDefaultValue() { 779 return false; 780 } 781 782 @Override public boolean isOptional() { 783 return true; 784 } 785 786 @Override public Asn1Object getComponentValue() { 787 return getCauseCode(); 788 } 789 790 @Override public void setToNewInstance() { 791 setCauseCodeToNewInstance(); 792 } 793 794 @Override public Collection<Asn1Tag> getPossibleFirstTags() { 795 return tag == null ? CauseCode.getPossibleFirstTags() : ImmutableList.of(tag); 796 } 797 798 @Override 799 public Asn1Tag getTag() { 800 return tag; 801 } 802 803 @Override 804 public boolean isImplicitTagging() { 805 return true; 806 } 807 808 @Override public String toIndentedString(String indent) { 809 return "causeCode : " 810 + getCauseCode().toIndentedString(indent); 811 } 812 }); 813 814 return builder.build(); 815 } 816 817 @Override public Iterable<? extends SequenceComponent> 818 getExtensionComponents() { 819 ImmutableList.Builder<SequenceComponent> builder = ImmutableList.builder(); 820 821 return builder.build(); 822 } 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 @Override public Iterable<BitStream> encodePerUnaligned() { 853 return super.encodePerUnaligned(); 854 } 855 856 @Override public Iterable<BitStream> encodePerAligned() { 857 return super.encodePerAligned(); 858 } 859 860 @Override public void decodePerUnaligned(BitStreamReader reader) { 861 super.decodePerUnaligned(reader); 862 } 863 864 @Override public void decodePerAligned(BitStreamReader reader) { 865 super.decodePerAligned(reader); 866 } 867 868 @Override public String toString() { 869 return toIndentedString(""); 870 } 871 872 public String toIndentedString(String indent) { 873 StringBuilder builder = new StringBuilder(); 874 builder.append("Ver2_SUPLTRIGGEREDSTART = {\n"); 875 final String internalIndent = indent + " "; 876 for (SequenceComponent component : getComponents()) { 877 if (component.isExplicitlySet()) { 878 builder.append(internalIndent) 879 .append(component.toIndentedString(internalIndent)); 880 } 881 } 882 if (isExtensible()) { 883 builder.append(internalIndent).append("...\n"); 884 for (SequenceComponent component : getExtensionComponents()) { 885 if (component.isExplicitlySet()) { 886 builder.append(internalIndent) 887 .append(component.toIndentedString(internalIndent)); 888 } 889 } 890 } 891 builder.append(indent).append("};\n"); 892 return builder.toString(); 893 } 894 } 895