blob: 403166477ae580a31f6e7605959d02504d511601 [file] [log] [blame]
Hridya Valsarajue596a712016-09-22 14:07:22 -07001/*
2 * Copyright (C) 2016 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@1.0;
18
Andreas Huber40d3a9b2017-03-28 16:19:16 -070019/** The callback interface to report measurements from the HAL. */
Hridya Valsarajue596a712016-09-22 14:07:22 -070020interface IGnssMeasurementCallback {
Andreas Huber40d3a9b2017-03-28 16:19:16 -070021 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -070022 * Flags to indicate what fields in GnssClock are valid.
23 */
Hridya Valsaraju529331c2016-11-22 08:17:23 -080024 @export(name="", value_prefix="GNSS_CLOCK_")
Hridya Valsarajue596a712016-09-22 14:07:22 -070025 enum GnssClockFlags : uint16_t {
26 /** A valid 'leap second' is stored in the data structure. */
27 HAS_LEAP_SECOND = 1 << 0,
28 /** A valid 'time uncertainty' is stored in the data structure. */
29 HAS_TIME_UNCERTAINTY = 1 << 1,
30 /** A valid 'full bias' is stored in the data structure. */
31 HAS_FULL_BIAS = 1 << 2,
32 /** A valid 'bias' is stored in the data structure. */
33 HAS_BIAS = 1 << 3,
34 /** A valid 'bias uncertainty' is stored in the data structure. */
35 HAS_BIAS_UNCERTAINTY = 1 << 4,
36 /** A valid 'drift' is stored in the data structure. */
37 HAS_DRIFT = 1 << 5,
38 /** A valid 'drift uncertainty' is stored in the data structure. */
39 HAS_DRIFT_UNCERTAINTY = 1 << 6
40 };
41
Andreas Huber40d3a9b2017-03-28 16:19:16 -070042 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -070043 * Flags to indicate what fields in GnssMeasurement are valid.
44 */
Hridya Valsaraju529331c2016-11-22 08:17:23 -080045 @export(name="", value_prefix="GNSS_MEASUREMENT_")
Hridya Valsarajue596a712016-09-22 14:07:22 -070046 enum GnssMeasurementFlags : uint32_t {
47 /** A valid 'snr' is stored in the data structure. */
48 HAS_SNR = 1 << 0,
49 /** A valid 'carrier frequency' is stored in the data structure. */
50 HAS_CARRIER_FREQUENCY = 1 << 9,
51 /** A valid 'carrier cycles' is stored in the data structure. */
52 HAS_CARRIER_CYCLES = 1 << 10,
53 /** A valid 'carrier phase' is stored in the data structure. */
54 HAS_CARRIER_PHASE = 1 << 11,
55 /** A valid 'carrier phase uncertainty' is stored in the data structure. */
gomoc3d92782017-01-11 14:04:21 -080056 HAS_CARRIER_PHASE_UNCERTAINTY = 1 << 12,
57 /** A valid automatic gain control is stored in the data structure. */
58 HAS_AUTOMATIC_GAIN_CONTROL = 1 << 13
Hridya Valsarajue596a712016-09-22 14:07:22 -070059 };
60
Andreas Huber40d3a9b2017-03-28 16:19:16 -070061 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -070062 * Enumeration of available values for the GNSS Measurement's multipath
63 * indicator.
64 */
Hridya Valsaraju529331c2016-11-22 08:17:23 -080065 @export(name="", value_prefix="GNSS_MULTIPATH_")
Hridya Valsarajue596a712016-09-22 14:07:22 -070066 enum GnssMultipathIndicator : uint8_t {
67 /** The indicator is not available or unknown. */
68 INDICATOR_UNKNOWN = 0,
69 /** The measurement is indicated to be affected by multipath. */
70 INDICATOR_PRESENT = 1,
71 /** The measurement is indicated to be not affected by multipath. */
72 INDICATIOR_NOT_PRESENT = 2
73 };
74
Andreas Huber40d3a9b2017-03-28 16:19:16 -070075 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -070076 * Flags indicating the GNSS measurement state.
77 *
78 * The expected behavior here is for GNSS HAL to set all the flags that applies.
79 * For example, if the state for a satellite is only C/A code locked and bit
80 * synchronized, and there is still millisecond ambiguity, the state must be
81 * set as:
82 *
83 * STATE_CODE_LOCK | STATE_BIT_SYNC | STATE_MSEC_AMBIGUOUS
84 *
85 * If GNSS is still searching for a satellite, the corresponding state must be
86 * set to STATE_UNKNOWN(0).
87 */
Hridya Valsaraju529331c2016-11-22 08:17:23 -080088 @export(name="", value_prefix="GNSS_MEASUREMENT_")
Hridya Valsarajue596a712016-09-22 14:07:22 -070089 enum GnssMeasurementState : uint32_t {
90 STATE_UNKNOWN = 0,
91 STATE_CODE_LOCK = 1 << 0,
92 STATE_BIT_SYNC = 1 << 1,
93 STATE_SUBFRAME_SYNC = 1 << 2,
94 STATE_TOW_DECODED = 1 << 3,
95 STATE_MSEC_AMBIGUOUS = 1 << 4,
96 STATE_SYMBOL_SYNC = 1 << 5,
97 STATE_GLO_STRING_SYNC = 1 << 6,
98 STATE_GLO_TOD_DECODED = 1 << 7,
99 STATE_BDS_D2_BIT_SYNC = 1 << 8,
100 STATE_BDS_D2_SUBFRAME_SYNC = 1 << 9,
101 STATE_GAL_E1BC_CODE_LOCK = 1 << 10,
102 STATE_GAL_E1C_2ND_CODE_LOCK = 1 << 11,
103 STATE_GAL_E1B_PAGE_SYNC = 1 << 12,
gomoc3d92782017-01-11 14:04:21 -0800104 STATE_SBAS_SYNC = 1 << 13,
105 STATE_TOW_KNOWN = 1 << 14,
106 STATE_GLO_TOD_KNOWN = 1 << 15,
Hridya Valsarajue596a712016-09-22 14:07:22 -0700107 };
108
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700109 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700110 * Flags indicating the Accumulated Delta Range's states.
111 */
Hridya Valsaraju529331c2016-11-22 08:17:23 -0800112 @export(name="", value_prefix="GNSS_")
Hridya Valsarajue596a712016-09-22 14:07:22 -0700113 enum GnssAccumulatedDeltaRangeState : uint16_t {
114 ADR_STATE_UNKNOWN = 0,
115 ADR_STATE_VALID = 1 << 0,
116 ADR_STATE_RESET = 1 << 1,
117 ADR_STATE_CYCLE_SLIP = 1 << 2,
118 };
119
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700120 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700121 * Represents an estimate of the GNSS clock time.
122 */
123 struct GnssClock {
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700124 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700125 * A set of flags indicating the validity of the fields in this data
126 * structure.
127 */
Yifan Hong7037fdb2016-12-05 17:16:09 -0800128 bitfield<GnssClockFlags> gnssClockFlags;
Hridya Valsarajue596a712016-09-22 14:07:22 -0700129
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700130 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700131 * Leap second data.
132 * The sign of the value is defined by the following equation:
133 * utcTimeNs = timeNs - (fullBiasNs + biasNs) - leapSecond *
134 * 1,000,000,000
135 *
136 * If this data is available, gnssClockFlags must contain
137 * HAS_LEAP_SECOND.
138 */
139 int16_t leapSecond;
140
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700141 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700142 * The GNSS receiver internal clock value. This is the local hardware clock
143 * value.
144 *
145 * For local hardware clock, this value is expected to be monotonically
146 * increasing while the hardware clock remains powered on. (For the case of a
147 * HW clock that is not continuously on, see the
148 * hwClockDiscontinuityCount field). The receiver's estimate of GNSS time
149 * can be derived by subtracting the sum of fullBiasNs and biasNs (when
150 * available) from this value.
151 *
152 * This GNSS time must be the best estimate of current GNSS time
153 * that GNSS receiver can achieve.
154 *
155 * Sub-nanosecond accuracy can be provided by means of the 'biasNs' field.
156 * The value contains the timeUncertaintyNs in it.
157 *
158 * This field is mandatory.
159 */
160 int64_t timeNs;
161
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700162 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700163 * 1-Sigma uncertainty associated with the clock's time in nanoseconds.
164 * The uncertainty is represented as an absolute (single sided) value.
165 *
166 * If the data is available, gnssClockFlags must contain
167 * HAS_TIME_UNCERTAINTY. Ths value is ideally zero, as the time
168 * 'latched' by timeNs is defined as the reference clock vs. which all
169 * other times (and corresponding uncertainties) are measured.
170 */
171 double timeUncertaintyNs;
172
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700173 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700174 * The difference between hardware clock ('time' field) inside GNSS receiver
175 * and the true GNSS time since 0000Z, January 6, 1980, in nanoseconds.
176 *
177 * The sign of the value is defined by the following equation:
178 * local estimate of GNSS time = timeNs - (fullBiasNs + biasNs)
179 *
180 * This value is mandatory if the receiver has estimated GNSS time. If the
181 * computed time is for a non-GNSS constellation, the time offset of that
182 * constellation to GNSS has to be applied to fill this value. The error
183 * estimate for the sum of this and the biasNs is the biasUncertaintyNs,
184 * and the caller is responsible for using this uncertainty (it can be very
185 * large before the GNSS time has been solved for.) If the data is available
186 * gnssClockFlags must contain HAS_FULL_BIAS.
187 */
188 int64_t fullBiasNs;
189
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700190 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700191 * Sub-nanosecond bias.
192 * The error estimate for the sum of this and the fullBiasNs is the
193 * biasUncertaintyNs.
194 *
195 * If the data is available gnssClockFlags must contain HAS_BIAS. If GNSS
196 * has computed a position fix. This value is mandatory if the receiver has
197 * estimated GNSS time.
198 */
199 double biasNs;
200
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700201 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700202 * 1-Sigma uncertainty associated with the local estimate of GNSS time (clock
203 * bias) in nanoseconds. The uncertainty is represented as an absolute
204 * (single sided) value.
205 *
206 * If the data is available gnssClockFlags must contain
207 * HAS_BIAS_UNCERTAINTY. This value is mandatory if the receiver
208 * has estimated GNSS time.
209 */
210 double biasUncertaintyNs;
211
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700212 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700213 * The clock's drift in nanoseconds (per second).
214 *
215 * A positive value means that the frequency is higher than the nominal
216 * frequency, and that the (fullBiasNs + biasNs) is growing more positive
217 * over time.
218 *
219 * The value contains the 'drift uncertainty' in it.
220 * If the data is available gnssClockFlags must contain HAS_DRIFT.
221 *
222 * This value is mandatory if the receiver has estimated GNSS time.
223 */
224 double driftNsps;
225
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700226 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700227 * 1-Sigma uncertainty associated with the clock's drift in nanoseconds (per
228 * second).
229 * The uncertainty is represented as an absolute (single sided) value.
230 *
231 * If the data is available gnssClockFlags must contain
232 * HAS_DRIFT_UNCERTAINTY. If GNSS has computed a position fix this
233 * field is mandatory and must be populated.
234 */
235 double driftUncertaintyNsps;
236
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700237 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700238 * When there are any discontinuities in the HW clock, this field is
239 * mandatory.
240 *
241 * A "discontinuity" is meant to cover the case of a switch from one source
242 * of clock to another. A single free-running crystal oscillator (XO)
243 * will generally not have any discontinuities, and this can be set and
244 * left at 0.
245 *
246 * If, however, the timeNs value (HW clock) is derived from a composite of
247 * sources, that is not as smooth as a typical XO, or is otherwise stopped &
248 * restarted, then this value shall be incremented each time a discontinuity
249 * occurs. (E.g. this value can start at zero at device boot-up and
250 * increment each time there is a change in clock continuity. In the
251 * unlikely event that this value reaches full scale, rollover (not
252 * clamping) is required, such that this value continues to change, during
253 * subsequent discontinuity events.)
254 *
255 * While this number stays the same, between GnssClock reports, it can be
256 * safely assumed that the timeNs value has been running continuously, e.g.
257 * derived from a single, high quality clock (XO like, or better, that is
258 * typically used during continuous GNSS signal sampling.)
259 *
260 * It is expected, esp. during periods where there are few GNSS signals
261 * available, that the HW clock be discontinuity-free as long as possible,
262 * as this avoids the need to use (waste) a GNSS measurement to fully
263 * re-solve for the GNSS clock bias and drift, when using the accompanying
264 * measurements, from consecutive GnssData reports.
265 */
266 uint32_t hwClockDiscontinuityCount;
267
268 };
269
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700270 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700271 * Represents a GNSS Measurement, it contains raw and computed information.
272 *
273 * All signal measurement information (e.g. svTime,
274 * pseudorangeRate, multipathIndicator) reported in this struct must be
275 * based on GNSS signal measurements only. You must not synthesize measurements
276 * by calculating or reporting expected measurements based on known or estimated
277 * position, velocity, or time.
278 */
279 struct GnssMeasurement{
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700280 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700281 * A set of flags indicating the validity of the fields in this data
282 * structure.
283 */
Yifan Hong7037fdb2016-12-05 17:16:09 -0800284 bitfield<GnssMeasurementFlags> flags;
Hridya Valsarajue596a712016-09-22 14:07:22 -0700285
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700286 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700287 * Satellite vehicle ID number, as defined in GnssSvInfo::svid
288 * This is a mandatory value.
289 */
290 int16_t svid;
291
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700292 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700293 * Defines the constellation of the given SV.
294 */
295 GnssConstellationType constellation;
296
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700297 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700298 * Time offset at which the measurement was taken in nanoseconds.
299 * The reference receiver's time is specified by GnssData::clock::timeNs.
300 *
301 * The sign of timeOffsetNs is given by the following equation:
302 * measurement time = GnssClock::timeNs + timeOffsetNs
303 *
304 * It provides an individual time-stamp for the measurement, and allows
305 * sub-nanosecond accuracy.
306 * This is a mandatory value.
307 */
308 double timeOffsetNs;
309
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700310 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700311 * Per satellite sync state. It represents the current sync state for the
312 * associated satellite.
313 * Based on the sync state, the 'received GNSS tow' field must be interpreted
314 * accordingly.
315 *
316 * This is a mandatory value.
317 */
Yifan Hong7037fdb2016-12-05 17:16:09 -0800318 bitfield<GnssMeasurementState> state;
Hridya Valsarajue596a712016-09-22 14:07:22 -0700319
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700320 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700321 * The received GNSS Time-of-Week at the measurement time, in nanoseconds.
322 * For GNSS & QZSS, this is the received GNSS Time-of-Week at the
323 * measurement time, in nanoseconds. The value is relative to the
324 * beginning of the current GNSS week.
325 *
326 * Given the highest sync state that can be achieved, per each satellite,
327 * valid range for this field can be:
328 * Searching : [ 0 ] : STATE_UNKNOWN
329 * C/A code lock : [ 0 1ms ] : STATE_CODE_LOCK set
330 * Bit sync : [ 0 20ms ] : STATE_BIT_SYNC set
331 * Subframe sync : [ 0 6s ] : STATE_SUBFRAME_SYNC set
332 * TOW decoded : [ 0 1week ] : STATE_TOW_DECODED set
gomoc3d92782017-01-11 14:04:21 -0800333 * TOW Known : [ 0 1week ] : STATE_TOW_KNOWN set
334 *
335 * Note: TOW Known refers to the case where TOW is possibly not decoded
336 * over the air but has been determined from other sources. If TOW
337 * decoded is set then TOW Known must also be set.
Hridya Valsarajue596a712016-09-22 14:07:22 -0700338 *
339 * Note: If there is any ambiguity in integer millisecond,
340 * GNSS_MEASUREMENT_STATE_MSEC_AMBIGUOUS must be set accordingly, in the
341 * 'state' field.
342 *
343 * This value must be populated if 'state' != STATE_UNKNOWN.
344 *
345 * For Glonass, this is the received Glonass time of day, at the
346 * measurement time in nanoseconds.
347 *
348 * Given the highest sync state that can be achieved, per each satellite,
349 * valid range for this field can be:
gomoc3d92782017-01-11 14:04:21 -0800350 * Searching : [ 0 ] : STATE_UNKNOWN set
351 * C/A code lock : [ 0 1ms ] : STATE_CODE_LOCK set
352 * Symbol sync : [ 0 10ms ] : STATE_SYMBOL_SYNC set
353 * Bit sync : [ 0 20ms ] : STATE_BIT_SYNC set
354 * String sync : [ 0 2s ] : STATE_GLO_STRING_SYNC set
355 * Time of day decoded : [ 0 1day ] : STATE_GLO_TOD_DECODED set
356 * Time of day known : [ 0 1day ] : STATE_GLO_TOD_KNOWN set
357 *
358 * Note: Time of day known refers to the case where it is possibly not
359 * decoded over the air but has been determined from other sources. If
360 * Time of day decoded is set then Time of day known must also be set.
Hridya Valsarajue596a712016-09-22 14:07:22 -0700361 *
362 * For Beidou, this is the received Beidou time of week,
363 * at the measurement time in nanoseconds.
364 *
365 * Given the highest sync state that can be achieved, per each satellite,
366 * valid range for this field can be:
gomoc3d92782017-01-11 14:04:21 -0800367 * Searching : [ 0 ] : STATE_UNKNOWN set.
368 * C/A code lock : [ 0 1ms ] : STATE_CODE_LOCK set.
369 * Bit sync (D2) : [ 0 2ms ] : STATE_BDS_D2_BIT_SYNC set.
370 * Bit sync (D1) : [ 0 20ms ] : STATE_BIT_SYNC set.
371 * Subframe (D2) : [ 0 0.6s ] : STATE_BDS_D2_SUBFRAME_SYNC set.
372 * Subframe (D1) : [ 0 6s ] : STATE_SUBFRAME_SYNC set.
373 * Time of week decoded : [ 0 1week ] : STATE_TOW_DECODED set.
374 * Time of week known : [ 0 1week ] : STATE_TOW_KNOWN set
375 *
376 * Note: TOW Known refers to the case where TOW is possibly not decoded
377 * over the air but has been determined from other sources. If TOW
378 * decoded is set then TOW Known must also be set.
Hridya Valsarajue596a712016-09-22 14:07:22 -0700379 *
380 * For Galileo, this is the received Galileo time of week,
381 * at the measurement time in nanoseconds.
382 *
gomoc3d92782017-01-11 14:04:21 -0800383 * E1BC code lock : [ 0 4ms ] : STATE_GAL_E1BC_CODE_LOCK set.
384 * E1C 2nd code lock : [ 0 100ms] : STATE_GAL_E1C_2ND_CODE_LOCK set.
385 * E1B page : [ 0 2s ] : STATE_GAL_E1B_PAGE_SYNC set.
386 * Time of week decoded : [ 0 1week] : STATE_TOW_DECODED is set.
387 * Time of week known : [ 0 1week] : STATE_TOW_KNOWN set
388 *
389 * Note: TOW Known refers to the case where TOW is possibly not decoded
390 * over the air but has been determined from other sources. If TOW
391 * decoded is set then TOW Known must also be set.
Hridya Valsarajue596a712016-09-22 14:07:22 -0700392 *
393 * For SBAS, this is received SBAS time, at the measurement time in
394 * nanoseconds.
395 *
396 * Given the highest sync state that can be achieved, per each satellite,
397 * valid range for this field can be:
398 * Searching : [ 0 ] : STATE_UNKNOWN
399 * C/A code lock: [ 0 1ms ] : STATE_CODE_LOCK is set
400 * Symbol sync : [ 0 2ms ] : STATE_SYMBOL_SYNC is set
401 * Message : [ 0 1s ] : STATE_SBAS_SYNC is set
402 */
403 int64_t receivedSvTimeInNs;
404
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700405 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700406 * 1-Sigma uncertainty of the Received GNSS Time-of-Week in nanoseconds.
407 *
408 * This value must be populated if 'state' != STATE_UNKNOWN.
409 */
410 int64_t receivedSvTimeUncertaintyInNs;
411
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700412 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700413 * Carrier-to-noise density in dB-Hz, typically in the range [0, 63].
414 * It contains the measured C/N0 value for the signal at the antenna port.
415 *
416 * This is a mandatory value.
417 */
418 double cN0DbHz;
419
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700420 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700421 * Pseudorange rate at the timestamp in m/s. The correction of a given
422 * Pseudorange Rate value includes corrections for receiver and satellite
423 * clock frequency errors. Ensure that this field is independent (see
424 * comment at top of GnssMeasurement struct.)
425 *
426 * It is mandatory to provide the 'uncorrected' 'pseudorange rate', and
427 * provide GnssClock's 'drift' field as well. When providing the
428 * uncorrected pseudorange rate, do not apply the corrections described above.)
429 *
430 * The value includes the 'pseudorange rate uncertainty' in it.
431 * A positive 'uncorrected' value indicates that the SV is moving away from
432 * the receiver.
433 *
434 * The sign of the 'uncorrected' 'pseudorange rate' and its relation to the
435 * sign of 'doppler shift' is given by the equation:
436 * pseudorange rate = -k * doppler shift (where k is a constant)
437 *
438 * This must be the most accurate pseudorange rate available, based on
439 * fresh signal measurements from this channel.
440 *
441 * It is mandatory that this value be provided at typical carrier phase PRR
442 * quality (few cm/sec per second of uncertainty, or better) - when signals
443 * are sufficiently strong & stable, e.g. signals from a GNSS simulator at >=
444 * 35 dB-Hz.
445 */
446 double pseudorangeRateMps;
447
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700448 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700449 * 1-Sigma uncertainty of the pseudorangeRateMps.
450 * The uncertainty is represented as an absolute (single sided) value.
451 *
452 * This is a mandatory value.
453 */
454 double pseudorangeRateUncertaintyMps;
455
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700456 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700457 * Accumulated delta range's state. It indicates whether ADR is reset or
458 * there is a cycle slip(indicating loss of lock).
459 *
460 * This is a mandatory value.
461 */
Yifan Hong7037fdb2016-12-05 17:16:09 -0800462 bitfield<GnssAccumulatedDeltaRangeState> accumulatedDeltaRangeState;
Hridya Valsarajue596a712016-09-22 14:07:22 -0700463
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700464 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700465 * Accumulated delta range since the last channel reset in meters.
466 * A positive value indicates that the SV is moving away from the receiver.
467 *
468 * The sign of the 'accumulated delta range' and its relation to the sign of
469 * 'carrier phase' is given by the equation:
470 * accumulated delta range = -k * carrier phase (where k is a constant)
471 *
472 * This value must be populated if 'accumulated delta range state' !=
473 * ADR_STATE_UNKNOWN.
474 * However, it is expected that the data is only accurate when:
475 * 'accumulated delta range state' == ADR_STATE_VALID.
476 */
477 double accumulatedDeltaRangeM;
478
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700479 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700480 * 1-Sigma uncertainty of the accumulated delta range in meters.
481 * This value must be populated if 'accumulated delta range state' !=
482 * ADR_STATE_UNKNOWN.
483 */
484 double accumulatedDeltaRangeUncertaintyM;
485
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700486 /**
gomoc3d92782017-01-11 14:04:21 -0800487 * Carrier frequency of the signal tracked, for example it can be the
gomod567a992017-01-20 00:00:42 -0800488 * GPS central frequency for L1 = 1575.45 MHz, or L2 = 1227.60 MHz, L5 =
489 * 1176.45 MHz, varying GLO channels, etc. If the field is not set, it
490 * is the primary common use central frequency, e.g. L1 = 1575.45 MHz
491 * for GPS.
492 *
493 * For an L1, L5 receiver tracking a satellite on L1 and L5 at the same
494 * time, two raw measurement structs must be reported for this same
495 * satellite, in one of the measurement structs, all the values related
496 * to L1 must be filled, and in the other all of the values related to
497 * L5 must be filled.
Hridya Valsarajue596a712016-09-22 14:07:22 -0700498 *
499 * If the data is available, gnssClockFlags must contain
500 * HAS_CARRIER_FREQUENCY.
501 */
502 float carrierFrequencyHz;
503
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700504 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700505 * The number of full carrier cycles between the satellite and the
506 * receiver. The reference frequency is given by the field
507 * 'carrierFrequencyHz'. Indications of possible cycle slips and
508 * resets in the accumulation of this value can be inferred from the
509 * accumulatedDeltaRangeState flags.
510 *
511 * If the data is available, gnssClockFlags must contain
512 * HAS_CARRIER_CYCLES.
513 */
514 int64_t carrierCycles;
515
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700516 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700517 * The RF phase detected by the receiver, in the range [0.0, 1.0].
518 * This is usually the fractional part of the complete carrier phase
519 * measurement.
520 *
521 * The reference frequency is given by the field 'carrierFrequencyHz'.
522 * The value contains the 'carrier-phase uncertainty' in it.
523 *
524 * If the data is available, gnssClockFlags must contain
525 * HAS_CARRIER_PHASE.
526 */
527 double carrierPhase;
528
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700529 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700530 * 1-Sigma uncertainty of the carrier-phase.
531 * If the data is available, gnssClockFlags must contain
532 * HAS_CARRIER_PHASE_UNCERTAINTY.
533 */
534 double carrierPhaseUncertainty;
535
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700536 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700537 * An enumeration that indicates the 'multipath' state of the event.
538 *
539 * The multipath Indicator is intended to report the presence of overlapping
540 * signals that manifest as distorted correlation peaks.
541 *
542 * - if there is a distorted correlation peak shape, report that multipath
543 * is MULTIPATH_INDICATOR_PRESENT.
544 * - if there is no distorted correlation peak shape, report
545 * MULTIPATH_INDICATOR_NOT_PRESENT
546 * - if signals are too weak to discern this information, report
547 * MULTIPATH_INDICATOR_UNKNOWN
548 *
549 * Example: when doing the standardized overlapping Multipath Performance
550 * test (3GPP TS 34.171) the Multipath indicator must report
551 * MULTIPATH_INDICATOR_PRESENT for those signals that are tracked, and
552 * contain multipath, and MULTIPATH_INDICATOR_NOT_PRESENT for those
553 * signals that are tracked and do not contain multipath.
554 */
555 GnssMultipathIndicator multipathIndicator;
556
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700557 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700558 * Signal-to-noise ratio at correlator output in dB.
Yu Liu216b8702017-05-02 11:33:20 -0700559 * If the data is available, GnssMeasurementFlags must contain HAS_SNR.
Hridya Valsarajue596a712016-09-22 14:07:22 -0700560 * This is the power ratio of the "correlation peak height above the
561 * observed noise floor" to "the noise RMS".
562 */
563 double snrDb;
gomoc3d92782017-01-11 14:04:21 -0800564
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700565 /**
gomoc3d92782017-01-11 14:04:21 -0800566 * Automatic gain control (AGC) level. AGC acts as a variable gain
gomod567a992017-01-20 00:00:42 -0800567 * amplifier adjusting the power of the incoming signal. The AGC level
568 * may be used to indicate potential interference. When AGC is at a
569 * nominal level, this value must be set as 0. Higher gain (and/or lower
570 * input power) must be output as a positive number. Hence in cases of
571 * strong jamming, in the band of this signal, this value must go more
572 * negative.
gomoc3d92782017-01-11 14:04:21 -0800573 *
574 * Note: Different hardware designs (e.g. antenna, pre-amplification, or
575 * other RF HW components) may also affect the typical output of of this
576 * value on any given hardware design in an open sky test - the
577 * important aspect of this output is that changes in this value are
578 * indicative of changes on input signal power in the frequency band for
579 * this measurement.
580 */
581 double agcLevelDb;
Hridya Valsarajue596a712016-09-22 14:07:22 -0700582 };
583
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700584 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700585 * Represents a reading of GNSS measurements. For devices where GnssSystemInfo's
586 * yearOfHw is set to 2016+, it is mandatory that these be provided, on
587 * request, when the GNSS receiver is searching/tracking signals.
588 *
589 * - Reporting of GNSS constellation measurements is mandatory.
590 * - Reporting of all tracked constellations are encouraged.
591 */
592 struct GnssData {
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700593 /** Number of GnssMeasurement elements. */
Hridya Valsarajue596a712016-09-22 14:07:22 -0700594 uint32_t measurementCount;
595
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700596 /** The array of measurements. */
Hridya Valsaraju97ecaa02016-11-02 10:20:07 -0700597 GnssMeasurement[GnssMax:SVS_COUNT] measurements;
Hridya Valsarajue596a712016-09-22 14:07:22 -0700598
599 /** The GNSS clock time reading. */
600 GnssClock clock;
601 };
602
Andreas Huber40d3a9b2017-03-28 16:19:16 -0700603 /**
Hridya Valsarajue596a712016-09-22 14:07:22 -0700604 * Callback for the hal to pass a GnssData structure back to the client.
605 *
606 * @param data Contains a reading of GNSS measurements.
607 */
608 GnssMeasurementCb(GnssData data);
609};