1 /* 2 * Copyright (C) 2010 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 #ifndef LOC_GPS_H 18 #define LOC_GPS_H 19 20 #include <stdint.h> 21 #include <sys/cdefs.h> 22 #include <sys/types.h> 23 #include <pthread.h> 24 #include <sys/socket.h> 25 #include <stdbool.h> 26 27 __BEGIN_DECLS 28 29 #define LOC_FLP_STATUS_LOCATION_AVAILABLE 0 30 #define LOC_FLP_STATUS_LOCATION_UNAVAILABLE 1 31 #define LOC_CAPABILITY_GNSS (1U<<0) 32 #define LOC_CAPABILITY_WIFI (1U<<1) 33 #define LOC_CAPABILITY_CELL (1U<<3) 34 35 /** Milliseconds since January 1, 1970 */ 36 typedef int64_t LocGpsUtcTime; 37 38 /** Maximum number of SVs for loc_gps_sv_status_callback(). */ 39 #define LOC_GPS_MAX_SVS 32 40 /** Maximum number of SVs for loc_gps_sv_status_callback(). */ 41 #define LOC_GNSS_MAX_SVS 64 42 43 /** Maximum number of Measurements in loc_gps_measurement_callback(). */ 44 #define LOC_GPS_MAX_MEASUREMENT 32 45 46 /** Maximum number of Measurements in loc_gnss_measurement_callback(). */ 47 #define LOC_GNSS_MAX_MEASUREMENT 64 48 49 /** Requested operational mode for GPS operation. */ 50 typedef uint32_t LocGpsPositionMode; 51 /* IMPORTANT: Note that the following values must match 52 * constants in GpsLocationProvider.java. */ 53 /** Mode for running GPS standalone (no assistance). */ 54 #define LOC_GPS_POSITION_MODE_STANDALONE 0 55 /** AGPS MS-Based mode. */ 56 #define LOC_GPS_POSITION_MODE_MS_BASED 1 57 /** 58 * AGPS MS-Assisted mode. This mode is not maintained by the platform anymore. 59 * It is strongly recommended to use LOC_GPS_POSITION_MODE_MS_BASED instead. 60 */ 61 #define LOC_GPS_POSITION_MODE_MS_ASSISTED 2 62 63 /** Requested recurrence mode for GPS operation. */ 64 typedef uint32_t LocGpsPositionRecurrence; 65 /* IMPORTANT: Note that the following values must match 66 * constants in GpsLocationProvider.java. */ 67 /** Receive GPS fixes on a recurring basis at a specified period. */ 68 #define LOC_GPS_POSITION_RECURRENCE_PERIODIC 0 69 /** Request a single shot GPS fix. */ 70 #define LOC_GPS_POSITION_RECURRENCE_SINGLE 1 71 72 /** GPS status event values. */ 73 typedef uint16_t LocGpsStatusValue; 74 /* IMPORTANT: Note that the following values must match 75 * constants in GpsLocationProvider.java. */ 76 /** GPS status unknown. */ 77 #define LOC_GPS_STATUS_NONE 0 78 /** GPS has begun navigating. */ 79 #define LOC_GPS_STATUS_SESSION_BEGIN 1 80 /** GPS has stopped navigating. */ 81 #define LOC_GPS_STATUS_SESSION_END 2 82 /** GPS has powered on but is not navigating. */ 83 #define LOC_GPS_STATUS_ENGINE_ON 3 84 /** GPS is powered off. */ 85 #define LOC_GPS_STATUS_ENGINE_OFF 4 86 87 /** Flags to indicate which values are valid in a LocGpsLocation. */ 88 typedef uint16_t LocGpsLocationFlags; 89 /* IMPORTANT: Note that the following values must match 90 * constants in GpsLocationProvider.java. */ 91 /** LocGpsLocation has valid latitude and longitude. */ 92 #define LOC_GPS_LOCATION_HAS_LAT_LONG 0x0001 93 /** LocGpsLocation has valid altitude. */ 94 #define LOC_GPS_LOCATION_HAS_ALTITUDE 0x0002 95 /** LocGpsLocation has valid speed. */ 96 #define LOC_GPS_LOCATION_HAS_SPEED 0x0004 97 /** LocGpsLocation has valid bearing. */ 98 #define LOC_GPS_LOCATION_HAS_BEARING 0x0008 99 /** LocGpsLocation has valid accuracy. */ 100 #define LOC_GPS_LOCATION_HAS_ACCURACY 0x0010 101 /** LocGpsLocation has valid vertical uncertainity */ 102 #define LOC_GPS_LOCATION_HAS_VERT_UNCERTAINITY 0x0040 103 104 /** Flags for the loc_gps_set_capabilities callback. */ 105 106 /** 107 * GPS HAL schedules fixes for LOC_GPS_POSITION_RECURRENCE_PERIODIC mode. If this is 108 * not set, then the framework will use 1000ms for min_interval and will start 109 * and call start() and stop() to schedule the GPS. 110 */ 111 #define LOC_GPS_CAPABILITY_SCHEDULING (1 << 0) 112 /** GPS supports MS-Based AGPS mode */ 113 #define LOC_GPS_CAPABILITY_MSB (1 << 1) 114 /** GPS supports MS-Assisted AGPS mode */ 115 #define LOC_GPS_CAPABILITY_MSA (1 << 2) 116 /** GPS supports single-shot fixes */ 117 #define LOC_GPS_CAPABILITY_SINGLE_SHOT (1 << 3) 118 /** GPS supports on demand time injection */ 119 #define LOC_GPS_CAPABILITY_ON_DEMAND_TIME (1 << 4) 120 /** GPS supports Geofencing */ 121 #define LOC_GPS_CAPABILITY_GEOFENCING (1 << 5) 122 /** GPS supports Measurements. */ 123 #define LOC_GPS_CAPABILITY_MEASUREMENTS (1 << 6) 124 /** GPS supports Navigation Messages */ 125 #define LOC_GPS_CAPABILITY_NAV_MESSAGES (1 << 7) 126 127 /** 128 * Flags used to specify which aiding data to delete when calling 129 * delete_aiding_data(). 130 */ 131 typedef uint16_t LocGpsAidingData; 132 /* IMPORTANT: Note that the following values must match 133 * constants in GpsLocationProvider.java. */ 134 #define LOC_GPS_DELETE_EPHEMERIS 0x0001 135 #define LOC_GPS_DELETE_ALMANAC 0x0002 136 #define LOC_GPS_DELETE_POSITION 0x0004 137 #define LOC_GPS_DELETE_TIME 0x0008 138 #define LOC_GPS_DELETE_IONO 0x0010 139 #define LOC_GPS_DELETE_UTC 0x0020 140 #define LOC_GPS_DELETE_HEALTH 0x0040 141 #define LOC_GPS_DELETE_SVDIR 0x0080 142 #define LOC_GPS_DELETE_SVSTEER 0x0100 143 #define LOC_GPS_DELETE_SADATA 0x0200 144 #define LOC_GPS_DELETE_RTI 0x0400 145 #define LOC_GPS_DELETE_CELLDB_INFO 0x8000 146 #define LOC_GPS_DELETE_ALL 0xFFFF 147 148 /** AGPS type */ 149 typedef uint16_t LocAGpsType; 150 #define LOC_AGPS_TYPE_SUPL 1 151 #define LOC_AGPS_TYPE_C2K 2 152 153 typedef uint16_t LocAGpsSetIDType; 154 #define LOC_AGPS_SETID_TYPE_NONE 0 155 #define LOC_AGPS_SETID_TYPE_IMSI 1 156 #define LOC_AGPS_SETID_TYPE_MSISDN 2 157 158 typedef uint16_t LocApnIpType; 159 #define LOC_APN_IP_INVALID 0 160 #define LOC_APN_IP_IPV4 1 161 #define LOC_APN_IP_IPV6 2 162 #define LOC_APN_IP_IPV4V6 3 163 164 /** 165 * String length constants 166 */ 167 #define LOC_GPS_NI_SHORT_STRING_MAXLEN 256 168 #define LOC_GPS_NI_LONG_STRING_MAXLEN 2048 169 170 /** 171 * LocGpsNiType constants 172 */ 173 typedef uint32_t LocGpsNiType; 174 #define LOC_GPS_NI_TYPE_VOICE 1 175 #define LOC_GPS_NI_TYPE_UMTS_SUPL 2 176 #define LOC_GPS_NI_TYPE_UMTS_CTRL_PLANE 3 177 /*Emergency SUPL*/ 178 #define LOC_GPS_NI_TYPE_EMERGENCY_SUPL 4 179 180 /** 181 * LocGpsNiNotifyFlags constants 182 */ 183 typedef uint32_t LocGpsNiNotifyFlags; 184 /** NI requires notification */ 185 #define LOC_GPS_NI_NEED_NOTIFY 0x0001 186 /** NI requires verification */ 187 #define LOC_GPS_NI_NEED_VERIFY 0x0002 188 /** NI requires privacy override, no notification/minimal trace */ 189 #define LOC_GPS_NI_PRIVACY_OVERRIDE 0x0004 190 191 /** 192 * GPS NI responses, used to define the response in 193 * NI structures 194 */ 195 typedef int LocGpsUserResponseType; 196 #define LOC_GPS_NI_RESPONSE_ACCEPT 1 197 #define LOC_GPS_NI_RESPONSE_DENY 2 198 #define LOC_GPS_NI_RESPONSE_NORESP 3 199 200 /** 201 * NI data encoding scheme 202 */ 203 typedef int LocGpsNiEncodingType; 204 #define LOC_GPS_ENC_NONE 0 205 #define LOC_GPS_ENC_SUPL_GSM_DEFAULT 1 206 #define LOC_GPS_ENC_SUPL_UTF8 2 207 #define LOC_GPS_ENC_SUPL_UCS2 3 208 #define LOC_GPS_ENC_UNKNOWN -1 209 210 /** AGPS status event values. */ 211 typedef uint16_t LocAGpsStatusValue; 212 /** GPS requests data connection for AGPS. */ 213 #define LOC_GPS_REQUEST_AGPS_DATA_CONN 1 214 /** GPS releases the AGPS data connection. */ 215 #define LOC_GPS_RELEASE_AGPS_DATA_CONN 2 216 /** AGPS data connection initiated */ 217 #define LOC_GPS_AGPS_DATA_CONNECTED 3 218 /** AGPS data connection completed */ 219 #define LOC_GPS_AGPS_DATA_CONN_DONE 4 220 /** AGPS data connection failed */ 221 #define LOC_GPS_AGPS_DATA_CONN_FAILED 5 222 223 typedef uint16_t LocAGpsRefLocationType; 224 #define LOC_AGPS_REF_LOCATION_TYPE_GSM_CELLID 1 225 #define LOC_AGPS_REF_LOCATION_TYPE_UMTS_CELLID 2 226 #define LOC_AGPS_REF_LOCATION_TYPE_MAC 3 227 #define LOC_AGPS_REF_LOCATION_TYPE_LTE_CELLID 4 228 229 /* Deprecated, to be removed in the next Android release. */ 230 #define LOC_AGPS_REG_LOCATION_TYPE_MAC 3 231 232 /** Network types for update_network_state "type" parameter */ 233 #define LOC_AGPS_RIL_NETWORK_TYPE_MOBILE 0 234 #define LOC_AGPS_RIL_NETWORK_TYPE_WIFI 1 235 #define LOC_AGPS_RIL_NETWORK_TYPE_MOBILE_MMS 2 236 #define LOC_AGPS_RIL_NETWORK_TYPE_MOBILE_SUPL 3 237 #define LOC_AGPS_RIL_NETWORK_TTYPE_MOBILE_DUN 4 238 #define LOC_AGPS_RIL_NETWORK_TTYPE_MOBILE_HIPRI 5 239 #define LOC_AGPS_RIL_NETWORK_TTYPE_WIMAX 6 240 241 /* The following typedef together with its constants below are deprecated, and 242 * will be removed in the next release. */ 243 typedef uint16_t LocGpsClockFlags; 244 #define LOC_GPS_CLOCK_HAS_LEAP_SECOND (1<<0) 245 #define LOC_GPS_CLOCK_HAS_TIME_UNCERTAINTY (1<<1) 246 #define LOC_GPS_CLOCK_HAS_FULL_BIAS (1<<2) 247 #define LOC_GPS_CLOCK_HAS_BIAS (1<<3) 248 #define LOC_GPS_CLOCK_HAS_BIAS_UNCERTAINTY (1<<4) 249 #define LOC_GPS_CLOCK_HAS_DRIFT (1<<5) 250 #define LOC_GPS_CLOCK_HAS_DRIFT_UNCERTAINTY (1<<6) 251 252 /** 253 * Flags to indicate what fields in LocGnssClock are valid. 254 */ 255 typedef uint16_t LocGnssClockFlags; 256 /** A valid 'leap second' is stored in the data structure. */ 257 #define LOC_GNSS_CLOCK_HAS_LEAP_SECOND (1<<0) 258 /** A valid 'time uncertainty' is stored in the data structure. */ 259 #define LOC_GNSS_CLOCK_HAS_TIME_UNCERTAINTY (1<<1) 260 /** A valid 'full bias' is stored in the data structure. */ 261 #define LOC_GNSS_CLOCK_HAS_FULL_BIAS (1<<2) 262 /** A valid 'bias' is stored in the data structure. */ 263 #define LOC_GNSS_CLOCK_HAS_BIAS (1<<3) 264 /** A valid 'bias uncertainty' is stored in the data structure. */ 265 #define LOC_GNSS_CLOCK_HAS_BIAS_UNCERTAINTY (1<<4) 266 /** A valid 'drift' is stored in the data structure. */ 267 #define LOC_GNSS_CLOCK_HAS_DRIFT (1<<5) 268 /** A valid 'drift uncertainty' is stored in the data structure. */ 269 #define LOC_GNSS_CLOCK_HAS_DRIFT_UNCERTAINTY (1<<6) 270 271 /* The following typedef together with its constants below are deprecated, and 272 * will be removed in the next release. */ 273 typedef uint8_t LocGpsClockType; 274 #define LOC_GPS_CLOCK_TYPE_UNKNOWN 0 275 #define LOC_GPS_CLOCK_TYPE_LOCAL_HW_TIME 1 276 #define LOC_GPS_CLOCK_TYPE_GPS_TIME 2 277 278 /* The following typedef together with its constants below are deprecated, and 279 * will be removed in the next release. */ 280 typedef uint32_t LocGpsMeasurementFlags; 281 #define LOC_GPS_MEASUREMENT_HAS_SNR (1<<0) 282 #define LOC_GPS_MEASUREMENT_HAS_ELEVATION (1<<1) 283 #define LOC_GPS_MEASUREMENT_HAS_ELEVATION_UNCERTAINTY (1<<2) 284 #define LOC_GPS_MEASUREMENT_HAS_AZIMUTH (1<<3) 285 #define LOC_GPS_MEASUREMENT_HAS_AZIMUTH_UNCERTAINTY (1<<4) 286 #define LOC_GPS_MEASUREMENT_HAS_PSEUDORANGE (1<<5) 287 #define LOC_GPS_MEASUREMENT_HAS_PSEUDORANGE_UNCERTAINTY (1<<6) 288 #define LOC_GPS_MEASUREMENT_HAS_CODE_PHASE (1<<7) 289 #define LOC_GPS_MEASUREMENT_HAS_CODE_PHASE_UNCERTAINTY (1<<8) 290 #define LOC_GPS_MEASUREMENT_HAS_CARRIER_FREQUENCY (1<<9) 291 #define LOC_GPS_MEASUREMENT_HAS_CARRIER_CYCLES (1<<10) 292 #define LOC_GPS_MEASUREMENT_HAS_CARRIER_PHASE (1<<11) 293 #define LOC_GPS_MEASUREMENT_HAS_CARRIER_PHASE_UNCERTAINTY (1<<12) 294 #define LOC_GPS_MEASUREMENT_HAS_BIT_NUMBER (1<<13) 295 #define LOC_GPS_MEASUREMENT_HAS_TIME_FROM_LAST_BIT (1<<14) 296 #define LOC_GPS_MEASUREMENT_HAS_DOPPLER_SHIFT (1<<15) 297 #define LOC_GPS_MEASUREMENT_HAS_DOPPLER_SHIFT_UNCERTAINTY (1<<16) 298 #define LOC_GPS_MEASUREMENT_HAS_USED_IN_FIX (1<<17) 299 #define LOC_GPS_MEASUREMENT_HAS_UNCORRECTED_PSEUDORANGE_RATE (1<<18) 300 301 /** 302 * Flags to indicate what fields in LocGnssMeasurement are valid. 303 */ 304 typedef uint32_t LocGnssMeasurementFlags; 305 /** A valid 'snr' is stored in the data structure. */ 306 #define LOC_GNSS_MEASUREMENT_HAS_SNR (1<<0) 307 /** A valid 'carrier frequency' is stored in the data structure. */ 308 #define LOC_GNSS_MEASUREMENT_HAS_CARRIER_FREQUENCY (1<<9) 309 /** A valid 'carrier cycles' is stored in the data structure. */ 310 #define LOC_GNSS_MEASUREMENT_HAS_CARRIER_CYCLES (1<<10) 311 /** A valid 'carrier phase' is stored in the data structure. */ 312 #define LOC_GNSS_MEASUREMENT_HAS_CARRIER_PHASE (1<<11) 313 /** A valid 'carrier phase uncertainty' is stored in the data structure. */ 314 #define LOC_GNSS_MEASUREMENT_HAS_CARRIER_PHASE_UNCERTAINTY (1<<12) 315 316 /* The following typedef together with its constants below are deprecated, and 317 * will be removed in the next release. */ 318 typedef uint8_t LocGpsLossOfLock; 319 #define LOC_GPS_LOSS_OF_LOCK_UNKNOWN 0 320 #define LOC_GPS_LOSS_OF_LOCK_OK 1 321 #define LOC_GPS_LOSS_OF_LOCK_CYCLE_SLIP 2 322 323 /* The following typedef together with its constants below are deprecated, and 324 * will be removed in the next release. Use LocGnssMultipathIndicator instead. 325 */ 326 typedef uint8_t LocGpsMultipathIndicator; 327 #define LOC_GPS_MULTIPATH_INDICATOR_UNKNOWN 0 328 #define LOC_GPS_MULTIPATH_INDICATOR_DETECTED 1 329 #define LOC_GPS_MULTIPATH_INDICATOR_NOT_USED 2 330 331 /** 332 * Enumeration of available values for the GNSS Measurement's multipath 333 * indicator. 334 */ 335 typedef uint8_t LocGnssMultipathIndicator; 336 /** The indicator is not available or unknown. */ 337 #define LOC_GNSS_MULTIPATH_INDICATOR_UNKNOWN 0 338 /** The measurement is indicated to be affected by multipath. */ 339 #define LOC_GNSS_MULTIPATH_INDICATOR_PRESENT 1 340 /** The measurement is indicated to be not affected by multipath. */ 341 #define LOC_GNSS_MULTIPATH_INDICATOR_NOT_PRESENT 2 342 343 /* The following typedef together with its constants below are deprecated, and 344 * will be removed in the next release. */ 345 typedef uint16_t LocGpsMeasurementState; 346 #define LOC_GPS_MEASUREMENT_STATE_UNKNOWN 0 347 #define LOC_GPS_MEASUREMENT_STATE_CODE_LOCK (1<<0) 348 #define LOC_GPS_MEASUREMENT_STATE_BIT_SYNC (1<<1) 349 #define LOC_GPS_MEASUREMENT_STATE_SUBFRAME_SYNC (1<<2) 350 #define LOC_GPS_MEASUREMENT_STATE_TOW_DECODED (1<<3) 351 #define LOC_GPS_MEASUREMENT_STATE_MSEC_AMBIGUOUS (1<<4) 352 353 /** 354 * Flags indicating the GNSS measurement state. 355 * 356 * The expected behavior here is for GPS HAL to set all the flags that applies. 357 * For example, if the state for a satellite is only C/A code locked and bit 358 * synchronized, and there is still millisecond ambiguity, the state should be 359 * set as: 360 * 361 * LOC_GNSS_MEASUREMENT_STATE_CODE_LOCK | LOC_GNSS_MEASUREMENT_STATE_BIT_SYNC | 362 * LOC_GNSS_MEASUREMENT_STATE_MSEC_AMBIGUOUS 363 * 364 * If GNSS is still searching for a satellite, the corresponding state should be 365 * set to LOC_GNSS_MEASUREMENT_STATE_UNKNOWN(0). 366 */ 367 typedef uint32_t LocGnssMeasurementState; 368 #define LOC_GNSS_MEASUREMENT_STATE_UNKNOWN 0 369 #define LOC_GNSS_MEASUREMENT_STATE_CODE_LOCK (1<<0) 370 #define LOC_GNSS_MEASUREMENT_STATE_BIT_SYNC (1<<1) 371 #define LOC_GNSS_MEASUREMENT_STATE_SUBFRAME_SYNC (1<<2) 372 #define LOC_GNSS_MEASUREMENT_STATE_TOW_DECODED (1<<3) 373 #define LOC_GNSS_MEASUREMENT_STATE_MSEC_AMBIGUOUS (1<<4) 374 #define LOC_GNSS_MEASUREMENT_STATE_SYMBOL_SYNC (1<<5) 375 #define LOC_GNSS_MEASUREMENT_STATE_GLO_STRING_SYNC (1<<6) 376 #define LOC_GNSS_MEASUREMENT_STATE_GLO_TOD_DECODED (1<<7) 377 #define LOC_GNSS_MEASUREMENT_STATE_BDS_D2_BIT_SYNC (1<<8) 378 #define LOC_GNSS_MEASUREMENT_STATE_BDS_D2_SUBFRAME_SYNC (1<<9) 379 #define LOC_GNSS_MEASUREMENT_STATE_GAL_E1BC_CODE_LOCK (1<<10) 380 #define LOC_GNSS_MEASUREMENT_STATE_GAL_E1C_2ND_CODE_LOCK (1<<11) 381 #define LOC_GNSS_MEASUREMENT_STATE_GAL_E1B_PAGE_SYNC (1<<12) 382 #define LOC_GNSS_MEASUREMENT_STATE_SBAS_SYNC (1<<13) 383 384 /* The following typedef together with its constants below are deprecated, and 385 * will be removed in the next release. */ 386 typedef uint16_t LocGpsAccumulatedDeltaRangeState; 387 #define LOC_GPS_ADR_STATE_UNKNOWN 0 388 #define LOC_GPS_ADR_STATE_VALID (1<<0) 389 #define LOC_GPS_ADR_STATE_RESET (1<<1) 390 #define LOC_GPS_ADR_STATE_CYCLE_SLIP (1<<2) 391 392 /** 393 * Flags indicating the Accumulated Delta Range's states. 394 */ 395 typedef uint16_t LocGnssAccumulatedDeltaRangeState; 396 #define LOC_GNSS_ADR_STATE_UNKNOWN 0 397 #define LOC_GNSS_ADR_STATE_VALID (1<<0) 398 #define LOC_GNSS_ADR_STATE_RESET (1<<1) 399 #define LOC_GNSS_ADR_STATE_CYCLE_SLIP (1<<2) 400 401 #if 0 402 /* The following typedef together with its constants below are deprecated, and 403 * will be removed in the next release. */ 404 typedef uint8_t GpsNavigationMessageType; 405 #define GPS_NAVIGATION_MESSAGE_TYPE_UNKNOWN 0 406 #define GPS_NAVIGATION_MESSAGE_TYPE_L1CA 1 407 #define GPS_NAVIGATION_MESSAGE_TYPE_L2CNAV 2 408 #define GPS_NAVIGATION_MESSAGE_TYPE_L5CNAV 3 409 #define GPS_NAVIGATION_MESSAGE_TYPE_CNAV2 4 410 411 /** 412 * Enumeration of available values to indicate the GNSS Navigation message 413 * types. 414 * 415 * For convenience, first byte is the LocGnssConstellationType on which that signal 416 * is typically transmitted 417 */ 418 typedef int16_t GnssNavigationMessageType; 419 420 #define GNSS_NAVIGATION_MESSAGE_TYPE_UNKNOWN 0 421 /** GPS L1 C/A message contained in the structure. */ 422 #define GNSS_NAVIGATION_MESSAGE_TYPE_GPS_L1CA 0x0101 423 /** GPS L2-CNAV message contained in the structure. */ 424 #define GNSS_NAVIGATION_MESSAGE_TYPE_GPS_L2CNAV 0x0102 425 /** GPS L5-CNAV message contained in the structure. */ 426 #define GNSS_NAVIGATION_MESSAGE_TYPE_GPS_L5CNAV 0x0103 427 /** GPS CNAV-2 message contained in the structure. */ 428 #define GNSS_NAVIGATION_MESSAGE_TYPE_GPS_CNAV2 0x0104 429 /** Glonass L1 CA message contained in the structure. */ 430 #define GNSS_NAVIGATION_MESSAGE_TYPE_GLO_L1CA 0x0301 431 /** Beidou D1 message contained in the structure. */ 432 #define GNSS_NAVIGATION_MESSAGE_TYPE_BDS_D1 0x0501 433 /** Beidou D2 message contained in the structure. */ 434 #define GNSS_NAVIGATION_MESSAGE_TYPE_BDS_D2 0x0502 435 /** Galileo I/NAV message contained in the structure. */ 436 #define GNSS_NAVIGATION_MESSAGE_TYPE_GAL_I 0x0601 437 /** Galileo F/NAV message contained in the structure. */ 438 #define GNSS_NAVIGATION_MESSAGE_TYPE_GAL_F 0x0602 439 440 /** 441 * Status of Navigation Message 442 * When a message is received properly without any parity error in its navigation words, the 443 * status should be set to NAV_MESSAGE_STATUS_PARITY_PASSED. But if a message is received 444 * with words that failed parity check, but GPS is able to correct those words, the status 445 * should be set to NAV_MESSAGE_STATUS_PARITY_REBUILT. 446 * No need to send any navigation message that contains words with parity error and cannot be 447 * corrected. 448 */ 449 typedef uint16_t NavigationMessageStatus; 450 #define NAV_MESSAGE_STATUS_UNKNOWN 0 451 #define NAV_MESSAGE_STATUS_PARITY_PASSED (1<<0) 452 #define NAV_MESSAGE_STATUS_PARITY_REBUILT (1<<1) 453 454 /* This constant is deprecated, and will be removed in the next release. */ 455 #define NAV_MESSAGE_STATUS_UNKONW 0 456 #endif 457 458 /** 459 * Flags that indicate information about the satellite 460 */ 461 typedef uint8_t LocGnssSvFlags; 462 #define LOC_GNSS_SV_FLAGS_NONE 0 463 #define LOC_GNSS_SV_FLAGS_HAS_EPHEMERIS_DATA (1 << 0) 464 #define LOC_GNSS_SV_FLAGS_HAS_ALMANAC_DATA (1 << 1) 465 #define LOC_GNSS_SV_FLAGS_USED_IN_FIX (1 << 2) 466 467 /** 468 * Constellation type of LocGnssSvInfo 469 */ 470 typedef uint8_t LocGnssConstellationType; 471 #define LOC_GNSS_CONSTELLATION_UNKNOWN 0 472 #define LOC_GNSS_CONSTELLATION_GPS 1 473 #define LOC_GNSS_CONSTELLATION_SBAS 2 474 #define LOC_GNSS_CONSTELLATION_GLONASS 3 475 #define LOC_GNSS_CONSTELLATION_QZSS 4 476 #define LOC_GNSS_CONSTELLATION_BEIDOU 5 477 #define LOC_GNSS_CONSTELLATION_GALILEO 6 478 479 /** 480 * Name for the GPS XTRA interface. 481 */ 482 #define LOC_GPS_XTRA_INTERFACE "gps-xtra" 483 484 /** 485 * Name for the GPS DEBUG interface. 486 */ 487 #define LOC_GPS_DEBUG_INTERFACE "gps-debug" 488 489 /** 490 * Name for the AGPS interface. 491 */ 492 493 #define LOC_AGPS_INTERFACE "agps" 494 495 /** 496 * Name of the Supl Certificate interface. 497 */ 498 #define LOC_SUPL_CERTIFICATE_INTERFACE "supl-certificate" 499 500 /** 501 * Name for NI interface 502 */ 503 #define LOC_GPS_NI_INTERFACE "gps-ni" 504 505 /** 506 * Name for the AGPS-RIL interface. 507 */ 508 #define LOC_AGPS_RIL_INTERFACE "agps_ril" 509 510 /** 511 * Name for the GPS_Geofencing interface. 512 */ 513 #define LOC_GPS_GEOFENCING_INTERFACE "gps_geofencing" 514 515 /** 516 * Name of the GPS Measurements interface. 517 */ 518 #define LOC_GPS_MEASUREMENT_INTERFACE "gps_measurement" 519 520 /** 521 * Name of the GPS navigation message interface. 522 */ 523 #define LOC_GPS_NAVIGATION_MESSAGE_INTERFACE "gps_navigation_message" 524 525 /** 526 * Name of the GNSS/GPS configuration interface. 527 */ 528 #define LOC_GNSS_CONFIGURATION_INTERFACE "gnss_configuration" 529 530 /** Represents a location. */ 531 typedef struct { 532 /** set to sizeof(LocGpsLocation) */ 533 size_t size; 534 /** Contains LocGpsLocationFlags bits. */ 535 uint16_t flags; 536 /** Represents latitude in degrees. */ 537 double latitude; 538 /** Represents longitude in degrees. */ 539 double longitude; 540 /** 541 * Represents altitude in meters above the WGS 84 reference ellipsoid. 542 */ 543 double altitude; 544 /** Represents horizontal speed in meters per second. */ 545 float speed; 546 /** Represents heading in degrees. */ 547 float bearing; 548 /** Represents expected accuracy in meters. */ 549 float accuracy; 550 /** Represents the expected vertical uncertainity in meters*/ 551 float vertUncertainity; 552 /** Timestamp for the location fix. */ 553 LocGpsUtcTime timestamp; 554 } LocGpsLocation; 555 556 /** Represents the status. */ 557 typedef struct { 558 /** set to sizeof(LocGpsStatus) */ 559 size_t size; 560 LocGpsStatusValue status; 561 } LocGpsStatus; 562 563 /** 564 * Legacy struct to represents SV information. 565 * Deprecated, to be removed in the next Android release. 566 * Use LocGnssSvInfo instead. 567 */ 568 typedef struct { 569 /** set to sizeof(LocGpsSvInfo) */ 570 size_t size; 571 /** Pseudo-random number for the SV. */ 572 int prn; 573 /** Signal to noise ratio. */ 574 float snr; 575 /** Elevation of SV in degrees. */ 576 float elevation; 577 /** Azimuth of SV in degrees. */ 578 float azimuth; 579 } LocGpsSvInfo; 580 581 typedef struct { 582 /** set to sizeof(LocGnssSvInfo) */ 583 size_t size; 584 585 /** 586 * Pseudo-random number for the SV, or FCN/OSN number for Glonass. The 587 * distinction is made by looking at constellation field. Values should be 588 * in the range of: 589 * 590 * - GPS: 1-32 591 * - SBAS: 120-151, 183-192 592 * - GLONASS: 1-24, the orbital slot number (OSN), if known. Or, if not: 593 * 93-106, the frequency channel number (FCN) (-7 to +6) offset by + 100 594 * i.e. report an FCN of -7 as 93, FCN of 0 as 100, and FCN of +6 as 106. 595 * - QZSS: 193-200 596 * - Galileo: 1-36 597 * - Beidou: 1-37 598 */ 599 int16_t svid; 600 601 /** 602 * Defines the constellation of the given SV. Value should be one of those 603 * LOC_GNSS_CONSTELLATION_* constants 604 */ 605 LocGnssConstellationType constellation; 606 607 /** 608 * Carrier-to-noise density in dB-Hz, typically in the range [0, 63]. 609 * It contains the measured C/N0 value for the signal at the antenna port. 610 * 611 * This is a mandatory value. 612 */ 613 float c_n0_dbhz; 614 615 /** Elevation of SV in degrees. */ 616 float elevation; 617 618 /** Azimuth of SV in degrees. */ 619 float azimuth; 620 621 /** 622 * Contains additional data about the given SV. Value should be one of those 623 * LOC_GNSS_SV_FLAGS_* constants 624 */ 625 LocGnssSvFlags flags; 626 627 } LocGnssSvInfo; 628 629 /** 630 * Legacy struct to represents SV status. 631 * Deprecated, to be removed in the next Android release. 632 * Use LocGnssSvStatus instead. 633 */ 634 typedef struct { 635 /** set to sizeof(LocGpsSvStatus) */ 636 size_t size; 637 int num_svs; 638 LocGpsSvInfo sv_list[LOC_GPS_MAX_SVS]; 639 uint32_t ephemeris_mask; 640 uint32_t almanac_mask; 641 uint32_t used_in_fix_mask; 642 } LocGpsSvStatus; 643 644 /** 645 * Represents SV status. 646 */ 647 typedef struct { 648 /** set to sizeof(LocGnssSvStatus) */ 649 size_t size; 650 651 /** Number of GPS SVs currently visible, refers to the SVs stored in sv_list */ 652 int num_svs; 653 /** 654 * Pointer to an array of SVs information for all GNSS constellations, 655 * except GPS, which is reported using sv_list 656 */ 657 LocGnssSvInfo gnss_sv_list[LOC_GNSS_MAX_SVS]; 658 659 } LocGnssSvStatus; 660 661 /* CellID for 2G, 3G and LTE, used in AGPS. */ 662 typedef struct { 663 LocAGpsRefLocationType type; 664 /** Mobile Country Code. */ 665 uint16_t mcc; 666 /** Mobile Network Code .*/ 667 uint16_t mnc; 668 /** Location Area Code in 2G, 3G and LTE. In 3G lac is discarded. In LTE, 669 * lac is populated with tac, to ensure that we don't break old clients that 670 * might rely in the old (wrong) behavior. 671 */ 672 uint16_t lac; 673 /** Cell id in 2G. Utran Cell id in 3G. Cell Global Id EUTRA in LTE. */ 674 uint32_t cid; 675 /** Tracking Area Code in LTE. */ 676 uint16_t tac; 677 /** Physical Cell id in LTE (not used in 2G and 3G) */ 678 uint16_t pcid; 679 } LocAGpsRefLocationCellID; 680 681 typedef struct { 682 uint8_t mac[6]; 683 } LocAGpsRefLocationMac; 684 685 /** Represents ref locations */ 686 typedef struct { 687 LocAGpsRefLocationType type; 688 union { 689 LocAGpsRefLocationCellID cellID; 690 LocAGpsRefLocationMac mac; 691 } u; 692 } LocAGpsRefLocation; 693 694 /** 695 * Callback with location information. Can only be called from a thread created 696 * by create_thread_cb. 697 */ 698 typedef void (* loc_gps_location_callback)(LocGpsLocation* location); 699 700 /** 701 * Callback with status information. Can only be called from a thread created by 702 * create_thread_cb. 703 */ 704 typedef void (* loc_gps_status_callback)(LocGpsStatus* status); 705 /** 706 * Legacy callback with SV status information. 707 * Can only be called from a thread created by create_thread_cb. 708 * 709 * This callback is deprecated, and will be removed in the next release. Use 710 * loc_gnss_sv_status_callback() instead. 711 */ 712 typedef void (* loc_gps_sv_status_callback)(LocGpsSvStatus* sv_info); 713 714 /** 715 * Callback with SV status information. 716 * Can only be called from a thread created by create_thread_cb. 717 */ 718 typedef void (* loc_gnss_sv_status_callback)(LocGnssSvStatus* sv_info); 719 720 /** 721 * Callback for reporting NMEA sentences. Can only be called from a thread 722 * created by create_thread_cb. 723 */ 724 typedef void (* loc_gps_nmea_callback)(LocGpsUtcTime timestamp, const char* nmea, int length); 725 726 /** 727 * Callback to inform framework of the GPS engine's capabilities. Capability 728 * parameter is a bit field of LOC_GPS_CAPABILITY_* flags. 729 */ 730 typedef void (* loc_gps_set_capabilities)(uint32_t capabilities); 731 732 /** 733 * Callback utility for acquiring the GPS wakelock. This can be used to prevent 734 * the CPU from suspending while handling GPS events. 735 */ 736 typedef void (* loc_gps_acquire_wakelock)(); 737 738 /** Callback utility for releasing the GPS wakelock. */ 739 typedef void (* loc_gps_release_wakelock)(); 740 741 /** Callback for requesting NTP time */ 742 typedef void (* loc_gps_request_utc_time)(); 743 744 /** 745 * Callback for creating a thread that can call into the Java framework code. 746 * This must be used to create any threads that report events up to the 747 * framework. 748 */ 749 typedef pthread_t (* loc_gps_create_thread)(const char* name, void (*start)(void *), void* arg); 750 751 /** 752 * Provides information about how new the underlying GPS/GNSS hardware and 753 * software is. 754 * 755 * This information will be available for Android Test Applications. If a GPS 756 * HAL does not provide this information, it will be considered "2015 or 757 * earlier". 758 * 759 * If a GPS HAL does provide this information, then newer years will need to 760 * meet newer CTS standards. E.g. if the date are 2016 or above, then N+ level 761 * LocGpsMeasurement support will be verified. 762 */ 763 typedef struct { 764 /** Set to sizeof(LocGnssSystemInfo) */ 765 size_t size; 766 /* year in which the last update was made to the underlying hardware/firmware 767 * used to capture GNSS signals, e.g. 2016 */ 768 uint16_t year_of_hw; 769 } LocGnssSystemInfo; 770 771 /** 772 * Callback to inform framework of the engine's hardware version information. 773 */ 774 typedef void (*loc_gnss_set_system_info)(const LocGnssSystemInfo* info); 775 776 /** New GPS callback structure. */ 777 typedef struct { 778 /** set to sizeof(LocGpsCallbacks) */ 779 size_t size; 780 loc_gps_location_callback location_cb; 781 loc_gps_status_callback status_cb; 782 loc_gps_sv_status_callback sv_status_cb; 783 loc_gps_nmea_callback nmea_cb; 784 loc_gps_set_capabilities set_capabilities_cb; 785 loc_gps_acquire_wakelock acquire_wakelock_cb; 786 loc_gps_release_wakelock release_wakelock_cb; 787 loc_gps_create_thread create_thread_cb; 788 loc_gps_request_utc_time request_utc_time_cb; 789 790 loc_gnss_set_system_info set_system_info_cb; 791 loc_gnss_sv_status_callback gnss_sv_status_cb; 792 } LocGpsCallbacks; 793 794 /** Represents the standard GPS interface. */ 795 typedef struct { 796 /** set to sizeof(LocGpsInterface) */ 797 size_t size; 798 /** 799 * Opens the interface and provides the callback routines 800 * to the implementation of this interface. 801 */ 802 int (*init)( LocGpsCallbacks* callbacks ); 803 804 /** Starts navigating. */ 805 int (*start)( void ); 806 807 /** Stops navigating. */ 808 int (*stop)( void ); 809 810 /** Closes the interface. */ 811 void (*cleanup)( void ); 812 813 /** Injects the current time. */ 814 int (*inject_time)(LocGpsUtcTime time, int64_t timeReference, 815 int uncertainty); 816 817 /** 818 * Injects current location from another location provider (typically cell 819 * ID). Latitude and longitude are measured in degrees expected accuracy is 820 * measured in meters 821 */ 822 int (*inject_location)(double latitude, double longitude, float accuracy); 823 824 /** 825 * Specifies that the next call to start will not use the 826 * information defined in the flags. LOC_GPS_DELETE_ALL is passed for 827 * a cold start. 828 */ 829 void (*delete_aiding_data)(LocGpsAidingData flags); 830 831 /** 832 * min_interval represents the time between fixes in milliseconds. 833 * preferred_accuracy represents the requested fix accuracy in meters. 834 * preferred_time represents the requested time to first fix in milliseconds. 835 * 836 * 'mode' parameter should be one of LOC_GPS_POSITION_MODE_MS_BASED 837 * or LOC_GPS_POSITION_MODE_STANDALONE. 838 * It is allowed by the platform (and it is recommended) to fallback to 839 * LOC_GPS_POSITION_MODE_MS_BASED if LOC_GPS_POSITION_MODE_MS_ASSISTED is passed in, and 840 * LOC_GPS_POSITION_MODE_MS_BASED is supported. 841 */ 842 int (*set_position_mode)(LocGpsPositionMode mode, LocGpsPositionRecurrence recurrence, 843 uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time); 844 845 /** Get a pointer to extension information. */ 846 const void* (*get_extension)(const char* name); 847 } LocGpsInterface; 848 849 /** 850 * Callback to request the client to download XTRA data. The client should 851 * download XTRA data and inject it by calling inject_xtra_data(). Can only be 852 * called from a thread created by create_thread_cb. 853 */ 854 typedef void (* loc_gps_xtra_download_request)(); 855 856 /** Callback structure for the XTRA interface. */ 857 typedef struct { 858 loc_gps_xtra_download_request download_request_cb; 859 loc_gps_create_thread create_thread_cb; 860 } LocGpsXtraCallbacks; 861 862 /** Extended interface for XTRA support. */ 863 typedef struct { 864 /** set to sizeof(LocGpsXtraInterface) */ 865 size_t size; 866 /** 867 * Opens the XTRA interface and provides the callback routines 868 * to the implementation of this interface. 869 */ 870 int (*init)( LocGpsXtraCallbacks* callbacks ); 871 /** Injects XTRA data into the GPS. */ 872 int (*inject_xtra_data)( char* data, int length ); 873 } LocGpsXtraInterface; 874 875 #if 0 876 /** Extended interface for DEBUG support. */ 877 typedef struct { 878 /** set to sizeof(LocGpsDebugInterface) */ 879 size_t size; 880 881 /** 882 * This function should return any information that the native 883 * implementation wishes to include in a bugreport. 884 */ 885 size_t (*get_internal_state)(char* buffer, size_t bufferSize); 886 } LocGpsDebugInterface; 887 #endif 888 889 /* 890 * Represents the status of AGPS augmented to support IPv4 and IPv6. 891 */ 892 typedef struct { 893 /** set to sizeof(LocAGpsStatus) */ 894 size_t size; 895 896 LocAGpsType type; 897 LocAGpsStatusValue status; 898 899 /** 900 * Must be set to a valid IPv4 address if the field 'addr' contains an IPv4 901 * address, or set to INADDR_NONE otherwise. 902 */ 903 uint32_t ipaddr; 904 905 /** 906 * Must contain the IPv4 (AF_INET) or IPv6 (AF_INET6) address to report. 907 * Any other value of addr.ss_family will be rejected. 908 */ 909 struct sockaddr_storage addr; 910 } LocAGpsStatus; 911 912 /** 913 * Callback with AGPS status information. Can only be called from a thread 914 * created by create_thread_cb. 915 */ 916 typedef void (* loc_agps_status_callback)(LocAGpsStatus* status); 917 918 /** Callback structure for the AGPS interface. */ 919 typedef struct { 920 loc_agps_status_callback status_cb; 921 loc_gps_create_thread create_thread_cb; 922 } LocAGpsCallbacks; 923 924 /** 925 * Extended interface for AGPS support, it is augmented to enable to pass 926 * extra APN data. 927 */ 928 typedef struct { 929 /** set to sizeof(LocAGpsInterface) */ 930 size_t size; 931 932 /** 933 * Opens the AGPS interface and provides the callback routines to the 934 * implementation of this interface. 935 */ 936 void (*init)(LocAGpsCallbacks* callbacks); 937 /** 938 * Deprecated. 939 * If the HAL supports LocAGpsInterface_v2 this API will not be used, see 940 * data_conn_open_with_apn_ip_type for more information. 941 */ 942 int (*data_conn_open)(const char* apn); 943 /** 944 * Notifies that the AGPS data connection has been closed. 945 */ 946 int (*data_conn_closed)(); 947 /** 948 * Notifies that a data connection is not available for AGPS. 949 */ 950 int (*data_conn_failed)(); 951 /** 952 * Sets the hostname and port for the AGPS server. 953 */ 954 int (*set_server)(LocAGpsType type, const char* hostname, int port); 955 956 /** 957 * Notifies that a data connection is available and sets the name of the 958 * APN, and its IP type, to be used for SUPL connections. 959 */ 960 int (*data_conn_open_with_apn_ip_type)( 961 const char* apn, 962 LocApnIpType apnIpType); 963 } LocAGpsInterface; 964 965 /** Error codes associated with certificate operations */ 966 #define LOC_AGPS_CERTIFICATE_OPERATION_SUCCESS 0 967 #define LOC_AGPS_CERTIFICATE_ERROR_GENERIC -100 968 #define LOC_AGPS_CERTIFICATE_ERROR_TOO_MANY_CERTIFICATES -101 969 970 /** A data structure that represents an X.509 certificate using DER encoding */ 971 typedef struct { 972 size_t length; 973 u_char* data; 974 } LocDerEncodedCertificate; 975 976 /** 977 * A type definition for SHA1 Fingerprints used to identify X.509 Certificates 978 * The Fingerprint is a digest of the DER Certificate that uniquely identifies it. 979 */ 980 typedef struct { 981 u_char data[20]; 982 } LocSha1CertificateFingerprint; 983 984 /** AGPS Interface to handle SUPL certificate operations */ 985 typedef struct { 986 /** set to sizeof(LocSuplCertificateInterface) */ 987 size_t size; 988 989 /** 990 * Installs a set of Certificates used for SUPL connections to the AGPS server. 991 * If needed the HAL should find out internally any certificates that need to be removed to 992 * accommodate the certificates to install. 993 * The certificates installed represent a full set of valid certificates needed to connect to 994 * AGPS SUPL servers. 995 * The list of certificates is required, and all must be available at the same time, when trying 996 * to establish a connection with the AGPS Server. 997 * 998 * Parameters: 999 * certificates - A pointer to an array of DER encoded certificates that are need to be 1000 * installed in the HAL. 1001 * length - The number of certificates to install. 1002 * Returns: 1003 * LOC_AGPS_CERTIFICATE_OPERATION_SUCCESS if the operation is completed successfully 1004 * LOC_AGPS_CERTIFICATE_ERROR_TOO_MANY_CERTIFICATES if the HAL cannot store the number of 1005 * certificates attempted to be installed, the state of the certificates stored should 1006 * remain the same as before on this error case. 1007 * 1008 * IMPORTANT: 1009 * If needed the HAL should find out internally the set of certificates that need to be 1010 * removed to accommodate the certificates to install. 1011 */ 1012 int (*install_certificates) ( const LocDerEncodedCertificate* certificates, size_t length ); 1013 1014 /** 1015 * Notifies the HAL that a list of certificates used for SUPL connections are revoked. It is 1016 * expected that the given set of certificates is removed from the internal store of the HAL. 1017 * 1018 * Parameters: 1019 * fingerprints - A pointer to an array of SHA1 Fingerprints to identify the set of 1020 * certificates to revoke. 1021 * length - The number of fingerprints provided. 1022 * Returns: 1023 * LOC_AGPS_CERTIFICATE_OPERATION_SUCCESS if the operation is completed successfully. 1024 * 1025 * IMPORTANT: 1026 * If any of the certificates provided (through its fingerprint) is not known by the HAL, 1027 * it should be ignored and continue revoking/deleting the rest of them. 1028 */ 1029 int (*revoke_certificates) ( const LocSha1CertificateFingerprint* fingerprints, size_t length ); 1030 } LocSuplCertificateInterface; 1031 1032 /** Represents an NI request */ 1033 typedef struct { 1034 /** set to sizeof(LocGpsNiNotification) */ 1035 size_t size; 1036 1037 /** 1038 * An ID generated by HAL to associate NI notifications and UI 1039 * responses 1040 */ 1041 int notification_id; 1042 1043 /** 1044 * An NI type used to distinguish different categories of NI 1045 * events, such as LOC_GPS_NI_TYPE_VOICE, LOC_GPS_NI_TYPE_UMTS_SUPL, ... 1046 */ 1047 LocGpsNiType ni_type; 1048 1049 /** 1050 * Notification/verification options, combinations of LocGpsNiNotifyFlags constants 1051 */ 1052 LocGpsNiNotifyFlags notify_flags; 1053 1054 /** 1055 * Timeout period to wait for user response. 1056 * Set to 0 for no time out limit. 1057 */ 1058 int timeout; 1059 1060 /** 1061 * Default response when time out. 1062 */ 1063 LocGpsUserResponseType default_response; 1064 1065 /** 1066 * Requestor ID 1067 */ 1068 char requestor_id[LOC_GPS_NI_SHORT_STRING_MAXLEN]; 1069 1070 /** 1071 * Notification message. It can also be used to store client_id in some cases 1072 */ 1073 char text[LOC_GPS_NI_LONG_STRING_MAXLEN]; 1074 1075 /** 1076 * Client name decoding scheme 1077 */ 1078 LocGpsNiEncodingType requestor_id_encoding; 1079 1080 /** 1081 * Client name decoding scheme 1082 */ 1083 LocGpsNiEncodingType text_encoding; 1084 1085 /** 1086 * A pointer to extra data. Format: 1087 * key_1 = value_1 1088 * key_2 = value_2 1089 */ 1090 char extras[LOC_GPS_NI_LONG_STRING_MAXLEN]; 1091 1092 } LocGpsNiNotification; 1093 1094 /** 1095 * Callback with NI notification. Can only be called from a thread created by 1096 * create_thread_cb. 1097 */ 1098 typedef void (*loc_gps_ni_notify_callback)(LocGpsNiNotification *notification); 1099 1100 /** GPS NI callback structure. */ 1101 typedef struct 1102 { 1103 /** 1104 * Sends the notification request from HAL to GPSLocationProvider. 1105 */ 1106 loc_gps_ni_notify_callback notify_cb; 1107 loc_gps_create_thread create_thread_cb; 1108 } LocGpsNiCallbacks; 1109 1110 /** 1111 * Extended interface for Network-initiated (NI) support. 1112 */ 1113 typedef struct 1114 { 1115 /** set to sizeof(LocGpsNiInterface) */ 1116 size_t size; 1117 1118 /** Registers the callbacks for HAL to use. */ 1119 void (*init) (LocGpsNiCallbacks *callbacks); 1120 1121 /** Sends a response to HAL. */ 1122 void (*respond) (int notif_id, LocGpsUserResponseType user_response); 1123 } LocGpsNiInterface; 1124 1125 #define LOC_AGPS_RIL_REQUEST_SETID_IMSI (1<<0L) 1126 #define LOC_AGPS_RIL_REQUEST_SETID_MSISDN (1<<1L) 1127 1128 #define LOC_AGPS_RIL_REQUEST_REFLOC_CELLID (1<<0L) 1129 #define LOC_AGPS_RIL_REQUEST_REFLOC_MAC (1<<1L) 1130 1131 typedef void (*loc_agps_ril_request_set_id)(uint32_t flags); 1132 typedef void (*loc_agps_ril_request_ref_loc)(uint32_t flags); 1133 1134 typedef struct { 1135 loc_agps_ril_request_set_id request_setid; 1136 loc_agps_ril_request_ref_loc request_refloc; 1137 loc_gps_create_thread create_thread_cb; 1138 } LocAGpsRilCallbacks; 1139 1140 /** Extended interface for AGPS_RIL support. */ 1141 typedef struct { 1142 /** set to sizeof(LocAGpsRilInterface) */ 1143 size_t size; 1144 /** 1145 * Opens the AGPS interface and provides the callback routines 1146 * to the implementation of this interface. 1147 */ 1148 void (*init)( LocAGpsRilCallbacks* callbacks ); 1149 1150 /** 1151 * Sets the reference location. 1152 */ 1153 void (*set_ref_location) (const LocAGpsRefLocation *agps_reflocation, size_t sz_struct); 1154 /** 1155 * Sets the set ID. 1156 */ 1157 void (*set_set_id) (LocAGpsSetIDType type, const char* setid); 1158 1159 /** 1160 * Send network initiated message. 1161 */ 1162 void (*ni_message) (uint8_t *msg, size_t len); 1163 1164 /** 1165 * Notify GPS of network status changes. 1166 * These parameters match values in the android.net.NetworkInfo class. 1167 */ 1168 void (*update_network_state) (int connected, int type, int roaming, const char* extra_info); 1169 1170 /** 1171 * Notify GPS of network status changes. 1172 * These parameters match values in the android.net.NetworkInfo class. 1173 */ 1174 void (*update_network_availability) (int avaiable, const char* apn); 1175 } LocAGpsRilInterface; 1176 1177 /** 1178 * GPS Geofence. 1179 * There are 3 states associated with a Geofence: Inside, Outside, Unknown. 1180 * There are 3 transitions: ENTERED, EXITED, UNCERTAIN. 1181 * 1182 * An example state diagram with confidence level: 95% and Unknown time limit 1183 * set as 30 secs is shown below. (confidence level and Unknown time limit are 1184 * explained latter) 1185 * ____________________________ 1186 * | Unknown (30 secs) | 1187 * """""""""""""""""""""""""""" 1188 * ^ | | ^ 1189 * UNCERTAIN| |ENTERED EXITED| |UNCERTAIN 1190 * | v v | 1191 * ________ EXITED _________ 1192 * | Inside | -----------> | Outside | 1193 * | | <----------- | | 1194 * """""""" ENTERED """"""""" 1195 * 1196 * Inside state: We are 95% confident that the user is inside the geofence. 1197 * Outside state: We are 95% confident that the user is outside the geofence 1198 * Unknown state: Rest of the time. 1199 * 1200 * The Unknown state is better explained with an example: 1201 * 1202 * __________ 1203 * | c| 1204 * | ___ | _______ 1205 * | |a| | | b | 1206 * | """ | """"""" 1207 * | | 1208 * """""""""" 1209 * In the diagram above, "a" and "b" are 2 geofences and "c" is the accuracy 1210 * circle reported by the GPS subsystem. Now with regard to "b", the system is 1211 * confident that the user is outside. But with regard to "a" is not confident 1212 * whether it is inside or outside the geofence. If the accuracy remains the 1213 * same for a sufficient period of time, the UNCERTAIN transition would be 1214 * triggered with the state set to Unknown. If the accuracy improves later, an 1215 * appropriate transition should be triggered. This "sufficient period of time" 1216 * is defined by the parameter in the add_geofence_area API. 1217 * In other words, Unknown state can be interpreted as a state in which the 1218 * GPS subsystem isn't confident enough that the user is either inside or 1219 * outside the Geofence. It moves to Unknown state only after the expiry of the 1220 * timeout. 1221 * 1222 * The geofence callback needs to be triggered for the ENTERED and EXITED 1223 * transitions, when the GPS system is confident that the user has entered 1224 * (Inside state) or exited (Outside state) the Geofence. An implementation 1225 * which uses a value of 95% as the confidence is recommended. The callback 1226 * should be triggered only for the transitions requested by the 1227 * add_geofence_area call. 1228 * 1229 * Even though the diagram and explanation talks about states and transitions, 1230 * the callee is only interested in the transistions. The states are mentioned 1231 * here for illustrative purposes. 1232 * 1233 * Startup Scenario: When the device boots up, if an application adds geofences, 1234 * and then we get an accurate GPS location fix, it needs to trigger the 1235 * appropriate (ENTERED or EXITED) transition for every Geofence it knows about. 1236 * By default, all the Geofences will be in the Unknown state. 1237 * 1238 * When the GPS system is unavailable, loc_gps_geofence_status_callback should be 1239 * called to inform the upper layers of the same. Similarly, when it becomes 1240 * available the callback should be called. This is a global state while the 1241 * UNKNOWN transition described above is per geofence. 1242 * 1243 * An important aspect to note is that users of this API (framework), will use 1244 * other subsystems like wifi, sensors, cell to handle Unknown case and 1245 * hopefully provide a definitive state transition to the third party 1246 * application. GPS Geofence will just be a signal indicating what the GPS 1247 * subsystem knows about the Geofence. 1248 * 1249 */ 1250 #define LOC_GPS_GEOFENCE_ENTERED (1<<0L) 1251 #define LOC_GPS_GEOFENCE_EXITED (1<<1L) 1252 #define LOC_GPS_GEOFENCE_UNCERTAIN (1<<2L) 1253 1254 #define LOC_GPS_GEOFENCE_UNAVAILABLE (1<<0L) 1255 #define LOC_GPS_GEOFENCE_AVAILABLE (1<<1L) 1256 1257 #define LOC_GPS_GEOFENCE_OPERATION_SUCCESS 0 1258 #define LOC_GPS_GEOFENCE_ERROR_TOO_MANY_GEOFENCES -100 1259 #define LOC_GPS_GEOFENCE_ERROR_ID_EXISTS -101 1260 #define LOC_GPS_GEOFENCE_ERROR_ID_UNKNOWN -102 1261 #define LOC_GPS_GEOFENCE_ERROR_INVALID_TRANSITION -103 1262 #define LOC_GPS_GEOFENCE_ERROR_GENERIC -149 1263 1264 /** 1265 * The callback associated with the geofence. 1266 * Parameters: 1267 * geofence_id - The id associated with the add_geofence_area. 1268 * location - The current GPS location. 1269 * transition - Can be one of LOC_GPS_GEOFENCE_ENTERED, LOC_GPS_GEOFENCE_EXITED, 1270 * LOC_GPS_GEOFENCE_UNCERTAIN. 1271 * timestamp - Timestamp when the transition was detected. 1272 * 1273 * The callback should only be called when the caller is interested in that 1274 * particular transition. For instance, if the caller is interested only in 1275 * ENTERED transition, then the callback should NOT be called with the EXITED 1276 * transition. 1277 * 1278 * IMPORTANT: If a transition is triggered resulting in this callback, the GPS 1279 * subsystem will wake up the application processor, if its in suspend state. 1280 */ 1281 typedef void (*loc_gps_geofence_transition_callback) (int32_t geofence_id, LocGpsLocation* location, 1282 int32_t transition, LocGpsUtcTime timestamp); 1283 1284 /** 1285 * The callback associated with the availability of the GPS system for geofencing 1286 * monitoring. If the GPS system determines that it cannot monitor geofences 1287 * because of lack of reliability or unavailability of the GPS signals, it will 1288 * call this callback with LOC_GPS_GEOFENCE_UNAVAILABLE parameter. 1289 * 1290 * Parameters: 1291 * status - LOC_GPS_GEOFENCE_UNAVAILABLE or LOC_GPS_GEOFENCE_AVAILABLE. 1292 * last_location - Last known location. 1293 */ 1294 typedef void (*loc_gps_geofence_status_callback) (int32_t status, LocGpsLocation* last_location); 1295 1296 /** 1297 * The callback associated with the add_geofence call. 1298 * 1299 * Parameter: 1300 * geofence_id - Id of the geofence. 1301 * status - LOC_GPS_GEOFENCE_OPERATION_SUCCESS 1302 * LOC_GPS_GEOFENCE_ERROR_TOO_MANY_GEOFENCES - geofence limit has been reached. 1303 * LOC_GPS_GEOFENCE_ERROR_ID_EXISTS - geofence with id already exists 1304 * LOC_GPS_GEOFENCE_ERROR_INVALID_TRANSITION - the monitorTransition contains an 1305 * invalid transition 1306 * LOC_GPS_GEOFENCE_ERROR_GENERIC - for other errors. 1307 */ 1308 typedef void (*loc_gps_geofence_add_callback) (int32_t geofence_id, int32_t status); 1309 1310 /** 1311 * The callback associated with the remove_geofence call. 1312 * 1313 * Parameter: 1314 * geofence_id - Id of the geofence. 1315 * status - LOC_GPS_GEOFENCE_OPERATION_SUCCESS 1316 * LOC_GPS_GEOFENCE_ERROR_ID_UNKNOWN - for invalid id 1317 * LOC_GPS_GEOFENCE_ERROR_GENERIC for others. 1318 */ 1319 typedef void (*loc_gps_geofence_remove_callback) (int32_t geofence_id, int32_t status); 1320 1321 1322 /** 1323 * The callback associated with the pause_geofence call. 1324 * 1325 * Parameter: 1326 * geofence_id - Id of the geofence. 1327 * status - LOC_GPS_GEOFENCE_OPERATION_SUCCESS 1328 * LOC_GPS_GEOFENCE_ERROR_ID_UNKNOWN - for invalid id 1329 * LOC_GPS_GEOFENCE_ERROR_INVALID_TRANSITION - 1330 * when monitor_transitions is invalid 1331 * LOC_GPS_GEOFENCE_ERROR_GENERIC for others. 1332 */ 1333 typedef void (*loc_gps_geofence_pause_callback) (int32_t geofence_id, int32_t status); 1334 1335 /** 1336 * The callback associated with the resume_geofence call. 1337 * 1338 * Parameter: 1339 * geofence_id - Id of the geofence. 1340 * status - LOC_GPS_GEOFENCE_OPERATION_SUCCESS 1341 * LOC_GPS_GEOFENCE_ERROR_ID_UNKNOWN - for invalid id 1342 * LOC_GPS_GEOFENCE_ERROR_GENERIC for others. 1343 */ 1344 typedef void (*loc_gps_geofence_resume_callback) (int32_t geofence_id, int32_t status); 1345 1346 typedef struct { 1347 loc_gps_geofence_transition_callback geofence_transition_callback; 1348 loc_gps_geofence_status_callback geofence_status_callback; 1349 loc_gps_geofence_add_callback geofence_add_callback; 1350 loc_gps_geofence_remove_callback geofence_remove_callback; 1351 loc_gps_geofence_pause_callback geofence_pause_callback; 1352 loc_gps_geofence_resume_callback geofence_resume_callback; 1353 loc_gps_create_thread create_thread_cb; 1354 } LocGpsGeofenceCallbacks; 1355 1356 /** Extended interface for GPS_Geofencing support */ 1357 typedef struct { 1358 /** set to sizeof(LocGpsGeofencingInterface) */ 1359 size_t size; 1360 1361 /** 1362 * Opens the geofence interface and provides the callback routines 1363 * to the implementation of this interface. 1364 */ 1365 void (*init)( LocGpsGeofenceCallbacks* callbacks ); 1366 1367 /** 1368 * Add a geofence area. This api currently supports circular geofences. 1369 * Parameters: 1370 * geofence_id - The id for the geofence. If a geofence with this id 1371 * already exists, an error value (LOC_GPS_GEOFENCE_ERROR_ID_EXISTS) 1372 * should be returned. 1373 * latitude, longtitude, radius_meters - The lat, long and radius 1374 * (in meters) for the geofence 1375 * last_transition - The current state of the geofence. For example, if 1376 * the system already knows that the user is inside the geofence, 1377 * this will be set to LOC_GPS_GEOFENCE_ENTERED. In most cases, it 1378 * will be LOC_GPS_GEOFENCE_UNCERTAIN. 1379 * monitor_transition - Which transitions to monitor. Bitwise OR of 1380 * LOC_GPS_GEOFENCE_ENTERED, LOC_GPS_GEOFENCE_EXITED and 1381 * LOC_GPS_GEOFENCE_UNCERTAIN. 1382 * notification_responsiveness_ms - Defines the best-effort description 1383 * of how soon should the callback be called when the transition 1384 * associated with the Geofence is triggered. For instance, if set 1385 * to 1000 millseconds with LOC_GPS_GEOFENCE_ENTERED, the callback 1386 * should be called 1000 milliseconds within entering the geofence. 1387 * This parameter is defined in milliseconds. 1388 * NOTE: This is not to be confused with the rate that the GPS is 1389 * polled at. It is acceptable to dynamically vary the rate of 1390 * sampling the GPS for power-saving reasons; thus the rate of 1391 * sampling may be faster or slower than this. 1392 * unknown_timer_ms - The time limit after which the UNCERTAIN transition 1393 * should be triggered. This parameter is defined in milliseconds. 1394 * See above for a detailed explanation. 1395 */ 1396 void (*add_geofence_area) (int32_t geofence_id, double latitude, double longitude, 1397 double radius_meters, int last_transition, int monitor_transitions, 1398 int notification_responsiveness_ms, int unknown_timer_ms); 1399 1400 /** 1401 * Pause monitoring a particular geofence. 1402 * Parameters: 1403 * geofence_id - The id for the geofence. 1404 */ 1405 void (*pause_geofence) (int32_t geofence_id); 1406 1407 /** 1408 * Resume monitoring a particular geofence. 1409 * Parameters: 1410 * geofence_id - The id for the geofence. 1411 * monitor_transitions - Which transitions to monitor. Bitwise OR of 1412 * LOC_GPS_GEOFENCE_ENTERED, LOC_GPS_GEOFENCE_EXITED and 1413 * LOC_GPS_GEOFENCE_UNCERTAIN. 1414 * This supersedes the value associated provided in the 1415 * add_geofence_area call. 1416 */ 1417 void (*resume_geofence) (int32_t geofence_id, int monitor_transitions); 1418 1419 /** 1420 * Remove a geofence area. After the function returns, no notifications 1421 * should be sent. 1422 * Parameter: 1423 * geofence_id - The id for the geofence. 1424 */ 1425 void (*remove_geofence_area) (int32_t geofence_id); 1426 } LocGpsGeofencingInterface; 1427 1428 /** 1429 * Legacy struct to represent an estimate of the GPS clock time. 1430 * Deprecated, to be removed in the next Android release. 1431 * Use LocGnssClock instead. 1432 */ 1433 typedef struct { 1434 /** set to sizeof(LocGpsClock) */ 1435 size_t size; 1436 LocGpsClockFlags flags; 1437 int16_t leap_second; 1438 LocGpsClockType type; 1439 int64_t time_ns; 1440 double time_uncertainty_ns; 1441 int64_t full_bias_ns; 1442 double bias_ns; 1443 double bias_uncertainty_ns; 1444 double drift_nsps; 1445 double drift_uncertainty_nsps; 1446 } LocGpsClock; 1447 1448 /** 1449 * Represents an estimate of the GPS clock time. 1450 */ 1451 typedef struct { 1452 /** set to sizeof(LocGnssClock) */ 1453 size_t size; 1454 1455 /** 1456 * A set of flags indicating the validity of the fields in this data 1457 * structure. 1458 */ 1459 LocGnssClockFlags flags; 1460 1461 /** 1462 * Leap second data. 1463 * The sign of the value is defined by the following equation: 1464 * utc_time_ns = time_ns - (full_bias_ns + bias_ns) - leap_second * 1465 * 1,000,000,000 1466 * 1467 * If the data is available 'flags' must contain LOC_GNSS_CLOCK_HAS_LEAP_SECOND. 1468 */ 1469 int16_t leap_second; 1470 1471 /** 1472 * The GNSS receiver internal clock value. This is the local hardware clock 1473 * value. 1474 * 1475 * For local hardware clock, this value is expected to be monotonically 1476 * increasing while the hardware clock remains power on. (For the case of a 1477 * HW clock that is not continuously on, see the 1478 * hw_clock_discontinuity_count field). The receiver's estimate of GPS time 1479 * can be derived by substracting the sum of full_bias_ns and bias_ns (when 1480 * available) from this value. 1481 * 1482 * This GPS time is expected to be the best estimate of current GPS time 1483 * that GNSS receiver can achieve. 1484 * 1485 * Sub-nanosecond accuracy can be provided by means of the 'bias_ns' field. 1486 * The value contains the 'time uncertainty' in it. 1487 * 1488 * This field is mandatory. 1489 */ 1490 int64_t time_ns; 1491 1492 /** 1493 * 1-Sigma uncertainty associated with the clock's time in nanoseconds. 1494 * The uncertainty is represented as an absolute (single sided) value. 1495 * 1496 * If the data is available, 'flags' must contain 1497 * LOC_GNSS_CLOCK_HAS_TIME_UNCERTAINTY. This value is effectively zero (it is 1498 * the reference local clock, by which all other times and time 1499 * uncertainties are measured.) (And thus this field can be not provided, 1500 * per LOC_GNSS_CLOCK_HAS_TIME_UNCERTAINTY flag, or provided & set to 0.) 1501 */ 1502 double time_uncertainty_ns; 1503 1504 /** 1505 * The difference between hardware clock ('time' field) inside GPS receiver 1506 * and the true GPS time since 0000Z, January 6, 1980, in nanoseconds. 1507 * 1508 * The sign of the value is defined by the following equation: 1509 * local estimate of GPS time = time_ns - (full_bias_ns + bias_ns) 1510 * 1511 * This value is mandatory if the receiver has estimated GPS time. If the 1512 * computed time is for a non-GPS constellation, the time offset of that 1513 * constellation to GPS has to be applied to fill this value. The error 1514 * estimate for the sum of this and the bias_ns is the bias_uncertainty_ns, 1515 * and the caller is responsible for using this uncertainty (it can be very 1516 * large before the GPS time has been solved for.) If the data is available 1517 * 'flags' must contain LOC_GNSS_CLOCK_HAS_FULL_BIAS. 1518 */ 1519 int64_t full_bias_ns; 1520 1521 /** 1522 * Sub-nanosecond bias. 1523 * The error estimate for the sum of this and the full_bias_ns is the 1524 * bias_uncertainty_ns 1525 * 1526 * If the data is available 'flags' must contain LOC_GNSS_CLOCK_HAS_BIAS. If GPS 1527 * has computed a position fix. This value is mandatory if the receiver has 1528 * estimated GPS time. 1529 */ 1530 double bias_ns; 1531 1532 /** 1533 * 1-Sigma uncertainty associated with the local estimate of GPS time (clock 1534 * bias) in nanoseconds. The uncertainty is represented as an absolute 1535 * (single sided) value. 1536 * 1537 * If the data is available 'flags' must contain 1538 * LOC_GNSS_CLOCK_HAS_BIAS_UNCERTAINTY. This value is mandatory if the receiver 1539 * has estimated GPS time. 1540 */ 1541 double bias_uncertainty_ns; 1542 1543 /** 1544 * The clock's drift in nanoseconds (per second). 1545 * 1546 * A positive value means that the frequency is higher than the nominal 1547 * frequency, and that the (full_bias_ns + bias_ns) is growing more positive 1548 * over time. 1549 * 1550 * The value contains the 'drift uncertainty' in it. 1551 * If the data is available 'flags' must contain LOC_GNSS_CLOCK_HAS_DRIFT. 1552 * 1553 * This value is mandatory if the receiver has estimated GNSS time 1554 */ 1555 double drift_nsps; 1556 1557 /** 1558 * 1-Sigma uncertainty associated with the clock's drift in nanoseconds (per second). 1559 * The uncertainty is represented as an absolute (single sided) value. 1560 * 1561 * If the data is available 'flags' must contain 1562 * LOC_GNSS_CLOCK_HAS_DRIFT_UNCERTAINTY. If GPS has computed a position fix this 1563 * field is mandatory and must be populated. 1564 */ 1565 double drift_uncertainty_nsps; 1566 1567 /** 1568 * When there are any discontinuities in the HW clock, this field is 1569 * mandatory. 1570 * 1571 * A "discontinuity" is meant to cover the case of a switch from one source 1572 * of clock to another. A single free-running crystal oscillator (XO) 1573 * should generally not have any discontinuities, and this can be set and 1574 * left at 0. 1575 * 1576 * If, however, the time_ns value (HW clock) is derived from a composite of 1577 * sources, that is not as smooth as a typical XO, or is otherwise stopped & 1578 * restarted, then this value shall be incremented each time a discontinuity 1579 * occurs. (E.g. this value may start at zero at device boot-up and 1580 * increment each time there is a change in clock continuity. In the 1581 * unlikely event that this value reaches full scale, rollover (not 1582 * clamping) is required, such that this value continues to change, during 1583 * subsequent discontinuity events.) 1584 * 1585 * While this number stays the same, between LocGnssClock reports, it can be 1586 * safely assumed that the time_ns value has been running continuously, e.g. 1587 * derived from a single, high quality clock (XO like, or better, that's 1588 * typically used during continuous GNSS signal sampling.) 1589 * 1590 * It is expected, esp. during periods where there are few GNSS signals 1591 * available, that the HW clock be discontinuity-free as long as possible, 1592 * as this avoids the need to use (waste) a GNSS measurement to fully 1593 * re-solve for the GPS clock bias and drift, when using the accompanying 1594 * measurements, from consecutive LocGnssData reports. 1595 */ 1596 uint32_t hw_clock_discontinuity_count; 1597 1598 } LocGnssClock; 1599 1600 /** 1601 * Legacy struct to represent a GPS Measurement, it contains raw and computed 1602 * information. 1603 * Deprecated, to be removed in the next Android release. 1604 * Use LocGnssMeasurement instead. 1605 */ 1606 typedef struct { 1607 /** set to sizeof(LocGpsMeasurement) */ 1608 size_t size; 1609 LocGpsMeasurementFlags flags; 1610 int8_t prn; 1611 double time_offset_ns; 1612 LocGpsMeasurementState state; 1613 int64_t received_gps_tow_ns; 1614 int64_t received_gps_tow_uncertainty_ns; 1615 double c_n0_dbhz; 1616 double pseudorange_rate_mps; 1617 double pseudorange_rate_uncertainty_mps; 1618 LocGpsAccumulatedDeltaRangeState accumulated_delta_range_state; 1619 double accumulated_delta_range_m; 1620 double accumulated_delta_range_uncertainty_m; 1621 double pseudorange_m; 1622 double pseudorange_uncertainty_m; 1623 double code_phase_chips; 1624 double code_phase_uncertainty_chips; 1625 float carrier_frequency_hz; 1626 int64_t carrier_cycles; 1627 double carrier_phase; 1628 double carrier_phase_uncertainty; 1629 LocGpsLossOfLock loss_of_lock; 1630 int32_t bit_number; 1631 int16_t time_from_last_bit_ms; 1632 double doppler_shift_hz; 1633 double doppler_shift_uncertainty_hz; 1634 LocGpsMultipathIndicator multipath_indicator; 1635 double snr_db; 1636 double elevation_deg; 1637 double elevation_uncertainty_deg; 1638 double azimuth_deg; 1639 double azimuth_uncertainty_deg; 1640 bool used_in_fix; 1641 } LocGpsMeasurement; 1642 1643 /** 1644 * Represents a GNSS Measurement, it contains raw and computed information. 1645 * 1646 * Independence - All signal measurement information (e.g. sv_time, 1647 * pseudorange_rate, multipath_indicator) reported in this struct should be 1648 * based on GNSS signal measurements only. You may not synthesize measurements 1649 * by calculating or reporting expected measurements based on known or estimated 1650 * position, velocity, or time. 1651 */ 1652 typedef struct { 1653 /** set to sizeof(LocGnssMeasurement) */ 1654 size_t size; 1655 1656 /** A set of flags indicating the validity of the fields in this data structure. */ 1657 LocGnssMeasurementFlags flags; 1658 1659 /** 1660 * Satellite vehicle ID number, as defined in LocGnssSvInfo::svid 1661 * This is a mandatory value. 1662 */ 1663 int16_t svid; 1664 1665 /** 1666 * Defines the constellation of the given SV. Value should be one of those 1667 * LOC_GNSS_CONSTELLATION_* constants 1668 */ 1669 LocGnssConstellationType constellation; 1670 1671 /** 1672 * Time offset at which the measurement was taken in nanoseconds. 1673 * The reference receiver's time is specified by LocGpsData::clock::time_ns and should be 1674 * interpreted in the same way as indicated by LocGpsClock::type. 1675 * 1676 * The sign of time_offset_ns is given by the following equation: 1677 * measurement time = LocGpsClock::time_ns + time_offset_ns 1678 * 1679 * It provides an individual time-stamp for the measurement, and allows sub-nanosecond accuracy. 1680 * This is a mandatory value. 1681 */ 1682 double time_offset_ns; 1683 1684 /** 1685 * Per satellite sync state. It represents the current sync state for the associated satellite. 1686 * Based on the sync state, the 'received GPS tow' field should be interpreted accordingly. 1687 * 1688 * This is a mandatory value. 1689 */ 1690 LocGnssMeasurementState state; 1691 1692 /** 1693 * The received GNSS Time-of-Week at the measurement time, in nanoseconds. 1694 * Ensure that this field is independent (see comment at top of 1695 * LocGnssMeasurement struct.) 1696 * 1697 * For GPS & QZSS, this is: 1698 * Received GPS Time-of-Week at the measurement time, in nanoseconds. 1699 * The value is relative to the beginning of the current GPS week. 1700 * 1701 * Given the highest sync state that can be achieved, per each satellite, valid range 1702 * for this field can be: 1703 * Searching : [ 0 ] : LOC_GNSS_MEASUREMENT_STATE_UNKNOWN 1704 * C/A code lock : [ 0 1ms ] : LOC_GNSS_MEASUREMENT_STATE_CODE_LOCK is set 1705 * Bit sync : [ 0 20ms ] : LOC_GNSS_MEASUREMENT_STATE_BIT_SYNC is set 1706 * Subframe sync : [ 0 6s ] : LOC_GNSS_MEASUREMENT_STATE_SUBFRAME_SYNC is set 1707 * TOW decoded : [ 0 1week ] : LOC_GNSS_MEASUREMENT_STATE_TOW_DECODED is set 1708 * 1709 * Note well: if there is any ambiguity in integer millisecond, 1710 * LOC_GNSS_MEASUREMENT_STATE_MSEC_AMBIGUOUS should be set accordingly, in the 'state' field. 1711 * 1712 * This value must be populated if 'state' != LOC_GNSS_MEASUREMENT_STATE_UNKNOWN. 1713 * 1714 * For Glonass, this is: 1715 * Received Glonass time of day, at the measurement time in nanoseconds. 1716 * 1717 * Given the highest sync state that can be achieved, per each satellite, valid range for 1718 * this field can be: 1719 * Searching : [ 0 ] : LOC_GNSS_MEASUREMENT_STATE_UNKNOWN 1720 * C/A code lock : [ 0 1ms ] : LOC_GNSS_MEASUREMENT_STATE_CODE_LOCK is set 1721 * Symbol sync : [ 0 10ms ] : LOC_GNSS_MEASUREMENT_STATE_SYMBOL_SYNC is set 1722 * Bit sync : [ 0 20ms ] : LOC_GNSS_MEASUREMENT_STATE_BIT_SYNC is set 1723 * String sync : [ 0 2s ] : LOC_GNSS_MEASUREMENT_STATE_GLO_STRING_SYNC is set 1724 * Time of day : [ 0 1day ] : LOC_GNSS_MEASUREMENT_STATE_GLO_TOD_DECODED is set 1725 * 1726 * For Beidou, this is: 1727 * Received Beidou time of week, at the measurement time in nanoseconds. 1728 * 1729 * Given the highest sync state that can be achieved, per each satellite, valid range for 1730 * this field can be: 1731 * Searching : [ 0 ] : LOC_GNSS_MEASUREMENT_STATE_UNKNOWN 1732 * C/A code lock: [ 0 1ms ] : LOC_GNSS_MEASUREMENT_STATE_CODE_LOCK is set 1733 * Bit sync (D2): [ 0 2ms ] : LOC_GNSS_MEASUREMENT_STATE_BDS_D2_BIT_SYNC is set 1734 * Bit sync (D1): [ 0 20ms ] : LOC_GNSS_MEASUREMENT_STATE_BIT_SYNC is set 1735 * Subframe (D2): [ 0 0.6s ] : LOC_GNSS_MEASUREMENT_STATE_BDS_D2_SUBFRAME_SYNC is set 1736 * Subframe (D1): [ 0 6s ] : LOC_GNSS_MEASUREMENT_STATE_SUBFRAME_SYNC is set 1737 * Time of week : [ 0 1week ] : LOC_GNSS_MEASUREMENT_STATE_TOW_DECODED is set 1738 * 1739 * For Galileo, this is: 1740 * Received Galileo time of week, at the measurement time in nanoseconds. 1741 * 1742 * E1BC code lock : [ 0 4ms ] : LOC_GNSS_MEASUREMENT_STATE_GAL_E1BC_CODE_LOCK is set 1743 * E1C 2nd code lock: [ 0 100ms ] : 1744 * LOC_GNSS_MEASUREMENT_STATE_GAL_E1C_2ND_CODE_LOCK is set 1745 * 1746 * E1B page : [ 0 2s ] : LOC_GNSS_MEASUREMENT_STATE_GAL_E1B_PAGE_SYNC is set 1747 * Time of week: [ 0 1week ] : LOC_GNSS_MEASUREMENT_STATE_TOW_DECODED is set 1748 * 1749 * For SBAS, this is: 1750 * Received SBAS time, at the measurement time in nanoseconds. 1751 * 1752 * Given the highest sync state that can be achieved, per each satellite, 1753 * valid range for this field can be: 1754 * Searching : [ 0 ] : LOC_GNSS_MEASUREMENT_STATE_UNKNOWN 1755 * C/A code lock: [ 0 1ms ] : LOC_GNSS_MEASUREMENT_STATE_CODE_LOCK is set 1756 * Symbol sync : [ 0 2ms ] : LOC_GNSS_MEASUREMENT_STATE_SYMBOL_SYNC is set 1757 * Message : [ 0 1s ] : LOC_GNSS_MEASUREMENT_STATE_SBAS_SYNC is set 1758 */ 1759 int64_t received_sv_time_in_ns; 1760 1761 /** 1762 * 1-Sigma uncertainty of the Received GPS Time-of-Week in nanoseconds. 1763 * 1764 * This value must be populated if 'state' != LOC_GPS_MEASUREMENT_STATE_UNKNOWN. 1765 */ 1766 int64_t received_sv_time_uncertainty_in_ns; 1767 1768 /** 1769 * Carrier-to-noise density in dB-Hz, typically in the range [0, 63]. 1770 * It contains the measured C/N0 value for the signal at the antenna port. 1771 * 1772 * This is a mandatory value. 1773 */ 1774 double c_n0_dbhz; 1775 1776 /** 1777 * Pseudorange rate at the timestamp in m/s. The correction of a given 1778 * Pseudorange Rate value includes corrections for receiver and satellite 1779 * clock frequency errors. Ensure that this field is independent (see 1780 * comment at top of LocGnssMeasurement struct.) 1781 * 1782 * It is mandatory to provide the 'uncorrected' 'pseudorange rate', and provide LocGpsClock's 1783 * 'drift' field as well (When providing the uncorrected pseudorange rate, do not apply the 1784 * corrections described above.) 1785 * 1786 * The value includes the 'pseudorange rate uncertainty' in it. 1787 * A positive 'uncorrected' value indicates that the SV is moving away from the receiver. 1788 * 1789 * The sign of the 'uncorrected' 'pseudorange rate' and its relation to the sign of 'doppler 1790 * shift' is given by the equation: 1791 * pseudorange rate = -k * doppler shift (where k is a constant) 1792 * 1793 * This should be the most accurate pseudorange rate available, based on 1794 * fresh signal measurements from this channel. 1795 * 1796 * It is mandatory that this value be provided at typical carrier phase PRR 1797 * quality (few cm/sec per second of uncertainty, or better) - when signals 1798 * are sufficiently strong & stable, e.g. signals from a GPS simulator at >= 1799 * 35 dB-Hz. 1800 */ 1801 double pseudorange_rate_mps; 1802 1803 /** 1804 * 1-Sigma uncertainty of the pseudorange_rate_mps. 1805 * The uncertainty is represented as an absolute (single sided) value. 1806 * 1807 * This is a mandatory value. 1808 */ 1809 double pseudorange_rate_uncertainty_mps; 1810 1811 /** 1812 * Accumulated delta range's state. It indicates whether ADR is reset or there is a cycle slip 1813 * (indicating loss of lock). 1814 * 1815 * This is a mandatory value. 1816 */ 1817 LocGnssAccumulatedDeltaRangeState accumulated_delta_range_state; 1818 1819 /** 1820 * Accumulated delta range since the last channel reset in meters. 1821 * A positive value indicates that the SV is moving away from the receiver. 1822 * 1823 * The sign of the 'accumulated delta range' and its relation to the sign of 'carrier phase' 1824 * is given by the equation: 1825 * accumulated delta range = -k * carrier phase (where k is a constant) 1826 * 1827 * This value must be populated if 'accumulated delta range state' != LOC_GPS_ADR_STATE_UNKNOWN. 1828 * However, it is expected that the data is only accurate when: 1829 * 'accumulated delta range state' == LOC_GPS_ADR_STATE_VALID. 1830 */ 1831 double accumulated_delta_range_m; 1832 1833 /** 1834 * 1-Sigma uncertainty of the accumulated delta range in meters. 1835 * This value must be populated if 'accumulated delta range state' != LOC_GPS_ADR_STATE_UNKNOWN. 1836 */ 1837 double accumulated_delta_range_uncertainty_m; 1838 1839 /** 1840 * Carrier frequency at which codes and messages are modulated, it can be L1 or L2. 1841 * If the field is not set, the carrier frequency is assumed to be L1. 1842 * 1843 * If the data is available, 'flags' must contain 1844 * LOC_GNSS_MEASUREMENT_HAS_CARRIER_FREQUENCY. 1845 */ 1846 float carrier_frequency_hz; 1847 1848 /** 1849 * The number of full carrier cycles between the satellite and the receiver. 1850 * The reference frequency is given by the field 'carrier_frequency_hz'. 1851 * Indications of possible cycle slips and resets in the accumulation of 1852 * this value can be inferred from the accumulated_delta_range_state flags. 1853 * 1854 * If the data is available, 'flags' must contain 1855 * LOC_GNSS_MEASUREMENT_HAS_CARRIER_CYCLES. 1856 */ 1857 int64_t carrier_cycles; 1858 1859 /** 1860 * The RF phase detected by the receiver, in the range [0.0, 1.0]. 1861 * This is usually the fractional part of the complete carrier phase measurement. 1862 * 1863 * The reference frequency is given by the field 'carrier_frequency_hz'. 1864 * The value contains the 'carrier-phase uncertainty' in it. 1865 * 1866 * If the data is available, 'flags' must contain 1867 * LOC_GNSS_MEASUREMENT_HAS_CARRIER_PHASE. 1868 */ 1869 double carrier_phase; 1870 1871 /** 1872 * 1-Sigma uncertainty of the carrier-phase. 1873 * If the data is available, 'flags' must contain 1874 * LOC_GNSS_MEASUREMENT_HAS_CARRIER_PHASE_UNCERTAINTY. 1875 */ 1876 double carrier_phase_uncertainty; 1877 1878 /** 1879 * An enumeration that indicates the 'multipath' state of the event. 1880 * 1881 * The multipath Indicator is intended to report the presence of overlapping 1882 * signals that manifest as distorted correlation peaks. 1883 * 1884 * - if there is a distorted correlation peak shape, report that multipath 1885 * is LOC_GNSS_MULTIPATH_INDICATOR_PRESENT. 1886 * - if there is not a distorted correlation peak shape, report 1887 * LOC_GNSS_MULTIPATH_INDICATOR_NOT_PRESENT 1888 * - if signals are too weak to discern this information, report 1889 * LOC_GNSS_MULTIPATH_INDICATOR_UNKNOWN 1890 * 1891 * Example: when doing the standardized overlapping Multipath Performance 1892 * test (3GPP TS 34.171) the Multipath indicator should report 1893 * LOC_GNSS_MULTIPATH_INDICATOR_PRESENT for those signals that are tracked, and 1894 * contain multipath, and LOC_GNSS_MULTIPATH_INDICATOR_NOT_PRESENT for those 1895 * signals that are tracked and do not contain multipath. 1896 */ 1897 LocGnssMultipathIndicator multipath_indicator; 1898 1899 /** 1900 * Signal-to-noise ratio at correlator output in dB. 1901 * If the data is available, 'flags' must contain LOC_GNSS_MEASUREMENT_HAS_SNR. 1902 * This is the power ratio of the "correlation peak height above the 1903 * observed noise floor" to "the noise RMS". 1904 */ 1905 double snr_db; 1906 } LocGnssMeasurement; 1907 1908 /** 1909 * Legacy struct to represents a reading of GPS measurements. 1910 * Deprecated, to be removed in the next Android release. 1911 * Use LocGnssData instead. 1912 */ 1913 typedef struct { 1914 /** set to sizeof(LocGpsData) */ 1915 size_t size; 1916 size_t measurement_count; 1917 LocGpsMeasurement measurements[LOC_GPS_MAX_MEASUREMENT]; 1918 1919 /** The GPS clock time reading. */ 1920 LocGpsClock clock; 1921 } LocGpsData; 1922 1923 /** 1924 * Represents a reading of GNSS measurements. For devices where LocGnssSystemInfo's 1925 * year_of_hw is set to 2016+, it is mandatory that these be provided, on 1926 * request, when the GNSS receiver is searching/tracking signals. 1927 * 1928 * - Reporting of GPS constellation measurements is mandatory. 1929 * - Reporting of all tracked constellations are encouraged. 1930 */ 1931 typedef struct { 1932 /** set to sizeof(LocGnssData) */ 1933 size_t size; 1934 1935 /** Number of measurements. */ 1936 size_t measurement_count; 1937 1938 /** The array of measurements. */ 1939 LocGnssMeasurement measurements[LOC_GNSS_MAX_MEASUREMENT]; 1940 1941 /** The GPS clock time reading. */ 1942 LocGnssClock clock; 1943 } LocGnssData; 1944 1945 /** 1946 * The legacy callback for to report measurements from the HAL. 1947 * 1948 * This callback is deprecated, and will be removed in the next release. Use 1949 * loc_gnss_measurement_callback() instead. 1950 * 1951 * Parameters: 1952 * data - A data structure containing the measurements. 1953 */ 1954 typedef void (*loc_gps_measurement_callback) (LocGpsData* data); 1955 1956 /** 1957 * The callback for to report measurements from the HAL. 1958 * 1959 * Parameters: 1960 * data - A data structure containing the measurements. 1961 */ 1962 typedef void (*loc_gnss_measurement_callback) (LocGnssData* data); 1963 1964 typedef struct { 1965 /** set to sizeof(LocGpsMeasurementCallbacks) */ 1966 size_t size; 1967 loc_gps_measurement_callback measurement_callback; 1968 loc_gnss_measurement_callback loc_gnss_measurement_callback; 1969 } LocGpsMeasurementCallbacks; 1970 1971 #define LOC_GPS_MEASUREMENT_OPERATION_SUCCESS 0 1972 #define LOC_GPS_MEASUREMENT_ERROR_ALREADY_INIT -100 1973 #define LOC_GPS_MEASUREMENT_ERROR_GENERIC -101 1974 1975 /** 1976 * Extended interface for GPS Measurements support. 1977 */ 1978 typedef struct { 1979 /** Set to sizeof(LocGpsMeasurementInterface) */ 1980 size_t size; 1981 1982 /** 1983 * Initializes the interface and registers the callback routines with the HAL. 1984 * After a successful call to 'init' the HAL must begin to provide updates at its own phase. 1985 * 1986 * Status: 1987 * LOC_GPS_MEASUREMENT_OPERATION_SUCCESS 1988 * LOC_GPS_MEASUREMENT_ERROR_ALREADY_INIT - if a callback has already been registered without a 1989 * corresponding call to 'close' 1990 * LOC_GPS_MEASUREMENT_ERROR_GENERIC - if any other error occurred, it is expected that the HAL 1991 * will not generate any updates upon returning this error code. 1992 */ 1993 int (*init) (LocGpsMeasurementCallbacks* callbacks); 1994 1995 /** 1996 * Stops updates from the HAL, and unregisters the callback routines. 1997 * After a call to stop, the previously registered callbacks must be considered invalid by the 1998 * HAL. 1999 * If stop is invoked without a previous 'init', this function should perform no work. 2000 */ 2001 void (*close) (); 2002 2003 } LocGpsMeasurementInterface; 2004 2005 #if 0 2006 /** 2007 * Legacy struct to represents a GPS navigation message (or a fragment of it). 2008 * Deprecated, to be removed in the next Android release. 2009 * Use GnssNavigationMessage instead. 2010 */ 2011 typedef struct { 2012 /** set to sizeof(GpsNavigationMessage) */ 2013 size_t size; 2014 int8_t prn; 2015 GpsNavigationMessageType type; 2016 NavigationMessageStatus status; 2017 int16_t message_id; 2018 int16_t submessage_id; 2019 size_t data_length; 2020 uint8_t* data; 2021 } GpsNavigationMessage; 2022 2023 /** Represents a GPS navigation message (or a fragment of it). */ 2024 typedef struct { 2025 /** set to sizeof(GnssNavigationMessage) */ 2026 size_t size; 2027 2028 /** 2029 * Satellite vehicle ID number, as defined in LocGnssSvInfo::svid 2030 * This is a mandatory value. 2031 */ 2032 int16_t svid; 2033 2034 /** 2035 * The type of message contained in the structure. 2036 * This is a mandatory value. 2037 */ 2038 GnssNavigationMessageType type; 2039 2040 /** 2041 * The status of the received navigation message. 2042 * No need to send any navigation message that contains words with parity error and cannot be 2043 * corrected. 2044 */ 2045 NavigationMessageStatus status; 2046 2047 /** 2048 * Message identifier. It provides an index so the complete Navigation 2049 * Message can be assembled. 2050 * 2051 * - For GPS L1 C/A subframe 4 and 5, this value corresponds to the 'frame 2052 * id' of the navigation message, in the range of 1-25 (Subframe 1, 2, 3 2053 * does not contain a 'frame id' and this value can be set to -1.) 2054 * 2055 * - For Glonass L1 C/A, this refers to the frame ID, in the range of 1-5. 2056 * 2057 * - For BeiDou D1, this refers to the frame number in the range of 1-24 2058 * 2059 * - For Beidou D2, this refers to the frame number, in the range of 1-120 2060 * 2061 * - For Galileo F/NAV nominal frame structure, this refers to the subframe 2062 * number, in the range of 1-12 2063 * 2064 * - For Galileo I/NAV nominal frame structure, this refers to the subframe 2065 * number in the range of 1-24 2066 */ 2067 int16_t message_id; 2068 2069 /** 2070 * Sub-message identifier. If required by the message 'type', this value 2071 * contains a sub-index within the current message (or frame) that is being 2072 * transmitted. 2073 * 2074 * - For GPS L1 C/A, BeiDou D1 & BeiDou D2, the submessage id corresponds to 2075 * the subframe number of the navigation message, in the range of 1-5. 2076 * 2077 * - For Glonass L1 C/A, this refers to the String number, in the range from 2078 * 1-15 2079 * 2080 * - For Galileo F/NAV, this refers to the page type in the range 1-6 2081 * 2082 * - For Galileo I/NAV, this refers to the word type in the range 1-10+ 2083 */ 2084 int16_t submessage_id; 2085 2086 /** 2087 * The length of the data (in bytes) contained in the current message. 2088 * If this value is different from zero, 'data' must point to an array of the same size. 2089 * e.g. for L1 C/A the size of the sub-frame will be 40 bytes (10 words, 30 bits/word). 2090 * 2091 * This is a mandatory value. 2092 */ 2093 size_t data_length; 2094 2095 /** 2096 * The data of the reported GPS message. The bytes (or words) specified 2097 * using big endian format (MSB first). 2098 * 2099 * - For GPS L1 C/A, Beidou D1 & Beidou D2, each subframe contains 10 30-bit 2100 * words. Each word (30 bits) should be fit into the last 30 bits in a 2101 * 4-byte word (skip B31 and B32), with MSB first, for a total of 40 2102 * bytes, covering a time period of 6, 6, and 0.6 seconds, respectively. 2103 * 2104 * - For Glonass L1 C/A, each string contains 85 data bits, including the 2105 * checksum. These bits should be fit into 11 bytes, with MSB first (skip 2106 * B86-B88), covering a time period of 2 seconds. 2107 * 2108 * - For Galileo F/NAV, each word consists of 238-bit (sync & tail symbols 2109 * excluded). Each word should be fit into 30-bytes, with MSB first (skip 2110 * B239, B240), covering a time period of 10 seconds. 2111 * 2112 * - For Galileo I/NAV, each page contains 2 page parts, even and odd, with 2113 * a total of 2x114 = 228 bits, (sync & tail excluded) that should be fit 2114 * into 29 bytes, with MSB first (skip B229-B232). 2115 */ 2116 uint8_t* data; 2117 2118 } GnssNavigationMessage; 2119 2120 /** 2121 * The legacy callback to report an available fragment of a GPS navigation 2122 * messages from the HAL. 2123 * 2124 * This callback is deprecated, and will be removed in the next release. Use 2125 * gnss_navigation_message_callback() instead. 2126 * 2127 * Parameters: 2128 * message - The GPS navigation submessage/subframe representation. 2129 */ 2130 typedef void (*gps_navigation_message_callback) (GpsNavigationMessage* message); 2131 2132 /** 2133 * The callback to report an available fragment of a GPS navigation messages from the HAL. 2134 * 2135 * Parameters: 2136 * message - The GPS navigation submessage/subframe representation. 2137 */ 2138 typedef void (*gnss_navigation_message_callback) (GnssNavigationMessage* message); 2139 2140 typedef struct { 2141 /** set to sizeof(GpsNavigationMessageCallbacks) */ 2142 size_t size; 2143 gps_navigation_message_callback navigation_message_callback; 2144 gnss_navigation_message_callback gnss_navigation_message_callback; 2145 } GpsNavigationMessageCallbacks; 2146 2147 #define GPS_NAVIGATION_MESSAGE_OPERATION_SUCCESS 0 2148 #define GPS_NAVIGATION_MESSAGE_ERROR_ALREADY_INIT -100 2149 #define GPS_NAVIGATION_MESSAGE_ERROR_GENERIC -101 2150 2151 /** 2152 * Extended interface for GPS navigation message reporting support. 2153 */ 2154 typedef struct { 2155 /** Set to sizeof(GpsNavigationMessageInterface) */ 2156 size_t size; 2157 2158 /** 2159 * Initializes the interface and registers the callback routines with the HAL. 2160 * After a successful call to 'init' the HAL must begin to provide updates as they become 2161 * available. 2162 * 2163 * Status: 2164 * GPS_NAVIGATION_MESSAGE_OPERATION_SUCCESS 2165 * GPS_NAVIGATION_MESSAGE_ERROR_ALREADY_INIT - if a callback has already been registered 2166 * without a corresponding call to 'close'. 2167 * GPS_NAVIGATION_MESSAGE_ERROR_GENERIC - if any other error occurred, it is expected that 2168 * the HAL will not generate any updates upon returning this error code. 2169 */ 2170 int (*init) (GpsNavigationMessageCallbacks* callbacks); 2171 2172 /** 2173 * Stops updates from the HAL, and unregisters the callback routines. 2174 * After a call to stop, the previously registered callbacks must be considered invalid by the 2175 * HAL. 2176 * If stop is invoked without a previous 'init', this function should perform no work. 2177 */ 2178 void (*close) (); 2179 2180 } GpsNavigationMessageInterface; 2181 #endif 2182 2183 /** 2184 * Interface for passing GNSS configuration contents from platform to HAL. 2185 */ 2186 typedef struct { 2187 /** Set to sizeof(LocGnssConfigurationInterface) */ 2188 size_t size; 2189 2190 /** 2191 * Deliver GNSS configuration contents to HAL. 2192 * Parameters: 2193 * config_data - a pointer to a char array which holds what usually is expected from 2194 file(/vendor/etc/gps.conf), i.e., a sequence of UTF8 strings separated by '\n'. 2195 * length - total number of UTF8 characters in configuraiton data. 2196 * 2197 * IMPORTANT: 2198 * GPS HAL should expect this function can be called multiple times. And it may be 2199 * called even when GpsLocationProvider is already constructed and enabled. GPS HAL 2200 * should maintain the existing requests for various callback regardless the change 2201 * in configuration data. 2202 */ 2203 void (*configuration_update) (const char* config_data, int32_t length); 2204 } LocGnssConfigurationInterface; 2205 2206 __END_DECLS 2207 2208 #endif /* LOC_GPS_H */ 2209 2210