Home | History | Annotate | Download | only in supl_pos_init
      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_pos_init;
     18 
     19 /*
     20  */
     21 
     22 
     23 //
     24 //
     25 import android.location.cts.asn1.base.Asn1Integer;
     26 import android.location.cts.asn1.base.Asn1Null;
     27 import android.location.cts.asn1.base.Asn1Object;
     28 import android.location.cts.asn1.base.Asn1Sequence;
     29 import android.location.cts.asn1.base.Asn1Tag;
     30 import android.location.cts.asn1.base.BitStream;
     31 import android.location.cts.asn1.base.BitStreamReader;
     32 import android.location.cts.asn1.base.SequenceComponent;
     33 import com.google.common.collect.ImmutableList;
     34 import java.util.Collection;
     35 import javax.annotation.Nullable;
     36 
     37 
     38 /**
     39 */
     40 public  class NavigationModel extends Asn1Sequence {
     41   //
     42 
     43   private static final Asn1Tag TAG_NavigationModel
     44       = Asn1Tag.fromClassAndNumber(-1, -1);
     45 
     46   public NavigationModel() {
     47     super();
     48   }
     49 
     50   @Override
     51   @Nullable
     52   protected Asn1Tag getTag() {
     53     return TAG_NavigationModel;
     54   }
     55 
     56   @Override
     57   protected boolean isTagImplicit() {
     58     return true;
     59   }
     60 
     61   public static Collection<Asn1Tag> getPossibleFirstTags() {
     62     if (TAG_NavigationModel != null) {
     63       return ImmutableList.of(TAG_NavigationModel);
     64     } else {
     65       return Asn1Sequence.getPossibleFirstTags();
     66     }
     67   }
     68 
     69   /**
     70    * Creates a new NavigationModel from encoded stream.
     71    */
     72   public static NavigationModel fromPerUnaligned(byte[] encodedBytes) {
     73     NavigationModel result = new NavigationModel();
     74     result.decodePerUnaligned(new BitStreamReader(encodedBytes));
     75     return result;
     76   }
     77 
     78   /**
     79    * Creates a new NavigationModel from encoded stream.
     80    */
     81   public static NavigationModel fromPerAligned(byte[] encodedBytes) {
     82     NavigationModel result = new NavigationModel();
     83     result.decodePerAligned(new BitStreamReader(encodedBytes));
     84     return result;
     85   }
     86 
     87 
     88 
     89   @Override protected boolean isExtensible() {
     90     return true;
     91   }
     92 
     93   @Override public boolean containsExtensionValues() {
     94     for (SequenceComponent extensionComponent : getExtensionComponents()) {
     95       if (extensionComponent.isExplicitlySet()) return true;
     96     }
     97     return false;
     98   }
     99 
    100 
    101   private NavigationModel.gpsWeekType gpsWeek_;
    102   public NavigationModel.gpsWeekType getGpsWeek() {
    103     return gpsWeek_;
    104   }
    105   /**
    106    * @throws ClassCastException if value is not a NavigationModel.gpsWeekType
    107    */
    108   public void setGpsWeek(Asn1Object value) {
    109     this.gpsWeek_ = (NavigationModel.gpsWeekType) value;
    110   }
    111   public NavigationModel.gpsWeekType setGpsWeekToNewInstance() {
    112     gpsWeek_ = new NavigationModel.gpsWeekType();
    113     return gpsWeek_;
    114   }
    115 
    116   private NavigationModel.gpsToeType gpsToe_;
    117   public NavigationModel.gpsToeType getGpsToe() {
    118     return gpsToe_;
    119   }
    120   /**
    121    * @throws ClassCastException if value is not a NavigationModel.gpsToeType
    122    */
    123   public void setGpsToe(Asn1Object value) {
    124     this.gpsToe_ = (NavigationModel.gpsToeType) value;
    125   }
    126   public NavigationModel.gpsToeType setGpsToeToNewInstance() {
    127     gpsToe_ = new NavigationModel.gpsToeType();
    128     return gpsToe_;
    129   }
    130 
    131   private NavigationModel.nSATType nSAT_;
    132   public NavigationModel.nSATType getNSAT() {
    133     return nSAT_;
    134   }
    135   /**
    136    * @throws ClassCastException if value is not a NavigationModel.nSATType
    137    */
    138   public void setNSAT(Asn1Object value) {
    139     this.nSAT_ = (NavigationModel.nSATType) value;
    140   }
    141   public NavigationModel.nSATType setNSATToNewInstance() {
    142     nSAT_ = new NavigationModel.nSATType();
    143     return nSAT_;
    144   }
    145 
    146   private NavigationModel.toeLimitType toeLimit_;
    147   public NavigationModel.toeLimitType getToeLimit() {
    148     return toeLimit_;
    149   }
    150   /**
    151    * @throws ClassCastException if value is not a NavigationModel.toeLimitType
    152    */
    153   public void setToeLimit(Asn1Object value) {
    154     this.toeLimit_ = (NavigationModel.toeLimitType) value;
    155   }
    156   public NavigationModel.toeLimitType setToeLimitToNewInstance() {
    157     toeLimit_ = new NavigationModel.toeLimitType();
    158     return toeLimit_;
    159   }
    160 
    161   private SatelliteInfo satInfo_;
    162   public SatelliteInfo getSatInfo() {
    163     return satInfo_;
    164   }
    165   /**
    166    * @throws ClassCastException if value is not a SatelliteInfo
    167    */
    168   public void setSatInfo(Asn1Object value) {
    169     this.satInfo_ = (SatelliteInfo) value;
    170   }
    171   public SatelliteInfo setSatInfoToNewInstance() {
    172     satInfo_ = new SatelliteInfo();
    173     return satInfo_;
    174   }
    175 
    176 
    177 
    178 
    179 
    180 
    181   @Override public Iterable<? extends SequenceComponent> getComponents() {
    182     ImmutableList.Builder<SequenceComponent> builder = ImmutableList.builder();
    183 
    184     builder.add(new SequenceComponent() {
    185           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 0);
    186 
    187           @Override public boolean isExplicitlySet() {
    188             return getGpsWeek() != null;
    189           }
    190 
    191           @Override public boolean hasDefaultValue() {
    192             return false;
    193           }
    194 
    195           @Override public boolean isOptional() {
    196             return false;
    197           }
    198 
    199           @Override public Asn1Object getComponentValue() {
    200             return getGpsWeek();
    201           }
    202 
    203           @Override public void setToNewInstance() {
    204             setGpsWeekToNewInstance();
    205           }
    206 
    207           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
    208             return tag == null ? NavigationModel.gpsWeekType.getPossibleFirstTags() : ImmutableList.of(tag);
    209           }
    210 
    211           @Override
    212           public Asn1Tag getTag() {
    213             return tag;
    214           }
    215 
    216           @Override
    217           public boolean isImplicitTagging() {
    218             return true;
    219           }
    220 
    221           @Override public String toIndentedString(String indent) {
    222                 return "gpsWeek : "
    223                     + getGpsWeek().toIndentedString(indent);
    224               }
    225         });
    226 
    227     builder.add(new SequenceComponent() {
    228           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 1);
    229 
    230           @Override public boolean isExplicitlySet() {
    231             return getGpsToe() != null;
    232           }
    233 
    234           @Override public boolean hasDefaultValue() {
    235             return false;
    236           }
    237 
    238           @Override public boolean isOptional() {
    239             return false;
    240           }
    241 
    242           @Override public Asn1Object getComponentValue() {
    243             return getGpsToe();
    244           }
    245 
    246           @Override public void setToNewInstance() {
    247             setGpsToeToNewInstance();
    248           }
    249 
    250           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
    251             return tag == null ? NavigationModel.gpsToeType.getPossibleFirstTags() : ImmutableList.of(tag);
    252           }
    253 
    254           @Override
    255           public Asn1Tag getTag() {
    256             return tag;
    257           }
    258 
    259           @Override
    260           public boolean isImplicitTagging() {
    261             return true;
    262           }
    263 
    264           @Override public String toIndentedString(String indent) {
    265                 return "gpsToe : "
    266                     + getGpsToe().toIndentedString(indent);
    267               }
    268         });
    269 
    270     builder.add(new SequenceComponent() {
    271           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 2);
    272 
    273           @Override public boolean isExplicitlySet() {
    274             return getNSAT() != null;
    275           }
    276 
    277           @Override public boolean hasDefaultValue() {
    278             return false;
    279           }
    280 
    281           @Override public boolean isOptional() {
    282             return false;
    283           }
    284 
    285           @Override public Asn1Object getComponentValue() {
    286             return getNSAT();
    287           }
    288 
    289           @Override public void setToNewInstance() {
    290             setNSATToNewInstance();
    291           }
    292 
    293           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
    294             return tag == null ? NavigationModel.nSATType.getPossibleFirstTags() : ImmutableList.of(tag);
    295           }
    296 
    297           @Override
    298           public Asn1Tag getTag() {
    299             return tag;
    300           }
    301 
    302           @Override
    303           public boolean isImplicitTagging() {
    304             return true;
    305           }
    306 
    307           @Override public String toIndentedString(String indent) {
    308                 return "nSAT : "
    309                     + getNSAT().toIndentedString(indent);
    310               }
    311         });
    312 
    313     builder.add(new SequenceComponent() {
    314           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 3);
    315 
    316           @Override public boolean isExplicitlySet() {
    317             return getToeLimit() != null;
    318           }
    319 
    320           @Override public boolean hasDefaultValue() {
    321             return false;
    322           }
    323 
    324           @Override public boolean isOptional() {
    325             return false;
    326           }
    327 
    328           @Override public Asn1Object getComponentValue() {
    329             return getToeLimit();
    330           }
    331 
    332           @Override public void setToNewInstance() {
    333             setToeLimitToNewInstance();
    334           }
    335 
    336           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
    337             return tag == null ? NavigationModel.toeLimitType.getPossibleFirstTags() : ImmutableList.of(tag);
    338           }
    339 
    340           @Override
    341           public Asn1Tag getTag() {
    342             return tag;
    343           }
    344 
    345           @Override
    346           public boolean isImplicitTagging() {
    347             return true;
    348           }
    349 
    350           @Override public String toIndentedString(String indent) {
    351                 return "toeLimit : "
    352                     + getToeLimit().toIndentedString(indent);
    353               }
    354         });
    355 
    356     builder.add(new SequenceComponent() {
    357           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 4);
    358 
    359           @Override public boolean isExplicitlySet() {
    360             return getSatInfo() != null;
    361           }
    362 
    363           @Override public boolean hasDefaultValue() {
    364             return false;
    365           }
    366 
    367           @Override public boolean isOptional() {
    368             return true;
    369           }
    370 
    371           @Override public Asn1Object getComponentValue() {
    372             return getSatInfo();
    373           }
    374 
    375           @Override public void setToNewInstance() {
    376             setSatInfoToNewInstance();
    377           }
    378 
    379           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
    380             return tag == null ? SatelliteInfo.getPossibleFirstTags() : ImmutableList.of(tag);
    381           }
    382 
    383           @Override
    384           public Asn1Tag getTag() {
    385             return tag;
    386           }
    387 
    388           @Override
    389           public boolean isImplicitTagging() {
    390             return true;
    391           }
    392 
    393           @Override public String toIndentedString(String indent) {
    394                 return "satInfo : "
    395                     + getSatInfo().toIndentedString(indent);
    396               }
    397         });
    398 
    399     return builder.build();
    400   }
    401 
    402   @Override public Iterable<? extends SequenceComponent>
    403                                                     getExtensionComponents() {
    404     ImmutableList.Builder<SequenceComponent> builder = ImmutableList.builder();
    405 
    406       return builder.build();
    407     }
    408 
    409 
    410 /*
    411  */
    412 
    413 
    414 //
    415 
    416 /**
    417  */
    418 public static class gpsWeekType extends Asn1Integer {
    419   //
    420 
    421   private static final Asn1Tag TAG_gpsWeekType
    422       = Asn1Tag.fromClassAndNumber(-1, -1);
    423 
    424   public gpsWeekType() {
    425     super();
    426     setValueRange("0", "1023");
    427 
    428   }
    429 
    430   @Override
    431   @Nullable
    432   protected Asn1Tag getTag() {
    433     return TAG_gpsWeekType;
    434   }
    435 
    436   @Override
    437   protected boolean isTagImplicit() {
    438     return true;
    439   }
    440 
    441   public static Collection<Asn1Tag> getPossibleFirstTags() {
    442     if (TAG_gpsWeekType != null) {
    443       return ImmutableList.of(TAG_gpsWeekType);
    444     } else {
    445       return Asn1Integer.getPossibleFirstTags();
    446     }
    447   }
    448 
    449   /**
    450    * Creates a new gpsWeekType from encoded stream.
    451    */
    452   public static gpsWeekType fromPerUnaligned(byte[] encodedBytes) {
    453     gpsWeekType result = new gpsWeekType();
    454     result.decodePerUnaligned(new BitStreamReader(encodedBytes));
    455     return result;
    456   }
    457 
    458   /**
    459    * Creates a new gpsWeekType from encoded stream.
    460    */
    461   public static gpsWeekType fromPerAligned(byte[] encodedBytes) {
    462     gpsWeekType result = new gpsWeekType();
    463     result.decodePerAligned(new BitStreamReader(encodedBytes));
    464     return result;
    465   }
    466 
    467   @Override public Iterable<BitStream> encodePerUnaligned() {
    468     return super.encodePerUnaligned();
    469   }
    470 
    471   @Override public Iterable<BitStream> encodePerAligned() {
    472     return super.encodePerAligned();
    473   }
    474 
    475   @Override public void decodePerUnaligned(BitStreamReader reader) {
    476     super.decodePerUnaligned(reader);
    477   }
    478 
    479   @Override public void decodePerAligned(BitStreamReader reader) {
    480     super.decodePerAligned(reader);
    481   }
    482 
    483   @Override public String toString() {
    484     return toIndentedString("");
    485   }
    486 
    487   public String toIndentedString(String indent) {
    488     return "gpsWeekType = " + getInteger() + ";\n";
    489   }
    490 }
    491 
    492 
    493 /*
    494  */
    495 
    496 
    497 //
    498 
    499 /**
    500  */
    501 public static class gpsToeType extends Asn1Integer {
    502   //
    503 
    504   private static final Asn1Tag TAG_gpsToeType
    505       = Asn1Tag.fromClassAndNumber(-1, -1);
    506 
    507   public gpsToeType() {
    508     super();
    509     setValueRange("0", "167");
    510 
    511   }
    512 
    513   @Override
    514   @Nullable
    515   protected Asn1Tag getTag() {
    516     return TAG_gpsToeType;
    517   }
    518 
    519   @Override
    520   protected boolean isTagImplicit() {
    521     return true;
    522   }
    523 
    524   public static Collection<Asn1Tag> getPossibleFirstTags() {
    525     if (TAG_gpsToeType != null) {
    526       return ImmutableList.of(TAG_gpsToeType);
    527     } else {
    528       return Asn1Integer.getPossibleFirstTags();
    529     }
    530   }
    531 
    532   /**
    533    * Creates a new gpsToeType from encoded stream.
    534    */
    535   public static gpsToeType fromPerUnaligned(byte[] encodedBytes) {
    536     gpsToeType result = new gpsToeType();
    537     result.decodePerUnaligned(new BitStreamReader(encodedBytes));
    538     return result;
    539   }
    540 
    541   /**
    542    * Creates a new gpsToeType from encoded stream.
    543    */
    544   public static gpsToeType fromPerAligned(byte[] encodedBytes) {
    545     gpsToeType result = new gpsToeType();
    546     result.decodePerAligned(new BitStreamReader(encodedBytes));
    547     return result;
    548   }
    549 
    550   @Override public Iterable<BitStream> encodePerUnaligned() {
    551     return super.encodePerUnaligned();
    552   }
    553 
    554   @Override public Iterable<BitStream> encodePerAligned() {
    555     return super.encodePerAligned();
    556   }
    557 
    558   @Override public void decodePerUnaligned(BitStreamReader reader) {
    559     super.decodePerUnaligned(reader);
    560   }
    561 
    562   @Override public void decodePerAligned(BitStreamReader reader) {
    563     super.decodePerAligned(reader);
    564   }
    565 
    566   @Override public String toString() {
    567     return toIndentedString("");
    568   }
    569 
    570   public String toIndentedString(String indent) {
    571     return "gpsToeType = " + getInteger() + ";\n";
    572   }
    573 }
    574 
    575 
    576 /*
    577  */
    578 
    579 
    580 //
    581 
    582 /**
    583  */
    584 public static class nSATType extends Asn1Integer {
    585   //
    586 
    587   private static final Asn1Tag TAG_nSATType
    588       = Asn1Tag.fromClassAndNumber(-1, -1);
    589 
    590   public nSATType() {
    591     super();
    592     setValueRange("0", "31");
    593 
    594   }
    595 
    596   @Override
    597   @Nullable
    598   protected Asn1Tag getTag() {
    599     return TAG_nSATType;
    600   }
    601 
    602   @Override
    603   protected boolean isTagImplicit() {
    604     return true;
    605   }
    606 
    607   public static Collection<Asn1Tag> getPossibleFirstTags() {
    608     if (TAG_nSATType != null) {
    609       return ImmutableList.of(TAG_nSATType);
    610     } else {
    611       return Asn1Integer.getPossibleFirstTags();
    612     }
    613   }
    614 
    615   /**
    616    * Creates a new nSATType from encoded stream.
    617    */
    618   public static nSATType fromPerUnaligned(byte[] encodedBytes) {
    619     nSATType result = new nSATType();
    620     result.decodePerUnaligned(new BitStreamReader(encodedBytes));
    621     return result;
    622   }
    623 
    624   /**
    625    * Creates a new nSATType from encoded stream.
    626    */
    627   public static nSATType fromPerAligned(byte[] encodedBytes) {
    628     nSATType result = new nSATType();
    629     result.decodePerAligned(new BitStreamReader(encodedBytes));
    630     return result;
    631   }
    632 
    633   @Override public Iterable<BitStream> encodePerUnaligned() {
    634     return super.encodePerUnaligned();
    635   }
    636 
    637   @Override public Iterable<BitStream> encodePerAligned() {
    638     return super.encodePerAligned();
    639   }
    640 
    641   @Override public void decodePerUnaligned(BitStreamReader reader) {
    642     super.decodePerUnaligned(reader);
    643   }
    644 
    645   @Override public void decodePerAligned(BitStreamReader reader) {
    646     super.decodePerAligned(reader);
    647   }
    648 
    649   @Override public String toString() {
    650     return toIndentedString("");
    651   }
    652 
    653   public String toIndentedString(String indent) {
    654     return "nSATType = " + getInteger() + ";\n";
    655   }
    656 }
    657 
    658 
    659 /*
    660  */
    661 
    662 
    663 //
    664 
    665 /**
    666  */
    667 public static class toeLimitType extends Asn1Integer {
    668   //
    669 
    670   private static final Asn1Tag TAG_toeLimitType
    671       = Asn1Tag.fromClassAndNumber(-1, -1);
    672 
    673   public toeLimitType() {
    674     super();
    675     setValueRange("0", "10");
    676 
    677   }
    678 
    679   @Override
    680   @Nullable
    681   protected Asn1Tag getTag() {
    682     return TAG_toeLimitType;
    683   }
    684 
    685   @Override
    686   protected boolean isTagImplicit() {
    687     return true;
    688   }
    689 
    690   public static Collection<Asn1Tag> getPossibleFirstTags() {
    691     if (TAG_toeLimitType != null) {
    692       return ImmutableList.of(TAG_toeLimitType);
    693     } else {
    694       return Asn1Integer.getPossibleFirstTags();
    695     }
    696   }
    697 
    698   /**
    699    * Creates a new toeLimitType from encoded stream.
    700    */
    701   public static toeLimitType fromPerUnaligned(byte[] encodedBytes) {
    702     toeLimitType result = new toeLimitType();
    703     result.decodePerUnaligned(new BitStreamReader(encodedBytes));
    704     return result;
    705   }
    706 
    707   /**
    708    * Creates a new toeLimitType from encoded stream.
    709    */
    710   public static toeLimitType fromPerAligned(byte[] encodedBytes) {
    711     toeLimitType result = new toeLimitType();
    712     result.decodePerAligned(new BitStreamReader(encodedBytes));
    713     return result;
    714   }
    715 
    716   @Override public Iterable<BitStream> encodePerUnaligned() {
    717     return super.encodePerUnaligned();
    718   }
    719 
    720   @Override public Iterable<BitStream> encodePerAligned() {
    721     return super.encodePerAligned();
    722   }
    723 
    724   @Override public void decodePerUnaligned(BitStreamReader reader) {
    725     super.decodePerUnaligned(reader);
    726   }
    727 
    728   @Override public void decodePerAligned(BitStreamReader reader) {
    729     super.decodePerAligned(reader);
    730   }
    731 
    732   @Override public String toString() {
    733     return toIndentedString("");
    734   }
    735 
    736   public String toIndentedString(String indent) {
    737     return "toeLimitType = " + getInteger() + ";\n";
    738   }
    739 }
    740 
    741 
    742 
    743 
    744 
    745 
    746 
    747   @Override public Iterable<BitStream> encodePerUnaligned() {
    748     return super.encodePerUnaligned();
    749   }
    750 
    751   @Override public Iterable<BitStream> encodePerAligned() {
    752     return super.encodePerAligned();
    753   }
    754 
    755   @Override public void decodePerUnaligned(BitStreamReader reader) {
    756     super.decodePerUnaligned(reader);
    757   }
    758 
    759   @Override public void decodePerAligned(BitStreamReader reader) {
    760     super.decodePerAligned(reader);
    761   }
    762 
    763   @Override public String toString() {
    764     return toIndentedString("");
    765   }
    766 
    767   public String toIndentedString(String indent) {
    768     StringBuilder builder = new StringBuilder();
    769     builder.append("NavigationModel = {\n");
    770     final String internalIndent = indent + "  ";
    771     for (SequenceComponent component : getComponents()) {
    772       if (component.isExplicitlySet()) {
    773         builder.append(internalIndent)
    774             .append(component.toIndentedString(internalIndent));
    775       }
    776     }
    777     if (isExtensible()) {
    778       builder.append(internalIndent).append("...\n");
    779       for (SequenceComponent component : getExtensionComponents()) {
    780         if (component.isExplicitlySet()) {
    781           builder.append(internalIndent)
    782               .append(component.toIndentedString(internalIndent));
    783         }
    784       }
    785     }
    786     builder.append(indent).append("};\n");
    787     return builder.toString();
    788   }
    789 }
    790