blob: 0385abd467074f893b86a7deca063b138ebc6561 [file] [log] [blame]
Yu-Han Yangc06b5362019-10-25 14:14:35 -07001/*
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
17package android.hardware.gnss@2.1;
18
19import @1.0::IGnssMeasurementCallback;
Yu-Han Yangc06b5362019-10-25 14:14:35 -070020import @2.0::IGnssMeasurementCallback;
21import @2.0::ElapsedRealtime;
Yu-Han Yang5fe14fa2019-12-03 20:54:53 -080022import GnssSignalType;
Yu-Han Yangc06b5362019-10-25 14:14:35 -070023
24/** The callback interface to report measurements from the HAL. */
25interface IGnssMeasurementCallback extends @2.0::IGnssMeasurementCallback {
26
27 /**
Yu-Han Yang5fe14fa2019-12-03 20:54:53 -080028 * Flags to indicate what fields in GnssMeasurement are valid.
29 */
30 enum GnssMeasurementFlags : uint32_t {
31 /** A valid 'snr' is stored in the data structure. */
32 HAS_SNR = 1 << 0,
33 /** A valid 'carrier frequency' is stored in the data structure. */
34 HAS_CARRIER_FREQUENCY = 1 << 9,
35 /** A valid 'carrier cycles' is stored in the data structure. */
36 HAS_CARRIER_CYCLES = 1 << 10,
37 /** A valid 'carrier phase' is stored in the data structure. */
38 HAS_CARRIER_PHASE = 1 << 11,
39 /** A valid 'carrier phase uncertainty' is stored in the data structure. */
40 HAS_CARRIER_PHASE_UNCERTAINTY = 1 << 12,
41 /** A valid automatic gain control is stored in the data structure. */
42 HAS_AUTOMATIC_GAIN_CONTROL = 1 << 13,
43 /** A valid receiver inter-signal bias is stored in the data structure. */
44 HAS_RECEIVER_ISB = 1 << 16,
45 /** A valid receiver inter-signal bias uncertainty is stored in the data structure. */
46 HAS_RECEIVER_ISB_UNCERTAINTY = 1 << 17,
47 /** A valid satellite inter-signal bias is stored in the data structure. */
48 HAS_SATELLITE_ISB = 1 << 18,
49 /** A valid satellite inter-signal bias uncertainty is stored in the data structure. */
50 HAS_SATELLITE_ISB_UNCERTAINTY = 1 << 19
51 };
52
53
54 /**
55 * Extends a GNSS Measurement, adding basebandCN0DbHz, GnssMeasurementFlags,
56 * receiverInterSignalBiasNs, receiverInterSignalBiasUncertaintyNs, satelliteInterSignalBiasNs
57 * and satelliteInterSignalBiasUncertaintyNs.
Yu-Han Yangc06b5362019-10-25 14:14:35 -070058 */
59 struct GnssMeasurement {
60 /**
61 * GNSS measurement information for a single satellite and frequency, as in the 2.0 version
62 * of the HAL.
Yu-Han Yang5fe14fa2019-12-03 20:54:53 -080063 *
64 * In this version of the HAL, the field 'flags' in the v2_0.v1_1.v1_0 struct is deprecated,
65 * and is no longer used by the framework. The GNSS measurement flags are instead reported
66 * in @2.1::IGnssMeasurementCallback.GnssMeasurement.flags.
67 *
Yu-Han Yangc06b5362019-10-25 14:14:35 -070068 */
69 @2.0::IGnssMeasurementCallback.GnssMeasurement v2_0;
70
71 /**
Yu-Han Yang5fe14fa2019-12-03 20:54:53 -080072 * A set of flags indicating the validity of the fields in this data
73 * structure.
74 *
75 * Fields for which there is no corresponding flag must be filled in
76 * with a valid value. For convenience, these are marked as mandatory.
77 *
78 * Others fields may have invalid information in them, if not marked as
79 * valid by the corresponding bit in flags.
80 */
81 bitfield<GnssMeasurementFlags> flags;
82
83 /**
84 * The receiver inter-signal bias (ISB) in nanoseconds.
85 *
86 * This value is the estimated receiver-side inter-system (different from the constellation
87 * in GnssClock.referenceSignalForIsb) bias and inter-frequency (different from the carrier
88 * frequency in GnssClock.referenceSignalForIsb) bias. The reported receiver ISB
89 * must include signal delays caused by
90 *
91 * - Receiver inter-constellation bias
92 * - Receiver inter-frequency bias
93 * - Receiver inter-code bias
94 *
95 * The value does not include the inter-frequency Ionospheric bias.
96 *
97 * The receiver ISB of GnssClock.referenceSignalForIsb is defined to be 0.0 nanoseconds.
98 */
99 double receiverInterSignalBiasNs;
100
101 /**
102 * 1-sigma uncertainty associated with the receiver inter-signal bias in nanoseconds.
103 */
104 double receiverInterSignalBiasUncertaintyNs;
105
106 /**
107 * The satellite inter-signal bias in nanoseconds.
108 *
109 * This value is the satellite-and-control-segment-side inter-system (different from the
110 * constellation in GnssClock.referenceSignalForIsb) bias and inter-frequency (different
111 * from the carrier frequency in GnssClock.referenceSignalForIsb) bias, including:
112 *
113 * - Master clock bias (e.g., GPS-GAL Time Offset (GGTO), GPT-UTC Time Offset (TauGps),
114 * BDS-GLO Time Offset (BGTO))
115 * - Group delay (e.g., Total Group Delay (TGD))
116 * - Satellite inter-signal bias, which includes satellite inter-frequency bias (GLO only),
117 * and satellite inter-code bias (e.g., Differential Code Bias (DCB)).
118 *
119 * The receiver ISB of GnssClock.referenceSignalForIsb is defined to be 0.0 nanoseconds.
120 */
121 double satelliteInterSignalBiasNs;
122
123 /**
124 * 1-sigma uncertainty associated with the satellite inter-signal bias in nanoseconds.
125 */
126 double satelliteInterSignalBiasUncertaintyNs;
127
128 /**
Yu-Han Yangc06b5362019-10-25 14:14:35 -0700129 * Baseband Carrier-to-noise density in dB-Hz, typically in the range [0, 63]. It contains
130 * the measured C/N0 value for the signal measured at the baseband.
131 *
132 * This is typically a few dB weaker than the value estimated for C/N0 at the antenna port,
133 * which is reported in cN0DbHz.
134 *
135 * If a signal has separate components (e.g. Pilot and Data channels) and the receiver only
136 * processes one of the components, then the reported basebandCN0DbHz reflects only the
137 * component that is processed.
138 *
139 * This value is mandatory.
140 */
141 double basebandCN0DbHz;
142 };
143
144 /**
Yu-Han Yang5fe14fa2019-12-03 20:54:53 -0800145 * Extends a GNSS clock time, adding a referenceSignalTypeForIsb.
146 */
147 struct GnssClock {
148 /**
149 * GNSS clock time information, as in the 1.0 version of the HAL.
150 */
151 @1.0::IGnssMeasurementCallback.GnssClock v1_0;
152
153 /**
154 * Reference GNSS signal type for inter-signal bias.
155 */
156 GnssSignalType referenceSignalTypeForIsb;
157 };
158
159 /**
160 * Complete set of GNSS Measurement data, same as 2.0 with additional fields in measurements.
Yu-Han Yangc06b5362019-10-25 14:14:35 -0700161 */
162 struct GnssData {
163 /** The full set of satellite measurement observations. */
164 vec<GnssMeasurement> measurements;
165
166 /** The GNSS clock time reading. */
167 GnssClock clock;
168
169 /**
170 * Timing information of the GNSS data synchronized with SystemClock.elapsedRealtimeNanos()
171 * clock.
172 */
173 ElapsedRealtime elapsedRealtime;
174 };
175
176 /**
177 * Callback for the hal to pass a GnssData structure back to the client.
178 *
179 * @param data Contains a reading of GNSS measurements.
180 */
181 gnssMeasurementCb_2_1(GnssData data);
182};