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_response;
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_triggered_start.TriggerParams;
33 import android.location.cts.asn1.supl2.ulp_components.PosMethod;
34 import android.location.cts.asn1.supl2.ulp_components.SLPAddress;
35 import android.location.cts.asn1.supl2.ver2_ulp_components.GNSSPosTechnology;
36 import android.location.cts.asn1.supl2.ver2_ulp_components.SPCSETKey;
37 import android.location.cts.asn1.supl2.ver2_ulp_components.SPCSETKeylifetime;
38 import android.location.cts.asn1.supl2.ver2_ulp_components.SPCTID;
39 import android.location.cts.asn1.supl2.ver2_ulp_components.SupportedNetworkInformation;
40 import com.google.common.collect.ImmutableList;
41 import java.util.Collection;
42 import javax.annotation.Nullable;
43 
44 
45 /**
46 */
47 public  class Ver2_SUPLTRIGGEREDRESPONSE extends Asn1Sequence {
48   //
49 
50   private static final Asn1Tag TAG_Ver2_SUPLTRIGGEREDRESPONSE
51       = Asn1Tag.fromClassAndNumber(-1, -1);
52 
Ver2_SUPLTRIGGEREDRESPONSE()53   public Ver2_SUPLTRIGGEREDRESPONSE() {
54     super();
55   }
56 
57   @Override
58   @Nullable
getTag()59   protected Asn1Tag getTag() {
60     return TAG_Ver2_SUPLTRIGGEREDRESPONSE;
61   }
62 
63   @Override
isTagImplicit()64   protected boolean isTagImplicit() {
65     return true;
66   }
67 
getPossibleFirstTags()68   public static Collection<Asn1Tag> getPossibleFirstTags() {
69     if (TAG_Ver2_SUPLTRIGGEREDRESPONSE != null) {
70       return ImmutableList.of(TAG_Ver2_SUPLTRIGGEREDRESPONSE);
71     } else {
72       return Asn1Sequence.getPossibleFirstTags();
73     }
74   }
75 
76   /**
77    * Creates a new Ver2_SUPLTRIGGEREDRESPONSE from encoded stream.
78    */
fromPerUnaligned(byte[] encodedBytes)79   public static Ver2_SUPLTRIGGEREDRESPONSE fromPerUnaligned(byte[] encodedBytes) {
80     Ver2_SUPLTRIGGEREDRESPONSE result = new Ver2_SUPLTRIGGEREDRESPONSE();
81     result.decodePerUnaligned(new BitStreamReader(encodedBytes));
82     return result;
83   }
84 
85   /**
86    * Creates a new Ver2_SUPLTRIGGEREDRESPONSE from encoded stream.
87    */
fromPerAligned(byte[] encodedBytes)88   public static Ver2_SUPLTRIGGEREDRESPONSE fromPerAligned(byte[] encodedBytes) {
89     Ver2_SUPLTRIGGEREDRESPONSE result = new Ver2_SUPLTRIGGEREDRESPONSE();
90     result.decodePerAligned(new BitStreamReader(encodedBytes));
91     return result;
92   }
93 
94 
95 
isExtensible()96   @Override protected boolean isExtensible() {
97     return true;
98   }
99 
containsExtensionValues()100   @Override public boolean containsExtensionValues() {
101     for (SequenceComponent extensionComponent : getExtensionComponents()) {
102       if (extensionComponent.isExplicitlySet()) return true;
103     }
104     return false;
105   }
106 
107 
108   private PosMethod posMethod_;
getPosMethod()109   public PosMethod getPosMethod() {
110     return posMethod_;
111   }
112   /**
113    * @throws ClassCastException if value is not a PosMethod
114    */
setPosMethod(Asn1Object value)115   public void setPosMethod(Asn1Object value) {
116     this.posMethod_ = (PosMethod) value;
117   }
setPosMethodToNewInstance()118   public PosMethod setPosMethodToNewInstance() {
119     posMethod_ = new PosMethod();
120     return posMethod_;
121   }
122 
123   private TriggerParams triggerParams_;
getTriggerParams()124   public TriggerParams getTriggerParams() {
125     return triggerParams_;
126   }
127   /**
128    * @throws ClassCastException if value is not a TriggerParams
129    */
setTriggerParams(Asn1Object value)130   public void setTriggerParams(Asn1Object value) {
131     this.triggerParams_ = (TriggerParams) value;
132   }
setTriggerParamsToNewInstance()133   public TriggerParams setTriggerParamsToNewInstance() {
134     triggerParams_ = new TriggerParams();
135     return triggerParams_;
136   }
137 
138   private SLPAddress sLPAddress_;
getSLPAddress()139   public SLPAddress getSLPAddress() {
140     return sLPAddress_;
141   }
142   /**
143    * @throws ClassCastException if value is not a SLPAddress
144    */
setSLPAddress(Asn1Object value)145   public void setSLPAddress(Asn1Object value) {
146     this.sLPAddress_ = (SLPAddress) value;
147   }
setSLPAddressToNewInstance()148   public SLPAddress setSLPAddressToNewInstance() {
149     sLPAddress_ = new SLPAddress();
150     return sLPAddress_;
151   }
152 
153   private SupportedNetworkInformation supportedNetworkInformation_;
getSupportedNetworkInformation()154   public SupportedNetworkInformation getSupportedNetworkInformation() {
155     return supportedNetworkInformation_;
156   }
157   /**
158    * @throws ClassCastException if value is not a SupportedNetworkInformation
159    */
setSupportedNetworkInformation(Asn1Object value)160   public void setSupportedNetworkInformation(Asn1Object value) {
161     this.supportedNetworkInformation_ = (SupportedNetworkInformation) value;
162   }
setSupportedNetworkInformationToNewInstance()163   public SupportedNetworkInformation setSupportedNetworkInformationToNewInstance() {
164     supportedNetworkInformation_ = new SupportedNetworkInformation();
165     return supportedNetworkInformation_;
166   }
167 
168   private ReportingMode reportingMode_;
getReportingMode()169   public ReportingMode getReportingMode() {
170     return reportingMode_;
171   }
172   /**
173    * @throws ClassCastException if value is not a ReportingMode
174    */
setReportingMode(Asn1Object value)175   public void setReportingMode(Asn1Object value) {
176     this.reportingMode_ = (ReportingMode) value;
177   }
setReportingModeToNewInstance()178   public ReportingMode setReportingModeToNewInstance() {
179     reportingMode_ = new ReportingMode();
180     return reportingMode_;
181   }
182 
183   private SPCSETKey sPCSETKey_;
getSPCSETKey()184   public SPCSETKey getSPCSETKey() {
185     return sPCSETKey_;
186   }
187   /**
188    * @throws ClassCastException if value is not a SPCSETKey
189    */
setSPCSETKey(Asn1Object value)190   public void setSPCSETKey(Asn1Object value) {
191     this.sPCSETKey_ = (SPCSETKey) value;
192   }
setSPCSETKeyToNewInstance()193   public SPCSETKey setSPCSETKeyToNewInstance() {
194     sPCSETKey_ = new SPCSETKey();
195     return sPCSETKey_;
196   }
197 
198   private SPCTID sPCTID_;
getSPCTID()199   public SPCTID getSPCTID() {
200     return sPCTID_;
201   }
202   /**
203    * @throws ClassCastException if value is not a SPCTID
204    */
setSPCTID(Asn1Object value)205   public void setSPCTID(Asn1Object value) {
206     this.sPCTID_ = (SPCTID) value;
207   }
setSPCTIDToNewInstance()208   public SPCTID setSPCTIDToNewInstance() {
209     sPCTID_ = new SPCTID();
210     return sPCTID_;
211   }
212 
213   private SPCSETKeylifetime sPCSETKeylifetime_;
getSPCSETKeylifetime()214   public SPCSETKeylifetime getSPCSETKeylifetime() {
215     return sPCSETKeylifetime_;
216   }
217   /**
218    * @throws ClassCastException if value is not a SPCSETKeylifetime
219    */
setSPCSETKeylifetime(Asn1Object value)220   public void setSPCSETKeylifetime(Asn1Object value) {
221     this.sPCSETKeylifetime_ = (SPCSETKeylifetime) value;
222   }
setSPCSETKeylifetimeToNewInstance()223   public SPCSETKeylifetime setSPCSETKeylifetimeToNewInstance() {
224     sPCSETKeylifetime_ = new SPCSETKeylifetime();
225     return sPCSETKeylifetime_;
226   }
227 
228   private GNSSPosTechnology gnssPosTechnology_;
getGnssPosTechnology()229   public GNSSPosTechnology getGnssPosTechnology() {
230     return gnssPosTechnology_;
231   }
232   /**
233    * @throws ClassCastException if value is not a GNSSPosTechnology
234    */
setGnssPosTechnology(Asn1Object value)235   public void setGnssPosTechnology(Asn1Object value) {
236     this.gnssPosTechnology_ = (GNSSPosTechnology) value;
237   }
setGnssPosTechnologyToNewInstance()238   public GNSSPosTechnology setGnssPosTechnologyToNewInstance() {
239     gnssPosTechnology_ = new GNSSPosTechnology();
240     return gnssPosTechnology_;
241   }
242 
243 
244 
245 
246 
247 
getComponents()248   @Override public Iterable<? extends SequenceComponent> getComponents() {
249     ImmutableList.Builder<SequenceComponent> builder = ImmutableList.builder();
250 
251     builder.add(new SequenceComponent() {
252           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 0);
253 
254           @Override public boolean isExplicitlySet() {
255             return getPosMethod() != null;
256           }
257 
258           @Override public boolean hasDefaultValue() {
259             return false;
260           }
261 
262           @Override public boolean isOptional() {
263             return false;
264           }
265 
266           @Override public Asn1Object getComponentValue() {
267             return getPosMethod();
268           }
269 
270           @Override public void setToNewInstance() {
271             setPosMethodToNewInstance();
272           }
273 
274           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
275             return tag == null ? PosMethod.getPossibleFirstTags() : ImmutableList.of(tag);
276           }
277 
278           @Override
279           public Asn1Tag getTag() {
280             return tag;
281           }
282 
283           @Override
284           public boolean isImplicitTagging() {
285             return true;
286           }
287 
288           @Override public String toIndentedString(String indent) {
289                 return "posMethod : "
290                     + getPosMethod().toIndentedString(indent);
291               }
292         });
293 
294     builder.add(new SequenceComponent() {
295           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 1);
296 
297           @Override public boolean isExplicitlySet() {
298             return getTriggerParams() != null;
299           }
300 
301           @Override public boolean hasDefaultValue() {
302             return false;
303           }
304 
305           @Override public boolean isOptional() {
306             return true;
307           }
308 
309           @Override public Asn1Object getComponentValue() {
310             return getTriggerParams();
311           }
312 
313           @Override public void setToNewInstance() {
314             setTriggerParamsToNewInstance();
315           }
316 
317           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
318             return tag == null ? TriggerParams.getPossibleFirstTags() : ImmutableList.of(tag);
319           }
320 
321           @Override
322           public Asn1Tag getTag() {
323             return tag;
324           }
325 
326           @Override
327           public boolean isImplicitTagging() {
328             return true;
329           }
330 
331           @Override public String toIndentedString(String indent) {
332                 return "triggerParams : "
333                     + getTriggerParams().toIndentedString(indent);
334               }
335         });
336 
337     builder.add(new SequenceComponent() {
338           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 2);
339 
340           @Override public boolean isExplicitlySet() {
341             return getSLPAddress() != null;
342           }
343 
344           @Override public boolean hasDefaultValue() {
345             return false;
346           }
347 
348           @Override public boolean isOptional() {
349             return true;
350           }
351 
352           @Override public Asn1Object getComponentValue() {
353             return getSLPAddress();
354           }
355 
356           @Override public void setToNewInstance() {
357             setSLPAddressToNewInstance();
358           }
359 
360           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
361             return tag == null ? SLPAddress.getPossibleFirstTags() : ImmutableList.of(tag);
362           }
363 
364           @Override
365           public Asn1Tag getTag() {
366             return tag;
367           }
368 
369           @Override
370           public boolean isImplicitTagging() {
371             return true;
372           }
373 
374           @Override public String toIndentedString(String indent) {
375                 return "sLPAddress : "
376                     + getSLPAddress().toIndentedString(indent);
377               }
378         });
379 
380     builder.add(new SequenceComponent() {
381           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 3);
382 
383           @Override public boolean isExplicitlySet() {
384             return getSupportedNetworkInformation() != null;
385           }
386 
387           @Override public boolean hasDefaultValue() {
388             return false;
389           }
390 
391           @Override public boolean isOptional() {
392             return true;
393           }
394 
395           @Override public Asn1Object getComponentValue() {
396             return getSupportedNetworkInformation();
397           }
398 
399           @Override public void setToNewInstance() {
400             setSupportedNetworkInformationToNewInstance();
401           }
402 
403           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
404             return tag == null ? SupportedNetworkInformation.getPossibleFirstTags() : ImmutableList.of(tag);
405           }
406 
407           @Override
408           public Asn1Tag getTag() {
409             return tag;
410           }
411 
412           @Override
413           public boolean isImplicitTagging() {
414             return true;
415           }
416 
417           @Override public String toIndentedString(String indent) {
418                 return "supportedNetworkInformation : "
419                     + getSupportedNetworkInformation().toIndentedString(indent);
420               }
421         });
422 
423     builder.add(new SequenceComponent() {
424           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 4);
425 
426           @Override public boolean isExplicitlySet() {
427             return getReportingMode() != null;
428           }
429 
430           @Override public boolean hasDefaultValue() {
431             return false;
432           }
433 
434           @Override public boolean isOptional() {
435             return true;
436           }
437 
438           @Override public Asn1Object getComponentValue() {
439             return getReportingMode();
440           }
441 
442           @Override public void setToNewInstance() {
443             setReportingModeToNewInstance();
444           }
445 
446           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
447             return tag == null ? ReportingMode.getPossibleFirstTags() : ImmutableList.of(tag);
448           }
449 
450           @Override
451           public Asn1Tag getTag() {
452             return tag;
453           }
454 
455           @Override
456           public boolean isImplicitTagging() {
457             return true;
458           }
459 
460           @Override public String toIndentedString(String indent) {
461                 return "reportingMode : "
462                     + getReportingMode().toIndentedString(indent);
463               }
464         });
465 
466     builder.add(new SequenceComponent() {
467           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 5);
468 
469           @Override public boolean isExplicitlySet() {
470             return getSPCSETKey() != null;
471           }
472 
473           @Override public boolean hasDefaultValue() {
474             return false;
475           }
476 
477           @Override public boolean isOptional() {
478             return true;
479           }
480 
481           @Override public Asn1Object getComponentValue() {
482             return getSPCSETKey();
483           }
484 
485           @Override public void setToNewInstance() {
486             setSPCSETKeyToNewInstance();
487           }
488 
489           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
490             return tag == null ? SPCSETKey.getPossibleFirstTags() : ImmutableList.of(tag);
491           }
492 
493           @Override
494           public Asn1Tag getTag() {
495             return tag;
496           }
497 
498           @Override
499           public boolean isImplicitTagging() {
500             return true;
501           }
502 
503           @Override public String toIndentedString(String indent) {
504                 return "sPCSETKey : "
505                     + getSPCSETKey().toIndentedString(indent);
506               }
507         });
508 
509     builder.add(new SequenceComponent() {
510           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 6);
511 
512           @Override public boolean isExplicitlySet() {
513             return getSPCTID() != null;
514           }
515 
516           @Override public boolean hasDefaultValue() {
517             return false;
518           }
519 
520           @Override public boolean isOptional() {
521             return true;
522           }
523 
524           @Override public Asn1Object getComponentValue() {
525             return getSPCTID();
526           }
527 
528           @Override public void setToNewInstance() {
529             setSPCTIDToNewInstance();
530           }
531 
532           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
533             return tag == null ? SPCTID.getPossibleFirstTags() : ImmutableList.of(tag);
534           }
535 
536           @Override
537           public Asn1Tag getTag() {
538             return tag;
539           }
540 
541           @Override
542           public boolean isImplicitTagging() {
543             return true;
544           }
545 
546           @Override public String toIndentedString(String indent) {
547                 return "sPCTID : "
548                     + getSPCTID().toIndentedString(indent);
549               }
550         });
551 
552     builder.add(new SequenceComponent() {
553           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 7);
554 
555           @Override public boolean isExplicitlySet() {
556             return getSPCSETKeylifetime() != null;
557           }
558 
559           @Override public boolean hasDefaultValue() {
560             return false;
561           }
562 
563           @Override public boolean isOptional() {
564             return true;
565           }
566 
567           @Override public Asn1Object getComponentValue() {
568             return getSPCSETKeylifetime();
569           }
570 
571           @Override public void setToNewInstance() {
572             setSPCSETKeylifetimeToNewInstance();
573           }
574 
575           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
576             return tag == null ? SPCSETKeylifetime.getPossibleFirstTags() : ImmutableList.of(tag);
577           }
578 
579           @Override
580           public Asn1Tag getTag() {
581             return tag;
582           }
583 
584           @Override
585           public boolean isImplicitTagging() {
586             return true;
587           }
588 
589           @Override public String toIndentedString(String indent) {
590                 return "sPCSETKeylifetime : "
591                     + getSPCSETKeylifetime().toIndentedString(indent);
592               }
593         });
594 
595     builder.add(new SequenceComponent() {
596           Asn1Tag tag = Asn1Tag.fromClassAndNumber(2, 8);
597 
598           @Override public boolean isExplicitlySet() {
599             return getGnssPosTechnology() != null;
600           }
601 
602           @Override public boolean hasDefaultValue() {
603             return false;
604           }
605 
606           @Override public boolean isOptional() {
607             return true;
608           }
609 
610           @Override public Asn1Object getComponentValue() {
611             return getGnssPosTechnology();
612           }
613 
614           @Override public void setToNewInstance() {
615             setGnssPosTechnologyToNewInstance();
616           }
617 
618           @Override public Collection<Asn1Tag> getPossibleFirstTags() {
619             return tag == null ? GNSSPosTechnology.getPossibleFirstTags() : ImmutableList.of(tag);
620           }
621 
622           @Override
623           public Asn1Tag getTag() {
624             return tag;
625           }
626 
627           @Override
628           public boolean isImplicitTagging() {
629             return true;
630           }
631 
632           @Override public String toIndentedString(String indent) {
633                 return "gnssPosTechnology : "
634                     + getGnssPosTechnology().toIndentedString(indent);
635               }
636         });
637 
638     return builder.build();
639   }
640 
641   @Override public Iterable<? extends SequenceComponent>
getExtensionComponents()642                                                     getExtensionComponents() {
643     ImmutableList.Builder<SequenceComponent> builder = ImmutableList.builder();
644 
645       return builder.build();
646     }
647 
648 
649 
650 
651 
652 
653 
654 
655 
656 
657 
658 
659 
660 
661 
662 
663 
664 
665 
666 
667 
668 
669 
encodePerUnaligned()670   @Override public Iterable<BitStream> encodePerUnaligned() {
671     return super.encodePerUnaligned();
672   }
673 
encodePerAligned()674   @Override public Iterable<BitStream> encodePerAligned() {
675     return super.encodePerAligned();
676   }
677 
decodePerUnaligned(BitStreamReader reader)678   @Override public void decodePerUnaligned(BitStreamReader reader) {
679     super.decodePerUnaligned(reader);
680   }
681 
decodePerAligned(BitStreamReader reader)682   @Override public void decodePerAligned(BitStreamReader reader) {
683     super.decodePerAligned(reader);
684   }
685 
toString()686   @Override public String toString() {
687     return toIndentedString("");
688   }
689 
toIndentedString(String indent)690   public String toIndentedString(String indent) {
691     StringBuilder builder = new StringBuilder();
692     builder.append("Ver2_SUPLTRIGGEREDRESPONSE = {\n");
693     final String internalIndent = indent + "  ";
694     for (SequenceComponent component : getComponents()) {
695       if (component.isExplicitlySet()) {
696         builder.append(internalIndent)
697             .append(component.toIndentedString(internalIndent));
698       }
699     }
700     if (isExtensible()) {
701       builder.append(internalIndent).append("...\n");
702       for (SequenceComponent component : getExtensionComponents()) {
703         if (component.isExplicitlySet()) {
704           builder.append(internalIndent)
705               .append(component.toIndentedString(internalIndent));
706         }
707       }
708     }
709     builder.append(indent).append("};\n");
710     return builder.toString();
711   }
712 }
713