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