1 /* Copyright (c) 2018-2019 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 LOCATIONDATATYPES_H 30 #define LOCATIONDATATYPES_H 31 32 #include <vector> 33 #include <stdint.h> 34 #include <functional> 35 #include <list> 36 #include <string.h> 37 38 #define GNSS_NI_REQUESTOR_MAX (256) 39 #define GNSS_NI_MESSAGE_ID_MAX (2048) 40 #define GNSS_SV_MAX (176) 41 #define GNSS_MEASUREMENTS_MAX (128) 42 #define GNSS_UTC_TIME_OFFSET (3657) 43 44 #define GNSS_BUGREPORT_GPS_MIN (1) 45 #define GNSS_BUGREPORT_SBAS_MIN (120) 46 #define GNSS_BUGREPORT_GLO_MIN (1) 47 #define GNSS_BUGREPORT_QZSS_MIN (193) 48 #define GNSS_BUGREPORT_BDS_MIN (1) 49 #define GNSS_BUGREPORT_GAL_MIN (1) 50 #define GNSS_BUGREPORT_NAVIC_MIN (1) 51 52 #define GNSS_MAX_NAME_LENGTH (8) 53 54 typedef enum { 55 LOCATION_ERROR_SUCCESS = 0, 56 LOCATION_ERROR_GENERAL_FAILURE, 57 LOCATION_ERROR_CALLBACK_MISSING, 58 LOCATION_ERROR_INVALID_PARAMETER, 59 LOCATION_ERROR_ID_EXISTS, 60 LOCATION_ERROR_ID_UNKNOWN, 61 LOCATION_ERROR_ALREADY_STARTED, 62 LOCATION_ERROR_GEOFENCES_AT_MAX, 63 LOCATION_ERROR_NOT_SUPPORTED 64 } LocationError; 65 66 // Flags to indicate which values are valid in a Location 67 typedef uint16_t LocationFlagsMask; 68 typedef enum { 69 LOCATION_HAS_LAT_LONG_BIT = (1<<0), // location has valid latitude and longitude 70 LOCATION_HAS_ALTITUDE_BIT = (1<<1), // location has valid altitude 71 LOCATION_HAS_SPEED_BIT = (1<<2), // location has valid speed 72 LOCATION_HAS_BEARING_BIT = (1<<3), // location has valid bearing 73 LOCATION_HAS_ACCURACY_BIT = (1<<4), // location has valid accuracy 74 LOCATION_HAS_VERTICAL_ACCURACY_BIT = (1<<5), // location has valid vertical accuracy 75 LOCATION_HAS_SPEED_ACCURACY_BIT = (1<<6), // location has valid speed accuracy 76 LOCATION_HAS_BEARING_ACCURACY_BIT = (1<<7), // location has valid bearing accuracy 77 LOCATION_HAS_SPOOF_MASK = (1<<8), // location has valid spoof mask 78 } LocationFlagsBits; 79 80 typedef uint16_t LocationTechnologyMask; 81 typedef enum { 82 LOCATION_TECHNOLOGY_GNSS_BIT = (1<<0), // location was calculated using GNSS 83 LOCATION_TECHNOLOGY_CELL_BIT = (1<<1), // location was calculated using Cell 84 LOCATION_TECHNOLOGY_WIFI_BIT = (1<<2), // location was calculated using WiFi 85 LOCATION_TECHNOLOGY_SENSORS_BIT = (1<<3), // location was calculated using Sensors 86 } LocationTechnologyBits; 87 88 typedef uint32_t LocationSpoofMask; 89 typedef enum { 90 LOCATION_POSTION_SPOOFED = (1<<0), // location position spoofed 91 LOCATION_TIME_SPOOFED = (1<<1), // location time spoofed 92 LOCATION_NAVIGATION_DATA_SPOOFED = (1<<2), // location navigation data spoofed 93 } LocationSpoofBits; 94 95 typedef enum { 96 LOCATION_RELIABILITY_NOT_SET = 0, 97 LOCATION_RELIABILITY_VERY_LOW, 98 LOCATION_RELIABILITY_LOW, 99 LOCATION_RELIABILITY_MEDIUM, 100 LOCATION_RELIABILITY_HIGH, 101 } LocationReliability; 102 103 typedef uint32_t GnssLocationNavSolutionMask; 104 typedef enum { 105 LOCATION_SBAS_CORRECTION_IONO_BIT = (1<<0), // SBAS ionospheric correction is used 106 LOCATION_SBAS_CORRECTION_FAST_BIT = (1<<1), // SBAS fast correction is used 107 LOCATION_SBAS_CORRECTION_LONG_BIT = (1<<2), // SBAS long-tem correction is used 108 LOCATION_SBAS_INTEGRITY_BIT = (1<<3), // SBAS integrity information is used 109 LOCATION_NAV_CORRECTION_DGNSS_BIT = (1<<4), // Position Report is DGNSS corrected 110 LOCATION_NAV_CORRECTION_RTK_BIT = (1<<5), // Position Report is RTK corrected 111 LOCATION_NAV_CORRECTION_PPP_BIT = (1<<6) // Position Report is PPP corrected 112 } GnssLocationNavSolutionBits; 113 114 typedef uint32_t GnssLocationPosTechMask; 115 typedef enum { 116 LOCATION_POS_TECH_DEFAULT_BIT = 0, 117 LOCATION_POS_TECH_SATELLITE_BIT = (1<<0), 118 LOCATION_POS_TECH_CELLID_BIT = (1<<1), 119 LOCATION_POS_TECH_WIFI_BIT = (1<<2), 120 LOCATION_POS_TECH_SENSORS_BIT = (1<<3), 121 LOCATION_POS_TECH_REFERENCE_LOCATION_BIT = (1<<4), 122 LOCATION_POS_TECH_INJECTED_COARSE_POSITION_BIT = (1<<5), 123 LOCATION_POS_TECH_AFLT_BIT = (1<<6), 124 LOCATION_POS_TECH_HYBRID_BIT = (1<<7), 125 LOCATION_POS_TECH_PPE_BIT = (1<<8) 126 } GnssLocationPosTechBits; 127 128 typedef uint32_t GnssLocationPosDataMask; 129 typedef enum { 130 LOCATION_NAV_DATA_HAS_LONG_ACCEL_BIT = (1<<0), // Navigation data has Forward Acceleration 131 LOCATION_NAV_DATA_HAS_LAT_ACCEL_BIT = (1<<1), // Navigation data has Sideward Acceleration 132 LOCATION_NAV_DATA_HAS_VERT_ACCEL_BIT = (1<<2), // Navigation data has Vertical Acceleration 133 LOCATION_NAV_DATA_HAS_YAW_RATE_BIT = (1<<3), // Navigation data has Heading Rate 134 LOCATION_NAV_DATA_HAS_PITCH_BIT = (1<<4), // Navigation data has Body pitch 135 // Navigation data has Forward Acceleration uncertainty 136 LOCATION_NAV_DATA_HAS_LONG_ACCEL_UNC_BIT = (1<<5), 137 // Navigation data has Sideward Acceleration uncertainty 138 LOCATION_NAV_DATA_HAS_LAT_ACCEL_UNC_BIT = (1<<6), 139 // Navigation data has Vertical Acceleration uncertainty 140 LOCATION_NAV_DATA_HAS_VERT_ACCEL_UNC_BIT = (1<<7), 141 // Navigation data has Heading Rate uncertainty 142 LOCATION_NAV_DATA_HAS_YAW_RATE_UNC_BIT = (1<<8), 143 // Navigation data has Body pitch uncertainty 144 LOCATION_NAV_DATA_HAS_PITCH_UNC_BIT = (1<<9) 145 } GnssLocationPosDataBits; 146 147 typedef uint32_t GnssLocationInfoFlagMask; 148 typedef enum { 149 GNSS_LOCATION_INFO_ALTITUDE_MEAN_SEA_LEVEL_BIT = (1<<0), // valid altitude mean sea level 150 GNSS_LOCATION_INFO_DOP_BIT = (1<<1), // valid pdop, hdop, and vdop 151 GNSS_LOCATION_INFO_MAGNETIC_DEVIATION_BIT = (1<<2), // valid magnetic deviation 152 GNSS_LOCATION_INFO_HOR_RELIABILITY_BIT = (1<<3), // valid horizontal reliability 153 GNSS_LOCATION_INFO_VER_RELIABILITY_BIT = (1<<4), // valid vertical reliability 154 GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MAJOR_BIT = (1<<5), // valid elipsode semi major 155 GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MINOR_BIT = (1<<6), // valid elipsode semi minor 156 GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_AZIMUTH_BIT = (1<<7), // valid accuracy elipsode azimuth 157 GNSS_LOCATION_INFO_GNSS_SV_USED_DATA_BIT = (1<<8), // valid svUsedInPosition, 158 // numOfMeasReceived 159 // and measUsageInfo 160 GNSS_LOCATION_INFO_NAV_SOLUTION_MASK_BIT = (1<<9), // valid navSolutionMask 161 GNSS_LOCATION_INFO_POS_TECH_MASK_BIT = (1<<10),// valid LocPosTechMask 162 GNSS_LOCATION_INFO_SV_SOURCE_INFO_BIT = (1<<11),// valid LocSvInfoSource 163 GNSS_LOCATION_INFO_POS_DYNAMICS_DATA_BIT = (1<<12),// valid position dynamics data 164 GNSS_LOCATION_INFO_EXT_DOP_BIT = (1<<13),// valid gdop, tdop 165 GNSS_LOCATION_INFO_NORTH_STD_DEV_BIT = (1<<14),// valid North standard deviation 166 GNSS_LOCATION_INFO_EAST_STD_DEV_BIT = (1<<15),// valid East standard deviation 167 GNSS_LOCATION_INFO_NORTH_VEL_BIT = (1<<16),// valid North Velocity 168 GNSS_LOCATION_INFO_EAST_VEL_BIT = (1<<17),// valid East Velocity 169 GNSS_LOCATION_INFO_UP_VEL_BIT = (1<<18),// valid Up Velocity 170 GNSS_LOCATION_INFO_NORTH_VEL_UNC_BIT = (1<<19),// valid North Velocity Uncertainty 171 GNSS_LOCATION_INFO_EAST_VEL_UNC_BIT = (1<<20),// valid East Velocity Uncertainty 172 GNSS_LOCATION_INFO_UP_VEL_UNC_BIT = (1<<21),// valid Up Velocity Uncertainty 173 GNSS_LOCATION_INFO_LEAP_SECONDS_BIT = (1<<22),// valid leap seconds 174 GNSS_LOCATION_INFO_TIME_UNC_BIT = (1<<23),// valid time uncertainty 175 GNSS_LOCATION_INFO_NUM_SV_USED_IN_POSITION_BIT = (1<<24) // number of SV used in position 176 177 } GnssLocationInfoFlagBits; 178 179 typedef enum { 180 GEOFENCE_BREACH_ENTER = 0, 181 GEOFENCE_BREACH_EXIT, 182 GEOFENCE_BREACH_DWELL_IN, 183 GEOFENCE_BREACH_DWELL_OUT, 184 GEOFENCE_BREACH_UNKNOWN, 185 } GeofenceBreachType; 186 187 typedef uint16_t GeofenceBreachTypeMask; 188 typedef enum { 189 GEOFENCE_BREACH_ENTER_BIT = (1<<0), 190 GEOFENCE_BREACH_EXIT_BIT = (1<<1), 191 GEOFENCE_BREACH_DWELL_IN_BIT = (1<<2), 192 GEOFENCE_BREACH_DWELL_OUT_BIT = (1<<3), 193 } GeofenceBreachTypeBits; 194 195 typedef enum { 196 GEOFENCE_STATUS_AVAILABILE_NO = 0, 197 GEOFENCE_STATUS_AVAILABILE_YES, 198 } GeofenceStatusAvailable; 199 200 typedef uint32_t LocationCapabilitiesMask; 201 typedef enum { 202 // supports startTracking API with minInterval param 203 LOCATION_CAPABILITIES_TIME_BASED_TRACKING_BIT = (1<<0), 204 // supports startBatching API with minInterval param 205 LOCATION_CAPABILITIES_TIME_BASED_BATCHING_BIT = (1<<1), 206 // supports startTracking API with minDistance param 207 LOCATION_CAPABILITIES_DISTANCE_BASED_TRACKING_BIT = (1<<2), 208 // supports startBatching API with minDistance param 209 LOCATION_CAPABILITIES_DISTANCE_BASED_BATCHING_BIT = (1<<3), 210 // supports addGeofences API 211 LOCATION_CAPABILITIES_GEOFENCE_BIT = (1<<4), 212 // supports GnssMeasurementsCallback 213 LOCATION_CAPABILITIES_GNSS_MEASUREMENTS_BIT = (1<<5), 214 // supports startTracking/startBatching API with LocationOptions.mode of MSB (Ms Based) 215 LOCATION_CAPABILITIES_GNSS_MSB_BIT = (1<<6), 216 // supports startTracking/startBatching API with LocationOptions.mode of MSA (MS Assisted) 217 LOCATION_CAPABILITIES_GNSS_MSA_BIT = (1<<7), 218 // supports debug nmea sentences in the debugNmeaCallback 219 LOCATION_CAPABILITIES_DEBUG_NMEA_BIT = (1<<8), 220 // support outdoor trip batching 221 LOCATION_CAPABILITIES_OUTDOOR_TRIP_BATCHING_BIT = (1<<9), 222 // support constellation enablement 223 LOCATION_CAPABILITIES_CONSTELLATION_ENABLEMENT_BIT = (1<<10), 224 // support agpm 225 LOCATION_CAPABILITIES_AGPM_BIT = (1<<11), 226 // support location privacy 227 LOCATION_CAPABILITIES_PRIVACY_BIT = (1<<12), 228 } LocationCapabilitiesBits; 229 230 typedef enum { 231 LOCATION_TECHNOLOGY_TYPE_GNSS = 0, 232 } LocationTechnologyType; 233 234 // Configures how GPS is locked when GPS is disabled (through GnssDisable) 235 enum { 236 GNSS_CONFIG_GPS_LOCK_NONE = 0, // gps is not locked when GPS is disabled (GnssDisable) 237 GNSS_CONFIG_GPS_LOCK_MO, // gps mobile originated (MO) is locked when GPS is disabled 238 GNSS_CONFIG_GPS_LOCK_NI, // gps network initiated (NI) is locked when GPS is disabled 239 GNSS_CONFIG_GPS_LOCK_MO_AND_NI,// gps MO and NI is locked when GPS is disabled 240 }; 241 typedef int32_t GnssConfigGpsLock; 242 243 // SUPL version 244 typedef enum { 245 GNSS_CONFIG_SUPL_VERSION_1_0_0 = 1, 246 GNSS_CONFIG_SUPL_VERSION_2_0_0, 247 GNSS_CONFIG_SUPL_VERSION_2_0_2, 248 } GnssConfigSuplVersion; 249 250 // LTE Positioning Profile 251 typedef enum { 252 GNSS_CONFIG_LPP_PROFILE_RRLP_ON_LTE = 0, // RRLP on LTE (Default) 253 GNSS_CONFIG_LPP_PROFILE_USER_PLANE, // LPP User Plane (UP) on LTE 254 GNSS_CONFIG_LPP_PROFILE_CONTROL_PLANE, // LPP_Control_Plane (CP) 255 GNSS_CONFIG_LPP_PROFILE_USER_PLANE_AND_CONTROL_PLANE, // Both LPP UP and CP 256 } GnssConfigLppProfile; 257 258 // Technology for LPPe Control Plane 259 typedef uint16_t GnssConfigLppeControlPlaneMask; 260 typedef enum { 261 GNSS_CONFIG_LPPE_CONTROL_PLANE_DBH_BIT = (1<<0), // DBH 262 GNSS_CONFIG_LPPE_CONTROL_PLANE_WLAN_AP_MEASUREMENTS_BIT = (1<<1), // WLAN_AP_MEASUREMENTS 263 GNSS_CONFIG_LPPE_CONTROL_PLANE_SRN_AP_MEASUREMENTS_BIT = (1<<2), // SRN_AP_MEASUREMENTS 264 GNSS_CONFIG_LPPE_CONTROL_PLANE_SENSOR_BARO_MEASUREMENTS_BIT = (1<<3), 265 // SENSOR_BARO_MEASUREMENTS 266 } GnssConfigLppeControlPlaneBits; 267 268 // Technology for LPPe User Plane 269 typedef uint16_t GnssConfigLppeUserPlaneMask; 270 typedef enum { 271 GNSS_CONFIG_LPPE_USER_PLANE_DBH_BIT = (1<<0), // DBH 272 GNSS_CONFIG_LPPE_USER_PLANE_WLAN_AP_MEASUREMENTS_BIT = (1<<1), // WLAN_AP_MEASUREMENTS 273 GNSS_CONFIG_LPPE_USER_PLANE_SRN_AP_MEASUREMENTS_BIT = (1<<2), // SRN_AP_MEASUREMENTS 274 GNSS_CONFIG_LPPE_USER_PLANE_SENSOR_BARO_MEASUREMENTS_BIT = (1<<3), 275 // SENSOR_BARO_MEASUREMENTS 276 } GnssConfigLppeUserPlaneBits; 277 278 // Positioning Protocol on A-GLONASS system 279 typedef uint16_t GnssConfigAGlonassPositionProtocolMask; 280 typedef enum { 281 GNSS_CONFIG_RRC_CONTROL_PLANE_BIT = (1<<0), // RRC Control Plane 282 GNSS_CONFIG_RRLP_USER_PLANE_BIT = (1<<1), // RRLP User Plane 283 GNSS_CONFIG_LLP_USER_PLANE_BIT = (1<<2), // LPP User Plane 284 GNSS_CONFIG_LLP_CONTROL_PLANE_BIT = (1<<3), // LPP Control Plane 285 } GnssConfigAGlonassPositionProtocolBits; 286 287 typedef enum { 288 GNSS_CONFIG_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_NO = 0, 289 GNSS_CONFIG_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_YES, 290 } GnssConfigEmergencyPdnForEmergencySupl; 291 292 typedef enum { 293 GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_NO = 0, 294 GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_YES, 295 } GnssConfigSuplEmergencyServices; 296 297 typedef uint16_t GnssConfigSuplModeMask; 298 typedef enum { 299 GNSS_CONFIG_SUPL_MODE_MSB_BIT = (1<<0), 300 GNSS_CONFIG_SUPL_MODE_MSA_BIT = (1<<1), 301 } GnssConfigSuplModeBits; 302 303 typedef uint32_t GnssConfigFlagsMask; 304 typedef enum { 305 GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT = (1<<0), 306 GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT = (1<<1), 307 GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT = (1<<2), 308 GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT = (1<<3), 309 GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT = (1<<4), 310 GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT = (1<<5), 311 GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT = (1<<6), 312 GNSS_CONFIG_FLAGS_EM_PDN_FOR_EM_SUPL_VALID_BIT = (1<<7), 313 GNSS_CONFIG_FLAGS_SUPL_EM_SERVICES_BIT = (1<<8), 314 GNSS_CONFIG_FLAGS_SUPL_MODE_BIT = (1<<9), 315 GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT = (1<<10), 316 GNSS_CONFIG_FLAGS_EMERGENCY_EXTENSION_SECONDS_BIT = (1<<11), 317 } GnssConfigFlagsBits; 318 319 typedef enum { 320 GNSS_NI_ENCODING_TYPE_NONE = 0, 321 GNSS_NI_ENCODING_TYPE_GSM_DEFAULT, 322 GNSS_NI_ENCODING_TYPE_UTF8, 323 GNSS_NI_ENCODING_TYPE_UCS2, 324 } GnssNiEncodingType; 325 326 typedef enum { 327 GNSS_NI_TYPE_VOICE = 0, 328 GNSS_NI_TYPE_SUPL, 329 GNSS_NI_TYPE_CONTROL_PLANE, 330 GNSS_NI_TYPE_EMERGENCY_SUPL 331 } GnssNiType; 332 333 typedef uint16_t GnssNiOptionsMask; 334 typedef enum { 335 GNSS_NI_OPTIONS_NOTIFICATION_BIT = (1<<0), 336 GNSS_NI_OPTIONS_VERIFICATION_BIT = (1<<1), 337 GNSS_NI_OPTIONS_PRIVACY_OVERRIDE_BIT = (1<<2), 338 } GnssNiOptionsBits; 339 340 typedef enum { 341 GNSS_NI_RESPONSE_ACCEPT = 1, 342 GNSS_NI_RESPONSE_DENY, 343 GNSS_NI_RESPONSE_NO_RESPONSE, 344 GNSS_NI_RESPONSE_IGNORE, 345 } GnssNiResponse; 346 347 typedef enum { 348 GNSS_SV_TYPE_UNKNOWN = 0, 349 GNSS_SV_TYPE_GPS, 350 GNSS_SV_TYPE_SBAS, 351 GNSS_SV_TYPE_GLONASS, 352 GNSS_SV_TYPE_QZSS, 353 GNSS_SV_TYPE_BEIDOU, 354 GNSS_SV_TYPE_GALILEO, 355 GNSS_SV_TYPE_NAVIC, 356 } GnssSvType; 357 358 typedef enum { 359 GNSS_EPH_TYPE_UNKNOWN = 0, 360 GNSS_EPH_TYPE_EPHEMERIS, 361 GNSS_EPH_TYPE_ALMANAC, 362 } GnssEphemerisType; 363 364 typedef enum { 365 GNSS_EPH_SOURCE_UNKNOWN = 0, 366 GNSS_EPH_SOURCE_DEMODULATED, 367 GNSS_EPH_SOURCE_SUPL_PROVIDED, 368 GNSS_EPH_SOURCE_OTHER_SERVER_PROVIDED, 369 GNSS_EPH_SOURCE_LOCAL, 370 } GnssEphemerisSource; 371 372 typedef enum { 373 GNSS_EPH_HEALTH_UNKNOWN = 0, 374 GNSS_EPH_HEALTH_GOOD, 375 GNSS_EPH_HEALTH_BAD, 376 } GnssEphemerisHealth; 377 378 typedef uint16_t GnssSvOptionsMask; 379 typedef enum { 380 GNSS_SV_OPTIONS_HAS_EPHEMER_BIT = (1<<0), 381 GNSS_SV_OPTIONS_HAS_ALMANAC_BIT = (1<<1), 382 GNSS_SV_OPTIONS_USED_IN_FIX_BIT = (1<<2), 383 GNSS_SV_OPTIONS_HAS_CARRIER_FREQUENCY_BIT = (1<<3), 384 } GnssSvOptionsBits; 385 386 typedef enum { 387 GNSS_ASSISTANCE_TYPE_SUPL = 0, 388 GNSS_ASSISTANCE_TYPE_C2K, 389 GNSS_ASSISTANCE_TYPE_SUPL_EIMS, 390 GNSS_ASSISTANCE_TYPE_SUPL_IMS, 391 } GnssAssistanceType; 392 393 typedef enum { 394 GNSS_SUPL_MODE_STANDALONE = 0, 395 GNSS_SUPL_MODE_MSB, 396 GNSS_SUPL_MODE_MSA, 397 } GnssSuplMode; 398 399 typedef enum { 400 BATCHING_MODE_ROUTINE = 0, // positions are reported when batched positions memory is full 401 BATCHING_MODE_TRIP, // positions are reported when a certain distance is covered 402 BATCHING_MODE_NO_AUTO_REPORT // no report of positions automatically, instead queried on demand 403 } BatchingMode; 404 405 typedef enum { 406 BATCHING_STATUS_TRIP_COMPLETED = 0, 407 BATCHING_STATUS_POSITION_AVAILABE, 408 BATCHING_STATUS_POSITION_UNAVAILABLE 409 } BatchingStatus; 410 411 typedef uint16_t GnssMeasurementsAdrStateMask; 412 typedef enum { 413 GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_UNKNOWN = 0, 414 GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_VALID_BIT = (1<<0), 415 GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_RESET_BIT = (1<<1), 416 GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_CYCLE_SLIP_BIT = (1<<2), 417 GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_HALF_CYCLE_RESOLVED_BIT = (1<<3), 418 } GnssMeasurementsAdrStateBits; 419 420 typedef enum { 421 GNSS_MEASUREMENTS_CODE_TYPE_A = 0, 422 GNSS_MEASUREMENTS_CODE_TYPE_B = 1, 423 GNSS_MEASUREMENTS_CODE_TYPE_C = 2, 424 GNSS_MEASUREMENTS_CODE_TYPE_I = 3, 425 GNSS_MEASUREMENTS_CODE_TYPE_L = 4, 426 GNSS_MEASUREMENTS_CODE_TYPE_M = 5, 427 GNSS_MEASUREMENTS_CODE_TYPE_P = 6, 428 GNSS_MEASUREMENTS_CODE_TYPE_Q = 7, 429 GNSS_MEASUREMENTS_CODE_TYPE_S = 8, 430 GNSS_MEASUREMENTS_CODE_TYPE_W = 9, 431 GNSS_MEASUREMENTS_CODE_TYPE_X = 10, 432 GNSS_MEASUREMENTS_CODE_TYPE_Y = 11, 433 GNSS_MEASUREMENTS_CODE_TYPE_Z = 12, 434 GNSS_MEASUREMENTS_CODE_TYPE_N = 13, 435 GNSS_MEASUREMENTS_CODE_TYPE_OTHER = 255, 436 } GnssMeasurementsCodeType; 437 438 typedef uint32_t GnssMeasurementsDataFlagsMask; 439 typedef enum { 440 GNSS_MEASUREMENTS_DATA_SV_ID_BIT = (1<<0), 441 GNSS_MEASUREMENTS_DATA_SV_TYPE_BIT = (1<<1), 442 GNSS_MEASUREMENTS_DATA_STATE_BIT = (1<<2), 443 GNSS_MEASUREMENTS_DATA_RECEIVED_SV_TIME_BIT = (1<<3), 444 GNSS_MEASUREMENTS_DATA_RECEIVED_SV_TIME_UNCERTAINTY_BIT = (1<<4), 445 GNSS_MEASUREMENTS_DATA_CARRIER_TO_NOISE_BIT = (1<<5), 446 GNSS_MEASUREMENTS_DATA_PSEUDORANGE_RATE_BIT = (1<<6), 447 GNSS_MEASUREMENTS_DATA_PSEUDORANGE_RATE_UNCERTAINTY_BIT = (1<<7), 448 GNSS_MEASUREMENTS_DATA_ADR_STATE_BIT = (1<<8), 449 GNSS_MEASUREMENTS_DATA_ADR_BIT = (1<<9), 450 GNSS_MEASUREMENTS_DATA_ADR_UNCERTAINTY_BIT = (1<<10), 451 GNSS_MEASUREMENTS_DATA_CARRIER_FREQUENCY_BIT = (1<<11), 452 GNSS_MEASUREMENTS_DATA_CARRIER_CYCLES_BIT = (1<<12), 453 GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_BIT = (1<<13), 454 GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_UNCERTAINTY_BIT = (1<<14), 455 GNSS_MEASUREMENTS_DATA_MULTIPATH_INDICATOR_BIT = (1<<15), 456 GNSS_MEASUREMENTS_DATA_SIGNAL_TO_NOISE_RATIO_BIT = (1<<16), 457 GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT = (1<<17), 458 } GnssMeasurementsDataFlagsBits; 459 460 typedef uint32_t GnssMeasurementsStateMask; 461 typedef enum { 462 GNSS_MEASUREMENTS_STATE_UNKNOWN_BIT = 0, 463 GNSS_MEASUREMENTS_STATE_CODE_LOCK_BIT = (1<<0), 464 GNSS_MEASUREMENTS_STATE_BIT_SYNC_BIT = (1<<1), 465 GNSS_MEASUREMENTS_STATE_SUBFRAME_SYNC_BIT = (1<<2), 466 GNSS_MEASUREMENTS_STATE_TOW_DECODED_BIT = (1<<3), 467 GNSS_MEASUREMENTS_STATE_MSEC_AMBIGUOUS_BIT = (1<<4), 468 GNSS_MEASUREMENTS_STATE_SYMBOL_SYNC_BIT = (1<<5), 469 GNSS_MEASUREMENTS_STATE_GLO_STRING_SYNC_BIT = (1<<6), 470 GNSS_MEASUREMENTS_STATE_GLO_TOD_DECODED_BIT = (1<<7), 471 GNSS_MEASUREMENTS_STATE_BDS_D2_BIT_SYNC_BIT = (1<<8), 472 GNSS_MEASUREMENTS_STATE_BDS_D2_SUBFRAME_SYNC_BIT = (1<<9), 473 GNSS_MEASUREMENTS_STATE_GAL_E1BC_CODE_LOCK_BIT = (1<<10), 474 GNSS_MEASUREMENTS_STATE_GAL_E1C_2ND_CODE_LOCK_BIT = (1<<11), 475 GNSS_MEASUREMENTS_STATE_GAL_E1B_PAGE_SYNC_BIT = (1<<12), 476 GNSS_MEASUREMENTS_STATE_SBAS_SYNC_BIT = (1<<13), 477 GNSS_MEASUREMENTS_STATE_TOW_KNOWN_BIT = (1<<14), 478 GNSS_MEASUREMENTS_STATE_GLO_TOD_KNOWN_BIT = (1<<15), 479 GNSS_MEASUREMENTS_STATE_2ND_CODE_LOCK_BIT = (1<<16), 480 } GnssMeasurementsStateBits; 481 482 typedef enum { 483 GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_UNKNOWN = 0, 484 GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_PRESENT, 485 GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_NOT_PRESENT, 486 } GnssMeasurementsMultipathIndicator; 487 488 typedef uint32_t GnssMeasurementsClockFlagsMask; 489 typedef enum { 490 GNSS_MEASUREMENTS_CLOCK_FLAGS_LEAP_SECOND_BIT = (1<<0), 491 GNSS_MEASUREMENTS_CLOCK_FLAGS_TIME_BIT = (1<<1), 492 GNSS_MEASUREMENTS_CLOCK_FLAGS_TIME_UNCERTAINTY_BIT = (1<<2), 493 GNSS_MEASUREMENTS_CLOCK_FLAGS_FULL_BIAS_BIT = (1<<3), 494 GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_BIT = (1<<4), 495 GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_UNCERTAINTY_BIT = (1<<5), 496 GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_BIT = (1<<6), 497 GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_UNCERTAINTY_BIT = (1<<7), 498 GNSS_MEASUREMENTS_CLOCK_FLAGS_HW_CLOCK_DISCONTINUITY_COUNT_BIT = (1<<8), 499 } GnssMeasurementsClockFlagsBits; 500 501 typedef uint32_t GnssAidingDataSvMask; 502 typedef enum { 503 GNSS_AIDING_DATA_SV_EPHEMERIS_BIT = (1<<0), // ephemeris 504 GNSS_AIDING_DATA_SV_ALMANAC_BIT = (1<<1), // almanac 505 GNSS_AIDING_DATA_SV_HEALTH_BIT = (1<<2), // health 506 GNSS_AIDING_DATA_SV_DIRECTION_BIT = (1<<3), // direction 507 GNSS_AIDING_DATA_SV_STEER_BIT = (1<<4), // steer 508 GNSS_AIDING_DATA_SV_ALMANAC_CORR_BIT = (1<<5), // almanac correction 509 GNSS_AIDING_DATA_SV_BLACKLIST_BIT = (1<<6), // blacklist SVs 510 GNSS_AIDING_DATA_SV_SA_DATA_BIT = (1<<7), // sensitivity assistance data 511 GNSS_AIDING_DATA_SV_NO_EXIST_BIT = (1<<8), // SV does not exist 512 GNSS_AIDING_DATA_SV_IONOSPHERE_BIT = (1<<9), // ionosphere correction 513 GNSS_AIDING_DATA_SV_TIME_BIT = (1<<10),// reset satellite time 514 GNSS_AIDING_DATA_SV_MB_DATA = (1<<11),// delete multiband data 515 GNSS_AIDING_DATA_SV_POLY_BIT = (1<<12),// poly 516 } GnssAidingDataSvBits; 517 518 typedef uint32_t GnssAidingDataSvTypeMask; 519 typedef enum { 520 GNSS_AIDING_DATA_SV_TYPE_GPS_BIT = (1<<0), 521 GNSS_AIDING_DATA_SV_TYPE_GLONASS_BIT = (1<<1), 522 GNSS_AIDING_DATA_SV_TYPE_QZSS_BIT = (1<<2), 523 GNSS_AIDING_DATA_SV_TYPE_BEIDOU_BIT = (1<<3), 524 GNSS_AIDING_DATA_SV_TYPE_GALILEO_BIT = (1<<4), 525 GNSS_AIDING_DATA_SV_TYPE_NAVIC_BIT = (1<<5), 526 } GnssAidingDataSvTypeBits; 527 528 /* Gnss constellation type mask */ 529 typedef uint16_t GnssConstellationTypeMask; 530 typedef enum { 531 GNSS_CONSTELLATION_TYPE_GPS_BIT = (1<<0), 532 GNSS_CONSTELLATION_TYPE_GLONASS_BIT = (1<<1), 533 GNSS_CONSTELLATION_TYPE_QZSS_BIT = (1<<2), 534 GNSS_CONSTELLATION_TYPE_BEIDOU_BIT = (1<<3), 535 GNSS_CONSTELLATION_TYPE_GALILEO_BIT = (1<<4), 536 GNSS_CONSTELLATION_TYPE_SBAS_BIT = (1<<5), 537 GNSS_CONSTELLATION_TYPE_NAVIC_BIT = (1<<6) 538 } GnssConstellationTypeBits; 539 540 #define GNSS_CONSTELLATION_TYPE_MASK_ALL\ 541 (GNSS_CONSTELLATION_TYPE_GPS_BIT | GNSS_CONSTELLATION_TYPE_GLONASS_BIT |\ 542 GNSS_CONSTELLATION_TYPE_QZSS_BIT | GNSS_CONSTELLATION_TYPE_BEIDOU_BIT |\ 543 GNSS_CONSTELLATION_TYPE_GALILEO_BIT | GNSS_CONSTELLATION_TYPE_SBAS_BIT |\ 544 GNSS_CONSTELLATION_TYPE_NAVIC_BIT) 545 546 /** GNSS Signal Type and RF Band */ 547 typedef uint32_t GnssSignalTypeMask; 548 typedef enum { 549 /** GPS L1CA Signal */ 550 GNSS_SIGNAL_GPS_L1CA = (1<<0), 551 /** GPS L1C Signal */ 552 GNSS_SIGNAL_GPS_L1C = (1<<1), 553 /** GPS L2 RF Band */ 554 GNSS_SIGNAL_GPS_L2 = (1<<2), 555 /** GPS L5 RF Band */ 556 GNSS_SIGNAL_GPS_L5 = (1<<3), 557 /** GLONASS G1 (L1OF) RF Band */ 558 GNSS_SIGNAL_GLONASS_G1 = (1<<4), 559 /** GLONASS G2 (L2OF) RF Band */ 560 GNSS_SIGNAL_GLONASS_G2 = (1<<5), 561 /** GALILEO E1 RF Band */ 562 GNSS_SIGNAL_GALILEO_E1 = (1<<6), 563 /** GALILEO E5A RF Band */ 564 GNSS_SIGNAL_GALILEO_E5A = (1<<7), 565 /** GALILEO E5B RF Band */ 566 GNSS_SIGNAL_GALILEO_E5B = (1<<8), 567 /** BEIDOU B1_I RF Band */ 568 GNSS_SIGNAL_BEIDOU_B1I = (1<<9), 569 /** BEIDOU B1C RF Band */ 570 GNSS_SIGNAL_BEIDOU_B1C = (1<<10), 571 /** BEIDOU B2_I RF Band */ 572 GNSS_SIGNAL_BEIDOU_B2I = (1<<11), 573 /** BEIDOU B2A_I RF Band */ 574 GNSS_SIGNAL_BEIDOU_B2AI = (1<<12), 575 /** QZSS L1CA RF Band */ 576 GNSS_SIGNAL_QZSS_L1CA = (1<<13), 577 /** QZSS L1S RF Band */ 578 GNSS_SIGNAL_QZSS_L1S = (1<<14), 579 /** QZSS L2 RF Band */ 580 GNSS_SIGNAL_QZSS_L2 = (1<<15), 581 /** QZSS L5 RF Band */ 582 GNSS_SIGNAL_QZSS_L5 = (1<<16), 583 /** SBAS L1 RF Band */ 584 GNSS_SIGNAL_SBAS_L1 = (1<<17), 585 /** NAVIC L5 RF Band */ 586 GNSS_SIGNAL_NAVIC_L5 = (1<<18) 587 } GnssSignalTypeBits; 588 589 #define GNSS_SIGNAL_TYPE_MASK_ALL\ 590 (GNSS_SIGNAL_GPS_L1CA | GNSS_SIGNAL_GPS_L1C | GNSS_SIGNAL_GPS_L2 |\ 591 GNSS_SIGNAL_GPS_L5| GNSS_SIGNAL_GLONASS_G1 | GNSS_SIGNAL_GLONASS_G2 |\ 592 GNSS_SIGNAL_GALILEO_E1 | GNSS_SIGNAL_GALILEO_E5A | GNSS_SIGNAL_GALILEO_E5B |\ 593 GNSS_SIGNAL_BEIDOU_B1I | GNSS_SIGNAL_BEIDOU_B1C | GNSS_SIGNAL_BEIDOU_B2I|\ 594 GNSS_SIGNAL_BEIDOU_B2AI | GNSS_SIGNAL_QZSS_L1CA | GNSS_SIGNAL_QZSS_L1S |\ 595 GNSS_SIGNAL_QZSS_L2| GNSS_SIGNAL_QZSS_L5 | GNSS_SIGNAL_SBAS_L1 |\ 596 GNSS_SIGNAL_NAVIC_L5) 597 598 typedef enum 599 { 600 GNSS_LOC_SV_SYSTEM_UNKNOWN = 0, 601 /** unknown sv system. */ 602 GNSS_LOC_SV_SYSTEM_GPS = 1, 603 /**< GPS satellite. */ 604 GNSS_LOC_SV_SYSTEM_GALILEO = 2, 605 /**< GALILEO satellite. */ 606 GNSS_LOC_SV_SYSTEM_SBAS = 3, 607 /**< SBAS satellite. */ 608 GNSS_LOC_SV_SYSTEM_GLONASS = 4, 609 /**< GLONASS satellite. */ 610 GNSS_LOC_SV_SYSTEM_BDS = 5, 611 /**< BDS satellite. */ 612 GNSS_LOC_SV_SYSTEM_QZSS = 6, 613 /**< QZSS satellite. */ 614 GNSS_LOC_SV_SYSTEM_NAVIC = 7 615 /**< QZSS satellite. */ 616 } Gnss_LocSvSystemEnumType; 617 618 typedef enum { 619 GNSS_LOC_SIGNAL_TYPE_GPS_L1CA = 0, /**< GPS L1CA Signal */ 620 GNSS_LOC_SIGNAL_TYPE_GPS_L1C = 1, /**< GPS L1C Signal */ 621 GNSS_LOC_SIGNAL_TYPE_GPS_L2C_L = 2, /**< GPS L2C_L RF Band */ 622 GNSS_LOC_SIGNAL_TYPE_GPS_L5_Q = 3, /**< GPS L5_Q RF Band */ 623 GNSS_LOC_SIGNAL_TYPE_GLONASS_G1 = 4, /**< GLONASS G1 (L1OF) RF Band */ 624 GNSS_LOC_SIGNAL_TYPE_GLONASS_G2 = 5, /**< GLONASS G2 (L2OF) RF Band */ 625 GNSS_LOC_SIGNAL_TYPE_GALILEO_E1_C = 6, /**< GALILEO E1_C RF Band */ 626 GNSS_LOC_SIGNAL_TYPE_GALILEO_E5A_Q = 7, /**< GALILEO E5A_Q RF Band */ 627 GNSS_LOC_SIGNAL_TYPE_GALILEO_E5B_Q = 8, /**< GALILEO E5B_Q RF Band */ 628 GNSS_LOC_SIGNAL_TYPE_BEIDOU_B1_I = 9, /**< BEIDOU B1_I RF Band */ 629 GNSS_LOC_SIGNAL_TYPE_BEIDOU_B1C = 10, /**< BEIDOU B1C RF Band */ 630 GNSS_LOC_SIGNAL_TYPE_BEIDOU_B2_I = 11, /**< BEIDOU B2_I RF Band */ 631 GNSS_LOC_SIGNAL_TYPE_BEIDOU_B2A_I = 12, /**< BEIDOU B2A_I RF Band */ 632 GNSS_LOC_SIGNAL_TYPE_QZSS_L1CA = 13, /**< QZSS L1CA RF Band */ 633 GNSS_LOC_SIGNAL_TYPE_QZSS_L1S = 14, /**< QZSS L1S RF Band */ 634 GNSS_LOC_SIGNAL_TYPE_QZSS_L2C_L = 15, /**< QZSS L2C_L RF Band */ 635 GNSS_LOC_SIGNAL_TYPE_QZSS_L5_Q = 16, /**< QZSS L5_Q RF Band */ 636 GNSS_LOC_SIGNAL_TYPE_SBAS_L1_CA = 17, /**< SBAS L1_CA RF Band */ 637 GNSS_LOC_SIGNAL_TYPE_NAVIC_L5 = 18, /**< NAVIC L5 RF Band */ 638 GNSS_LOC_MAX_NUMBER_OF_SIGNAL_TYPES = 19 /**< Maximum number of signal types */ 639 } Gnss_LocSignalEnumType; 640 641 typedef uint64_t GnssDataMask; 642 typedef enum { 643 // Jammer Indicator is available 644 GNSS_LOC_DATA_JAMMER_IND_BIT = (1ULL << 0), 645 // AGC is available 646 GNSS_LOC_DATA_AGC_BIT = (1ULL << 1) 647 } GnssDataBits; 648 649 typedef uint32_t GnssSystemTimeStructTypeFlags; 650 typedef enum { 651 GNSS_SYSTEM_TIME_WEEK_VALID = (1 << 0), 652 GNSS_SYSTEM_TIME_WEEK_MS_VALID = (1 << 1), 653 GNSS_SYSTEM_CLK_TIME_BIAS_VALID = (1 << 2), 654 GNSS_SYSTEM_CLK_TIME_BIAS_UNC_VALID = (1 << 3), 655 GNSS_SYSTEM_REF_FCOUNT_VALID = (1 << 4), 656 GNSS_SYSTEM_NUM_CLOCK_RESETS_VALID = (1 << 5) 657 } GnssSystemTimeTypeBits; 658 659 typedef uint32_t GnssGloTimeStructTypeFlags; 660 typedef enum { 661 GNSS_CLO_DAYS_VALID = (1 << 0), 662 GNSS_GLO_MSEC_VALID = (1 << 1), 663 GNSS_GLO_CLK_TIME_BIAS_VALID = (1 << 2), 664 GNSS_GLO_CLK_TIME_BIAS_UNC_VALID = (1 << 3), 665 GNSS_GLO_REF_FCOUNT_VALID = (1 << 4), 666 GNSS_GLO_NUM_CLOCK_RESETS_VALID = (1 << 5), 667 GNSS_GLO_FOUR_YEAR_VALID = (1 << 6) 668 } GnssGloTimeTypeBits; 669 670 typedef struct { 671 GnssAidingDataSvMask svMask; // bitwise OR of GnssAidingDataSvBits 672 GnssAidingDataSvTypeMask svTypeMask; // bitwise OR of GnssAidingDataSvTypeBits 673 } GnssAidingDataSv; 674 675 typedef uint32_t GnssAidingDataCommonMask; 676 typedef enum { 677 GNSS_AIDING_DATA_COMMON_POSITION_BIT = (1<<0), // position estimate 678 GNSS_AIDING_DATA_COMMON_TIME_BIT = (1<<1), // reset all clock values 679 GNSS_AIDING_DATA_COMMON_UTC_BIT = (1<<2), // UTC estimate 680 GNSS_AIDING_DATA_COMMON_RTI_BIT = (1<<3), // RTI 681 GNSS_AIDING_DATA_COMMON_FREQ_BIAS_EST_BIT = (1<<4), // frequency bias estimate 682 GNSS_AIDING_DATA_COMMON_CELLDB_BIT = (1<<5), // all celldb info 683 } GnssAidingDataCommonBits; 684 685 typedef struct { 686 GnssAidingDataCommonMask mask; // bitwise OR of GnssAidingDataCommonBits 687 } GnssAidingDataCommon; 688 689 typedef struct { 690 bool deleteAll; // if true, delete all aiding data and ignore other params 691 GnssAidingDataSv sv; // SV specific aiding data 692 GnssAidingDataCommon common; // common aiding data 693 } GnssAidingData; 694 695 typedef struct { 696 uint32_t size; // set to sizeof(Location) 697 LocationFlagsMask flags; // bitwise OR of LocationFlagsBits to mark which params are valid 698 uint64_t timestamp; // UTC timestamp for location fix, milliseconds since January 1, 1970 699 double latitude; // in degrees 700 double longitude; // in degrees 701 double altitude; // in meters above the WGS 84 reference ellipsoid 702 float speed; // in meters per second 703 float bearing; // in degrees; range [0, 360) 704 float accuracy; // in meters 705 float verticalAccuracy; // in meters 706 float speedAccuracy; // in meters/second 707 float bearingAccuracy; // in degrees (0 to 359.999) 708 LocationTechnologyMask techMask; 709 LocationSpoofMask spoofMask; 710 } Location; 711 712 struct LocationOptions { 713 uint32_t size; // set to sizeof(LocationOptions) 714 uint32_t minInterval; // in milliseconds 715 uint32_t minDistance; // in meters. if minDistance > 0, gnssSvCallback/gnssNmeaCallback/ 716 // gnssMeasurementsCallback may not be called 717 GnssSuplMode mode; // Standalone/MS-Based/MS-Assisted 718 LocationOptionsLocationOptions719 inline LocationOptions() : 720 size(0), minInterval(0), minDistance(0), mode(GNSS_SUPL_MODE_STANDALONE) {} 721 }; 722 723 typedef enum { 724 GNSS_POWER_MODE_INVALID = 0, 725 GNSS_POWER_MODE_M1, /* Improved Accuracy Mode */ 726 GNSS_POWER_MODE_M2, /* Normal Mode */ 727 GNSS_POWER_MODE_M3, /* Background Mode */ 728 GNSS_POWER_MODE_M4, /* Background Mode */ 729 GNSS_POWER_MODE_M5 /* Background Mode */ 730 } GnssPowerMode; 731 732 struct TrackingOptions : LocationOptions { 733 GnssPowerMode powerMode; /* Power Mode to be used for time based tracking 734 sessions */ 735 uint32_t tbm; /* Time interval between measurements specified in millis. 736 Applicable to background power modes */ 737 TrackingOptionsTrackingOptions738 inline TrackingOptions() : 739 LocationOptions(), powerMode(GNSS_POWER_MODE_INVALID), tbm(0) {} TrackingOptionsTrackingOptions740 inline TrackingOptions(uint32_t s, GnssPowerMode m, uint32_t t) : 741 LocationOptions(), powerMode(m), tbm(t) { LocationOptions::size = s; } TrackingOptionsTrackingOptions742 inline TrackingOptions(const LocationOptions& options) : 743 LocationOptions(options), powerMode(GNSS_POWER_MODE_INVALID), tbm(0) {} setLocationOptionsTrackingOptions744 inline void setLocationOptions(const LocationOptions& options) { 745 minInterval = options.minInterval; 746 minDistance = options.minDistance; 747 mode = options.mode; 748 } getLocationOptionsTrackingOptions749 inline LocationOptions getLocationOptions() { 750 LocationOptions locOption; 751 locOption.size = sizeof(locOption); 752 locOption.minDistance = minDistance; 753 locOption.minInterval = minInterval; 754 locOption.mode = mode; 755 return locOption; 756 } 757 }; 758 759 struct BatchingOptions : LocationOptions { 760 BatchingMode batchingMode; 761 BatchingOptionsBatchingOptions762 inline BatchingOptions() : 763 LocationOptions(), batchingMode(BATCHING_MODE_ROUTINE) {} BatchingOptionsBatchingOptions764 inline BatchingOptions(uint32_t s, BatchingMode m) : 765 LocationOptions(), batchingMode(m) { LocationOptions::size = s; } BatchingOptionsBatchingOptions766 inline BatchingOptions(const LocationOptions& options) : 767 LocationOptions(options), batchingMode(BATCHING_MODE_ROUTINE) {} setLocationOptionsBatchingOptions768 inline void setLocationOptions(const LocationOptions& options) { 769 minInterval = options.minInterval; 770 minDistance = options.minDistance; 771 mode = options.mode; 772 } 773 }; 774 775 typedef struct { 776 uint32_t size; 777 BatchingStatus batchingStatus; 778 } BatchingStatusInfo; 779 780 typedef struct { 781 uint32_t size; // set to sizeof(GeofenceOption) 782 GeofenceBreachTypeMask breachTypeMask; // bitwise OR of GeofenceBreachTypeBits 783 uint32_t responsiveness; // in milliseconds 784 uint32_t dwellTime; // in seconds 785 } GeofenceOption; 786 787 typedef struct { 788 uint32_t size; // set to sizeof(GeofenceInfo) 789 double latitude; // in degrees 790 double longitude; // in degrees 791 double radius; // in meters 792 } GeofenceInfo; 793 794 typedef struct { 795 uint32_t size; // set to sizeof(GeofenceBreachNotification) 796 uint32_t count; // number of ids in array 797 uint32_t* ids; // array of ids that have breached 798 Location location; // location associated with breach 799 GeofenceBreachType type; // type of breach 800 uint64_t timestamp; // timestamp of breach 801 } GeofenceBreachNotification; 802 803 typedef struct { 804 uint32_t size; // set to sizeof(GeofenceBreachNotification) 805 GeofenceStatusAvailable available; // GEOFENCE_STATUS_AVAILABILE_NO/_YES 806 LocationTechnologyType techType; // GNSS 807 } GeofenceStatusNotification; 808 809 typedef struct { 810 uint64_t gpsSvUsedIdsMask; 811 uint64_t gloSvUsedIdsMask; 812 uint64_t galSvUsedIdsMask; 813 uint64_t bdsSvUsedIdsMask; 814 uint64_t qzssSvUsedIdsMask; 815 uint64_t navicSvUsedIdsMask; 816 } GnssLocationSvUsedInPosition; 817 818 typedef struct { 819 /** GnssSignalType mask */ 820 GnssSignalTypeMask gnssSignalType; 821 /** Specifies GNSS Constellation Type */ 822 Gnss_LocSvSystemEnumType gnssConstellation; 823 /** GNSS SV ID. 824 For GPS: 1 to 32 825 For GLONASS: 65 to 96. When slot-number to SV ID mapping is unknown, set as 255. 826 For SBAS: 120 to 151 827 For QZSS-L1CA:193 to 197 828 For BDS: 201 to 237 829 For GAL: 301 to 336 830 For NAVIC: 401 to 414 */ 831 uint16_t gnssSvId; 832 } GnssMeasUsageInfo; 833 834 /** @struct 835 Body Frame parameters 836 */ 837 typedef struct { 838 GnssLocationPosDataMask bodyFrameDataMask; // Contains Body frame LocPosDataMask bits 839 float longAccel; // Forward Acceleration in body frame (m/s2) 840 float latAccel; // Sideward Acceleration in body frame (m/s2) 841 float vertAccel; // Vertical Acceleration in body frame (m/s2) 842 float yawRate; // Heading Rate (Radians/second) 843 float pitch; // Body pitch (Radians) 844 float longAccelUnc; // Uncertainty of Forward Acceleration in body frame 845 float latAccelUnc; // Uncertainty of Side-ward Acceleration in body frame 846 float vertAccelUnc; // Uncertainty of Vertical Acceleration in body frame 847 float yawRateUnc; // Uncertainty of Heading Rate 848 float pitchUnc; // Uncertainty of Body pitch 849 } GnssLocationPositionDynamics; 850 851 typedef struct { 852 /** Validity mask for below fields */ 853 GnssSystemTimeStructTypeFlags validityMask; 854 /** Extended week number at reference tick. 855 Unit: Week. 856 Set to 65535 if week number is unknown. 857 For GPS: 858 Calculated from midnight, Jan. 6, 1980. 859 OTA decoded 10 bit GPS week is extended to map between: 860 [NV6264 to (NV6264 + 1023)]. 861 NV6264: Minimum GPS week number configuration. 862 Default value of NV6264: 1738 863 For BDS: 864 Calculated from 00:00:00 on January 1, 2006 of Coordinated Universal Time (UTC). 865 For GAL: 866 Calculated from 00:00 UT on Sunday August 22, 1999 (midnight between August 21 and August 22). 867 */ 868 uint16_t systemWeek; 869 /** Time in to the current week at reference tick. 870 Unit: Millisecond. Range: 0 to 604799999. 871 Check for systemClkTimeUncMs before use */ 872 uint32_t systemMsec; 873 /** System clock time bias (sub-millisecond) 874 Units: Millisecond 875 Note: System time (TOW Millisecond) = systemMsec - systemClkTimeBias. 876 Check for systemClkTimeUncMs before use. */ 877 float systemClkTimeBias; 878 /** Single sided maximum time bias uncertainty 879 Units: Millisecond */ 880 float systemClkTimeUncMs; 881 /** FCount (free running HW timer) value. Don't use for relative time purpose 882 due to possible discontinuities. 883 Unit: Millisecond */ 884 uint32_t refFCount; 885 /** Number of clock resets/discontinuities detected, affecting the local hardware counter value. */ 886 uint32_t numClockResets; 887 } GnssSystemTimeStructType; 888 889 typedef struct { 890 /** GLONASS day number in four years. Refer to GLONASS ICD. 891 Applicable only for GLONASS and shall be ignored for other constellations. 892 If unknown shall be set to 65535 */ 893 uint16_t gloDays; 894 /** Validity mask for below fields */ 895 GnssGloTimeStructTypeFlags validityMask; 896 /** GLONASS time of day in Millisecond. Refer to GLONASS ICD. 897 Units: Millisecond 898 Check for gloClkTimeUncMs before use */ 899 uint32_t gloMsec; 900 /** GLONASS clock time bias (sub-millisecond) 901 Units: Millisecond 902 Note: GLO time (TOD Millisecond) = gloMsec - gloClkTimeBias. 903 Check for gloClkTimeUncMs before use. */ 904 float gloClkTimeBias; 905 /** Single sided maximum time bias uncertainty 906 Units: Millisecond */ 907 float gloClkTimeUncMs; 908 /** FCount (free running HW timer) value. Don't use for relative time purpose 909 due to possible discontinuities. 910 Unit: Millisecond */ 911 uint32_t refFCount; 912 /** Number of clock resets/discontinuities detected, affecting the local hardware counter value. */ 913 uint32_t numClockResets; 914 /** GLONASS four year number from 1996. Refer to GLONASS ICD. 915 Applicable only for GLONASS and shall be ignored for other constellations. 916 If unknown shall be set to 255 */ 917 uint8_t gloFourYear; 918 } GnssGloTimeStructType; 919 920 typedef union { 921 GnssSystemTimeStructType gpsSystemTime; 922 GnssSystemTimeStructType galSystemTime; 923 GnssSystemTimeStructType bdsSystemTime; 924 GnssSystemTimeStructType qzssSystemTime; 925 GnssGloTimeStructType gloSystemTime; 926 GnssSystemTimeStructType navicSystemTime; 927 } SystemTimeStructUnion; 928 /** Time applicability of PVT report */ 929 typedef struct { 930 /** Specifies GNSS system time reported. Mandatory field */ 931 Gnss_LocSvSystemEnumType gnssSystemTimeSrc; 932 /** Reporting of GPS system time is recommended. 933 If GPS time is unknown & other satellite system time is known, 934 it should be reported. 935 Mandatory field 936 */ 937 SystemTimeStructUnion u; 938 } GnssSystemTime; 939 940 typedef struct { 941 uint32_t size; // set to sizeof(GnssLocationInfo) 942 GnssLocationInfoFlagMask flags; // bitwise OR of GnssLocationInfoBits for param validity 943 float altitudeMeanSeaLevel; // altitude wrt mean sea level 944 float pdop; // position dilusion of precision 945 float hdop; // horizontal dilusion of precision 946 float vdop; // vertical dilusion of precision 947 float gdop; // geometric dilution of precision 948 float tdop; // time dilution of precision 949 float magneticDeviation; // magnetic deviation 950 LocationReliability horReliability; // horizontal reliability 951 LocationReliability verReliability; // vertical reliability 952 float horUncEllipseSemiMajor; // horizontal elliptical accuracy semi-major axis 953 float horUncEllipseSemiMinor; // horizontal elliptical accuracy semi-minor axis 954 float horUncEllipseOrientAzimuth; // horizontal elliptical accuracy azimuth 955 float northStdDeviation; // North standard deviation Unit: Meters 956 float eastStdDeviation; // East standard deviation. Unit: Meters 957 float northVelocity; // North Velocity.Unit: Meters/sec 958 float eastVelocity; // East Velocity Unit Meters/sec 959 float upVelocity; // Up Velocity. Unit Meters/sec 960 float northVelocityStdDeviation; 961 float eastVelocityStdDeviation; 962 float upVelocityStdDeviation; 963 uint16_t numSvUsedInPosition; 964 GnssLocationSvUsedInPosition svUsedInPosition;// Gnss sv used in position data 965 GnssLocationNavSolutionMask navSolutionMask; // Nav solution mask to indicate sbas corrections 966 GnssLocationPosTechMask posTechMask; // Position technology used in computing this fix 967 GnssLocationPositionDynamics bodyFrameData; // Body Frame Dynamics: 4wayAcceleration and 968 // pitch set with validity 969 GnssSystemTime gnssSystemTime; // GNSS System Time 970 uint8_t numOfMeasReceived; // Number of measurements received for use in fix. 971 GnssMeasUsageInfo measUsageInfo[GNSS_SV_MAX]; // GNSS Measurement Usage info 972 uint8_t leapSeconds; // leap second 973 float timeUncMs; // Time uncertainty in milliseconds 974 Location location; 975 } GnssLocationInfoNotification; 976 977 typedef struct { 978 uint32_t size; // set to sizeof(GnssNiNotification) 979 GnssNiType type; // type of NI (Voice, SUPL, Control Plane) 980 GnssNiOptionsMask options; // bitwise OR of GnssNiOptionsBits 981 uint32_t timeout; // time (seconds) to wait for user input 982 GnssNiResponse timeoutResponse; // the response that should be sent when timeout expires 983 char requestor[GNSS_NI_REQUESTOR_MAX]; // the requestor that is making the request 984 GnssNiEncodingType requestorEncoding; // the encoding type for requestor 985 char message[GNSS_NI_MESSAGE_ID_MAX]; // the message to show user 986 GnssNiEncodingType messageEncoding; // the encoding type for message 987 char extras[GNSS_NI_MESSAGE_ID_MAX]; 988 } GnssNiNotification; 989 990 typedef struct { 991 uint32_t size; // set to sizeof(GnssSv) 992 uint16_t svId; // Unique Identifier 993 GnssSvType type; // type of SV (GPS, SBAS, GLONASS, QZSS, BEIDOU, GALILEO) 994 float cN0Dbhz; // signal strength 995 float elevation; // elevation of SV (in degrees) 996 float azimuth; // azimuth of SV (in degrees) 997 GnssSvOptionsMask gnssSvOptionsMask; // Bitwise OR of GnssSvOptionsBits 998 float carrierFrequencyHz; // carrier frequency of the signal tracked 999 GnssSignalTypeMask gnssSignalTypeMask; // Specifies GNSS signal type 1000 } GnssSv; 1001 1002 struct GnssConfigSetAssistanceServer { 1003 uint32_t size; // set to sizeof(GnssConfigSetAssistanceServer) 1004 GnssAssistanceType type; // SUPL or C2K 1005 const char* hostName; // null terminated string 1006 uint32_t port; // port of server 1007 equalsGnssConfigSetAssistanceServer1008 inline bool equals(const GnssConfigSetAssistanceServer& config) { 1009 if (config.type == type && config.port == port && 1010 ((NULL == config.hostName && NULL == hostName) || 1011 (NULL != config.hostName && NULL != hostName && 1012 0 == strcmp(config.hostName, hostName)))) { 1013 return true; 1014 } 1015 return false; 1016 } 1017 }; 1018 1019 typedef struct { 1020 uint32_t size; // set to sizeof(GnssMeasurementsData) 1021 GnssMeasurementsDataFlagsMask flags; // bitwise OR of GnssMeasurementsDataFlagsBits 1022 int16_t svId; 1023 GnssSvType svType; 1024 double timeOffsetNs; 1025 GnssMeasurementsStateMask stateMask; // bitwise OR of GnssMeasurementsStateBits 1026 int64_t receivedSvTimeNs; 1027 int64_t receivedSvTimeUncertaintyNs; 1028 double carrierToNoiseDbHz; 1029 double pseudorangeRateMps; 1030 double pseudorangeRateUncertaintyMps; 1031 GnssMeasurementsAdrStateMask adrStateMask; // bitwise OR of GnssMeasurementsAdrStateBits 1032 double adrMeters; 1033 double adrUncertaintyMeters; 1034 float carrierFrequencyHz; 1035 int64_t carrierCycles; 1036 double carrierPhase; 1037 double carrierPhaseUncertainty; 1038 GnssMeasurementsMultipathIndicator multipathIndicator; 1039 double signalToNoiseRatioDb; 1040 double agcLevelDb; 1041 GnssMeasurementsCodeType codeType; 1042 char otherCodeTypeName[GNSS_MAX_NAME_LENGTH]; 1043 } GnssMeasurementsData; 1044 1045 typedef struct { 1046 uint32_t size; // set to sizeof(GnssMeasurementsClock) 1047 GnssMeasurementsClockFlagsMask flags; // bitwise OR of GnssMeasurementsClockFlagsBits 1048 int16_t leapSecond; 1049 int64_t timeNs; 1050 double timeUncertaintyNs; 1051 int64_t fullBiasNs; 1052 double biasNs; 1053 double biasUncertaintyNs; 1054 double driftNsps; 1055 double driftUncertaintyNsps; 1056 uint32_t hwClockDiscontinuityCount; 1057 } GnssMeasurementsClock; 1058 1059 typedef struct { 1060 uint32_t size; // set to sizeof(GnssSvNotification) 1061 uint32_t count; // number of SVs in the GnssSv array 1062 bool gnssSignalTypeMaskValid; 1063 GnssSv gnssSvs[GNSS_SV_MAX]; // information on a number of SVs 1064 } GnssSvNotification; 1065 1066 typedef struct { 1067 uint32_t size; // set to sizeof(GnssNmeaNotification) 1068 uint64_t timestamp; // timestamp 1069 const char* nmea; // nmea text 1070 uint32_t length; // length of the nmea text 1071 } GnssNmeaNotification; 1072 1073 typedef struct { 1074 uint32_t size; // set to sizeof(GnssDataNotification) 1075 GnssDataMask gnssDataMask[GNSS_LOC_MAX_NUMBER_OF_SIGNAL_TYPES]; // bitwise OR of GnssDataBits 1076 double jammerInd[GNSS_LOC_MAX_NUMBER_OF_SIGNAL_TYPES]; // Jammer Indication 1077 double agc[GNSS_LOC_MAX_NUMBER_OF_SIGNAL_TYPES]; // Automatic gain control 1078 } GnssDataNotification; 1079 1080 typedef struct { 1081 uint32_t size; // set to sizeof(GnssMeasurementsNotification) 1082 uint32_t count; // number of items in GnssMeasurements array 1083 GnssMeasurementsData measurements[GNSS_MEASUREMENTS_MAX]; 1084 GnssMeasurementsClock clock; // clock 1085 } GnssMeasurementsNotification; 1086 1087 typedef uint32_t GnssSvId; 1088 1089 struct GnssSvIdSource{ 1090 uint32_t size; // set to sizeof(GnssSvIdSource) 1091 GnssSvType constellation; // constellation for the sv to blacklist 1092 GnssSvId svId; // sv id to blacklist 1093 }; 1094 inline bool operator ==(GnssSvIdSource const& left, GnssSvIdSource const& right) { 1095 return left.size == right.size && 1096 left.constellation == right.constellation && left.svId == right.svId; 1097 } 1098 1099 #define GNSS_SV_CONFIG_ALL_BITS_ENABLED_MASK ((uint64_t)0xFFFFFFFFFFFFFFFF) 1100 typedef struct { 1101 uint32_t size; // set to sizeof(GnssSvIdConfig) 1102 1103 // GLONASS - SV 65 maps to bit 0 1104 #define GNSS_SV_CONFIG_GLO_INITIAL_SV_ID 65 1105 uint64_t gloBlacklistSvMask; 1106 1107 // BEIDOU - SV 201 maps to bit 0 1108 #define GNSS_SV_CONFIG_BDS_INITIAL_SV_ID 201 1109 uint64_t bdsBlacklistSvMask; 1110 1111 // QZSS - SV 193 maps to bit 0 1112 #define GNSS_SV_CONFIG_QZSS_INITIAL_SV_ID 193 1113 uint64_t qzssBlacklistSvMask; 1114 1115 // GAL - SV 301 maps to bit 0 1116 #define GNSS_SV_CONFIG_GAL_INITIAL_SV_ID 301 1117 uint64_t galBlacklistSvMask; 1118 } GnssSvIdConfig; 1119 1120 struct GnssConfig{ 1121 uint32_t size; // set to sizeof(GnssConfig) 1122 GnssConfigFlagsMask flags; // bitwise OR of GnssConfigFlagsBits to mark which params are valid 1123 GnssConfigGpsLock gpsLock; 1124 GnssConfigSuplVersion suplVersion; 1125 GnssConfigSetAssistanceServer assistanceServer; 1126 GnssConfigLppProfile lppProfile; 1127 GnssConfigLppeControlPlaneMask lppeControlPlaneMask; 1128 GnssConfigLppeUserPlaneMask lppeUserPlaneMask; 1129 GnssConfigAGlonassPositionProtocolMask aGlonassPositionProtocolMask; 1130 GnssConfigEmergencyPdnForEmergencySupl emergencyPdnForEmergencySupl; 1131 GnssConfigSuplEmergencyServices suplEmergencyServices; 1132 GnssConfigSuplModeMask suplModeMask; //bitwise OR of GnssConfigSuplModeBits 1133 std::vector<GnssSvIdSource> blacklistedSvIds; 1134 uint32_t emergencyExtensionSeconds; 1135 equalsGnssConfig1136 inline bool equals(const GnssConfig& config) { 1137 if (flags == config.flags && 1138 gpsLock == config.gpsLock && 1139 suplVersion == config.suplVersion && 1140 assistanceServer.equals(config.assistanceServer) && 1141 lppProfile == config.lppProfile && 1142 lppeControlPlaneMask == config.lppeControlPlaneMask && 1143 lppeUserPlaneMask == config.lppeUserPlaneMask && 1144 aGlonassPositionProtocolMask == config.aGlonassPositionProtocolMask && 1145 emergencyPdnForEmergencySupl == config.emergencyPdnForEmergencySupl && 1146 suplEmergencyServices == config.suplEmergencyServices && 1147 suplModeMask == config.suplModeMask && 1148 blacklistedSvIds == config.blacklistedSvIds && 1149 emergencyExtensionSeconds == config.emergencyExtensionSeconds) { 1150 return true; 1151 } 1152 return false; 1153 } 1154 }; 1155 1156 typedef struct { 1157 uint32_t size; // set to sizeof 1158 bool mValid; 1159 Location mLocation; 1160 double verticalAccuracyMeters; 1161 double speedAccuracyMetersPerSecond; 1162 double bearingAccuracyDegrees; 1163 timespec mUtcReported; 1164 } GnssDebugLocation; 1165 1166 typedef struct { 1167 uint32_t size; // set to sizeof 1168 bool mValid; 1169 int64_t timeEstimate; 1170 float timeUncertaintyNs; 1171 float frequencyUncertaintyNsPerSec; 1172 } GnssDebugTime; 1173 1174 typedef struct { 1175 uint32_t size; // set to sizeof 1176 uint32_t svid; 1177 GnssSvType constellation; 1178 GnssEphemerisType mEphemerisType; 1179 GnssEphemerisSource mEphemerisSource; 1180 GnssEphemerisHealth mEphemerisHealth; 1181 float ephemerisAgeSeconds; 1182 bool serverPredictionIsAvailable; 1183 float serverPredictionAgeSeconds; 1184 } GnssDebugSatelliteInfo; 1185 1186 typedef struct { 1187 uint32_t size; // set to sizeof 1188 GnssDebugLocation mLocation; 1189 GnssDebugTime mTime; 1190 std::vector<GnssDebugSatelliteInfo> mSatelliteInfo; 1191 } GnssDebugReport; 1192 1193 typedef uint32_t LeapSecondSysInfoMask; 1194 typedef enum { 1195 // current leap second info is available. This info will only 1196 // be available if the leap second change info is not available. 1197 // 1198 // If leap second change info is avaiable, to figure out 1199 // the current leap second info, compare current gps time with 1200 // the gps timestamp of leap second change to know whether to choose 1201 // leapSecondBefore or leapSecondAfter as current leap second. 1202 LEAP_SECOND_SYS_INFO_CURRENT_LEAP_SECONDS_BIT = (1ULL << 0), 1203 // the last known leap change event is available. 1204 // The info can be available on two scenario: 1205 // 1: this leap second change event has been scheduled and yet to happen 1206 // 2: this leap second change event has already happened and next 1207 // leap second change event has not yet been scheduled. 1208 LEAP_SECOND_SYS_INFO_LEAP_SECOND_CHANGE_BIT = (1ULL << 1), 1209 } LeapSecondSysInfoDataBits; 1210 1211 struct LeapSecondChangeInfo { 1212 // GPS timestamp that corrresponds to the last known 1213 // leap second change event. 1214 // 1215 // The info can be available on two scenario: 1216 // 1: this leap second change event has been scheduled and yet to happen 1217 // 2: this leap second change event has already happened and next 1218 // leap second change event has not yet been scheduled. 1219 GnssSystemTimeStructType gpsTimestampLsChange; 1220 // Number of leap seconds prior to the leap second change event 1221 // that corresponds to the timestamp at gpsTimestampLsChange. 1222 uint8_t leapSecondsBeforeChange; 1223 // Number of leap seconds after the leap second change event 1224 // that corresponds to the timestamp at gpsTimestampLsChange. 1225 uint8_t leapSecondsAfterChange; 1226 }; 1227 1228 struct LeapSecondSystemInfo { 1229 LeapSecondSysInfoMask leapSecondInfoMask; 1230 uint8_t leapSecondCurrent; 1231 LeapSecondChangeInfo leapSecondChangeInfo; 1232 }; 1233 1234 typedef uint32_t LocationSystemInfoMask; 1235 typedef enum { 1236 // contains current leap second or leap second change info 1237 LOCATION_SYS_INFO_LEAP_SECOND = (1ULL << 0), 1238 } LocationSystemInfoDataBits; 1239 1240 struct LocationSystemInfo { 1241 LocationSystemInfoMask systemInfoMask; 1242 LeapSecondSystemInfo leapSecondSysInfo; 1243 }; 1244 1245 /* Provides the capabilities of the system 1246 capabilities callback is called once soon after createInstance is called */ 1247 typedef std::function<void( 1248 LocationCapabilitiesMask capabilitiesMask // bitwise OR of LocationCapabilitiesBits 1249 )> capabilitiesCallback; 1250 1251 /* Used by tracking, batching, and miscellanous APIs 1252 responseCallback is called for every Tracking, Batching API, and Miscellanous API */ 1253 typedef std::function<void( 1254 LocationError err, // if not SUCCESS, then id is not valid 1255 uint32_t id // id to be associated to the request 1256 )> responseCallback; 1257 1258 /* Used by APIs that gets more than one LocationError in it's response 1259 collectiveResponseCallback is called for every geofence API call. 1260 ids array and LocationError array are only valid until collectiveResponseCallback returns. */ 1261 typedef std::function<void( 1262 uint32_t count, // number of locations in arrays 1263 LocationError* errs, // array of LocationError associated to the request 1264 uint32_t* ids // array of ids to be associated to the request 1265 )> collectiveResponseCallback; 1266 1267 /* Used for startTracking API, optional can be NULL 1268 trackingCallback is called when delivering a location in a tracking session 1269 broadcasted to all clients, no matter if a session has started by client */ 1270 typedef std::function<void( 1271 Location location 1272 )> trackingCallback; 1273 1274 /* Used for startBatching API, optional can be NULL 1275 batchingCallback is called when delivering locations in a batching session. 1276 broadcasted to all clients, no matter if a session has started by client */ 1277 typedef std::function<void( 1278 uint32_t count, // number of locations in array 1279 Location* location, // array of locations 1280 BatchingOptions batchingOptions // Batching options 1281 )> batchingCallback; 1282 1283 typedef std::function<void( 1284 BatchingStatusInfo batchingStatus, // batch status 1285 std::list<uint32_t> & listOfCompletedTrips 1286 )> batchingStatusCallback; 1287 1288 /* Gives GNSS Location information, optional can be NULL 1289 gnssLocationInfoCallback is called only during a tracking session 1290 broadcasted to all clients, no matter if a session has started by client */ 1291 typedef std::function<void( 1292 GnssLocationInfoNotification gnssLocationInfoNotification 1293 )> gnssLocationInfoCallback; 1294 1295 /* Used for addGeofences API, optional can be NULL 1296 geofenceBreachCallback is called when any number of geofences have a state change */ 1297 typedef std::function<void( 1298 GeofenceBreachNotification geofenceBreachNotification 1299 )> geofenceBreachCallback; 1300 1301 /* Used for addGeofences API, optional can be NULL 1302 geofenceStatusCallback is called when any number of geofences have a status change */ 1303 typedef std::function<void( 1304 GeofenceStatusNotification geofenceStatusNotification 1305 )> geofenceStatusCallback; 1306 1307 /* Network Initiated request, optional can be NULL 1308 This callback should be responded to by calling gnssNiResponse */ 1309 typedef std::function<void( 1310 uint32_t id, // id that should be used to respond by calling gnssNiResponse 1311 GnssNiNotification gnssNiNotification 1312 )> gnssNiCallback; 1313 1314 /* Gives GNSS SV information, optional can be NULL 1315 gnssSvCallback is called only during a tracking session 1316 broadcasted to all clients, no matter if a session has started by client */ 1317 typedef std::function<void( 1318 GnssSvNotification gnssSvNotification 1319 )> gnssSvCallback; 1320 1321 /* Gives GNSS NMEA data, optional can be NULL 1322 gnssNmeaCallback is called only during a tracking session 1323 broadcasted to all clients, no matter if a session has started by client */ 1324 typedef std::function<void( 1325 GnssNmeaNotification gnssNmeaNotification 1326 )> gnssNmeaCallback; 1327 1328 /* Gives GNSS data, optional can be NULL 1329 gnssDataCallback is called only during a tracking session 1330 broadcasted to all clients, no matter if a session has started by client */ 1331 typedef std::function<void( 1332 GnssDataNotification gnssDataNotification 1333 )> gnssDataCallback; 1334 1335 /* Gives GNSS Measurements information, optional can be NULL 1336 gnssMeasurementsCallback is called only during a tracking session 1337 broadcasted to all clients, no matter if a session has started by client */ 1338 typedef std::function<void( 1339 GnssMeasurementsNotification gnssMeasurementsNotification 1340 )> gnssMeasurementsCallback; 1341 1342 /* Provides the current GNSS configuration to the client */ 1343 typedef std::function<void( 1344 GnssConfig& config 1345 )> gnssConfigCallback; 1346 1347 /* LocationSystemInfoCb is for receiving rare occuring location 1348 system information update. optional, can be NULL. 1349 */ 1350 typedef std::function<void( 1351 LocationSystemInfo locationSystemInfo 1352 )> locationSystemInfoCallback; 1353 1354 typedef std::function<void( 1355 )> locationApiDestroyCompleteCallback; 1356 1357 typedef uint16_t LocationAdapterTypeMask; 1358 typedef enum { 1359 LOCATION_ADAPTER_GNSS_TYPE_BIT = (1<<0), // adapter type is GNSS 1360 LOCATION_ADAPTER_BATCHING_TYPE_BIT = (1<<1), // adapter type is BATCHING 1361 LOCATION_ADAPTER_GEOFENCE_TYPE_BIT = (1<<2) // adapter type is geo fence 1362 } LocationAdapterTypeBits; 1363 1364 typedef struct { 1365 uint32_t size; // set to sizeof(LocationCallbacks) 1366 capabilitiesCallback capabilitiesCb; // mandatory 1367 responseCallback responseCb; // mandatory 1368 collectiveResponseCallback collectiveResponseCb; // mandatory 1369 trackingCallback trackingCb; // optional 1370 batchingCallback batchingCb; // optional 1371 geofenceBreachCallback geofenceBreachCb; // optional 1372 geofenceStatusCallback geofenceStatusCb; // optional 1373 gnssLocationInfoCallback gnssLocationInfoCb; // optional 1374 gnssNiCallback gnssNiCb; // optional 1375 gnssSvCallback gnssSvCb; // optional 1376 gnssNmeaCallback gnssNmeaCb; // optional 1377 gnssDataCallback gnssDataCb; // optional 1378 gnssMeasurementsCallback gnssMeasurementsCb; // optional 1379 batchingStatusCallback batchingStatusCb; // optional 1380 locationSystemInfoCallback locationSystemInfoCb; // optional 1381 } LocationCallbacks; 1382 1383 #endif /* LOCATIONDATATYPES_H */ 1384