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