Home | History | Annotate | Download | only in supl_report
      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_report;
     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.Ver;
     34 import com.google.common.collect.ImmutableList;
     35 import java.util.Collection;
     36 import javax.annotation.Nullable;
     37 
     38 
     39 /**
     40 */
     41 public  class Ver2_SUPLREPORT extends Asn1Sequence {
     42   //
     43 
     44   private static final Asn1Tag TAG_Ver2_SUPLREPORT
     45       = Asn1Tag.fromClassAndNumber(-1, -1);
     46 
     47   public Ver2_SUPLREPORT() {
     48     super();
     49   }
     50 
     51   @Override
     52   @Nullable
     53   protected Asn1Tag getTag() {
     54     return TAG_Ver2_SUPLREPORT;
     55   }
     56 
     57   @Override
     58   protected boolean isTagImplicit() {
     59     return true;
     60   }
     61 
     62   public static Collection<Asn1Tag> getPossibleFirstTags() {
     63     if (TAG_Ver2_SUPLREPORT != null) {
     64       return ImmutableList.of(TAG_Ver2_SUPLREPORT);
     65     } else {
     66       return Asn1Sequence.getPossibleFirstTags();
     67     }
     68   }
     69 
     70   /**
     71    * Creates a new Ver2_SUPLREPORT from encoded stream.
     72    */
     73   public static Ver2_SUPLREPORT fromPerUnaligned(byte[] encodedBytes) {
     74     Ver2_SUPLREPORT result = new Ver2_SUPLREPORT();
     75     result.decodePerUnaligned(new BitStreamReader(encodedBytes));
     76     return result;
     77   }
     78 
     79   /**
     80    * Creates a new Ver2_SUPLREPORT from encoded stream.
     81    */
     82   public static Ver2_SUPLREPORT fromPerAligned(byte[] encodedBytes) {
     83     Ver2_SUPLREPORT result = new Ver2_SUPLREPORT();
     84     result.decodePerAligned(new BitStreamReader(encodedBytes));
     85     return result;
     86   }
     87 
     88 
     89 
     90   @Override protected boolean isExtensible() {
     91     return true;
     92   }
     93 
     94   @Override public boolean containsExtensionValues() {
     95     for (SequenceComponent extensionComponent : getExtensionComponents()) {
     96       if (extensionComponent.isExplicitlySet()) return true;
     97     }
     98     return false;
     99   }
    100 
    101 
    102   private SessionList sessionList_;
    103   public SessionList getSessionList() {
    104     return sessionList_;
    105   }
    106   /**
    107    * @throws ClassCastException if value is not a SessionList
    108    */
    109   public void setSessionList(Asn1Object value) {
    110     this.sessionList_ = (SessionList) value;
    111   }
    112   public SessionList setSessionListToNewInstance() {
    113     sessionList_ = new SessionList();
    114     return sessionList_;
    115   }
    116 
    117   private SETCapabilities sETCapabilities_;
    118   public SETCapabilities getSETCapabilities() {
    119     return sETCapabilities_;
    120   }
    121   /**
    122    * @throws ClassCastException if value is not a SETCapabilities
    123    */
    124   public void setSETCapabilities(Asn1Object value) {
    125     this.sETCapabilities_ = (SETCapabilities) value;
    126   }
    127   public SETCapabilities setSETCapabilitiesToNewInstance() {
    128     sETCapabilities_ = new SETCapabilities();
    129     return sETCapabilities_;
    130   }
    131 
    132   private ReportDataList reportDataList_;
    133   public ReportDataList getReportDataList() {
    134     return reportDataList_;
    135   }
    136   /**
    137    * @throws ClassCastException if value is not a ReportDataList
    138    */
    139   public void setReportDataList(Asn1Object value) {
    140     this.reportDataList_ = (ReportDataList) value;
    141   }
    142   public ReportDataList setReportDataListToNewInstance() {
    143     reportDataList_ = new ReportDataList();
    144     return reportDataList_;
    145   }
    146 
    147   private Ver ver_;
    148   public Ver getVer() {
    149     return ver_;
    150   }
    151   /**
    152    * @throws ClassCastException if value is not a Ver
    153    */
    154   public void setVer(Asn1Object value) {
    155     this.ver_ = (Ver) value;
    156   }
    157   public Ver setVerToNewInstance() {
    158     ver_ = new Ver();
    159     return ver_;
    160   }
    161 
    162   private Ver2_SUPLREPORT.moreComponentsType moreComponents_;
    163   public Ver2_SUPLREPORT.moreComponentsType getMoreComponents() {
    164     return moreComponents_;
    165   }
    166   /**
    167    * @throws ClassCastException if value is not a Ver2_SUPLREPORT.moreComponentsType
    168    */
    169   public void setMoreComponents(Asn1Object value) {
    170     this.moreComponents_ = (Ver2_SUPLREPORT.moreComponentsType) value;
    171   }
    172   public Ver2_SUPLREPORT.moreComponentsType setMoreComponentsToNewInstance() {
    173     moreComponents_ = new Ver2_SUPLREPORT.moreComponentsType();
    174     return moreComponents_;
    175   }
    176 
    177 
    178 
    179 
    180 
    181 
    182   @Override public Iterable<? extends SequenceComponent> getComponents() {
    183     ImmutableList.Builder<SequenceComponent> builder = ImmutableList.builder();
    184 
    185     builder.add(new SequenceComponent() {
    186           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 0);
    187 
    188           @Override public boolean isExplicitlySet() {
    189             return getSessionList() != null;
    190           }
    191 
    192           @Override public boolean hasDefaultValue() {
    193             return false;
    194           }
    195 
    196           @Override public boolean isOptional() {
    197             return true;
    198           }
    199 
    200           @Override public Asn1Object getComponentValue() {
    201             return getSessionList();
    202           }
    203 
    204           @Override public void setToNewInstance() {
    205             setSessionListToNewInstance();
    206           }
    207 
    208           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
    209             return tag == null ? SessionList.getPossibleFirstTags() : ImmutableList.of(tag);
    210           }
    211 
    212           @Override
    213           public Asn1Tag getTag() {
    214             return tag;
    215           }
    216 
    217           @Override
    218           public boolean isImplicitTagging() {
    219             return true;
    220           }
    221 
    222           @Override public String toIndentedString(String indent) {
    223                 return "sessionList : "
    224                     + getSessionList().toIndentedString(indent);
    225               }
    226         });
    227 
    228     builder.add(new SequenceComponent() {
    229           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 1);
    230 
    231           @Override public boolean isExplicitlySet() {
    232             return getSETCapabilities() != null;
    233           }
    234 
    235           @Override public boolean hasDefaultValue() {
    236             return false;
    237           }
    238 
    239           @Override public boolean isOptional() {
    240             return true;
    241           }
    242 
    243           @Override public Asn1Object getComponentValue() {
    244             return getSETCapabilities();
    245           }
    246 
    247           @Override public void setToNewInstance() {
    248             setSETCapabilitiesToNewInstance();
    249           }
    250 
    251           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
    252             return tag == null ? SETCapabilities.getPossibleFirstTags() : ImmutableList.of(tag);
    253           }
    254 
    255           @Override
    256           public Asn1Tag getTag() {
    257             return tag;
    258           }
    259 
    260           @Override
    261           public boolean isImplicitTagging() {
    262             return true;
    263           }
    264 
    265           @Override public String toIndentedString(String indent) {
    266                 return "sETCapabilities : "
    267                     + getSETCapabilities().toIndentedString(indent);
    268               }
    269         });
    270 
    271     builder.add(new SequenceComponent() {
    272           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 2);
    273 
    274           @Override public boolean isExplicitlySet() {
    275             return getReportDataList() != null;
    276           }
    277 
    278           @Override public boolean hasDefaultValue() {
    279             return false;
    280           }
    281 
    282           @Override public boolean isOptional() {
    283             return true;
    284           }
    285 
    286           @Override public Asn1Object getComponentValue() {
    287             return getReportDataList();
    288           }
    289 
    290           @Override public void setToNewInstance() {
    291             setReportDataListToNewInstance();
    292           }
    293 
    294           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
    295             return tag == null ? ReportDataList.getPossibleFirstTags() : ImmutableList.of(tag);
    296           }
    297 
    298           @Override
    299           public Asn1Tag getTag() {
    300             return tag;
    301           }
    302 
    303           @Override
    304           public boolean isImplicitTagging() {
    305             return true;
    306           }
    307 
    308           @Override public String toIndentedString(String indent) {
    309                 return "reportDataList : "
    310                     + getReportDataList().toIndentedString(indent);
    311               }
    312         });
    313 
    314     builder.add(new SequenceComponent() {
    315           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 3);
    316 
    317           @Override public boolean isExplicitlySet() {
    318             return getVer() != null;
    319           }
    320 
    321           @Override public boolean hasDefaultValue() {
    322             return false;
    323           }
    324 
    325           @Override public boolean isOptional() {
    326             return true;
    327           }
    328 
    329           @Override public Asn1Object getComponentValue() {
    330             return getVer();
    331           }
    332 
    333           @Override public void setToNewInstance() {
    334             setVerToNewInstance();
    335           }
    336 
    337           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
    338             return tag == null ? Ver.getPossibleFirstTags() : ImmutableList.of(tag);
    339           }
    340 
    341           @Override
    342           public Asn1Tag getTag() {
    343             return tag;
    344           }
    345 
    346           @Override
    347           public boolean isImplicitTagging() {
    348             return true;
    349           }
    350 
    351           @Override public String toIndentedString(String indent) {
    352                 return "ver : "
    353                     + getVer().toIndentedString(indent);
    354               }
    355         });
    356 
    357     builder.add(new SequenceComponent() {
    358           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 4);
    359 
    360           @Override public boolean isExplicitlySet() {
    361             return getMoreComponents() != null;
    362           }
    363 
    364           @Override public boolean hasDefaultValue() {
    365             return false;
    366           }
    367 
    368           @Override public boolean isOptional() {
    369             return true;
    370           }
    371 
    372           @Override public Asn1Object getComponentValue() {
    373             return getMoreComponents();
    374           }
    375 
    376           @Override public void setToNewInstance() {
    377             setMoreComponentsToNewInstance();
    378           }
    379 
    380           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
    381             return tag == null ? Ver2_SUPLREPORT.moreComponentsType.getPossibleFirstTags() : ImmutableList.of(tag);
    382           }
    383 
    384           @Override
    385           public Asn1Tag getTag() {
    386             return tag;
    387           }
    388 
    389           @Override
    390           public boolean isImplicitTagging() {
    391             return true;
    392           }
    393 
    394           @Override public String toIndentedString(String indent) {
    395                 return "moreComponents : "
    396                     + getMoreComponents().toIndentedString(indent);
    397               }
    398         });
    399 
    400     return builder.build();
    401   }
    402 
    403   @Override public Iterable<? extends SequenceComponent>
    404                                                     getExtensionComponents() {
    405     ImmutableList.Builder<SequenceComponent> builder = ImmutableList.builder();
    406 
    407       return builder.build();
    408     }
    409 
    410 
    411 
    412 
    413 
    414 
    415 
    416 
    417 
    418 
    419 /*
    420  */
    421 
    422 
    423 //
    424 
    425 /**
    426  */
    427 public static class moreComponentsType extends Asn1Null {
    428   //
    429 
    430   private static final Asn1Tag TAG_moreComponentsType
    431       = Asn1Tag.fromClassAndNumber(-1, -1);
    432 
    433   public moreComponentsType() {
    434     super();
    435   }
    436 
    437   @Override
    438   @Nullable
    439   protected Asn1Tag getTag() {
    440     return TAG_moreComponentsType;
    441   }
    442 
    443   @Override
    444   protected boolean isTagImplicit() {
    445     return true;
    446   }
    447 
    448   public static Collection<Asn1Tag> getPossibleFirstTags() {
    449     if (TAG_moreComponentsType != null) {
    450       return ImmutableList.of(TAG_moreComponentsType);
    451     } else {
    452       return Asn1Null.getPossibleFirstTags();
    453     }
    454   }
    455 
    456   /**
    457    * Creates a new moreComponentsType from encoded stream.
    458    */
    459   public static moreComponentsType fromPerUnaligned(byte[] encodedBytes) {
    460     moreComponentsType result = new moreComponentsType();
    461     result.decodePerUnaligned(new BitStreamReader(encodedBytes));
    462     return result;
    463   }
    464 
    465   /**
    466    * Creates a new moreComponentsType from encoded stream.
    467    */
    468   public static moreComponentsType fromPerAligned(byte[] encodedBytes) {
    469     moreComponentsType result = new moreComponentsType();
    470     result.decodePerAligned(new BitStreamReader(encodedBytes));
    471     return result;
    472   }
    473 
    474   @Override public Iterable<BitStream> encodePerUnaligned() {
    475     return super.encodePerUnaligned();
    476   }
    477 
    478   @Override public Iterable<BitStream> encodePerAligned() {
    479     return super.encodePerAligned();
    480   }
    481 
    482   @Override public void decodePerUnaligned(BitStreamReader reader) {
    483     super.decodePerUnaligned(reader);
    484   }
    485 
    486   @Override public void decodePerAligned(BitStreamReader reader) {
    487     super.decodePerAligned(reader);
    488   }
    489 
    490   @Override public String toString() {
    491     return toIndentedString("");
    492   }
    493 
    494   public String toIndentedString(String indent) {
    495     return "moreComponentsType (null value);\n";
    496   }
    497 }
    498 
    499 
    500 
    501 
    502 
    503   @Override public Iterable<BitStream> encodePerUnaligned() {
    504     return super.encodePerUnaligned();
    505   }
    506 
    507   @Override public Iterable<BitStream> encodePerAligned() {
    508     return super.encodePerAligned();
    509   }
    510 
    511   @Override public void decodePerUnaligned(BitStreamReader reader) {
    512     super.decodePerUnaligned(reader);
    513   }
    514 
    515   @Override public void decodePerAligned(BitStreamReader reader) {
    516     super.decodePerAligned(reader);
    517   }
    518 
    519   @Override public String toString() {
    520     return toIndentedString("");
    521   }
    522 
    523   public String toIndentedString(String indent) {
    524     StringBuilder builder = new StringBuilder();
    525     builder.append("Ver2_SUPLREPORT = {\n");
    526     final String internalIndent = indent + "  ";
    527     for (SequenceComponent component : getComponents()) {
    528       if (component.isExplicitlySet()) {
    529         builder.append(internalIndent)
    530             .append(component.toIndentedString(internalIndent));
    531       }
    532     }
    533     if (isExtensible()) {
    534       builder.append(internalIndent).append("...\n");
    535       for (SequenceComponent component : getExtensionComponents()) {
    536         if (component.isExplicitlySet()) {
    537           builder.append(internalIndent)
    538               .append(component.toIndentedString(internalIndent));
    539         }
    540       }
    541     }
    542     builder.append(indent).append("};\n");
    543     return builder.toString();
    544   }
    545 }
    546