Hridya Valsaraju | e596a71 | 2016-09-22 14:07:22 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 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@1.0; |
| 18 | |
| 19 | /* The callback interface to report measurements from the HAL. */ |
| 20 | interface IGnssMeasurementCallback { |
| 21 | /* |
| 22 | * Flags to indicate what fields in GnssClock are valid. |
| 23 | */ |
| 24 | enum GnssClockFlags : uint16_t { |
| 25 | /** A valid 'leap second' is stored in the data structure. */ |
| 26 | HAS_LEAP_SECOND = 1 << 0, |
| 27 | /** A valid 'time uncertainty' is stored in the data structure. */ |
| 28 | HAS_TIME_UNCERTAINTY = 1 << 1, |
| 29 | /** A valid 'full bias' is stored in the data structure. */ |
| 30 | HAS_FULL_BIAS = 1 << 2, |
| 31 | /** A valid 'bias' is stored in the data structure. */ |
| 32 | HAS_BIAS = 1 << 3, |
| 33 | /** A valid 'bias uncertainty' is stored in the data structure. */ |
| 34 | HAS_BIAS_UNCERTAINTY = 1 << 4, |
| 35 | /** A valid 'drift' is stored in the data structure. */ |
| 36 | HAS_DRIFT = 1 << 5, |
| 37 | /** A valid 'drift uncertainty' is stored in the data structure. */ |
| 38 | HAS_DRIFT_UNCERTAINTY = 1 << 6 |
| 39 | }; |
| 40 | |
| 41 | /* |
| 42 | * Flags to indicate what fields in GnssMeasurement are valid. |
| 43 | */ |
| 44 | enum GnssMeasurementFlags : uint32_t { |
| 45 | /** A valid 'snr' is stored in the data structure. */ |
| 46 | HAS_SNR = 1 << 0, |
| 47 | /** A valid 'carrier frequency' is stored in the data structure. */ |
| 48 | HAS_CARRIER_FREQUENCY = 1 << 9, |
| 49 | /** A valid 'carrier cycles' is stored in the data structure. */ |
| 50 | HAS_CARRIER_CYCLES = 1 << 10, |
| 51 | /** A valid 'carrier phase' is stored in the data structure. */ |
| 52 | HAS_CARRIER_PHASE = 1 << 11, |
| 53 | /** A valid 'carrier phase uncertainty' is stored in the data structure. */ |
gomo | c3d9278 | 2017-01-11 14:04:21 -0800 | [diff] [blame^] | 54 | HAS_CARRIER_PHASE_UNCERTAINTY = 1 << 12, |
| 55 | /** A valid automatic gain control is stored in the data structure. */ |
| 56 | HAS_AUTOMATIC_GAIN_CONTROL = 1 << 13 |
Hridya Valsaraju | e596a71 | 2016-09-22 14:07:22 -0700 | [diff] [blame] | 57 | }; |
| 58 | |
| 59 | /* |
| 60 | * Enumeration of available values for the GNSS Measurement's multipath |
| 61 | * indicator. |
| 62 | */ |
| 63 | enum GnssMultipathIndicator : uint8_t { |
| 64 | /** The indicator is not available or unknown. */ |
| 65 | INDICATOR_UNKNOWN = 0, |
| 66 | /** The measurement is indicated to be affected by multipath. */ |
| 67 | INDICATOR_PRESENT = 1, |
| 68 | /** The measurement is indicated to be not affected by multipath. */ |
| 69 | INDICATIOR_NOT_PRESENT = 2 |
| 70 | }; |
| 71 | |
| 72 | /* |
| 73 | * Flags indicating the GNSS measurement state. |
| 74 | * |
| 75 | * The expected behavior here is for GNSS HAL to set all the flags that applies. |
| 76 | * For example, if the state for a satellite is only C/A code locked and bit |
| 77 | * synchronized, and there is still millisecond ambiguity, the state must be |
| 78 | * set as: |
| 79 | * |
| 80 | * STATE_CODE_LOCK | STATE_BIT_SYNC | STATE_MSEC_AMBIGUOUS |
| 81 | * |
| 82 | * If GNSS is still searching for a satellite, the corresponding state must be |
| 83 | * set to STATE_UNKNOWN(0). |
| 84 | */ |
| 85 | enum GnssMeasurementState : uint32_t { |
| 86 | STATE_UNKNOWN = 0, |
| 87 | STATE_CODE_LOCK = 1 << 0, |
| 88 | STATE_BIT_SYNC = 1 << 1, |
| 89 | STATE_SUBFRAME_SYNC = 1 << 2, |
| 90 | STATE_TOW_DECODED = 1 << 3, |
| 91 | STATE_MSEC_AMBIGUOUS = 1 << 4, |
| 92 | STATE_SYMBOL_SYNC = 1 << 5, |
| 93 | STATE_GLO_STRING_SYNC = 1 << 6, |
| 94 | STATE_GLO_TOD_DECODED = 1 << 7, |
| 95 | STATE_BDS_D2_BIT_SYNC = 1 << 8, |
| 96 | STATE_BDS_D2_SUBFRAME_SYNC = 1 << 9, |
| 97 | STATE_GAL_E1BC_CODE_LOCK = 1 << 10, |
| 98 | STATE_GAL_E1C_2ND_CODE_LOCK = 1 << 11, |
| 99 | STATE_GAL_E1B_PAGE_SYNC = 1 << 12, |
gomo | c3d9278 | 2017-01-11 14:04:21 -0800 | [diff] [blame^] | 100 | STATE_SBAS_SYNC = 1 << 13, |
| 101 | STATE_TOW_KNOWN = 1 << 14, |
| 102 | STATE_GLO_TOD_KNOWN = 1 << 15, |
Hridya Valsaraju | e596a71 | 2016-09-22 14:07:22 -0700 | [diff] [blame] | 103 | }; |
| 104 | |
| 105 | /* |
| 106 | * Flags indicating the Accumulated Delta Range's states. |
| 107 | */ |
| 108 | enum GnssAccumulatedDeltaRangeState : uint16_t { |
| 109 | ADR_STATE_UNKNOWN = 0, |
| 110 | ADR_STATE_VALID = 1 << 0, |
| 111 | ADR_STATE_RESET = 1 << 1, |
| 112 | ADR_STATE_CYCLE_SLIP = 1 << 2, |
| 113 | }; |
| 114 | |
| 115 | /* |
| 116 | * Represents an estimate of the GNSS clock time. |
| 117 | */ |
| 118 | struct GnssClock { |
| 119 | /* |
| 120 | * A set of flags indicating the validity of the fields in this data |
| 121 | * structure. |
| 122 | */ |
Yifan Hong | 7037fdb | 2016-12-05 17:16:09 -0800 | [diff] [blame] | 123 | bitfield<GnssClockFlags> gnssClockFlags; |
Hridya Valsaraju | e596a71 | 2016-09-22 14:07:22 -0700 | [diff] [blame] | 124 | |
| 125 | /* |
| 126 | * Leap second data. |
| 127 | * The sign of the value is defined by the following equation: |
| 128 | * utcTimeNs = timeNs - (fullBiasNs + biasNs) - leapSecond * |
| 129 | * 1,000,000,000 |
| 130 | * |
| 131 | * If this data is available, gnssClockFlags must contain |
| 132 | * HAS_LEAP_SECOND. |
| 133 | */ |
| 134 | int16_t leapSecond; |
| 135 | |
| 136 | /* |
| 137 | * The GNSS receiver internal clock value. This is the local hardware clock |
| 138 | * value. |
| 139 | * |
| 140 | * For local hardware clock, this value is expected to be monotonically |
| 141 | * increasing while the hardware clock remains powered on. (For the case of a |
| 142 | * HW clock that is not continuously on, see the |
| 143 | * hwClockDiscontinuityCount field). The receiver's estimate of GNSS time |
| 144 | * can be derived by subtracting the sum of fullBiasNs and biasNs (when |
| 145 | * available) from this value. |
| 146 | * |
| 147 | * This GNSS time must be the best estimate of current GNSS time |
| 148 | * that GNSS receiver can achieve. |
| 149 | * |
| 150 | * Sub-nanosecond accuracy can be provided by means of the 'biasNs' field. |
| 151 | * The value contains the timeUncertaintyNs in it. |
| 152 | * |
| 153 | * This field is mandatory. |
| 154 | */ |
| 155 | int64_t timeNs; |
| 156 | |
| 157 | /* |
| 158 | * 1-Sigma uncertainty associated with the clock's time in nanoseconds. |
| 159 | * The uncertainty is represented as an absolute (single sided) value. |
| 160 | * |
| 161 | * If the data is available, gnssClockFlags must contain |
| 162 | * HAS_TIME_UNCERTAINTY. Ths value is ideally zero, as the time |
| 163 | * 'latched' by timeNs is defined as the reference clock vs. which all |
| 164 | * other times (and corresponding uncertainties) are measured. |
| 165 | */ |
| 166 | double timeUncertaintyNs; |
| 167 | |
| 168 | /* |
| 169 | * The difference between hardware clock ('time' field) inside GNSS receiver |
| 170 | * and the true GNSS time since 0000Z, January 6, 1980, in nanoseconds. |
| 171 | * |
| 172 | * The sign of the value is defined by the following equation: |
| 173 | * local estimate of GNSS time = timeNs - (fullBiasNs + biasNs) |
| 174 | * |
| 175 | * This value is mandatory if the receiver has estimated GNSS time. If the |
| 176 | * computed time is for a non-GNSS constellation, the time offset of that |
| 177 | * constellation to GNSS has to be applied to fill this value. The error |
| 178 | * estimate for the sum of this and the biasNs is the biasUncertaintyNs, |
| 179 | * and the caller is responsible for using this uncertainty (it can be very |
| 180 | * large before the GNSS time has been solved for.) If the data is available |
| 181 | * gnssClockFlags must contain HAS_FULL_BIAS. |
| 182 | */ |
| 183 | int64_t fullBiasNs; |
| 184 | |
| 185 | /* |
| 186 | * Sub-nanosecond bias. |
| 187 | * The error estimate for the sum of this and the fullBiasNs is the |
| 188 | * biasUncertaintyNs. |
| 189 | * |
| 190 | * If the data is available gnssClockFlags must contain HAS_BIAS. If GNSS |
| 191 | * has computed a position fix. This value is mandatory if the receiver has |
| 192 | * estimated GNSS time. |
| 193 | */ |
| 194 | double biasNs; |
| 195 | |
| 196 | /* |
| 197 | * 1-Sigma uncertainty associated with the local estimate of GNSS time (clock |
| 198 | * bias) in nanoseconds. The uncertainty is represented as an absolute |
| 199 | * (single sided) value. |
| 200 | * |
| 201 | * If the data is available gnssClockFlags must contain |
| 202 | * HAS_BIAS_UNCERTAINTY. This value is mandatory if the receiver |
| 203 | * has estimated GNSS time. |
| 204 | */ |
| 205 | double biasUncertaintyNs; |
| 206 | |
| 207 | /* |
| 208 | * The clock's drift in nanoseconds (per second). |
| 209 | * |
| 210 | * A positive value means that the frequency is higher than the nominal |
| 211 | * frequency, and that the (fullBiasNs + biasNs) is growing more positive |
| 212 | * over time. |
| 213 | * |
| 214 | * The value contains the 'drift uncertainty' in it. |
| 215 | * If the data is available gnssClockFlags must contain HAS_DRIFT. |
| 216 | * |
| 217 | * This value is mandatory if the receiver has estimated GNSS time. |
| 218 | */ |
| 219 | double driftNsps; |
| 220 | |
| 221 | /* |
| 222 | * 1-Sigma uncertainty associated with the clock's drift in nanoseconds (per |
| 223 | * second). |
| 224 | * The uncertainty is represented as an absolute (single sided) value. |
| 225 | * |
| 226 | * If the data is available gnssClockFlags must contain |
| 227 | * HAS_DRIFT_UNCERTAINTY. If GNSS has computed a position fix this |
| 228 | * field is mandatory and must be populated. |
| 229 | */ |
| 230 | double driftUncertaintyNsps; |
| 231 | |
| 232 | /* |
| 233 | * When there are any discontinuities in the HW clock, this field is |
| 234 | * mandatory. |
| 235 | * |
| 236 | * A "discontinuity" is meant to cover the case of a switch from one source |
| 237 | * of clock to another. A single free-running crystal oscillator (XO) |
| 238 | * will generally not have any discontinuities, and this can be set and |
| 239 | * left at 0. |
| 240 | * |
| 241 | * If, however, the timeNs value (HW clock) is derived from a composite of |
| 242 | * sources, that is not as smooth as a typical XO, or is otherwise stopped & |
| 243 | * restarted, then this value shall be incremented each time a discontinuity |
| 244 | * occurs. (E.g. this value can start at zero at device boot-up and |
| 245 | * increment each time there is a change in clock continuity. In the |
| 246 | * unlikely event that this value reaches full scale, rollover (not |
| 247 | * clamping) is required, such that this value continues to change, during |
| 248 | * subsequent discontinuity events.) |
| 249 | * |
| 250 | * While this number stays the same, between GnssClock reports, it can be |
| 251 | * safely assumed that the timeNs value has been running continuously, e.g. |
| 252 | * derived from a single, high quality clock (XO like, or better, that is |
| 253 | * typically used during continuous GNSS signal sampling.) |
| 254 | * |
| 255 | * It is expected, esp. during periods where there are few GNSS signals |
| 256 | * available, that the HW clock be discontinuity-free as long as possible, |
| 257 | * as this avoids the need to use (waste) a GNSS measurement to fully |
| 258 | * re-solve for the GNSS clock bias and drift, when using the accompanying |
| 259 | * measurements, from consecutive GnssData reports. |
| 260 | */ |
| 261 | uint32_t hwClockDiscontinuityCount; |
| 262 | |
| 263 | }; |
| 264 | |
| 265 | /* |
| 266 | * Represents a GNSS Measurement, it contains raw and computed information. |
| 267 | * |
| 268 | * All signal measurement information (e.g. svTime, |
| 269 | * pseudorangeRate, multipathIndicator) reported in this struct must be |
| 270 | * based on GNSS signal measurements only. You must not synthesize measurements |
| 271 | * by calculating or reporting expected measurements based on known or estimated |
| 272 | * position, velocity, or time. |
| 273 | */ |
| 274 | struct GnssMeasurement{ |
| 275 | /* |
| 276 | * A set of flags indicating the validity of the fields in this data |
| 277 | * structure. |
| 278 | */ |
Yifan Hong | 7037fdb | 2016-12-05 17:16:09 -0800 | [diff] [blame] | 279 | bitfield<GnssMeasurementFlags> flags; |
Hridya Valsaraju | e596a71 | 2016-09-22 14:07:22 -0700 | [diff] [blame] | 280 | |
| 281 | /* |
| 282 | * Satellite vehicle ID number, as defined in GnssSvInfo::svid |
| 283 | * This is a mandatory value. |
| 284 | */ |
| 285 | int16_t svid; |
| 286 | |
| 287 | /* |
| 288 | * Defines the constellation of the given SV. |
| 289 | */ |
| 290 | GnssConstellationType constellation; |
| 291 | |
| 292 | /* |
| 293 | * Time offset at which the measurement was taken in nanoseconds. |
| 294 | * The reference receiver's time is specified by GnssData::clock::timeNs. |
| 295 | * |
| 296 | * The sign of timeOffsetNs is given by the following equation: |
| 297 | * measurement time = GnssClock::timeNs + timeOffsetNs |
| 298 | * |
| 299 | * It provides an individual time-stamp for the measurement, and allows |
| 300 | * sub-nanosecond accuracy. |
| 301 | * This is a mandatory value. |
| 302 | */ |
| 303 | double timeOffsetNs; |
| 304 | |
| 305 | /* |
| 306 | * Per satellite sync state. It represents the current sync state for the |
| 307 | * associated satellite. |
| 308 | * Based on the sync state, the 'received GNSS tow' field must be interpreted |
| 309 | * accordingly. |
| 310 | * |
| 311 | * This is a mandatory value. |
| 312 | */ |
Yifan Hong | 7037fdb | 2016-12-05 17:16:09 -0800 | [diff] [blame] | 313 | bitfield<GnssMeasurementState> state; |
Hridya Valsaraju | e596a71 | 2016-09-22 14:07:22 -0700 | [diff] [blame] | 314 | |
| 315 | /* |
| 316 | * The received GNSS Time-of-Week at the measurement time, in nanoseconds. |
| 317 | * For GNSS & QZSS, this is the received GNSS Time-of-Week at the |
| 318 | * measurement time, in nanoseconds. The value is relative to the |
| 319 | * beginning of the current GNSS week. |
| 320 | * |
| 321 | * Given the highest sync state that can be achieved, per each satellite, |
| 322 | * valid range for this field can be: |
| 323 | * Searching : [ 0 ] : STATE_UNKNOWN |
| 324 | * C/A code lock : [ 0 1ms ] : STATE_CODE_LOCK set |
| 325 | * Bit sync : [ 0 20ms ] : STATE_BIT_SYNC set |
| 326 | * Subframe sync : [ 0 6s ] : STATE_SUBFRAME_SYNC set |
| 327 | * TOW decoded : [ 0 1week ] : STATE_TOW_DECODED set |
gomo | c3d9278 | 2017-01-11 14:04:21 -0800 | [diff] [blame^] | 328 | * TOW Known : [ 0 1week ] : STATE_TOW_KNOWN set |
| 329 | * |
| 330 | * Note: TOW Known refers to the case where TOW is possibly not decoded |
| 331 | * over the air but has been determined from other sources. If TOW |
| 332 | * decoded is set then TOW Known must also be set. |
Hridya Valsaraju | e596a71 | 2016-09-22 14:07:22 -0700 | [diff] [blame] | 333 | * |
| 334 | * Note: If there is any ambiguity in integer millisecond, |
| 335 | * GNSS_MEASUREMENT_STATE_MSEC_AMBIGUOUS must be set accordingly, in the |
| 336 | * 'state' field. |
| 337 | * |
| 338 | * This value must be populated if 'state' != STATE_UNKNOWN. |
| 339 | * |
| 340 | * For Glonass, this is the received Glonass time of day, at the |
| 341 | * measurement time in nanoseconds. |
| 342 | * |
| 343 | * Given the highest sync state that can be achieved, per each satellite, |
| 344 | * valid range for this field can be: |
gomo | c3d9278 | 2017-01-11 14:04:21 -0800 | [diff] [blame^] | 345 | * Searching : [ 0 ] : STATE_UNKNOWN set |
| 346 | * C/A code lock : [ 0 1ms ] : STATE_CODE_LOCK set |
| 347 | * Symbol sync : [ 0 10ms ] : STATE_SYMBOL_SYNC set |
| 348 | * Bit sync : [ 0 20ms ] : STATE_BIT_SYNC set |
| 349 | * String sync : [ 0 2s ] : STATE_GLO_STRING_SYNC set |
| 350 | * Time of day decoded : [ 0 1day ] : STATE_GLO_TOD_DECODED set |
| 351 | * Time of day known : [ 0 1day ] : STATE_GLO_TOD_KNOWN set |
| 352 | * |
| 353 | * Note: Time of day known refers to the case where it is possibly not |
| 354 | * decoded over the air but has been determined from other sources. If |
| 355 | * Time of day decoded is set then Time of day known must also be set. |
Hridya Valsaraju | e596a71 | 2016-09-22 14:07:22 -0700 | [diff] [blame] | 356 | * |
| 357 | * For Beidou, this is the received Beidou time of week, |
| 358 | * at the measurement time in nanoseconds. |
| 359 | * |
| 360 | * Given the highest sync state that can be achieved, per each satellite, |
| 361 | * valid range for this field can be: |
gomo | c3d9278 | 2017-01-11 14:04:21 -0800 | [diff] [blame^] | 362 | * Searching : [ 0 ] : STATE_UNKNOWN set. |
| 363 | * C/A code lock : [ 0 1ms ] : STATE_CODE_LOCK set. |
| 364 | * Bit sync (D2) : [ 0 2ms ] : STATE_BDS_D2_BIT_SYNC set. |
| 365 | * Bit sync (D1) : [ 0 20ms ] : STATE_BIT_SYNC set. |
| 366 | * Subframe (D2) : [ 0 0.6s ] : STATE_BDS_D2_SUBFRAME_SYNC set. |
| 367 | * Subframe (D1) : [ 0 6s ] : STATE_SUBFRAME_SYNC set. |
| 368 | * Time of week decoded : [ 0 1week ] : STATE_TOW_DECODED set. |
| 369 | * Time of week known : [ 0 1week ] : STATE_TOW_KNOWN set |
| 370 | * |
| 371 | * Note: TOW Known refers to the case where TOW is possibly not decoded |
| 372 | * over the air but has been determined from other sources. If TOW |
| 373 | * decoded is set then TOW Known must also be set. |
Hridya Valsaraju | e596a71 | 2016-09-22 14:07:22 -0700 | [diff] [blame] | 374 | * |
| 375 | * For Galileo, this is the received Galileo time of week, |
| 376 | * at the measurement time in nanoseconds. |
| 377 | * |
gomo | c3d9278 | 2017-01-11 14:04:21 -0800 | [diff] [blame^] | 378 | * E1BC code lock : [ 0 4ms ] : STATE_GAL_E1BC_CODE_LOCK set. |
| 379 | * E1C 2nd code lock : [ 0 100ms] : STATE_GAL_E1C_2ND_CODE_LOCK set. |
| 380 | * E1B page : [ 0 2s ] : STATE_GAL_E1B_PAGE_SYNC set. |
| 381 | * Time of week decoded : [ 0 1week] : STATE_TOW_DECODED is set. |
| 382 | * Time of week known : [ 0 1week] : STATE_TOW_KNOWN set |
| 383 | * |
| 384 | * Note: TOW Known refers to the case where TOW is possibly not decoded |
| 385 | * over the air but has been determined from other sources. If TOW |
| 386 | * decoded is set then TOW Known must also be set. |
Hridya Valsaraju | e596a71 | 2016-09-22 14:07:22 -0700 | [diff] [blame] | 387 | * |
| 388 | * For SBAS, this is received SBAS time, at the measurement time in |
| 389 | * nanoseconds. |
| 390 | * |
| 391 | * Given the highest sync state that can be achieved, per each satellite, |
| 392 | * valid range for this field can be: |
| 393 | * Searching : [ 0 ] : STATE_UNKNOWN |
| 394 | * C/A code lock: [ 0 1ms ] : STATE_CODE_LOCK is set |
| 395 | * Symbol sync : [ 0 2ms ] : STATE_SYMBOL_SYNC is set |
| 396 | * Message : [ 0 1s ] : STATE_SBAS_SYNC is set |
| 397 | */ |
| 398 | int64_t receivedSvTimeInNs; |
| 399 | |
| 400 | /* |
| 401 | * 1-Sigma uncertainty of the Received GNSS Time-of-Week in nanoseconds. |
| 402 | * |
| 403 | * This value must be populated if 'state' != STATE_UNKNOWN. |
| 404 | */ |
| 405 | int64_t receivedSvTimeUncertaintyInNs; |
| 406 | |
| 407 | /* |
| 408 | * Carrier-to-noise density in dB-Hz, typically in the range [0, 63]. |
| 409 | * It contains the measured C/N0 value for the signal at the antenna port. |
| 410 | * |
| 411 | * This is a mandatory value. |
| 412 | */ |
| 413 | double cN0DbHz; |
| 414 | |
| 415 | /* |
| 416 | * Pseudorange rate at the timestamp in m/s. The correction of a given |
| 417 | * Pseudorange Rate value includes corrections for receiver and satellite |
| 418 | * clock frequency errors. Ensure that this field is independent (see |
| 419 | * comment at top of GnssMeasurement struct.) |
| 420 | * |
| 421 | * It is mandatory to provide the 'uncorrected' 'pseudorange rate', and |
| 422 | * provide GnssClock's 'drift' field as well. When providing the |
| 423 | * uncorrected pseudorange rate, do not apply the corrections described above.) |
| 424 | * |
| 425 | * The value includes the 'pseudorange rate uncertainty' in it. |
| 426 | * A positive 'uncorrected' value indicates that the SV is moving away from |
| 427 | * the receiver. |
| 428 | * |
| 429 | * The sign of the 'uncorrected' 'pseudorange rate' and its relation to the |
| 430 | * sign of 'doppler shift' is given by the equation: |
| 431 | * pseudorange rate = -k * doppler shift (where k is a constant) |
| 432 | * |
| 433 | * This must be the most accurate pseudorange rate available, based on |
| 434 | * fresh signal measurements from this channel. |
| 435 | * |
| 436 | * It is mandatory that this value be provided at typical carrier phase PRR |
| 437 | * quality (few cm/sec per second of uncertainty, or better) - when signals |
| 438 | * are sufficiently strong & stable, e.g. signals from a GNSS simulator at >= |
| 439 | * 35 dB-Hz. |
| 440 | */ |
| 441 | double pseudorangeRateMps; |
| 442 | |
| 443 | /* |
| 444 | * 1-Sigma uncertainty of the pseudorangeRateMps. |
| 445 | * The uncertainty is represented as an absolute (single sided) value. |
| 446 | * |
| 447 | * This is a mandatory value. |
| 448 | */ |
| 449 | double pseudorangeRateUncertaintyMps; |
| 450 | |
| 451 | /* |
| 452 | * Accumulated delta range's state. It indicates whether ADR is reset or |
| 453 | * there is a cycle slip(indicating loss of lock). |
| 454 | * |
| 455 | * This is a mandatory value. |
| 456 | */ |
Yifan Hong | 7037fdb | 2016-12-05 17:16:09 -0800 | [diff] [blame] | 457 | bitfield<GnssAccumulatedDeltaRangeState> accumulatedDeltaRangeState; |
Hridya Valsaraju | e596a71 | 2016-09-22 14:07:22 -0700 | [diff] [blame] | 458 | |
| 459 | /* |
| 460 | * Accumulated delta range since the last channel reset in meters. |
| 461 | * A positive value indicates that the SV is moving away from the receiver. |
| 462 | * |
| 463 | * The sign of the 'accumulated delta range' and its relation to the sign of |
| 464 | * 'carrier phase' is given by the equation: |
| 465 | * accumulated delta range = -k * carrier phase (where k is a constant) |
| 466 | * |
| 467 | * This value must be populated if 'accumulated delta range state' != |
| 468 | * ADR_STATE_UNKNOWN. |
| 469 | * However, it is expected that the data is only accurate when: |
| 470 | * 'accumulated delta range state' == ADR_STATE_VALID. |
| 471 | */ |
| 472 | double accumulatedDeltaRangeM; |
| 473 | |
| 474 | /* |
| 475 | * 1-Sigma uncertainty of the accumulated delta range in meters. |
| 476 | * This value must be populated if 'accumulated delta range state' != |
| 477 | * ADR_STATE_UNKNOWN. |
| 478 | */ |
| 479 | double accumulatedDeltaRangeUncertaintyM; |
| 480 | |
| 481 | /* |
gomo | c3d9278 | 2017-01-11 14:04:21 -0800 | [diff] [blame^] | 482 | * Carrier frequency of the signal tracked, for example it can be the |
| 483 | * GPS L1 = 1.57542e9 Hz, or L2, L5, varying GLO channels, etc. If the |
| 484 | * field is not set, it is the primary common use frequency, |
| 485 | * e.g. L1 for GPS. |
Hridya Valsaraju | e596a71 | 2016-09-22 14:07:22 -0700 | [diff] [blame] | 486 | * |
| 487 | * If the data is available, gnssClockFlags must contain |
| 488 | * HAS_CARRIER_FREQUENCY. |
| 489 | */ |
| 490 | float carrierFrequencyHz; |
| 491 | |
| 492 | /* |
| 493 | * The number of full carrier cycles between the satellite and the |
| 494 | * receiver. The reference frequency is given by the field |
| 495 | * 'carrierFrequencyHz'. Indications of possible cycle slips and |
| 496 | * resets in the accumulation of this value can be inferred from the |
| 497 | * accumulatedDeltaRangeState flags. |
| 498 | * |
| 499 | * If the data is available, gnssClockFlags must contain |
| 500 | * HAS_CARRIER_CYCLES. |
| 501 | */ |
| 502 | int64_t carrierCycles; |
| 503 | |
| 504 | /* |
| 505 | * The RF phase detected by the receiver, in the range [0.0, 1.0]. |
| 506 | * This is usually the fractional part of the complete carrier phase |
| 507 | * measurement. |
| 508 | * |
| 509 | * The reference frequency is given by the field 'carrierFrequencyHz'. |
| 510 | * The value contains the 'carrier-phase uncertainty' in it. |
| 511 | * |
| 512 | * If the data is available, gnssClockFlags must contain |
| 513 | * HAS_CARRIER_PHASE. |
| 514 | */ |
| 515 | double carrierPhase; |
| 516 | |
| 517 | /* |
| 518 | * 1-Sigma uncertainty of the carrier-phase. |
| 519 | * If the data is available, gnssClockFlags must contain |
| 520 | * HAS_CARRIER_PHASE_UNCERTAINTY. |
| 521 | */ |
| 522 | double carrierPhaseUncertainty; |
| 523 | |
| 524 | /* |
| 525 | * An enumeration that indicates the 'multipath' state of the event. |
| 526 | * |
| 527 | * The multipath Indicator is intended to report the presence of overlapping |
| 528 | * signals that manifest as distorted correlation peaks. |
| 529 | * |
| 530 | * - if there is a distorted correlation peak shape, report that multipath |
| 531 | * is MULTIPATH_INDICATOR_PRESENT. |
| 532 | * - if there is no distorted correlation peak shape, report |
| 533 | * MULTIPATH_INDICATOR_NOT_PRESENT |
| 534 | * - if signals are too weak to discern this information, report |
| 535 | * MULTIPATH_INDICATOR_UNKNOWN |
| 536 | * |
| 537 | * Example: when doing the standardized overlapping Multipath Performance |
| 538 | * test (3GPP TS 34.171) the Multipath indicator must report |
| 539 | * MULTIPATH_INDICATOR_PRESENT for those signals that are tracked, and |
| 540 | * contain multipath, and MULTIPATH_INDICATOR_NOT_PRESENT for those |
| 541 | * signals that are tracked and do not contain multipath. |
| 542 | */ |
| 543 | GnssMultipathIndicator multipathIndicator; |
| 544 | |
| 545 | /* |
| 546 | * Signal-to-noise ratio at correlator output in dB. |
| 547 | * If the data is available, gnssClockFlags must contain MEASUREMENT_HAS_SNR. |
| 548 | * This is the power ratio of the "correlation peak height above the |
| 549 | * observed noise floor" to "the noise RMS". |
| 550 | */ |
| 551 | double snrDb; |
gomo | c3d9278 | 2017-01-11 14:04:21 -0800 | [diff] [blame^] | 552 | |
| 553 | /* |
| 554 | * Automatic gain control (AGC) level. AGC acts as a variable gain |
| 555 | * amplifier adjusting the power of the incoming signal to minimize the |
| 556 | * quantization losses. The AGC level may be used to indicate potential |
| 557 | * interference. When AGC is at a nominal level, this value |
| 558 | * must be set as 0. Higher gain (and/or lower input power) must be |
| 559 | * output as a positive number. Hence in cases of strong jamming, in the |
| 560 | * band of this signal, this value must go more negative. |
| 561 | * |
| 562 | * Note: Different hardware designs (e.g. antenna, pre-amplification, or |
| 563 | * other RF HW components) may also affect the typical output of of this |
| 564 | * value on any given hardware design in an open sky test - the |
| 565 | * important aspect of this output is that changes in this value are |
| 566 | * indicative of changes on input signal power in the frequency band for |
| 567 | * this measurement. |
| 568 | */ |
| 569 | double agcLevelDb; |
Hridya Valsaraju | e596a71 | 2016-09-22 14:07:22 -0700 | [diff] [blame] | 570 | }; |
| 571 | |
| 572 | /* |
| 573 | * Represents a reading of GNSS measurements. For devices where GnssSystemInfo's |
| 574 | * yearOfHw is set to 2016+, it is mandatory that these be provided, on |
| 575 | * request, when the GNSS receiver is searching/tracking signals. |
| 576 | * |
| 577 | * - Reporting of GNSS constellation measurements is mandatory. |
| 578 | * - Reporting of all tracked constellations are encouraged. |
| 579 | */ |
| 580 | struct GnssData { |
| 581 | /* Number of GnssMeasurement elements. */ |
| 582 | uint32_t measurementCount; |
| 583 | |
| 584 | /* The array of measurements. */ |
Hridya Valsaraju | 97ecaa0 | 2016-11-02 10:20:07 -0700 | [diff] [blame] | 585 | GnssMeasurement[GnssMax:SVS_COUNT] measurements; |
Hridya Valsaraju | e596a71 | 2016-09-22 14:07:22 -0700 | [diff] [blame] | 586 | |
| 587 | /** The GNSS clock time reading. */ |
| 588 | GnssClock clock; |
| 589 | }; |
| 590 | |
| 591 | /* |
| 592 | * Callback for the hal to pass a GnssData structure back to the client. |
| 593 | * |
| 594 | * @param data Contains a reading of GNSS measurements. |
| 595 | */ |
| 596 | GnssMeasurementCb(GnssData data); |
| 597 | }; |