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