• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 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;
18 
19 import android.annotation.FlaggedApi;
20 import android.annotation.FloatRange;
21 import android.annotation.IntRange;
22 import android.annotation.NonNull;
23 import android.annotation.SystemApi;
24 import android.location.flags.Flags;
25 import android.os.Parcel;
26 import android.os.Parcelable;
27 
28 import com.android.internal.util.Preconditions;
29 
30 import java.util.ArrayList;
31 import java.util.Collections;
32 import java.util.List;
33 
34 /**
35  * A class contains almanac parameters for GPS, QZSS, Galileo, Beidou.
36  *
37  * <p>For Beidou, this is defined in BDS-SIS-ICD-B1I-3.0 section 5.2.4.15.
38  *
39  * <p>For GPS, this is defined in IS-GPS-200 section 20.3.3.5.1.2.
40  *
41  * <p>For QZSS, this is defined in IS-QZSS-PNT section 4.1.2.6.
42  *
43  * <p>For Galileo, this is defined in Galileo-OS-SIS-ICD-v2.1 section 5.1.10.
44  *
45  * @hide
46  */
47 @FlaggedApi(Flags.FLAG_GNSS_ASSISTANCE_INTERFACE)
48 @SystemApi
49 public final class GnssAlmanac implements Parcelable {
50     /**
51      * Almanac issue date in milliseconds (UTC).
52      *
53      * <p>This is unused for GPS/QZSS/Baidou.
54      */
55     private final long mIssueDateMillis;
56 
57     /**
58      * Almanac issue of data.
59      *
60      * <p>This is unused for GPS/QZSS/Baidou.
61      */
62     private final int mIoda;
63 
64     /**
65      * Almanac reference week number.
66      *
67      * <p>For GPS and QZSS, this is GPS week number (modulo 1024).
68      *
69      * <p>For Beidou, this is Baidou week number (modulo 8192).
70      *
71      * <p>For Galileo, this is modulo 4 representation of the Galileo week number.
72      */
73     private final int mWeekNumber;
74 
75     /** Almanac reference time in seconds. */
76     private final int mToaSeconds;
77 
78     /**
79      * Flag to indicate if the satelliteAlmanacs contains complete GNSS
80      * constellation indicated by svid.
81      */
82     private final boolean mCompleteAlmanacProvided;
83 
84     /** The list of GnssSatelliteAlmanacs. */
85     @NonNull private final List<GnssSatelliteAlmanac> mGnssSatelliteAlmanacs;
86 
GnssAlmanac(Builder builder)87     private GnssAlmanac(Builder builder) {
88         Preconditions.checkArgument(builder.mIssueDateMillis >= 0);
89         Preconditions.checkArgument(builder.mIoda >= 0);
90         Preconditions.checkArgument(builder.mWeekNumber >= 0);
91         Preconditions.checkArgumentInRange(builder.mToaSeconds, 0, 604800, "ToaSeconds");
92         Preconditions.checkNotNull(
93                 builder.mGnssSatelliteAlmanacs, "GnssSatelliteAlmanacs cannot be null");
94         mIssueDateMillis = builder.mIssueDateMillis;
95         mIoda = builder.mIoda;
96         mWeekNumber = builder.mWeekNumber;
97         mToaSeconds = builder.mToaSeconds;
98         mCompleteAlmanacProvided = builder.mCompleteAlmanacProvided;
99         mGnssSatelliteAlmanacs =
100                 Collections.unmodifiableList(new ArrayList<>(builder.mGnssSatelliteAlmanacs));
101     }
102 
103     /** Returns the almanac issue date in milliseconds (UTC). */
104     @IntRange(from = 0)
getIssueDateMillis()105     public long getIssueDateMillis() {
106         return mIssueDateMillis;
107     }
108 
109     /** Returns the almanac issue of data. */
110     @IntRange(from = 0)
getIoda()111     public int getIoda() {
112         return mIoda;
113     }
114 
115     /**
116      * Returns the almanac reference week number.
117      *
118      * <p>For GPS and QZSS, this is GPS week number (modulo 1024).
119      *
120      * <p>For Beidou, this is Baidou week number (modulo 8192).
121      *
122      * <p>For Galileo, this is modulo 4 representation of the Galileo week number.
123      */
124     @IntRange(from = 0)
getWeekNumber()125     public int getWeekNumber() {
126         return mWeekNumber;
127     }
128 
129     /** Returns the almanac reference time in seconds. */
130     @IntRange(from = 0, to = 604800)
getToaSeconds()131     public int getToaSeconds() {
132         return mToaSeconds;
133     }
134 
135     /**
136      * Returns the flag to indicate if the satelliteAlmanacs contains complete GNSS
137      * constellation indicated by svid.
138      */
isCompleteAlmanacProvided()139     public boolean isCompleteAlmanacProvided() {
140         return mCompleteAlmanacProvided;
141     }
142 
143     /** Returns the list of GnssSatelliteAlmanacs. */
144     @NonNull
getGnssSatelliteAlmanacs()145     public List<GnssSatelliteAlmanac> getGnssSatelliteAlmanacs() {
146         return mGnssSatelliteAlmanacs;
147     }
148 
149     @Override
describeContents()150     public int describeContents() {
151         return 0;
152     }
153 
154     @Override
writeToParcel(@onNull Parcel dest, int flags)155     public void writeToParcel(@NonNull Parcel dest, int flags) {
156         dest.writeLong(mIssueDateMillis);
157         dest.writeInt(mIoda);
158         dest.writeInt(mWeekNumber);
159         dest.writeInt(mToaSeconds);
160         dest.writeBoolean(mCompleteAlmanacProvided);
161         dest.writeTypedList(mGnssSatelliteAlmanacs);
162     }
163 
164     public static final @NonNull Creator<GnssAlmanac> CREATOR =
165             new Creator<GnssAlmanac>() {
166                 @Override
167                 public GnssAlmanac createFromParcel(Parcel in) {
168                     GnssAlmanac.Builder gnssAlmanac = new GnssAlmanac.Builder();
169                     gnssAlmanac.setIssueDateMillis(in.readLong());
170                     gnssAlmanac.setIoda(in.readInt());
171                     gnssAlmanac.setWeekNumber(in.readInt());
172                     gnssAlmanac.setToaSeconds(in.readInt());
173                     gnssAlmanac.setCompleteAlmanacProvided(in.readBoolean());
174                     List<GnssSatelliteAlmanac> satelliteAlmanacs = new ArrayList<>();
175                     in.readTypedList(satelliteAlmanacs, GnssSatelliteAlmanac.CREATOR);
176                     gnssAlmanac.setGnssSatelliteAlmanacs(satelliteAlmanacs);
177                     return gnssAlmanac.build();
178                 }
179 
180                 @Override
181                 public GnssAlmanac[] newArray(int size) {
182                     return new GnssAlmanac[size];
183                 }
184             };
185 
186     @Override
toString()187     public String toString() {
188         StringBuilder builder = new StringBuilder("GnssAlmanac[");
189         builder.append("issueDateMillis=").append(mIssueDateMillis);
190         builder.append(", ioda=").append(mIoda);
191         builder.append(", weekNumber=").append(mWeekNumber);
192         builder.append(", toaSeconds=").append(mToaSeconds);
193         builder.append(", completeAlmanacProvided=").append(mCompleteAlmanacProvided);
194         builder.append(", satelliteAlmanacs=").append(mGnssSatelliteAlmanacs);
195         builder.append("]");
196         return builder.toString();
197     }
198 
199     /** Builder for {@link GnssAlmanac}. */
200     public static final class Builder {
201         private long mIssueDateMillis;
202         private int mIoda;
203         private int mWeekNumber;
204         private int mToaSeconds;
205         private boolean mCompleteAlmanacProvided;
206         private List<GnssSatelliteAlmanac> mGnssSatelliteAlmanacs;
207 
208         /** Sets the almanac issue date in milliseconds (UTC). */
209         @NonNull
setIssueDateMillis(@ntRangefrom = 0) long issueDateMillis)210         public Builder setIssueDateMillis(@IntRange(from = 0) long issueDateMillis) {
211             mIssueDateMillis = issueDateMillis;
212             return this;
213         }
214 
215         /** Sets the almanac issue of data. */
216         @NonNull
setIoda(@ntRangefrom = 0) int ioda)217         public Builder setIoda(@IntRange(from = 0) int ioda) {
218             mIoda = ioda;
219             return this;
220         }
221 
222         /**
223          * Sets the almanac reference week number.
224          *
225          * <p>For GPS and QZSS, this is GPS week number (modulo 1024).
226          *
227          * <p>For Beidou, this is Baidou week number (modulo 8192).
228          *
229          * <p>For Galileo, this is modulo 4 representation of the Galileo week number.
230          */
231         @NonNull
setWeekNumber(@ntRangefrom = 0) int weekNumber)232         public Builder setWeekNumber(@IntRange(from = 0) int weekNumber) {
233             mWeekNumber = weekNumber;
234             return this;
235         }
236 
237         /** Sets the almanac reference time in seconds. */
238         @NonNull
setToaSeconds(@ntRangefrom = 0, to = 604800) int toaSeconds)239         public Builder setToaSeconds(@IntRange(from = 0, to = 604800) int toaSeconds) {
240             mToaSeconds = toaSeconds;
241             return this;
242         }
243 
244         /**
245          * Sets to true if the satelliteAlmanacs contains complete GNSS
246          * constellation indicated by svid, false otherwise.
247          */
248         @NonNull
setCompleteAlmanacProvided(boolean isCompleteAlmanacProvided)249         public Builder setCompleteAlmanacProvided(boolean isCompleteAlmanacProvided) {
250             this.mCompleteAlmanacProvided = isCompleteAlmanacProvided;
251             return this;
252         }
253 
254         /** Sets the list of GnssSatelliteAlmanacs. */
255         @NonNull
setGnssSatelliteAlmanacs( @onNull List<GnssSatelliteAlmanac> gnssSatelliteAlmanacs)256         public Builder setGnssSatelliteAlmanacs(
257                 @NonNull List<GnssSatelliteAlmanac> gnssSatelliteAlmanacs) {
258             mGnssSatelliteAlmanacs = gnssSatelliteAlmanacs;
259             return this;
260         }
261 
262         /** Builds a {@link GnssAlmanac} instance as specified by this builder. */
263         @NonNull
build()264         public GnssAlmanac build() {
265             return new GnssAlmanac(this);
266         }
267     }
268 
269     /**
270      * A class contains almanac parameters for GPS, QZSS, Galileo, Beidou.
271      *
272      * <p>For Beidou, this is defined in BDS-SIS-ICD-B1I-3.0 section 5.2.4.15.
273      *
274      * <p>For GPS, this is defined in IS-GPS-200 section 20.3.3.5.1.2.
275      *
276      * <p>For QZSS, this is defined in IS-QZSS-PNT section 4.1.2.6.
277      *
278      * <p>For Galileo, this is defined in Galileo-OS-SIS-ICD-v2.1 section 5.1.10.
279      */
280     public static final class GnssSatelliteAlmanac implements Parcelable {
281         /** The PRN or satellite ID number for the GNSS satellite. */
282         private final int mSvid;
283 
284         /**
285          * Satellite health information.
286          *
287          * <p>For GPS, this is satellite subframe 4 and 5, page 25 6-bit health code as defined in
288          * IS-GPS-200 Table 20-VIII expressed in integer form.
289          *
290          * <p>For QZSS, this is the 5-bit health code as defined in IS-QZSS-PNT, Table 4.1.2-5-2
291          * expressed in integer form.
292          *
293          * <p>For Beidou, this is 1-bit health information. (0=healthy, 1=unhealthy).
294          *
295          * <p>For Galileo, this is 6-bit health, bit 0 and 1 is for E5a, bit 2 and 3 is for E5b, bit
296          * 4 and 5 is for E1b.
297          */
298         private final int mSvHealth;
299 
300         /** Eccentricity. */
301         private final double mEccentricity;
302 
303         /**
304          * Inclination in semi-circles.
305          *
306          * <p>For GPS and Galileo, this is the difference between the inclination angle at reference
307          * time and the nominal inclination in semi-circles.
308          *
309          * <p>For Beidou and QZSS, this is the inclination angle at reference time in semi-circles.
310          */
311         private final double mInclination;
312 
313         /** Argument of perigee in semi-circles. */
314         private final double mOmega;
315 
316         /** Longitude of ascending node of orbital plane at weekly epoch in semi-circles. */
317         private final double mOmega0;
318 
319         /** Rate of right ascension in semi-circles per second. */
320         private final double mOmegaDot;
321 
322         /**
323          * Square root of semi-major axis in square root of meters.
324          *
325          * <p>For Galileo, this is the difference with respect to the square root of the nominal
326          * semi-major axis in square root of meters.
327          */
328         private final double mRootA;
329 
330         /** Mean anomaly at reference time in semi-circles. */
331         private final double mM0;
332 
333         /** Satellite clock time bias correction coefficient in seconds. */
334         private final double mAf0;
335 
336         /** Satellite clock time drift correction coefficient in seconds per second. */
337         private final double mAf1;
338 
GnssSatelliteAlmanac(Builder builder)339         private GnssSatelliteAlmanac(Builder builder) {
340             Preconditions.checkArgument(builder.mSvid > 0);
341             Preconditions.checkArgument(builder.mSvHealth >= 0);
342             Preconditions.checkArgument(builder.mEccentricity >= 0.0f);
343             Preconditions.checkArgumentInRange(builder.mInclination, -1.0f, 1.0f, "Inclination");
344             Preconditions.checkArgumentInRange(builder.mOmega, -1.0f, 1.0f, "Omega");
345             Preconditions.checkArgumentInRange(builder.mOmega0, -1.0f, 1.0f, "Omega0");
346             Preconditions.checkArgumentInRange(builder.mOmegaDot, -1.0f, 1.0f, "OmegaDot");
347             Preconditions.checkArgumentInRange(builder.mRootA, 0.0f, 8192.0f, "RootA");
348             Preconditions.checkArgumentInRange(builder.mM0, -1.0f, 1.0f, "M0");
349             Preconditions.checkArgumentInRange(builder.mAf0, -0.0625f, 0.0625f, "Af0");
350             Preconditions.checkArgumentInRange(builder.mAf1, -1.5e-8f, 1.5e-8f, "Af1");
351             mSvid = builder.mSvid;
352             mSvHealth = builder.mSvHealth;
353             mEccentricity = builder.mEccentricity;
354             mInclination = builder.mInclination;
355             mOmega = builder.mOmega;
356             mOmega0 = builder.mOmega0;
357             mOmegaDot = builder.mOmegaDot;
358             mRootA = builder.mRootA;
359             mM0 = builder.mM0;
360             mAf0 = builder.mAf0;
361             mAf1 = builder.mAf1;
362         }
363 
364         /** Returns the PRN or satellite ID number of the GNSS satellite. */
365         @IntRange(from = 1)
getSvid()366         public int getSvid() {
367             return mSvid;
368         }
369 
370         /**
371          * Returns the satellite health information.
372          *
373          * <p>For GPS, this is satellite subframe 4 and 5, page 25 6-bit health code as defined in
374          * IS-GPS-200 Table 20-VIII expressed in integer form.
375          *
376          * <p>For QZSS, this is the 5-bit health code as defined in IS-QZSS-PNT, Table 4.1.2-5-2
377          * expressed in integer form.
378          *
379          * <p>For Beidou, this is 1-bit health information. (0=healthy, 1=unhealthy).
380          *
381          * <p>For Galileo, this is 6-bit health, bit 0 and 1 is for E5a, bit 2 and 3 is for E5b,
382          * bit 4 and 5 is for E1b.
383          */
384         @IntRange(from = 0)
getSvHealth()385         public int getSvHealth() {
386             return mSvHealth;
387         }
388 
389         /** Returns the eccentricity. */
390         @FloatRange(from = 0.0f)
getEccentricity()391         public double getEccentricity() {
392             return mEccentricity;
393         }
394 
395         /**
396          * Returns the inclination in semi-circles.
397          *
398          * <p>For GPS and Galileo, this is the difference between the inclination angle at reference
399          * time and the nominal inclination in semi-circles.
400          *
401          * <p>For Beidou and QZSS, this is the inclination angle at reference time in semi-circles.
402          */
403         @FloatRange(from = -1.0f, to = 1.0f)
getInclination()404         public double getInclination() {
405             return mInclination;
406         }
407 
408         /** Returns the argument of perigee in semi-circles. */
409         @FloatRange(from = -1.0f, to = 1.0f)
getOmega()410         public double getOmega() {
411             return mOmega;
412         }
413 
414         /**
415          * Returns the longitude of ascending node of orbital plane at weekly epoch in semi-circles.
416          */
417         @FloatRange(from = -1.0f, to = 1.0f)
getOmega0()418         public double getOmega0() {
419             return mOmega0;
420         }
421 
422         /** Returns the rate of right ascension in semi-circles per second. */
423         @FloatRange(from = -1.0f, to = 1.0f)
getOmegaDot()424         public double getOmegaDot() {
425             return mOmegaDot;
426         }
427 
428         /**
429          * Returns the square root of semi-major axis in square root of meters.
430          *
431          * <p>For Galileo, this is the difference with respect to the square root of the nominal
432          * semi-major axis in square root of meters.
433          */
434         @FloatRange(from = 0.0f, to = 8192.0f)
getRootA()435         public double getRootA() {
436             return mRootA;
437         }
438 
439         /** Returns the mean anomaly at reference time in semi-circles. */
440         @FloatRange(from = -1.0f, to = 1.0f)
getM0()441         public double getM0() {
442             return mM0;
443         }
444 
445         /** Returns the satellite clock time bias correction coefficient in seconds. */
446         @FloatRange(from = -0.0625f, to = 0.0625f)
getAf0()447         public double getAf0() {
448             return mAf0;
449         }
450 
451         /** Returns the satellite clock time drift correction coefficient in seconds per second. */
452         @FloatRange(from = -1.5e-8f, to = 1.5e-8f)
getAf1()453         public double getAf1() {
454             return mAf1;
455         }
456 
457         @Override
describeContents()458         public int describeContents() {
459             return 0;
460         }
461 
462         @Override
writeToParcel(@onNull Parcel dest, int flags)463         public void writeToParcel(@NonNull Parcel dest, int flags) {
464             dest.writeInt(mSvid);
465             dest.writeInt(mSvHealth);
466             dest.writeDouble(mEccentricity);
467             dest.writeDouble(mInclination);
468             dest.writeDouble(mOmega);
469             dest.writeDouble(mOmega0);
470             dest.writeDouble(mOmegaDot);
471             dest.writeDouble(mRootA);
472             dest.writeDouble(mM0);
473             dest.writeDouble(mAf0);
474             dest.writeDouble(mAf1);
475         }
476 
477         public static final @NonNull Creator<GnssSatelliteAlmanac> CREATOR =
478                 new Creator<GnssSatelliteAlmanac>() {
479                     @Override
480                     public GnssSatelliteAlmanac createFromParcel(Parcel in) {
481                         return new GnssSatelliteAlmanac(
482                                 new Builder()
483                                         .setSvid(in.readInt())
484                                         .setSvHealth(in.readInt())
485                                         .setEccentricity(in.readDouble())
486                                         .setInclination(in.readDouble())
487                                         .setOmega(in.readDouble())
488                                         .setOmega0(in.readDouble())
489                                         .setOmegaDot(in.readDouble())
490                                         .setRootA(in.readDouble())
491                                         .setM0(in.readDouble())
492                                         .setAf0(in.readDouble())
493                                         .setAf1(in.readDouble()));
494                     }
495 
496                     @Override
497                     public GnssSatelliteAlmanac[] newArray(int size) {
498                         return new GnssSatelliteAlmanac[size];
499                     }
500                 };
501 
502         @Override
503         @NonNull
toString()504         public String toString() {
505             StringBuilder builder = new StringBuilder("GnssSatelliteAlmanac[");
506             builder.append("svid = ").append(mSvid);
507             builder.append(", svHealth = ").append(mSvHealth);
508             builder.append(", eccentricity = ").append(mEccentricity);
509             builder.append(", inclination = ").append(mInclination);
510             builder.append(", omega = ").append(mOmega);
511             builder.append(", omega0 = ").append(mOmega0);
512             builder.append(", omegaDot = ").append(mOmegaDot);
513             builder.append(", rootA = ").append(mRootA);
514             builder.append(", m0 = ").append(mM0);
515             builder.append(", af0 = ").append(mAf0);
516             builder.append(", af1 = ").append(mAf1);
517             builder.append("]");
518             return builder.toString();
519         }
520 
521         /** Builder for {@link GnssSatelliteAlmanac}. */
522         public static final class Builder {
523             private int mSvid;
524             private int mSvHealth;
525             private double mEccentricity;
526             private double mInclination;
527             private double mOmega;
528             private double mOmega0;
529             private double mOmegaDot;
530             private double mRootA;
531             private double mM0;
532             private double mAf0;
533             private double mAf1;
534 
535             /** Sets the PRN or satellite ID number of the GNSS satellite. */
536             @NonNull
setSvid(@ntRangefrom = 1) int svid)537             public Builder setSvid(@IntRange(from = 1) int svid) {
538                 mSvid = svid;
539                 return this;
540             }
541 
542             /**
543              * Sets the satellite health information.
544              *
545              * <p>For GPS, this is satellite subframe 4 and 5, page 25 6-bit health code as defined
546              * in IS-GPS-200 Table 20-VIII expressed in integer form.
547              *
548              * <p>For QZSS, this is the 5-bit health code as defined in IS-QZSS-PNT, Table 4.1.2-5-2
549              * expressed in integer form.
550              *
551              * <p>For Beidou, this is 1-bit health information. (0=healthy, 1=unhealthy).
552              *
553              * <p>For Galileo, this is 6-bit health, bit 0 and 1 is for E5a,
554              * bit 2 and 3 is for E5b, bit 4 and 5 is for E1b.
555              */
556             @NonNull
setSvHealth(@ntRangefrom = 0) int svHealth)557             public Builder setSvHealth(@IntRange(from = 0) int svHealth) {
558                 mSvHealth = svHealth;
559                 return this;
560             }
561 
562             /** Sets the eccentricity. */
563             @NonNull
setEccentricity(@loatRangefrom = 0.0f) double eccentricity)564             public Builder setEccentricity(@FloatRange(from = 0.0f) double eccentricity) {
565                 mEccentricity = eccentricity;
566                 return this;
567             }
568 
569             /**
570              * Sets the inclination in semi-circles.
571              *
572              * <p>For GPS and Galileo, this is the difference between the inclination angle at
573              * reference time and the nominal inclination in semi-circles.
574              *
575              * <p>For Beidou and QZSS, this is the inclination angle at reference time in
576              * semi-circles.
577              */
578             @NonNull
setInclination(@loatRangefrom = -1.0f, to = 1.0f) double inclination)579             public Builder setInclination(@FloatRange(from = -1.0f, to = 1.0f) double inclination) {
580                 mInclination = inclination;
581                 return this;
582             }
583 
584             /** Sets the argument of perigee in semi-circles. */
585             @NonNull
setOmega(@loatRangefrom = -1.0f, to = 1.0f) double omega)586             public Builder setOmega(@FloatRange(from = -1.0f, to = 1.0f) double omega) {
587                 mOmega = omega;
588                 return this;
589             }
590 
591             /**
592              * Sets the longitude of ascending node of orbital plane at weekly epoch in
593              * semi-circles.
594              */
595             @NonNull
setOmega0(@loatRangefrom = -1.0f, to = 1.0f) double omega0)596             public Builder setOmega0(@FloatRange(from = -1.0f, to = 1.0f) double omega0) {
597                 mOmega0 = omega0;
598                 return this;
599             }
600 
601             /** Sets the rate of right ascension in semi-circles per second. */
602             @NonNull
setOmegaDot(@loatRangefrom = -1.0f, to = 1.0f) double omegaDot)603             public Builder setOmegaDot(@FloatRange(from = -1.0f, to = 1.0f) double omegaDot) {
604                 mOmegaDot = omegaDot;
605                 return this;
606             }
607 
608             /**
609              * Sets the square root of semi-major axis in square root of meters.
610              *
611              * <p>For Galileo, this is the difference with respect to the square root of the nominal
612              * semi-major axis in square root of meters.
613              */
614             @NonNull
setRootA(@loatRangefrom = 0.0f, to = 8192.0f) double rootA)615             public Builder setRootA(@FloatRange(from = 0.0f, to = 8192.0f) double rootA) {
616                 mRootA = rootA;
617                 return this;
618             }
619 
620             /** Sets the mean anomaly at reference time in semi-circles. */
621             @NonNull
setM0(@loatRangefrom = -1.0f, to = 1.0f) double m0)622             public Builder setM0(@FloatRange(from = -1.0f, to = 1.0f) double m0) {
623                 mM0 = m0;
624                 return this;
625             }
626 
627             /** Sets the satellite clock time bias correction coefficient in seconds. */
628             @NonNull
setAf0(@loatRangefrom = -0.0625f, to = 0.0625f) double af0)629             public Builder setAf0(@FloatRange(from = -0.0625f, to = 0.0625f) double af0) {
630                 mAf0 = af0;
631                 return this;
632             }
633 
634             /** Sets the satellite clock time drift correction coefficient in seconds per second. */
635             @NonNull
setAf1(@loatRangefrom = -1.5e-8f, to = 1.5e-8f) double af1)636             public Builder setAf1(@FloatRange(from = -1.5e-8f, to = 1.5e-8f) double af1) {
637                 mAf1 = af1;
638                 return this;
639             }
640 
641             /** Builds a {@link GnssSatelliteAlmanac} instance as specified by this builder. */
642             @NonNull
build()643             public GnssSatelliteAlmanac build() {
644                 return new GnssSatelliteAlmanac(this);
645             }
646         }
647     }
648 }
649