1 /* Copyright (c) 2017 The Linux Foundation. All rights reserved. 2 * 3 * Redistribution and use in source and binary forms, with or without 4 * modification, are permitted provided that the following conditions are 5 * met: 6 * * Redistributions of source code must retain the above copyright 7 * notice, this list of conditions and the following disclaimer. 8 * * Redistributions in binary form must reproduce the above 9 * copyright notice, this list of conditions and the following 10 * disclaimer in the documentation and/or other materials provided 11 * with the distribution. 12 * * Neither the name of The Linux Foundation nor the names of its 13 * contributors may be used to endorse or promote products derived 14 * from this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 #ifndef LOCATION_H 30 #define LOCATION_H 31 32 #include <vector> 33 #include <stdint.h> 34 #include <functional> 35 36 #define GNSS_NI_REQUESTOR_MAX 256 37 #define GNSS_NI_MESSAGE_ID_MAX 2048 38 #define GNSS_SV_MAX 64 39 #define GNSS_MEASUREMENTS_MAX 64 40 #define GNSS_UTC_TIME_OFFSET (3657) 41 42 #define GNSS_BUGREPORT_GPS_MIN (1) 43 #define GNSS_BUGREPORT_SBAS_MIN (120) 44 #define GNSS_BUGREPORT_GLO_MIN (1) 45 #define GNSS_BUGREPORT_QZSS_MIN (193) 46 #define GNSS_BUGREPORT_BDS_MIN (1) 47 #define GNSS_BUGREPORT_GAL_MIN (1) 48 49 typedef enum { 50 LOCATION_ERROR_SUCCESS = 0, 51 LOCATION_ERROR_GENERAL_FAILURE, 52 LOCATION_ERROR_CALLBACK_MISSING, 53 LOCATION_ERROR_INVALID_PARAMETER, 54 LOCATION_ERROR_ID_EXISTS, 55 LOCATION_ERROR_ID_UNKNOWN, 56 LOCATION_ERROR_ALREADY_STARTED, 57 LOCATION_ERROR_GEOFENCES_AT_MAX, 58 LOCATION_ERROR_NOT_SUPPORTED 59 } LocationError; 60 61 // Flags to indicate which values are valid in a Location 62 typedef uint16_t LocationFlagsMask; 63 typedef enum { 64 LOCATION_HAS_LAT_LONG_BIT = (1<<0), // location has valid latitude and longitude 65 LOCATION_HAS_ALTITUDE_BIT = (1<<1), // location has valid altitude 66 LOCATION_HAS_SPEED_BIT = (1<<2), // location has valid speed 67 LOCATION_HAS_BEARING_BIT = (1<<3), // location has valid bearing 68 LOCATION_HAS_ACCURACY_BIT = (1<<4), // location has valid accuracy 69 LOCATION_HAS_VERTICAL_ACCURACY_BIT = (1<<5), // location has valid vertical accuracy 70 LOCATION_HAS_SPEED_ACCURACY_BIT = (1<<6), // location has valid speed accuracy 71 LOCATION_HAS_BEARING_ACCURACY_BIT = (1<<7), // location has valid bearing accuracy 72 } LocationFlagsBits; 73 74 typedef uint16_t LocationTechnologyMask; 75 typedef enum { 76 LOCATION_TECHNOLOGY_GNSS_BIT = (1<<0), // location was calculated using GNSS 77 LOCATION_TECHNOLOGY_CELL_BIT = (1<<1), // location was calculated using Cell 78 LOCATION_TECHNOLOGY_WIFI_BIT = (1<<2), // location was calculated using WiFi 79 LOCATION_TECHNOLOGY_SENSORS_BIT = (1<<3), // location was calculated using Sensors 80 } LocationTechnologyBits; 81 82 typedef enum { 83 LOCATION_RELIABILITY_NOT_SET = 0, 84 LOCATION_RELIABILITY_VERY_LOW, 85 LOCATION_RELIABILITY_LOW, 86 LOCATION_RELIABILITY_MEDIUM, 87 LOCATION_RELIABILITY_HIGH, 88 } LocationReliability; 89 90 typedef uint32_t GnssLocationInfoFlagMask; 91 typedef enum { 92 GNSS_LOCATION_INFO_ALTITUDE_MEAN_SEA_LEVEL_BIT = (1<<0), // valid altitude mean sea level 93 GNSS_LOCATION_INFO_DOP_BIT = (1<<1), // valid pdop, hdop, and vdop 94 GNSS_LOCATION_INFO_MAGNETIC_DEVIATION_BIT = (1<<2), // valid magnetic deviation 95 GNSS_LOCATION_INFO_HOR_RELIABILITY_BIT = (1<<3), // valid horizontal reliability 96 GNSS_LOCATION_INFO_VER_RELIABILITY_BIT = (1<<4), // valid vertical reliability 97 GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MAJOR_BIT = (1<<5), // valid elipsode semi major 98 GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MINOR_BIT = (1<<6), // valid elipsode semi minor 99 GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_AZIMUTH_BIT = (1<<7),// valid accuracy elipsode azimuth 100 } GnssLocationInfoFlagBits; 101 102 typedef enum { 103 GEOFENCE_BREACH_ENTER = 0, 104 GEOFENCE_BREACH_EXIT, 105 GEOFENCE_BREACH_DWELL_IN, 106 GEOFENCE_BREACH_DWELL_OUT, 107 GEOFENCE_BREACH_UNKNOWN, 108 } GeofenceBreachType; 109 110 typedef uint16_t GeofenceBreachTypeMask; 111 typedef enum { 112 GEOFENCE_BREACH_ENTER_BIT = (1<<0), 113 GEOFENCE_BREACH_EXIT_BIT = (1<<1), 114 GEOFENCE_BREACH_DWELL_IN_BIT = (1<<2), 115 GEOFENCE_BREACH_DWELL_OUT_BIT = (1<<3), 116 } GeofenceBreachTypeBits; 117 118 typedef enum { 119 GEOFENCE_STATUS_AVAILABILE_NO = 0, 120 GEOFENCE_STATUS_AVAILABILE_YES, 121 } GeofenceStatusAvailable; 122 123 typedef uint32_t LocationCapabilitiesMask; 124 typedef enum { 125 // supports startTracking API with minInterval param 126 LOCATION_CAPABILITIES_TIME_BASED_TRACKING_BIT = (1<<0), 127 // supports startBatching API with minInterval param 128 LOCATION_CAPABILITIES_TIME_BASED_BATCHING_BIT = (1<<1), 129 // supports startTracking API with minDistance param 130 LOCATION_CAPABILITIES_DISTANCE_BASED_TRACKING_BIT = (1<<2), 131 // supports startBatching API with minDistance param 132 LOCATION_CAPABILITIES_DISTANCE_BASED_BATCHING_BIT = (1<<3), 133 // supports addGeofences API 134 LOCATION_CAPABILITIES_GEOFENCE_BIT = (1<<4), 135 // supports GnssMeasurementsCallback 136 LOCATION_CAPABILITIES_GNSS_MEASUREMENTS_BIT = (1<<5), 137 // supports startTracking/startBatching API with LocationOptions.mode of MSB (Ms Based) 138 LOCATION_CAPABILITIES_GNSS_MSB_BIT = (1<<6), 139 // supports startTracking/startBatching API with LocationOptions.mode of MSA (MS Assisted) 140 LOCATION_CAPABILITIES_GNSS_MSA_BIT = (1<<7), 141 } LocationCapabilitiesBits; 142 143 typedef enum { 144 LOCATION_TECHNOLOGY_TYPE_GNSS = 0, 145 } LocationTechnologyType; 146 147 // Configures how GPS is locked when GPS is disabled (through GnssDisable) 148 typedef enum { 149 GNSS_CONFIG_GPS_LOCK_NONE = 0, // gps is not locked when GPS is disabled (GnssDisable) 150 GNSS_CONFIG_GPS_LOCK_MO, // gps mobile originated (MO) is locked when GPS is disabled 151 GNSS_CONFIG_GPS_LOCK_NI, // gps network initiated (NI) is locked when GPS is disabled 152 GNSS_CONFIG_GPS_LOCK_MO_AND_NI,// gps MO and NI is locked when GPS is disabled 153 } GnssConfigGpsLock; 154 155 // SUPL version 156 typedef enum { 157 GNSS_CONFIG_SUPL_VERSION_1_0_0 = 1, 158 GNSS_CONFIG_SUPL_VERSION_2_0_0, 159 GNSS_CONFIG_SUPL_VERSION_2_0_2, 160 } GnssConfigSuplVersion; 161 162 // LTE Positioning Profile 163 typedef enum { 164 GNSS_CONFIG_LPP_PROFILE_RRLP_ON_LTE = 0, // RRLP on LTE (Default) 165 GNSS_CONFIG_LPP_PROFILE_USER_PLANE, // LPP User Plane (UP) on LTE 166 GNSS_CONFIG_LPP_PROFILE_CONTROL_PLANE, // LPP_Control_Plane (CP) 167 GNSS_CONFIG_LPP_PROFILE_USER_PLANE_AND_CONTROL_PLANE, // Both LPP UP and CP 168 } GnssConfigLppProfile; 169 170 // Technology for LPPe Control Plane 171 typedef uint16_t GnssConfigLppeControlPlaneMask; 172 typedef enum { 173 GNSS_CONFIG_LPPE_CONTROL_PLANE_DBH_BIT = (1<<0), // DBH 174 GNSS_CONFIG_LPPE_CONTROL_PLANE_WLAN_AP_MEASUREMENTS_BIT = (1<<1), // WLAN_AP_MEASUREMENTS 175 } GnssConfigLppeControlPlaneBits; 176 177 // Technology for LPPe User Plane 178 typedef uint16_t GnssConfigLppeUserPlaneMask; 179 typedef enum { 180 GNSS_CONFIG_LPPE_USER_PLANE_DBH_BIT = (1<<0), // DBH 181 GNSS_CONFIG_LPPE_USER_PLANE_WLAN_AP_MEASUREMENTS_BIT = (1<<1), // WLAN_AP_MEASUREMENTS 182 } GnssConfigLppeUserPlaneBits; 183 184 // Positioning Protocol on A-GLONASS system 185 typedef uint16_t GnssConfigAGlonassPositionProtocolMask; 186 typedef enum { 187 GNSS_CONFIG_RRC_CONTROL_PLANE_BIT = (1<<0), // RRC Control Plane 188 GNSS_CONFIG_RRLP_USER_PLANE_BIT = (1<<1), // RRLP User Plane 189 GNSS_CONFIG_LLP_USER_PLANE_BIT = (1<<2), // LPP User Plane 190 GNSS_CONFIG_LLP_CONTROL_PLANE_BIT = (1<<3), // LPP Control Plane 191 } GnssConfigAGlonassPositionProtocolBits; 192 193 typedef enum { 194 GNSS_CONFIG_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_NO = 0, 195 GNSS_CONFIG_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_YES, 196 } GnssConfigEmergencyPdnForEmergencySupl; 197 198 typedef enum { 199 GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_NO = 0, 200 GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_YES, 201 } GnssConfigSuplEmergencyServices; 202 203 typedef uint16_t GnssConfigSuplModeMask; 204 typedef enum { 205 GNSS_CONFIG_SUPL_MODE_MSB_BIT = (1<<0), 206 GNSS_CONFIG_SUPL_MODE_MSA_BIT = (1<<1), 207 } GnssConfigSuplModeBits; 208 209 typedef uint32_t GnssConfigFlagsMask; 210 typedef enum { 211 GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT = (1<<0), 212 GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT = (1<<1), 213 GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT = (1<<2), 214 GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT = (1<<3), 215 GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT = (1<<4), 216 GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT = (1<<5), 217 GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT = (1<<6), 218 GNSS_CONFIG_FLAGS_EM_PDN_FOR_EM_SUPL_VALID_BIT = (1<<7), 219 GNSS_CONFIG_FLAGS_SUPL_EM_SERVICES_BIT = (1<<8), 220 GNSS_CONFIG_FLAGS_SUPL_MODE_BIT = (1<<9), 221 } GnssConfigFlagsBits; 222 223 typedef enum { 224 GNSS_NI_ENCODING_TYPE_NONE = 0, 225 GNSS_NI_ENCODING_TYPE_GSM_DEFAULT, 226 GNSS_NI_ENCODING_TYPE_UTF8, 227 GNSS_NI_ENCODING_TYPE_UCS2, 228 } GnssNiEncodingType; 229 230 typedef enum { 231 GNSS_NI_TYPE_VOICE = 0, 232 GNSS_NI_TYPE_SUPL, 233 GNSS_NI_TYPE_CONTROL_PLANE, 234 GNSS_NI_TYPE_EMERGENCY_SUPL 235 } GnssNiType; 236 237 typedef uint16_t GnssNiOptionsMask; 238 typedef enum { 239 GNSS_NI_OPTIONS_NOTIFICATION_BIT = (1<<0), 240 GNSS_NI_OPTIONS_VERIFICATION_BIT = (1<<1), 241 GNSS_NI_OPTIONS_PRIVACY_OVERRIDE_BIT = (1<<2), 242 } GnssNiOptionsBits; 243 244 typedef enum { 245 GNSS_NI_RESPONSE_ACCEPT = 1, 246 GNSS_NI_RESPONSE_DENY, 247 GNSS_NI_RESPONSE_NO_RESPONSE, 248 GNSS_NI_RESPONSE_IGNORE, 249 } GnssNiResponse; 250 251 typedef enum { 252 GNSS_SV_TYPE_UNKNOWN = 0, 253 GNSS_SV_TYPE_GPS, 254 GNSS_SV_TYPE_SBAS, 255 GNSS_SV_TYPE_GLONASS, 256 GNSS_SV_TYPE_QZSS, 257 GNSS_SV_TYPE_BEIDOU, 258 GNSS_SV_TYPE_GALILEO, 259 } GnssSvType; 260 261 typedef enum { 262 GNSS_EPH_TYPE_UNKNOWN = 0, 263 GNSS_EPH_TYPE_EPHEMERIS, 264 GNSS_EPH_TYPE_ALMANAC, 265 } GnssEphemerisType; 266 267 typedef enum { 268 GNSS_EPH_SOURCE_UNKNOWN = 0, 269 GNSS_EPH_SOURCE_DEMODULATED, 270 GNSS_EPH_SOURCE_SUPL_PROVIDED, 271 GNSS_EPH_SOURCE_OTHER_SERVER_PROVIDED, 272 GNSS_EPH_SOURCE_LOCAL, 273 } GnssEphemerisSource; 274 275 typedef enum { 276 GNSS_EPH_HEALTH_UNKNOWN = 0, 277 GNSS_EPH_HEALTH_GOOD, 278 GNSS_EPH_HEALTH_BAD, 279 } GnssEphemerisHealth; 280 281 typedef uint16_t GnssSvOptionsMask; 282 typedef enum { 283 GNSS_SV_OPTIONS_HAS_EPHEMER_BIT = (1<<0), 284 GNSS_SV_OPTIONS_HAS_ALMANAC_BIT = (1<<1), 285 GNSS_SV_OPTIONS_USED_IN_FIX_BIT = (1<<2), 286 GNSS_SV_OPTIONS_HAS_CARRIER_FREQUENCY_BIT = (1<<3), 287 } GnssSvOptionsBits; 288 289 typedef enum { 290 GNSS_ASSISTANCE_TYPE_SUPL = 0, 291 GNSS_ASSISTANCE_TYPE_C2K, 292 } GnssAssistanceType; 293 294 typedef enum { 295 GNSS_SUPL_MODE_STANDALONE = 0, 296 GNSS_SUPL_MODE_MSB, 297 GNSS_SUPL_MODE_MSA, 298 } GnssSuplMode; 299 300 typedef uint16_t GnssMeasurementsAdrStateMask; 301 typedef enum { 302 GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_UNKNOWN = 0, 303 GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_VALID_BIT = (1<<0), 304 GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_RESET_BIT = (1<<1), 305 GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_CYCLE_SLIP_BIT = (1<<2), 306 } GnssMeasurementsAdrStateBits; 307 308 typedef uint32_t GnssMeasurementsDataFlagsMask; 309 typedef enum { 310 GNSS_MEASUREMENTS_DATA_SV_ID_BIT = (1<<0), 311 GNSS_MEASUREMENTS_DATA_SV_TYPE_BIT = (1<<1), 312 GNSS_MEASUREMENTS_DATA_STATE_BIT = (1<<2), 313 GNSS_MEASUREMENTS_DATA_RECEIVED_SV_TIME_BIT = (1<<3), 314 GNSS_MEASUREMENTS_DATA_RECEIVED_SV_TIME_UNCERTAINTY_BIT = (1<<4), 315 GNSS_MEASUREMENTS_DATA_CARRIER_TO_NOISE_BIT = (1<<5), 316 GNSS_MEASUREMENTS_DATA_PSEUDORANGE_RATE_BIT = (1<<6), 317 GNSS_MEASUREMENTS_DATA_PSEUDORANGE_RATE_UNCERTAINTY_BIT = (1<<7), 318 GNSS_MEASUREMENTS_DATA_ADR_STATE_BIT = (1<<8), 319 GNSS_MEASUREMENTS_DATA_ADR_BIT = (1<<9), 320 GNSS_MEASUREMENTS_DATA_ADR_UNCERTAINTY_BIT = (1<<10), 321 GNSS_MEASUREMENTS_DATA_CARRIER_FREQUENCY_BIT = (1<<11), 322 GNSS_MEASUREMENTS_DATA_CARRIER_CYCLES_BIT = (1<<12), 323 GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_BIT = (1<<13), 324 GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_UNCERTAINTY_BIT = (1<<14), 325 GNSS_MEASUREMENTS_DATA_MULTIPATH_INDICATOR_BIT = (1<<15), 326 GNSS_MEASUREMENTS_DATA_SIGNAL_TO_NOISE_RATIO_BIT = (1<<16), 327 GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT = (1<<17), 328 } GnssMeasurementsDataFlagsBits; 329 330 typedef uint32_t GnssMeasurementsStateMask; 331 typedef enum { 332 GNSS_MEASUREMENTS_STATE_UNKNOWN_BIT = 0, 333 GNSS_MEASUREMENTS_STATE_CODE_LOCK_BIT = (1<<0), 334 GNSS_MEASUREMENTS_STATE_BIT_SYNC_BIT = (1<<1), 335 GNSS_MEASUREMENTS_STATE_SUBFRAME_SYNC_BIT = (1<<2), 336 GNSS_MEASUREMENTS_STATE_TOW_DECODED_BIT = (1<<3), 337 GNSS_MEASUREMENTS_STATE_MSEC_AMBIGUOUS_BIT = (1<<4), 338 GNSS_MEASUREMENTS_STATE_SYMBOL_SYNC_BIT = (1<<5), 339 GNSS_MEASUREMENTS_STATE_GLO_STRING_SYNC_BIT = (1<<6), 340 GNSS_MEASUREMENTS_STATE_GLO_TOD_DECODED_BIT = (1<<7), 341 GNSS_MEASUREMENTS_STATE_BDS_D2_BIT_SYNC_BIT = (1<<8), 342 GNSS_MEASUREMENTS_STATE_BDS_D2_SUBFRAME_SYNC_BIT = (1<<9), 343 GNSS_MEASUREMENTS_STATE_GAL_E1BC_CODE_LOCK_BIT = (1<<10), 344 GNSS_MEASUREMENTS_STATE_GAL_E1C_2ND_CODE_LOCK_BIT = (1<<11), 345 GNSS_MEASUREMENTS_STATE_GAL_E1B_PAGE_SYNC_BIT = (1<<12), 346 GNSS_MEASUREMENTS_STATE_SBAS_SYNC_BIT = (1<<13), 347 } GnssMeasurementsStateBits; 348 349 typedef enum { 350 GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_UNKNOWN = 0, 351 GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_PRESENT, 352 GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_NOT_PRESENT, 353 } GnssMeasurementsMultipathIndicator; 354 355 typedef uint32_t GnssMeasurementsClockFlagsMask; 356 typedef enum { 357 GNSS_MEASUREMENTS_CLOCK_FLAGS_LEAP_SECOND_BIT = (1<<0), 358 GNSS_MEASUREMENTS_CLOCK_FLAGS_TIME_BIT = (1<<1), 359 GNSS_MEASUREMENTS_CLOCK_FLAGS_TIME_UNCERTAINTY_BIT = (1<<2), 360 GNSS_MEASUREMENTS_CLOCK_FLAGS_FULL_BIAS_BIT = (1<<3), 361 GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_BIT = (1<<4), 362 GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_UNCERTAINTY_BIT = (1<<5), 363 GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_BIT = (1<<6), 364 GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_UNCERTAINTY_BIT = (1<<7), 365 GNSS_MEASUREMENTS_CLOCK_FLAGS_HW_CLOCK_DISCONTINUITY_COUNT_BIT = (1<<8), 366 } GnssMeasurementsClockFlagsBits; 367 368 typedef uint32_t GnssAidingDataSvMask; 369 typedef enum { 370 GNSS_AIDING_DATA_SV_EPHEMERIS_BIT = (1<<0), // ephemeris 371 GNSS_AIDING_DATA_SV_ALMANAC_BIT = (1<<1), // almanac 372 GNSS_AIDING_DATA_SV_HEALTH_BIT = (1<<2), // health 373 GNSS_AIDING_DATA_SV_DIRECTION_BIT = (1<<3), // direction 374 GNSS_AIDING_DATA_SV_STEER_BIT = (1<<4), // steer 375 GNSS_AIDING_DATA_SV_ALMANAC_CORR_BIT = (1<<5), // almanac correction 376 GNSS_AIDING_DATA_SV_BLACKLIST_BIT = (1<<6), // blacklist SVs 377 GNSS_AIDING_DATA_SV_SA_DATA_BIT = (1<<7), // sensitivity assistance data 378 GNSS_AIDING_DATA_SV_NO_EXIST_BIT = (1<<8), // SV does not exist 379 GNSS_AIDING_DATA_SV_IONOSPHERE_BIT = (1<<9), // ionosphere correction 380 GNSS_AIDING_DATA_SV_TIME_BIT = (1<<10),// reset satellite time 381 } GnssAidingDataSvBits; 382 383 typedef uint32_t GnssAidingDataSvTypeMask; 384 typedef enum { 385 GNSS_AIDING_DATA_SV_TYPE_GPS_BIT = (1<<0), 386 GNSS_AIDING_DATA_SV_TYPE_GLONASS_BIT = (1<<1), 387 GNSS_AIDING_DATA_SV_TYPE_QZSS_BIT = (1<<2), 388 GNSS_AIDING_DATA_SV_TYPE_BEIDOU_BIT = (1<<3), 389 GNSS_AIDING_DATA_SV_TYPE_GALILEO_BIT = (1<<4), 390 } GnssAidingDataSvTypeBits; 391 392 typedef struct { 393 GnssAidingDataSvMask svMask; // bitwise OR of GnssAidingDataSvBits 394 GnssAidingDataSvTypeMask svTypeMask; // bitwise OR of GnssAidingDataSvTypeBits 395 } GnssAidingDataSv; 396 397 typedef uint32_t GnssAidingDataCommonMask; 398 typedef enum { 399 GNSS_AIDING_DATA_COMMON_POSITION_BIT = (1<<0), // position estimate 400 GNSS_AIDING_DATA_COMMON_TIME_BIT = (1<<1), // reset all clock values 401 GNSS_AIDING_DATA_COMMON_UTC_BIT = (1<<2), // UTC estimate 402 GNSS_AIDING_DATA_COMMON_RTI_BIT = (1<<3), // RTI 403 GNSS_AIDING_DATA_COMMON_FREQ_BIAS_EST_BIT = (1<<4), // frequency bias estimate 404 GNSS_AIDING_DATA_COMMON_CELLDB_BIT = (1<<5), // all celldb info 405 } GnssAidingDataCommonBits; 406 407 typedef struct { 408 GnssAidingDataCommonMask mask; // bitwise OR of GnssAidingDataCommonBits 409 } GnssAidingDataCommon; 410 411 typedef struct { 412 bool deleteAll; // if true, delete all aiding data and ignore other params 413 GnssAidingDataSv sv; // SV specific aiding data 414 GnssAidingDataCommon common; // common aiding data 415 } GnssAidingData; 416 417 typedef struct { 418 size_t size; // set to sizeof(Location) 419 LocationFlagsMask flags; // bitwise OR of LocationFlagsBits to mark which params are valid 420 uint64_t timestamp; // UTC timestamp for location fix, milliseconds since January 1, 1970 421 double latitude; // in degrees 422 double longitude; // in degrees 423 double altitude; // in meters above the WGS 84 reference ellipsoid 424 float speed; // in meters per second 425 float bearing; // in degrees; range [0, 360) 426 float accuracy; // in meters 427 float verticalAccuracy; // in meters 428 float speedAccuracy; // in meters/second 429 float bearingAccuracy; // in degrees (0 to 359.999) 430 LocationTechnologyMask techMask; 431 } Location; 432 433 typedef struct { 434 size_t size; // set to sizeof(LocationOptions) 435 uint32_t minInterval; // in milliseconds 436 uint32_t minDistance; // in meters. if minDistance > 0, gnssSvCallback/gnssNmeaCallback/ 437 // gnssMeasurementsCallback may not be called 438 GnssSuplMode mode; // Standalone/MS-Based/MS-Assisted 439 } LocationOptions; 440 441 typedef struct { 442 size_t size; // set to sizeof(GeofenceOption) 443 GeofenceBreachTypeMask breachTypeMask; // bitwise OR of GeofenceBreachTypeBits 444 uint32_t responsiveness; // in milliseconds 445 uint32_t dwellTime; // in seconds 446 } GeofenceOption; 447 448 typedef struct { 449 size_t size; // set to sizeof(GeofenceInfo) 450 double latitude; // in degrees 451 double longitude; // in degrees 452 double radius; // in meters 453 } GeofenceInfo; 454 455 typedef struct { 456 size_t size; // set to sizeof(GeofenceBreachNotification) 457 size_t count; // number of ids in array 458 uint32_t* ids; // array of ids that have breached 459 Location location; // location associated with breach 460 GeofenceBreachType type; // type of breach 461 uint64_t timestamp; // timestamp of breach 462 } GeofenceBreachNotification; 463 464 typedef struct { 465 size_t size; // set to sizeof(GeofenceBreachNotification) 466 GeofenceStatusAvailable available; // GEOFENCE_STATUS_AVAILABILE_NO/_YES 467 LocationTechnologyType techType; // GNSS 468 } GeofenceStatusNotification; 469 470 typedef struct { 471 size_t size; // set to sizeof(GnssLocationInfo) 472 GnssLocationInfoFlagMask flags; // bitwise OR of GnssLocationInfoBits for param validity 473 float altitudeMeanSeaLevel; // altitude wrt mean sea level 474 float pdop; // position dilusion of precision 475 float hdop; // horizontal dilusion of precision 476 float vdop; // vertical dilusion of precision 477 float magneticDeviation; // magnetic deviation 478 LocationReliability horReliability; // horizontal reliability 479 LocationReliability verReliability; // vertical reliability 480 float horUncEllipseSemiMajor; // horizontal elliptical accuracy semi-major axis 481 float horUncEllipseSemiMinor; // horizontal elliptical accuracy semi-minor axis 482 float horUncEllipseOrientAzimuth; // horizontal elliptical accuracy azimuth 483 } GnssLocationInfoNotification; 484 485 typedef struct { 486 size_t size; // set to sizeof(GnssNiNotification) 487 GnssNiType type; // type of NI (Voice, SUPL, Control Plane) 488 GnssNiOptionsMask options; // bitwise OR of GnssNiOptionsBits 489 uint32_t timeout; // time (seconds) to wait for user input 490 GnssNiResponse timeoutResponse; // the response that should be sent when timeout expires 491 char requestor[GNSS_NI_REQUESTOR_MAX]; // the requestor that is making the request 492 GnssNiEncodingType requestorEncoding; // the encoding type for requestor 493 char message[GNSS_NI_MESSAGE_ID_MAX]; // the message to show user 494 GnssNiEncodingType messageEncoding; // the encoding type for message 495 char extras[GNSS_NI_MESSAGE_ID_MAX]; 496 } GnssNiNotification; 497 498 typedef struct { 499 size_t size; // set to sizeof(GnssSv) 500 uint16_t svId; // Unique Identifier 501 GnssSvType type; // type of SV (GPS, SBAS, GLONASS, QZSS, BEIDOU, GALILEO) 502 float cN0Dbhz; // signal strength 503 float elevation; // elevation of SV (in degrees) 504 float azimuth; // azimuth of SV (in degrees) 505 GnssSvOptionsMask gnssSvOptionsMask; // Bitwise OR of GnssSvOptionsBits 506 float carrierFrequencyHz; // carrier frequency of the signal tracked 507 } GnssSv; 508 509 typedef struct { 510 size_t size; // set to sizeof(GnssConfigSetAssistanceServer) 511 GnssAssistanceType type; // SUPL or C2K 512 const char* hostName; // null terminated string 513 uint32_t port; // port of server 514 } GnssConfigSetAssistanceServer; 515 516 typedef struct { 517 size_t size; // set to sizeof(GnssMeasurementsData) 518 GnssMeasurementsDataFlagsMask flags; // bitwise OR of GnssMeasurementsDataFlagsBits 519 int16_t svId; 520 GnssSvType svType; 521 double timeOffsetNs; 522 GnssMeasurementsStateMask stateMask; // bitwise OR of GnssMeasurementsStateBits 523 int64_t receivedSvTimeNs; 524 int64_t receivedSvTimeUncertaintyNs; 525 double carrierToNoiseDbHz; 526 double pseudorangeRateMps; 527 double pseudorangeRateUncertaintyMps; 528 GnssMeasurementsAdrStateMask adrStateMask; // bitwise OR of GnssMeasurementsAdrStateBits 529 double adrMeters; 530 double adrUncertaintyMeters; 531 float carrierFrequencyHz; 532 int64_t carrierCycles; 533 double carrierPhase; 534 double carrierPhaseUncertainty; 535 GnssMeasurementsMultipathIndicator multipathIndicator; 536 double signalToNoiseRatioDb; 537 double agcLevelDb; 538 } GnssMeasurementsData; 539 540 typedef struct { 541 size_t size; // set to sizeof(GnssMeasurementsClock) 542 GnssMeasurementsClockFlagsMask flags; // bitwise OR of GnssMeasurementsClockFlagsBits 543 int16_t leapSecond; 544 int64_t timeNs; 545 double timeUncertaintyNs; 546 int64_t fullBiasNs; 547 double biasNs; 548 double biasUncertaintyNs; 549 double driftNsps; 550 double driftUncertaintyNsps; 551 uint32_t hwClockDiscontinuityCount; 552 } GnssMeasurementsClock; 553 554 typedef struct { 555 size_t size; // set to sizeof(GnssSvNotification) 556 size_t count; // number of SVs in the GnssSv array 557 GnssSv gnssSvs[GNSS_SV_MAX]; // information on a number of SVs 558 } GnssSvNotification; 559 560 typedef struct { 561 size_t size; // set to sizeof(GnssNmeaNotification) 562 uint64_t timestamp; // timestamp 563 const char* nmea; // nmea text 564 size_t length; // length of the nmea text 565 } GnssNmeaNotification; 566 567 typedef struct { 568 size_t size; // set to sizeof(GnssMeasurementsNotification) 569 size_t count; // number of items in GnssMeasurements array 570 GnssMeasurementsData measurements[GNSS_MEASUREMENTS_MAX]; 571 GnssMeasurementsClock clock; // clock 572 } GnssMeasurementsNotification; 573 574 typedef struct { 575 size_t size; // set to sizeof(GnssConfig) 576 GnssConfigFlagsMask flags; // bitwise OR of GnssConfigFlagsBits to mark which params are valid 577 GnssConfigGpsLock gpsLock; 578 GnssConfigSuplVersion suplVersion; 579 GnssConfigSetAssistanceServer assistanceServer; 580 GnssConfigLppProfile lppProfile; 581 GnssConfigLppeControlPlaneMask lppeControlPlaneMask; 582 GnssConfigLppeUserPlaneMask lppeUserPlaneMask; 583 GnssConfigAGlonassPositionProtocolMask aGlonassPositionProtocolMask; 584 GnssConfigEmergencyPdnForEmergencySupl emergencyPdnForEmergencySupl; 585 GnssConfigSuplEmergencyServices suplEmergencyServices; 586 GnssConfigSuplModeMask suplModeMask; //bitwise OR of GnssConfigSuplModeBits 587 } GnssConfig; 588 589 typedef struct { 590 size_t size; // set to sizeof 591 bool mValid; 592 Location mLocation; 593 double verticalAccuracyMeters; 594 double speedAccuracyMetersPerSecond; 595 double bearingAccuracyDegrees; 596 timespec mUtcReported; 597 } GnssDebugLocation; 598 599 typedef struct { 600 size_t size; // set to sizeof 601 bool mValid; 602 int64_t timeEstimate; 603 float timeUncertaintyNs; 604 float frequencyUncertaintyNsPerSec; 605 } GnssDebugTime; 606 607 typedef struct { 608 size_t size; // set to sizeof 609 uint32_t svid; 610 GnssSvType constellation; 611 GnssEphemerisType mEphemerisType; 612 GnssEphemerisSource mEphemerisSource; 613 GnssEphemerisHealth mEphemerisHealth; 614 float ephemerisAgeSeconds; 615 bool serverPredictionIsAvailable; 616 float serverPredictionAgeSeconds; 617 } GnssDebugSatelliteInfo; 618 619 typedef struct { 620 size_t size; // set to sizeof 621 GnssDebugLocation mLocation; 622 GnssDebugTime mTime; 623 std::vector<GnssDebugSatelliteInfo> mSatelliteInfo; 624 } GnssDebugReport; 625 626 /* Provides the capabilities of the system 627 capabilities callback is called once soon after createInstance is called */ 628 typedef std::function<void( 629 LocationCapabilitiesMask capabilitiesMask // bitwise OR of LocationCapabilitiesBits 630 )> capabilitiesCallback; 631 632 /* Used by tracking, batching, and miscellanous APIs 633 responseCallback is called for every Tracking, Batching API, and Miscellanous API */ 634 typedef std::function<void( 635 LocationError err, // if not SUCCESS, then id is not valid 636 uint32_t id // id to be associated to the request 637 )> responseCallback; 638 639 /* Used by APIs that gets more than one LocationError in it's response 640 collectiveResponseCallback is called for every geofence API call. 641 ids array and LocationError array are only valid until collectiveResponseCallback returns. */ 642 typedef std::function<void( 643 size_t count, // number of locations in arrays 644 LocationError* errs, // array of LocationError associated to the request 645 uint32_t* ids // array of ids to be associated to the request 646 )> collectiveResponseCallback; 647 648 /* Used for startTracking API, optional can be NULL 649 trackingCallback is called when delivering a location in a tracking session 650 broadcasted to all clients, no matter if a session has started by client */ 651 typedef std::function<void( 652 Location location 653 )> trackingCallback; 654 655 /* Used for startBatching API, optional can be NULL 656 batchingCallback is called when delivering locations in a batching session. 657 broadcasted to all clients, no matter if a session has started by client */ 658 typedef std::function<void( 659 size_t count, // number of locations in array 660 Location* location // array of locations 661 )> batchingCallback; 662 663 /* Gives GNSS Location information, optional can be NULL 664 gnssLocationInfoCallback is called only during a tracking session 665 broadcasted to all clients, no matter if a session has started by client */ 666 typedef std::function<void( 667 GnssLocationInfoNotification gnssLocationInfoNotification 668 )> gnssLocationInfoCallback; 669 670 /* Used for addGeofences API, optional can be NULL 671 geofenceBreachCallback is called when any number of geofences have a state change */ 672 typedef std::function<void( 673 GeofenceBreachNotification geofenceBreachNotification 674 )> geofenceBreachCallback; 675 676 /* Used for addGeofences API, optional can be NULL 677 geofenceStatusCallback is called when any number of geofences have a status change */ 678 typedef std::function<void( 679 GeofenceStatusNotification geofenceStatusNotification 680 )> geofenceStatusCallback; 681 682 /* Network Initiated request, optional can be NULL 683 This callback should be responded to by calling gnssNiResponse */ 684 typedef std::function<void( 685 uint32_t id, // id that should be used to respond by calling gnssNiResponse 686 GnssNiNotification gnssNiNotification 687 )> gnssNiCallback; 688 689 /* Gives GNSS SV information, optional can be NULL 690 gnssSvCallback is called only during a tracking session 691 broadcasted to all clients, no matter if a session has started by client */ 692 typedef std::function<void( 693 GnssSvNotification gnssSvNotification 694 )> gnssSvCallback; 695 696 /* Gives GNSS NMEA data, optional can be NULL 697 gnssNmeaCallback is called only during a tracking session 698 broadcasted to all clients, no matter if a session has started by client */ 699 typedef std::function<void( 700 GnssNmeaNotification gnssNmeaNotification 701 )> gnssNmeaCallback; 702 703 /* Gives GNSS Measurements information, optional can be NULL 704 gnssMeasurementsCallback is called only during a tracking session 705 broadcasted to all clients, no matter if a session has started by client */ 706 typedef std::function<void( 707 GnssMeasurementsNotification gnssMeasurementsNotification 708 )> gnssMeasurementsCallback; 709 710 typedef struct { 711 size_t size; // set to sizeof(LocationCallbacks) 712 capabilitiesCallback capabilitiesCb; // mandatory 713 responseCallback responseCb; // mandatory 714 collectiveResponseCallback collectiveResponseCb; // mandatory 715 trackingCallback trackingCb; // optional 716 batchingCallback batchingCb; // optional 717 geofenceBreachCallback geofenceBreachCb; // optional 718 geofenceStatusCallback geofenceStatusCb; // optional 719 gnssLocationInfoCallback gnssLocationInfoCb; // optional 720 gnssNiCallback gnssNiCb; // optional 721 gnssSvCallback gnssSvCb; // optional 722 gnssNmeaCallback gnssNmeaCb; // optional 723 gnssMeasurementsCallback gnssMeasurementsCb; // optional 724 } LocationCallbacks; 725 726 class LocationAPI 727 { 728 private: 729 LocationAPI(); 730 ~LocationAPI(); 731 732 public: 733 /* creates an instance to LocationAPI object. 734 Will return NULL if mandatory parameters are invalid or if the maximum number 735 of instances have been reached */ 736 static LocationAPI* createInstance(LocationCallbacks&); 737 738 /* destroy/cleans up the instance, which should be called when LocationAPI object is 739 no longer needed. LocationAPI* returned from createInstance will no longer valid 740 after destroy is called */ 741 void destroy(); 742 743 /* updates/changes the callbacks that will be called. 744 mandatory callbacks must be present for callbacks to be successfully updated 745 no return value */ 746 void updateCallbacks(LocationCallbacks&); 747 748 /* ================================== TRACKING ================================== */ 749 750 /* startTracking starts a tracking session, which returns a session id that will be 751 used by the other tracking APIs and also in the responseCallback to match command 752 with response. locations are reported on the trackingCallback passed in createInstance 753 periodically according to LocationOptions. 754 responseCallback returns: 755 LOCATION_ERROR_SUCCESS if session was successfully started 756 LOCATION_ERROR_ALREADY_STARTED if a startTracking session is already in progress 757 LOCATION_ERROR_CALLBACK_MISSING if no trackingCallback was passed in createInstance 758 LOCATION_ERROR_INVALID_PARAMETER if LocationOptions parameter is invalid */ 759 uint32_t startTracking(LocationOptions&); // returns session id 760 761 /* stopTracking stops a tracking session associated with id parameter. 762 responseCallback returns: 763 LOCATION_ERROR_SUCCESS if successful 764 LOCATION_ERROR_ID_UNKNOWN if id is not associated with a tracking session */ 765 void stopTracking(uint32_t id); 766 767 /* updateTrackingOptions changes the LocationOptions of a tracking session associated with id 768 responseCallback returns: 769 LOCATION_ERROR_SUCCESS if successful 770 LOCATION_ERROR_INVALID_PARAMETER if LocationOptions parameters are invalid 771 LOCATION_ERROR_ID_UNKNOWN if id is not associated with a tracking session */ 772 void updateTrackingOptions(uint32_t id, LocationOptions&); 773 774 /* ================================== BATCHING ================================== */ 775 776 /* startBatching starts a batching session, which returns a session id that will be 777 used by the other batching APIs and also in the responseCallback to match command 778 with response. locations are reported on the batchingCallback passed in createInstance 779 periodically according to LocationOptions. A batching session starts tracking on 780 the low power processor and delivers them in batches by the batchingCallback when 781 the batch is full or when getBatchedLocations is called. This allows for the processor 782 that calls this API to sleep when the low power processor can batch locations in the 783 backgroup and wake up the processor calling the API only when the batch is full, thus 784 saving power 785 responseCallback returns: 786 LOCATION_ERROR_SUCCESS if session was successful 787 LOCATION_ERROR_ALREADY_STARTED if a startBatching session is already in progress 788 LOCATION_ERROR_CALLBACK_MISSING if no batchingCallback was passed in createInstance 789 LOCATION_ERROR_INVALID_PARAMETER if a parameter is invalid 790 LOCATION_ERROR_NOT_SUPPORTED if batching is not supported */ 791 uint32_t startBatching(LocationOptions&); // returns session id 792 793 /* stopBatching stops a batching session associated with id parameter. 794 responseCallback returns: 795 LOCATION_ERROR_SUCCESS if successful 796 LOCATION_ERROR_ID_UNKNOWN if id is not associated with batching session */ 797 void stopBatching(uint32_t id); 798 799 /* updateBatchingOptions changes the LocationOptions of a batching session associated with id 800 responseCallback returns: 801 LOCATION_ERROR_SUCCESS if successful 802 LOCATION_ERROR_INVALID_PARAMETER if LocationOptions parameters are invalid 803 LOCATION_ERROR_ID_UNKNOWN if id is not associated with a batching session */ 804 void updateBatchingOptions(uint32_t id, LocationOptions&); 805 806 /* getBatchedLocations gets a number of locations that are currently stored/batched 807 on the low power processor, delivered by the batchingCallback passed in createInstance. 808 Location are then deleted from the batch stored on the low power processor. 809 responseCallback returns: 810 LOCATION_ERROR_SUCCESS if successful, will be followed by batchingCallback call 811 LOCATION_ERROR_CALLBACK_MISSING if no batchingCallback was passed in createInstance 812 LOCATION_ERROR_ID_UNKNOWN if id is not associated with a batching session */ 813 void getBatchedLocations(uint32_t id, size_t count); 814 815 /* ================================== GEOFENCE ================================== */ 816 817 /* addGeofences adds any number of geofences and returns an array of geofence ids that 818 will be used by the other geofence APIs and also in the collectiveResponseCallback to 819 match command with response. The geofenceBreachCallback will deliver the status of each 820 geofence according to the GeofenceOption for each. The geofence id array returned will 821 be valid until the collectiveResponseCallback is called and has returned. 822 collectiveResponseCallback returns: 823 LOCATION_ERROR_SUCCESS if session was successful 824 LOCATION_ERROR_CALLBACK_MISSING if no geofenceBreachCallback 825 LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid 826 LOCATION_ERROR_NOT_SUPPORTED if geofence is not supported */ 827 uint32_t* addGeofences(size_t count, GeofenceOption*, GeofenceInfo*); // returns id array 828 829 /* removeGeofences removes any number of geofences. Caller should delete ids array after 830 removeGeofences returneds. 831 collectiveResponseCallback returns: 832 LOCATION_ERROR_SUCCESS if successful 833 LOCATION_ERROR_ID_UNKNOWN if id is not associated with a geofence session */ 834 void removeGeofences(size_t count, uint32_t* ids); 835 836 /* modifyGeofences modifies any number of geofences. Caller should delete ids array after 837 modifyGeofences returns. 838 collectiveResponseCallback returns: 839 LOCATION_ERROR_SUCCESS if successful 840 LOCATION_ERROR_ID_UNKNOWN if id is not associated with a geofence session 841 LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid */ 842 void modifyGeofences(size_t count, uint32_t* ids, GeofenceOption* options); 843 844 /* pauseGeofences pauses any number of geofences, which is similar to removeGeofences, 845 only that they can be resumed at any time. Caller should delete ids array after 846 pauseGeofences returns. 847 collectiveResponseCallback returns: 848 LOCATION_ERROR_SUCCESS if successful 849 LOCATION_ERROR_ID_UNKNOWN if id is not associated with a geofence session */ 850 void pauseGeofences(size_t count, uint32_t* ids); 851 852 /* resumeGeofences resumes any number of geofences that are currently paused. Caller should 853 delete ids array after resumeGeofences returns. 854 collectiveResponseCallback returns: 855 LOCATION_ERROR_SUCCESS if successful 856 LOCATION_ERROR_ID_UNKNOWN if id is not associated with a geofence session */ 857 void resumeGeofences(size_t count, uint32_t* ids); 858 859 /* ================================== GNSS ====================================== */ 860 861 /* gnssNiResponse is called in response to a gnssNiCallback. 862 responseCallback returns: 863 LOCATION_ERROR_SUCCESS if session was successful 864 LOCATION_ERROR_INVALID_PARAMETER if any parameters in GnssNiResponse are invalid 865 LOCATION_ERROR_ID_UNKNOWN if id does not match a gnssNiCallback */ 866 void gnssNiResponse(uint32_t id, GnssNiResponse response); 867 }; 868 869 typedef struct { 870 size_t size; // set to sizeof(LocationControlCallbacks) 871 responseCallback responseCb; // mandatory 872 collectiveResponseCallback collectiveResponseCb; // mandatory 873 } LocationControlCallbacks; 874 875 class LocationControlAPI 876 { 877 private: 878 LocationControlAPI(); 879 ~LocationControlAPI(); 880 881 public: 882 /* creates an instance to LocationControlAPI object. 883 Will return NULL if mandatory parameters are invalid or if the maximum number 884 of instances have been reached. Only once instance allowed */ 885 static LocationControlAPI* createInstance(LocationControlCallbacks&); 886 887 /* destroy/cleans up the instance, which should be called when LocationControlAPI object is 888 no longer needed. LocationControlAPI* returned from createInstance will no longer valid 889 after destroy is called */ 890 void destroy(); 891 892 /* enable will enable specific location technology to be used for calculation locations and 893 will effectively start a control session if call is successful, which returns a session id 894 that will be returned in responseCallback to match command with response. The session id is 895 also needed to call the disable command. 896 This effect is global for all clients of LocationAPI 897 responseCallback returns: 898 LOCATION_ERROR_SUCCESS if successful 899 LOCATION_ERROR_ALREADY_STARTED if an enable was already called for this techType 900 LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid 901 LOCATION_ERROR_GENERAL_FAILURE if failure for any other reason */ 902 uint32_t enable(LocationTechnologyType techType); 903 904 /* disable will disable specific location technology to be used for calculation locations and 905 effectively ends the control session if call is successful. 906 id parameter is the session id that was returned in enable responseCallback for techType. 907 The session id is no longer valid after disable's responseCallback returns success. 908 This effect is global for all clients of LocationAPI 909 responseCallback returns: 910 LOCATION_ERROR_SUCCESS if successful 911 LOCATION_ERROR_ID_UNKNOWN if id was not returned from responseCallback from enable 912 LOCATION_ERROR_GENERAL_FAILURE if failure for any other reason */ 913 void disable(uint32_t id); 914 915 /* gnssUpdateConfig updates the gnss specific configuration, which returns a session id array 916 with an id for each of the bits set in GnssConfig.flags, order from low bits to high bits. 917 The response for each config that is set will be returned in collectiveResponseCallback. 918 The session id array returned will be valid until the collectiveResponseCallback is called 919 and has returned. This effect is global for all clients of LocationAPI 920 collectiveResponseCallback returns: 921 LOCATION_ERROR_SUCCESS if session was successful 922 LOCATION_ERROR_INVALID_PARAMETER if any other parameters are invalid 923 LOCATION_ERROR_GENERAL_FAILURE if failure for any other reason */ 924 uint32_t* gnssUpdateConfig(GnssConfig config); 925 926 /* delete specific gnss aiding data for testing, which returns a session id 927 that will be returned in responseCallback to match command with response. 928 Only allowed in userdebug builds. This effect is global for all clients of LocationAPI 929 responseCallback returns: 930 LOCATION_ERROR_SUCCESS if successful 931 LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid 932 LOCATION_ERROR_NOT_SUPPORTED if build is not userdebug */ 933 uint32_t gnssDeleteAidingData(GnssAidingData& data); 934 }; 935 936 #endif /* LOCATION_H */ 937