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