blob: 9e1b5edc87680b725b014cf2965d005e27ae8474 [file] [log] [blame]
Joe Huang202b02d2021-11-16 23:09:11 +08001/*
2 * Copyright (C) 2021 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
17package android.hardware.gnss;
18
19import android.hardware.gnss.GnssConstellationType;
Yu-Han Yang19c2d9b2022-01-14 14:45:30 -080020import android.hardware.gnss.SatellitePvt.SatelliteEphemerisSource;
Joe Huang202b02d2021-11-16 23:09:11 +080021
22/**
23 * Extended interface for GNSS Debug support
24 *
25 * This information is used for debugging purpose, e.g., shown in a bugreport to
26 * describe the chipset states including time, position, and satellite data.
Yu-Han Yang75a6af22022-03-04 13:46:52 -080027 *
28 * @hide
Joe Huang202b02d2021-11-16 23:09:11 +080029 */
30@VintfStability
31interface IGnssDebug {
32 /** Satellite's ephemeris type */
33 @VintfStability
34 @Backing(type="int")
35 enum SatelliteEphemerisType {
36 EPHEMERIS = 0,
37 ALMANAC_ONLY = 1,
38 NOT_AVAILABLE = 2,
39 }
40
Joe Huang202b02d2021-11-16 23:09:11 +080041 /** Satellite's ephemeris health */
42 @VintfStability
43 @Backing(type="int")
44 enum SatelliteEphemerisHealth {
45 GOOD = 0,
46 BAD = 1,
47 UNKNOWN = 2,
48 }
49
50 /**
51 * Provides the current best known UTC time estimate.
52 * If no fresh information is available, e.g. after a delete all,
53 * then whatever the effective defaults are on the device must be
54 * provided (e.g. Jan. 1, 2017, with an uncertainty of 5 years) expressed
55 * in the specified units.
56 */
57 @VintfStability
58 parcelable TimeDebug {
59 /** UTC time estimate in milliseconds. */
60 long timeEstimateMs;
61
62 /** 68% time error estimate in nanoseconds. */
63 float timeUncertaintyNs;
64
65 /**
66 * 68% error estimate in local clock drift,
67 * in nanoseconds per second (also known as parts per billion - ppb.)
68 */
69 float frequencyUncertaintyNsPerSec;
70 }
71
72 @VintfStability
73 parcelable PositionDebug {
74 /**
75 * Validity of the data in this struct. False only if no
76 * latitude/longitude information is known.
77 */
78 boolean valid;
79
80 /** Latitude expressed in degrees */
81 double latitudeDegrees;
82
83 /** Longitude expressed in degrees */
84 double longitudeDegrees;
85
86 /** Altitude above ellipsoid expressed in meters */
87 float altitudeMeters;
88
89 /** Represents horizontal speed in meters per second. */
90 float speedMetersPerSec;
91
92 /** Represents heading in degrees. */
93 float bearingDegrees;
94
95 /**
96 * Estimated horizontal accuracy of position expressed in meters,
97 * radial, 68% confidence.
98 */
99 double horizontalAccuracyMeters;
100
101 /**
102 * Estimated vertical accuracy of position expressed in meters, with
103 * 68% confidence.
104 */
105 double verticalAccuracyMeters;
106
107 /**
108 * Estimated speed accuracy in meters per second with 68% confidence.
109 */
110 double speedAccuracyMetersPerSecond;
111
112 /**
113 * Estimated bearing accuracy degrees with 68% confidence.
114 */
115 double bearingAccuracyDegrees;
116
117 /**
118 * Time duration before this report that this position information was
119 * valid. This can, for example, be a previous injected location with
120 * an age potentially thousands of seconds old, or
121 * extrapolated to the current time (with appropriately increased
122 * accuracy estimates), with a (near) zero age.
123 */
124 float ageSeconds;
125 }
126
127 @VintfStability
128 parcelable SatelliteData {
129 /** Satellite vehicle ID number */
130 int svid;
131
132 /** Defines the constellation type of the given SV. */
133 GnssConstellationType constellation;
134
135 /**
136 * Defines the standard broadcast ephemeris or almanac availability for
137 * the satellite. To report status of predicted orbit and clock
138 * information, see the serverPrediction fields below.
139 */
140 SatelliteEphemerisType ephemerisType;
141
142 /** Defines the ephemeris source of the satellite. */
143 SatelliteEphemerisSource ephemerisSource;
144
145 /**
146 * Defines whether the satellite is known healthy
147 * (safe for use in location calculation.)
148 */
149 SatelliteEphemerisHealth ephemerisHealth;
150
151 /**
152 * Time duration from this report (current time), minus the
153 * effective time of the ephemeris source (e.g. TOE, TOA.)
154 * Set to 0 when ephemerisType is NOT_AVAILABLE.
155 */
156 float ephemerisAgeSeconds;
157
158 /**
159 * True if a server has provided a predicted orbit and clock model for
160 * this satellite.
161 */
162 boolean serverPredictionIsAvailable;
163
164 /**
165 * Time duration from this report (current time) minus the time of the
166 * start of the server predicted information. For example, a 1 day
167 * old prediction would be reported as 86400 seconds here.
168 */
169 float serverPredictionAgeSeconds;
170 }
171
172 /**
173 * Provides a set of debug information that is filled by the GNSS chipset
174 * when the method getDebugData() is invoked.
175 */
176 @VintfStability
177 parcelable DebugData {
178 /** Current best known position. */
179 PositionDebug position;
180
181 /** Current best know time estimate */
182 TimeDebug time;
183
184 /**
185 * Provides a list of the available satellite data, for all
186 * satellites and constellations the device can track,
187 * including GnssConstellationType UNKNOWN.
188 */
189 List<SatelliteData> satelliteDataArray;
190 }
191
192 /**
193 * This methods requests position, time and satellite ephemeris debug information
194 * from the HAL.
195 *
196 * @return ret debugData information from GNSS Hal that contains the current best
197 * known position, best known time estimate and a complete list of
198 * constellations that the device can track.
199 */
200 DebugData getDebugData();
201}