• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2019 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.SystemApi;
20 
21 /**
22  * A container of supported GNSS chipset capabilities.
23  */
24 public final class GnssCapabilities {
25     /**
26      * Bit mask indicating GNSS chipset supports low power mode.
27      * @hide
28      */
29     public static final long LOW_POWER_MODE                                     = 1L << 0;
30 
31     /**
32      * Bit mask indicating GNSS chipset supports blacklisting satellites.
33      * @hide
34      */
35     public static final long SATELLITE_BLACKLIST                                = 1L << 1;
36 
37     /**
38      * Bit mask indicating GNSS chipset supports geofencing.
39      * @hide
40      */
41     public static final long GEOFENCING                                         = 1L << 2;
42 
43     /**
44      * Bit mask indicating GNSS chipset supports measurements.
45      * @hide
46      */
47     public static final long MEASUREMENTS                                       = 1L << 3;
48 
49     /**
50      * Bit mask indicating GNSS chipset supports navigation messages.
51      * @hide
52      */
53     public static final long NAV_MESSAGES                                       = 1L << 4;
54 
55     /**
56      * Bit mask indicating GNSS chipset supports measurement corrections.
57      * @hide
58      */
59     public static final long MEASUREMENT_CORRECTIONS                            = 1L << 5;
60 
61     /**
62      * Bit mask indicating GNSS chipset supports line-of-sight satellite identification
63      * measurement corrections.
64      * @hide
65      */
66     public static final long MEASUREMENT_CORRECTIONS_LOS_SATS                   = 1L << 6;
67 
68     /**
69      * Bit mask indicating GNSS chipset supports per satellite excess-path-length
70      * measurement corrections.
71      * @hide
72      */
73     public static final long MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH         = 1L << 7;
74 
75     /**
76      * Bit mask indicating GNSS chipset supports reflecting planes measurement corrections.
77      * @hide
78      */
79     public static final long MEASUREMENT_CORRECTIONS_REFLECTING_PLANE           = 1L << 8;
80 
81     /**
82      * Bit mask indicating GNSS chipset supports GNSS antenna info.
83      * @hide
84      */
85     public static final long ANTENNA_INFO                                       = 1L << 9;
86 
87     /** @hide */
88     public static final long INVALID_CAPABILITIES = -1;
89 
90     /** A bitmask of supported GNSS capabilities. */
91     private final long mGnssCapabilities;
92 
93     /** @hide */
of(long gnssCapabilities)94     public static GnssCapabilities of(long gnssCapabilities) {
95         return new GnssCapabilities(gnssCapabilities);
96     }
97 
GnssCapabilities(long gnssCapabilities)98     private GnssCapabilities(long gnssCapabilities) {
99         mGnssCapabilities = gnssCapabilities;
100     }
101 
102     /**
103      * Returns {@code true} if GNSS chipset supports low power mode, {@code false} otherwise.
104      *
105      * @hide
106      */
107     @SystemApi
hasLowPowerMode()108     public boolean hasLowPowerMode() {
109         return hasCapability(LOW_POWER_MODE);
110     }
111 
112     /**
113      * Returns {@code true} if GNSS chipset supports blacklisting satellites, {@code false}
114      * otherwise.
115      *
116      * @hide
117      */
118     @SystemApi
hasSatelliteBlacklist()119     public boolean hasSatelliteBlacklist() {
120         return hasCapability(SATELLITE_BLACKLIST);
121     }
122 
123     /**
124      * Returns {@code true} if GNSS chipset supports geofencing, {@code false} otherwise.
125      *
126      * @hide
127      */
128     @SystemApi
hasGeofencing()129     public boolean hasGeofencing() {
130         return hasCapability(GEOFENCING);
131     }
132 
133     /**
134      * Returns {@code true} if GNSS chipset supports measurements, {@code false} otherwise.
135      *
136      * @hide
137      */
138     @SystemApi
hasMeasurements()139     public boolean hasMeasurements() {
140         return hasCapability(MEASUREMENTS);
141     }
142 
143     /**
144      * Returns {@code true} if GNSS chipset supports navigation messages, {@code false} otherwise.
145      *
146      * @hide
147      */
148     @SystemApi
hasNavMessages()149     public boolean hasNavMessages() {
150         return hasCapability(NAV_MESSAGES);
151     }
152 
153     /**
154      * Returns {@code true} if GNSS chipset supports measurement corrections, {@code false}
155      * otherwise.
156      *
157      * @hide
158      */
159     @SystemApi
hasMeasurementCorrections()160     public boolean hasMeasurementCorrections() {
161         return hasCapability(MEASUREMENT_CORRECTIONS);
162     }
163 
164     /**
165      * Returns {@code true} if GNSS chipset supports line-of-sight satellite identification
166      * measurement corrections, {@code false} otherwise.
167      *
168      * @hide
169      */
170     @SystemApi
hasMeasurementCorrectionsLosSats()171     public boolean hasMeasurementCorrectionsLosSats() {
172         return hasCapability(MEASUREMENT_CORRECTIONS_LOS_SATS);
173     }
174 
175     /**
176      * Returns {@code true} if GNSS chipset supports per satellite excess-path-length measurement
177      * corrections, {@code false} otherwise.
178      *
179      * @hide
180      */
181     @SystemApi
hasMeasurementCorrectionsExcessPathLength()182     public boolean hasMeasurementCorrectionsExcessPathLength() {
183         return hasCapability(MEASUREMENT_CORRECTIONS_EXCESS_PATH_LENGTH);
184     }
185 
186     /**
187      * Returns {@code true} if GNSS chipset supports reflecting planes measurement corrections,
188      * {@code false} otherwise.
189      *
190      * @hide
191      */
192     @SystemApi
hasMeasurementCorrectionsReflectingPane()193     public boolean hasMeasurementCorrectionsReflectingPane() {
194         return hasCapability(MEASUREMENT_CORRECTIONS_REFLECTING_PLANE);
195     }
196 
197     /**
198      * Returns {@code true} if GNSS chipset supports antenna info, {@code false} otherwise.
199      */
hasGnssAntennaInfo()200     public boolean hasGnssAntennaInfo() {
201         return hasCapability(ANTENNA_INFO);
202     }
203 
hasCapability(long capability)204     private boolean hasCapability(long capability) {
205         return (mGnssCapabilities & capability) == capability;
206     }
207 }
208