• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2008 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 /**
20  * This class represents the current state of a GPS satellite.
21  *
22  * This class is used in conjunction with the {@link GpsStatus} class.
23  *
24  * @deprecated use {@link GnssStatus} and {@link GnssStatus.Callback}.
25  */
26 @Deprecated
27 public final class GpsSatellite {
28     /* These package private values are modified by the GpsStatus class */
29     boolean mValid;
30     boolean mHasEphemeris;
31     boolean mHasAlmanac;
32     boolean mUsedInFix;
33     int mPrn;
34     float mSnr;
35     float mElevation;
36     float mAzimuth;
37 
GpsSatellite(int prn)38     GpsSatellite(int prn) {
39         mPrn = prn;
40     }
41 
42     /**
43      * Used by {@link LocationManager#getGpsStatus} to copy LocationManager's
44      * cached GpsStatus instance to the client's copy.
45      */
setStatus(GpsSatellite satellite)46     void setStatus(GpsSatellite satellite) {
47         if (satellite == null) {
48             mValid = false;
49         } else {
50             mValid = satellite.mValid;
51             mHasEphemeris = satellite.mHasEphemeris;
52             mHasAlmanac = satellite.mHasAlmanac;
53             mUsedInFix = satellite.mUsedInFix;
54             mSnr = satellite.mSnr;
55             mElevation = satellite.mElevation;
56             mAzimuth = satellite.mAzimuth;
57         }
58     }
59 
60     /**
61      * Returns the PRN (pseudo-random number) for the satellite.
62      *
63      * @return PRN number
64      */
getPrn()65     public int getPrn() {
66         return mPrn;
67     }
68 
69     /**
70      * Returns the signal to noise ratio for the satellite.
71      *
72      * @return the signal to noise ratio
73      */
getSnr()74     public float getSnr() {
75         return mSnr;
76     }
77 
78     /**
79      * Returns the elevation of the satellite in degrees.
80      * The elevation can vary between 0 and 90.
81      *
82      * @return the elevation in degrees
83      */
getElevation()84     public float getElevation() {
85         return mElevation;
86     }
87 
88     /**
89      * Returns the azimuth of the satellite in degrees.
90      * The azimuth can vary between 0 and 360.
91      *
92      * @return the azimuth in degrees
93      */
getAzimuth()94     public float getAzimuth() {
95         return mAzimuth;
96     }
97 
98     /**
99      * Returns true if the GPS engine has ephemeris data for the satellite.
100      *
101      * @return true if the satellite has ephemeris data
102      */
hasEphemeris()103     public boolean hasEphemeris() {
104         return mHasEphemeris;
105     }
106 
107     /**
108      * Returns true if the GPS engine has almanac data for the satellite.
109      *
110      * @return true if the satellite has almanac data
111      */
hasAlmanac()112     public boolean hasAlmanac() {
113         return mHasAlmanac;
114     }
115 
116     /**
117      * Returns true if the satellite was used by the GPS engine when
118      * calculating the most recent GPS fix.
119      *
120      * @return true if the satellite was used to compute the most recent fix.
121      */
usedInFix()122     public boolean usedInFix() {
123         return mUsedInFix;
124     }
125 }
126