blob: d5dc038b822513db43db948f27032ea2609de0d1 [file] [log] [blame]
Yu-Han Yang9c6c20b2018-11-06 14:12:49 -08001/*
2 * Copyright (C) 2018 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@2.0;
18
19import @1.0::IGnssMeasurementCallback;
20import @1.1::IGnssMeasurementCallback;
Pierre Fite-Georgel12ac2b52019-01-17 16:56:17 -080021import ElapsedRealtime;
Yu-Han Yang9c6c20b2018-11-06 14:12:49 -080022
23/** The callback interface to report measurements from the HAL. */
24interface IGnssMeasurementCallback extends @1.1::IGnssMeasurementCallback {
25 /**
26 * Enumeration of available values for the GNSS Measurement's code type. Similar to the
Yu-Han Yang49cbed02019-01-23 12:11:01 -080027 * Attribute field described in RINEX 3.03, e.g., in Tables 4-10, and Table A2 at the RINEX 3.03
Yu-Han Yang9c6c20b2018-11-06 14:12:49 -080028 * Update 1 Document.
29 */
30 enum GnssMeasurementCodeType : uint8_t {
31 /** GALILEO E1A, GALILEO E6A, IRNSS L5A, IRNSS SA. */
Yu-Han Yang49cbed02019-01-23 12:11:01 -080032 A = 0,
Yu-Han Yang9c6c20b2018-11-06 14:12:49 -080033
34 /** GALILEO E1B, GALILEO E6B, IRNSS L5B, IRNSS SB. */
Yu-Han Yang49cbed02019-01-23 12:11:01 -080035 B = 1,
Yu-Han Yang9c6c20b2018-11-06 14:12:49 -080036
37 /**
38 * GPS L1 C/A, GPS L2 C/A, GLONASS G1 C/A, GLONASS G2 C/A, GALILEO E1C, GALILEO E6C, SBAS
39 * L1 C/A, QZSS L1 C/A, IRNSS L5C.
40 */
Yu-Han Yang49cbed02019-01-23 12:11:01 -080041 C = 2,
Yu-Han Yang9c6c20b2018-11-06 14:12:49 -080042
43 /**
44 * GPS L5 I, GLONASS G3 I, GALILEO E5a I, GALILEO E5b I, GALILEO E5a+b I, SBAS L5 I, QZSS L5
45 * I, BDS B1 I, BDS B2 I, BDS B3 I.
46 */
Yu-Han Yang49cbed02019-01-23 12:11:01 -080047 I = 3,
Yu-Han Yang9c6c20b2018-11-06 14:12:49 -080048
49 /** GPS L1C (P), GPS L2C (L), QZSS L1C (P), QZSS L2C (L), LEX(6) L. */
Yu-Han Yang49cbed02019-01-23 12:11:01 -080050 L = 4,
Yu-Han Yang9c6c20b2018-11-06 14:12:49 -080051
52 /** GPS L1M, GPS L2M. */
Yu-Han Yang49cbed02019-01-23 12:11:01 -080053 M = 5,
Yu-Han Yang9c6c20b2018-11-06 14:12:49 -080054
55 /** GPS L1P, GPS L2P, GLONASS G1P, GLONASS G2P. */
Yu-Han Yang49cbed02019-01-23 12:11:01 -080056 P = 6,
Yu-Han Yang9c6c20b2018-11-06 14:12:49 -080057
58 /**
59 * GPS L5 Q, GLONASS G3 Q, GALILEO E5a Q, GALILEO E5b Q, GALILEO E5a+b Q, SBAS L5 Q, QZSS L5
60 * Q, BDS B1 Q, BDS B2 Q, BDS B3 Q.
61 */
Yu-Han Yang49cbed02019-01-23 12:11:01 -080062 Q = 7,
Yu-Han Yang9c6c20b2018-11-06 14:12:49 -080063
64 /** GPS L1C (D), GPS L2C (M), QZSS L1C (D), QZSS L2C (M), LEX(6) S. */
Yu-Han Yang49cbed02019-01-23 12:11:01 -080065 S = 8,
Yu-Han Yang9c6c20b2018-11-06 14:12:49 -080066
67 /** GPS L1 Z-tracking, GPS L2 Z-tracking. */
Yu-Han Yang49cbed02019-01-23 12:11:01 -080068 W = 9,
Yu-Han Yang9c6c20b2018-11-06 14:12:49 -080069
70 /**
71 * GPS L1C (D+P), GPS L2C (M+L), GPS L5 (I+Q), GLONASS G3 (I+Q), GALILEO E1 (B+C), GALILEO
72 * E5a (I+Q), GALILEO E5b (I+Q), GALILEO E5a+b(I+Q), GALILEO E6 (B+C), SBAS L5 (I+Q), QZSS
73 * L1C (D+P), QZSS L2C (M+L), QZSS L5 (I+Q), LEX(6) (S+L), BDS B1 (I+Q), BDS B2 (I+Q), BDS
74 * B3 (I+Q), IRNSS L5 (B+C).
75 */
Yu-Han Yang49cbed02019-01-23 12:11:01 -080076 X = 10,
Yu-Han Yang9c6c20b2018-11-06 14:12:49 -080077
78 /** GPS L1Y, GPS L2Y. */
Yu-Han Yang49cbed02019-01-23 12:11:01 -080079 Y = 11,
Yu-Han Yang9c6c20b2018-11-06 14:12:49 -080080
81 /** GALILEO E1 (A+B+C), GALILEO E6 (A+B+C), QZSS L1-SAIF. */
Yu-Han Yang49cbed02019-01-23 12:11:01 -080082 Z = 12,
Yu-Han Yang9c6c20b2018-11-06 14:12:49 -080083
84 /** GPS L1 codeless, GPS L2 codeless. */
Yu-Han Yang49cbed02019-01-23 12:11:01 -080085 N = 13,
86
87 /**
88 * Other code type that does not belong to any of the above code types.
89 *
90 * This code type is used in the case that the above code types do not cover all the code
91 * types introduced in a new version of RINEX standard. When this code type is set, the
92 * field GnssMeasurement.otherCodeTypeName must specify the new code type.
93 */
94 OTHER = 255
Yu-Han Yang9c6c20b2018-11-06 14:12:49 -080095 };
96
97 /**
Yu-Han Yang9e2eaf12019-01-23 11:58:01 -080098 * Flags indicating the GNSS measurement state.
99 *
100 * <p>The expected behavior here is for GNSS HAL to set all the flags that apply. For example,
101 * if the state for a satellite is only C/A code locked and bit synchronized, and there is still
102 * millisecond ambiguity, the state must be set as:
103 *
104 * STATE_CODE_LOCK | STATE_BIT_SYNC | STATE_MSEC_AMBIGUOUS
105 *
106 * <p>If GNSS is still searching for a satellite, the corresponding state must be set to
107 * STATE_UNKNOWN(0).
108 *
109 * <p>In @2.0::IGnssMeasurementCallback.GnssMeasurement, v1_1.v1_0.receivedSvTimeInNs, the
110 * received satellite time, is relative to the beginning of the system week for all
111 * constellations except for Glonass where it is relative to the beginning of the Glonass system
112 * day.
113 *
114 * <p>The table below indicates the valid range of the received GNSS satellite time. These
115 * ranges depend on the constellation and code being tracked and the state of the tracking
116 * algorithms given by the getState method. If the state flag is set, then the valid measurement
117 * range is zero to the value in the table. The state flag with the widest range indicates the
118 * range of the received GNSS satellite time value.
119 *
120 * <table>
121 * <thead>
122 * <tr>
123 * <td />
124 * <td colspan="3"><strong>GPS/QZSS</strong></td>
125 * <td><strong>GLNS</strong></td>
126 * <td colspan="2"><strong>BDS</strong></td>
127 * <td colspan="3"><strong>GAL</strong></td>
128 * <td><strong>SBAS</strong></td>
129 * </tr>
130 * <tr>
131 * <td><strong>State Flag</strong></td>
132 * <td><strong>L1 C/A</strong></td>
133 * <td><strong>L5I</strong></td>
134 * <td><strong>L5Q</strong></td>
135 * <td><strong>L1OF</strong></td>
136 * <td><strong>B1I (D1)</strong></td>
137 * <td><strong>B1I &nbsp;(D2)</strong></td>
138 * <td><strong>E1B</strong></td>
139 * <td><strong>E1C</strong></td>
140 * <td><strong>E5AQ</strong></td>
141 * <td><strong>L1 C/A</strong></td>
142 * </tr>
143 * </thead>
144 * <tbody>
145 * <tr>
146 * <td>
147 * <strong>STATE_UNKNOWN</strong>
148 * </td>
149 * <td>0</td>
150 * <td>0</td>
151 * <td>0</td>
152 * <td>0</td>
153 * <td>0</td>
154 * <td>0</td>
155 * <td>0</td>
156 * <td>0</td>
157 * <td>0</td>
158 * <td>0</td>
159 * </tr>
160 * <tr>
161 * <td>
162 * <strong>STATE_CODE_LOCK</strong>
163 * </td>
164 * <td>1 ms</td>
165 * <td>1 ms</td>
166 * <td>1 ms</td>
167 * <td>1 ms</td>
168 * <td>1 ms</td>
169 * <td>1 ms</td>
170 * <td>-</td>
171 * <td>-</td>
172 * <td>1 ms</td>
173 * <td>1 ms</td>
174 * </tr>
175 * <tr>
176 * <td>
177 * <strong>STATE_SYMBOL_SYNC</strong>
178 * </td>
179 * <td>20 ms (optional)</td>
180 * <td>10 ms</td>
181 * <td>1 ms (optional)</td>
182 * <td>10 ms</td>
183 * <td>20 ms (optional)</td>
184 * <td>2 ms</td>
185 * <td>4 ms (optional)</td>
186 * <td>4 ms (optional)</td>
187 * <td>1 ms (optional)</td>
188 * <td>2 ms</td>
189 * </tr>
190 * <tr>
191 * <td>
192 * <strong>STATE_BIT_SYNC</strong>
193 * </td>
194 * <td>20 ms</td>
195 * <td>20 ms</td>
196 * <td>1 ms (optional)</td>
197 * <td>20 ms</td>
198 * <td>20 ms</td>
199 * <td>-</td>
200 * <td>8 ms</td>
201 * <td>-</td>
202 * <td>1 ms (optional)</td>
203 * <td>4 ms</td>
204 * </tr>
205 * <tr>
206 * <td>
207 * <strong>STATE_SUBFRAME_SYNC</strong>
208 * </td>
209 * <td>6s</td>
210 * <td>6s</td>
211 * <td>-</td>
212 * <td>2 s</td>
213 * <td>6 s</td>
214 * <td>-</td>
215 * <td>-</td>
216 * <td>-</td>
217 * <td>100 ms</td>
218 * <td>-</td>
219 * </tr>
220 * <tr>
221 * <td>
222 * <strong>STATE_TOW_DECODED</strong>
223 * </td>
224 * <td colspan="2">1 week</td>
225 * <td>-</td>
226 * <td>1 day</td>
227 * <td colspan="2">1 week</td>
228 * <td colspan="2">1 week</td>
229 * <td>-</td>
230 * <td>1 week</td>
231 * </tr>
232 * <tr>
233 * <td>
234 * <strong>STATE_TOW_KNOWN</strong>
235 * </td>
236 * <td colspan="3">1 week</td>
237 * <td>1 day</td>
238 * <td colspan="2">1 week</td>
239 * <td colspan="3">1 week</td>
240 * <td>1 week</td>
241 * </tr>
242 * <tr>
243 * <td>
244 * <strong>STATE_GLO_STRING_SYNC</strong>
245 * </td>
246 * <td>-</td>
247 * <td>-</td>
248 * <td>-</td>
249 * <td>2 s</td>
250 * <td>-</td>
251 * <td>-</td>
252 * <td>-</td>
253 * <td>-</td>
254 * <td>-</td>
255 * <td>-</td>
256 * </tr>
257 * <tr>
258 * <td>
259 * <strong>STATE_GLO_TOD_DECODED</strong>
260 * </td>
261 * <td>-</td>
262 * <td>-</td>
263 * <td>-</td>
264 * <td>1 day</td>
265 * <td>-</td>
266 * <td>-</td>
267 * <td>-</td>
268 * <td>-</td>
269 * <td>-</td>
270 * <td>-</td>
271 * </tr>
272 * <tr>
273 * <td>
274 * <strong>STATE_GLO_TOD_KNOWN</strong>
275 * </td>
276 * <td>-</td>
277 * <td>-</td>
278 * <td>-</td>
279 * <td>1 day</td>
280 * <td>-</td>
281 * <td>-</td>
282 * <td>-</td>
283 * <td>-</td>
284 * <td>-</td>
285 * <td>-</td>
286 * </tr>
287 * <tr>
288 * <td>
289 * <strong>STATE_BDS_D2_BIT_SYNC</strong>
290 * </td>
291 * <td>-</td>
292 * <td>-</td>
293 * <td>-</td>
294 * <td>-</td>
295 * <td>-</td>
296 * <td>2 ms</td>
297 * <td>-</td>
298 * <td>-</td>
299 * <td>-</td>
300 * <td>-</td>
301 * </tr>
302 * <tr>
303 * <td>
304 * <strong>STATE_BDS_D2_SUBFRAME_SYNC</strong>
305 * </td>
306 * <td>-</td>
307 * <td>-</td>
308 * <td>-</td>
309 * <td>-</td>
310 * <td>-</td>
311 * <td>600 ms</td>
312 * <td>-</td>
313 * <td>-</td>
314 * <td>-</td>
315 * <td>-</td>
316 * </tr>
317 * <tr>
318 * <td>
319 * <strong>STATE_GAL_E1BC_CODE_LOCK</strong>
320 * </td>
321 * <td>-</td>
322 * <td>-</td>
323 * <td>-</td>
324 * <td>-</td>
325 * <td>-</td>
326 * <td>-</td>
327 * <td>4 ms</td>
328 * <td>4 ms</td>
329 * <td>-</td>
330 * <td>-</td>
331 * </tr>
332 * <tr>
333 * <td>
334 * <strong>STATE_GAL_E1C_2ND_CODE_LOCK</strong>
335 * </td>
336 * <td>-</td>
337 * <td>-</td>
338 * <td>-</td>
339 * <td>-</td>
340 * <td>-</td>
341 * <td>-</td>
342 * <td>-</td>
343 * <td>100 ms</td>
344 * <td>-</td>
345 * <td>-</td>
346 * </tr>
347 * <tr>
348 * <td>
349 * <strong>STATE_2ND_CODE_LOCK</strong>
350 * </td>
351 * <td>-</td>
352 * <td>10 ms (optional)</td>
353 * <td>20 ms</td>
354 * <td>-</td>
355 * <td>-</td>
356 * <td>-</td>
357 * <td>-</td>
358 * <td>100 ms (optional)</td>
359 * <td>100 ms</td>
360 * <td>-</td>
361 * </tr>
362 * <tr>
363 * <td>
364 * <strong>STATE_GAL_E1B_PAGE_SYNC</strong>
365 * </td>
366 * <td>-</td>
367 * <td>-</td>
368 * <td>-</td>
369 * <td>-</td>
370 * <td>-</td>
371 * <td>-</td>
372 * <td>2 s</td>
373 * <td>-</td>
374 * <td>-</td>
375 * <td>-</td>
376 * </tr>
377 * <tr>
378 * <td>
379 * <strong>STATE_SBAS_SYNC</strong>
380 * </td>
381 * <td>-</td>
382 * <td>-</td>
383 * <td>-</td>
384 * <td>-</td>
385 * <td>-</td>
386 * <td>-</td>
387 * <td>-</td>
388 * <td>-</td>
389 * <td>-</td>
390 * <td>1 s</td>
391 * </tr>
392 * </tbody>
393 * </table>
394 *
395 * <p>Note: TOW Known refers to the case where TOW is possibly not decoded over the air but has
396 * been determined from other sources. If TOW decoded is set then TOW Known must also be set.
397 *
398 * <p>Note well: if there is any ambiguity in integer millisecond, STATE_MSEC_AMBIGUOUS must be
399 * set accordingly, in the 'state' field. This value must be populated if 'state' !=
400 * STATE_UNKNOWN.
401 *
402 * <p>Note on optional flags:
403 * <ul>
404 * <li> For L1 C/A and B1I, STATE_SYMBOL_SYNC is optional since the symbol length is the
405 * same as the bit length.
406 * <li> For L5Q and E5aQ, STATE_BIT_SYNC and STATE_SYMBOL_SYNC are optional since they are
407 * implied by STATE_CODE_LOCK.
408 * <li> STATE_2ND_CODE_LOCK for L5I is optional since it is implied by STATE_SYMBOL_SYNC.
409 * <li> STATE_2ND_CODE_LOCK for E1C is optional since it is implied by
410 * STATE_GAL_E1C_2ND_CODE_LOCK.
411 * <li> For E1B and E1C, STATE_SYMBOL_SYNC is optional, because it is implied by
412 * STATE_GAL_E1BC_CODE_LOCK.
413 * </ul>
414 *
415 */
416 @export(name="", value_prefix="GNSS_MEASUREMENT_")
417 enum GnssMeasurementState : uint32_t {
418 STATE_UNKNOWN = 0,
419 STATE_CODE_LOCK = 1 << 0,
420 STATE_BIT_SYNC = 1 << 1,
421 STATE_SUBFRAME_SYNC = 1 << 2,
422 STATE_TOW_DECODED = 1 << 3,
423 STATE_MSEC_AMBIGUOUS = 1 << 4,
424 STATE_SYMBOL_SYNC = 1 << 5,
425 STATE_GLO_STRING_SYNC = 1 << 6,
426 STATE_GLO_TOD_DECODED = 1 << 7,
427 STATE_BDS_D2_BIT_SYNC = 1 << 8,
428 STATE_BDS_D2_SUBFRAME_SYNC = 1 << 9,
429 STATE_GAL_E1BC_CODE_LOCK = 1 << 10,
430 STATE_GAL_E1C_2ND_CODE_LOCK = 1 << 11,
431 STATE_GAL_E1B_PAGE_SYNC = 1 << 12,
432 STATE_SBAS_SYNC = 1 << 13,
433 STATE_TOW_KNOWN = 1 << 14,
434 STATE_GLO_TOD_KNOWN = 1 << 15,
435 STATE_2ND_CODE_LOCK = 1 << 16,
436 };
437
438 /**
Yu-Han Yang9c6c20b2018-11-06 14:12:49 -0800439 * Extends a GNSS Measurement, adding a GnssMeasurementCodeType.
440 */
441 struct GnssMeasurement {
442 /**
443 * GNSS measurement information for a single satellite and frequency, as in the 1.1
444 * version of the HAL with further clarification of the value reported in the
445 * accumulatedDeltaRangeM field, i.e., the alignment of the phase measurement will not be
446 * adjusted by the receiver so the in-phase and quadrature phase components will have a
447 * quarter cycle offset as they do when transmitted from the satellites. If the measurement
448 * is from a combination of the in-phase and quadrature phase components, then the alignment
449 * of the phase measurement will be aligned to the in-phase component.
Yu-Han Yang9e2eaf12019-01-23 11:58:01 -0800450 *
451 * In this version of the HAL, the field 'state' in the v1_1.v1_0 struct is deprecated, and
452 * is no longer used by the framework. The satellite sync state is instead reported in
453 * @2.0::IGnssMeasurementCallback.GnssMeasurement.state.
Yu-Han Yang9c6c20b2018-11-06 14:12:49 -0800454 */
455 @1.1::IGnssMeasurementCallback.GnssMeasurement v1_1;
456
457 /**
458 * The type of code that is currently being tracked in the GNSS measurement.
459 *
460 * For high precision applications the type of code being tracked needs to be considered
461 * in-order to properly apply code specific corrections to the psuedorange measurements.
462 */
463 GnssMeasurementCodeType codeType;
Yu-Han Yang49cbed02019-01-23 12:11:01 -0800464
465 /**
466 * The name of the code type when codeType is OTHER.
467 *
468 * This is used to specify the observation descriptor defined in GNSS Observation Data File
469 * Header Section Description in the RINEX standard (Version 3.XX). In RINEX Version 3.03,
470 * in Appendix Table A2 Attributes are listed as uppercase letters (for instance, "A" for
471 * "A channel"). In the future, if for instance a code "G" was added in the official RINEX
472 * standard, "G" could be specified here.
473 */
474 string otherCodeTypeName;
Yu-Han Yang9e2eaf12019-01-23 11:58:01 -0800475
476 /**
477 * Per satellite sync state. It represents the current sync state for the associated
478 * satellite.
479 *
480 * Based on the sync state, the receivedSvTimeInNs field must be interpreted accordingly.
481 *
482 * This value is mandatory.
483 */
484 bitfield<GnssMeasurementState> state;
Yu-Han Yang9c6c20b2018-11-06 14:12:49 -0800485 };
486
487 /**
488 * Complete set of GNSS Measurement data, same as 1.1 with additional enum in measurements.
489 */
490 struct GnssData {
491 /** The full set of satellite measurement observations. */
492 vec<GnssMeasurement> measurements;
493
494 /** The GNSS clock time reading. */
495 GnssClock clock;
Pierre Fite-Georgel12ac2b52019-01-17 16:56:17 -0800496
497 /**
498 * Timing information of the GNSS data synchronized with SystemClock.elapsedRealtimeNanos()
499 * clock.
500 */
501 ElapsedRealtime elapsedRealtime;
Yu-Han Yang9c6c20b2018-11-06 14:12:49 -0800502 };
503
504 /**
505 * Callback for the hal to pass a GnssData structure back to the client.
506 *
507 * @param data Contains a reading of GNSS measurements.
508 */
509 gnssMeasurementCb_2_0(GnssData data);
510};