Home | History | Annotate | Download | only in ulp_version_2_message_extensions
      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.ulp_version_2_message_extensions;
     18 
     19 /*
     20  */
     21 
     22 
     23 //
     24 //
     25 import android.location.cts.asn1.base.Asn1Enumerated;
     26 import android.location.cts.asn1.base.Asn1Tag;
     27 import android.location.cts.asn1.base.BitStream;
     28 import android.location.cts.asn1.base.BitStreamReader;
     29 import com.google.common.collect.ImmutableList;
     30 import java.util.Collection;
     31 import javax.annotation.Nullable;
     32 
     33 
     34 /**
     35  */
     36 public  class NotificationMode extends Asn1Enumerated {
     37   public enum Value implements Asn1Enumerated.Value {
     38     normal(0),
     39     basedOnLocation(1),
     40     ;
     41 
     42     Value(int i) {
     43       value = i;
     44     }
     45 
     46     private int value;
     47     public int getAssignedValue() {
     48       return value;
     49     }
     50 
     51     @Override public boolean isExtensionValue() {
     52       return false;
     53     }
     54   }
     55 
     56   public enum ExtensionValue implements Asn1Enumerated.Value {
     57     ;
     58 
     59     ExtensionValue(int i) {
     60       value = i;
     61     }
     62 
     63     private int value;
     64     @Override public int getAssignedValue() {
     65       return value;
     66     }
     67 
     68     @Override public boolean isExtensionValue() {
     69       return true;
     70     }
     71   }
     72 
     73 
     74 
     75   private static final Asn1Tag TAG_NotificationMode
     76       = Asn1Tag.fromClassAndNumber(-1, -1);
     77 
     78   public NotificationMode() {
     79     super();
     80   }
     81 
     82   @Override
     83   @Nullable
     84   protected Asn1Tag getTag() {
     85     return TAG_NotificationMode;
     86   }
     87 
     88   @Override
     89   protected boolean isTagImplicit() {
     90     return true;
     91   }
     92 
     93   public static Collection<Asn1Tag> getPossibleFirstTags() {
     94     if (TAG_NotificationMode != null) {
     95       return ImmutableList.of(TAG_NotificationMode);
     96     } else {
     97       return Asn1Enumerated.getPossibleFirstTags();
     98     }
     99   }
    100 
    101   @Override protected boolean isExtensible() {
    102     return true;
    103   }
    104 
    105   @Override protected Asn1Enumerated.Value lookupValue(int ordinal) {
    106     return Value.values()[ordinal];
    107   }
    108 
    109   @Override protected Asn1Enumerated.Value lookupExtensionValue(int ordinal) {
    110     return ExtensionValue.values()[ordinal];
    111   }
    112 
    113   @Override protected int getValueCount() {
    114     return Value.values().length;
    115   }
    116 
    117   /**
    118    * Creates a new NotificationMode from encoded stream.
    119    */
    120   public static NotificationMode fromPerUnaligned(byte[] encodedBytes) {
    121     NotificationMode result = new NotificationMode();
    122     result.decodePerUnaligned(new BitStreamReader(encodedBytes));
    123     return result;
    124   }
    125 
    126   /**
    127    * Creates a new NotificationMode from encoded stream.
    128    */
    129   public static NotificationMode fromPerAligned(byte[] encodedBytes) {
    130     NotificationMode result = new NotificationMode();
    131     result.decodePerAligned(new BitStreamReader(encodedBytes));
    132     return result;
    133   }
    134 
    135   @Override public Iterable<BitStream> encodePerUnaligned() {
    136     return super.encodePerUnaligned();
    137   }
    138 
    139   @Override public Iterable<BitStream> encodePerAligned() {
    140     return super.encodePerAligned();
    141   }
    142 
    143   @Override public void decodePerUnaligned(BitStreamReader reader) {
    144     super.decodePerUnaligned(reader);
    145   }
    146 
    147   @Override public void decodePerAligned(BitStreamReader reader) {
    148     super.decodePerAligned(reader);
    149   }
    150 
    151   @Override public String toString() {
    152     return toIndentedString("");
    153   }
    154 
    155   public String toIndentedString(String indent) {
    156     return "NotificationMode = " + getValue() + ";\n";
    157   }
    158 }
    159