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