1 /* Copyright (c) 2013-2020 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 GPS_EXTENDED_C_H 30 #define GPS_EXTENDED_C_H 31 32 #include <ctype.h> 33 #include <stdbool.h> 34 #include <stdlib.h> 35 #include <string.h> 36 #include <loc_gps.h> 37 #include <LocationAPI.h> 38 39 struct timespec32_t { 40 uint32_t tv_sec; /* seconds */ 41 uint32_t tv_nsec; /* and nanoseconds */ 42 }; 43 44 45 /** 46 * @file 47 * @brief C++ declarations for GPS types 48 */ 49 50 #ifdef __cplusplus 51 extern "C" { 52 #endif /* __cplusplus */ 53 54 /** Location has valid source information. */ 55 #define LOCATION_HAS_SOURCE_INFO 0x0020 56 /** LocGpsLocation has valid "is indoor?" flag */ 57 #define LOC_GPS_LOCATION_HAS_IS_INDOOR 0x0040 58 /** LocGpsLocation has valid floor number */ 59 #define LOC_GPS_LOCATION_HAS_FLOOR_NUMBER 0x0080 60 /** LocGpsLocation has valid map URL*/ 61 #define LOC_GPS_LOCATION_HAS_MAP_URL 0x0100 62 /** LocGpsLocation has valid map index */ 63 #define LOC_GPS_LOCATION_HAS_MAP_INDEX 0x0200 64 65 #define GNSS_INVALID_JAMMER_IND 0x7FFFFFFF 66 67 /** Sizes for indoor fields */ 68 #define GPS_LOCATION_MAP_URL_SIZE 400 69 #define GPS_LOCATION_MAP_INDEX_SIZE 16 70 71 /** Position source is ULP */ 72 #define ULP_LOCATION_IS_FROM_HYBRID 0x0001 73 /** Position source is GNSS only */ 74 #define ULP_LOCATION_IS_FROM_GNSS 0x0002 75 /** Position is from a Geofence Breach Event */ 76 #define ULP_LOCATION_IS_FROM_GEOFENCE 0X0004 77 /** Position is from Hardware FLP */ 78 #define ULP_LOCATION_IS_FROM_HW_FLP 0x0008 79 /** Position is from NLP */ 80 #define ULP_LOCATION_IS_FROM_NLP 0x0010 81 /** Position is from external DR solution*/ 82 #define ULP_LOCATION_IS_FROM_EXT_DR 0X0020 83 /** Raw GNSS position fixes */ 84 #define ULP_LOCATION_IS_FROM_GNSS_RAW 0X0040 85 86 typedef uint32_t LocSvInfoSource; 87 /** SVinfo source is GNSS/DR */ 88 #define ULP_SVINFO_IS_FROM_GNSS ((LocSvInfoSource)0x0001) 89 /** Raw SVinfo from GNSS */ 90 #define ULP_SVINFO_IS_FROM_DR ((LocSvInfoSource)0x0002) 91 92 #define ULP_MIN_INTERVAL_INVALID 0xffffffff 93 #define ULP_MAX_NMEA_STRING_SIZE 201 94 95 /*Emergency SUPL*/ 96 #define LOC_GPS_NI_TYPE_EMERGENCY_SUPL 4 97 98 #define LOC_AGPS_CERTIFICATE_MAX_LENGTH 2000 99 #define LOC_AGPS_CERTIFICATE_MAX_SLOTS 10 100 101 /* TBM Threshold for tracking in background power mode : in millis */ 102 #define TRACKING_TBM_THRESHOLD_MILLIS 480000 103 104 /** Maximum number of satellites in an ephemeris report. */ 105 #define GNSS_EPHEMERIS_LIST_MAX_SIZE_V02 32 106 107 typedef uint32_t LocPosTechMask; 108 #define LOC_POS_TECH_MASK_DEFAULT ((LocPosTechMask)0x00000000) 109 #define LOC_POS_TECH_MASK_SATELLITE ((LocPosTechMask)0x00000001) 110 #define LOC_POS_TECH_MASK_CELLID ((LocPosTechMask)0x00000002) 111 #define LOC_POS_TECH_MASK_WIFI ((LocPosTechMask)0x00000004) 112 #define LOC_POS_TECH_MASK_SENSORS ((LocPosTechMask)0x00000008) 113 #define LOC_POS_TECH_MASK_REFERENCE_LOCATION ((LocPosTechMask)0x00000010) 114 #define LOC_POS_TECH_MASK_INJECTED_COARSE_POSITION ((LocPosTechMask)0x00000020) 115 #define LOC_POS_TECH_MASK_AFLT ((LocPosTechMask)0x00000040) 116 #define LOC_POS_TECH_MASK_HYBRID ((LocPosTechMask)0x00000080) 117 #define LOC_POS_TECH_MASK_PPE ((LocPosTechMask)0x00000100) 118 119 enum loc_registration_mask_status { 120 LOC_REGISTRATION_MASK_ENABLED, 121 LOC_REGISTRATION_MASK_DISABLED, 122 LOC_REGISTRATION_MASK_SET 123 }; 124 125 typedef enum { 126 LOC_SUPPORTED_FEATURE_ODCPI_2_V02 = 0, /**< Support ODCPI version 2 feature */ 127 LOC_SUPPORTED_FEATURE_WIFI_AP_DATA_INJECT_2_V02, /**< Support Wifi AP data inject version 2 feature */ 128 LOC_SUPPORTED_FEATURE_DEBUG_NMEA_V02, /**< Support debug NMEA feature */ 129 LOC_SUPPORTED_FEATURE_GNSS_ONLY_POSITION_REPORT, /**< Support GNSS Only position reports */ 130 LOC_SUPPORTED_FEATURE_FDCL, /**< Support FDCL */ 131 LOC_SUPPORTED_FEATURE_CONSTELLATION_ENABLEMENT_V02, /**< Support constellation enablement */ 132 LOC_SUPPORTED_FEATURE_AGPM_V02, /**< Support AGPM feature */ 133 LOC_SUPPORTED_FEATURE_XTRA_INTEGRITY, /**< Support XTRA integrity */ 134 LOC_SUPPORTED_FEATURE_FDCL_2, /**< Support FDCL V2 */ 135 LOC_SUPPORTED_FEATURE_LOCATION_PRIVACY /**< Support location privacy */ 136 } loc_supported_feature_enum; 137 138 typedef struct { 139 /** set to sizeof(UlpLocation) */ 140 uint32_t size; 141 LocGpsLocation gpsLocation; 142 /* Provider indicator for HYBRID or GPS */ 143 uint16_t position_source; 144 LocPosTechMask tech_mask; 145 bool unpropagatedPosition; 146 } UlpLocation; 147 148 typedef struct { 149 /** set to sizeof(UlpNmea) */ 150 uint32_t size; 151 char nmea_str[ULP_MAX_NMEA_STRING_SIZE]; 152 unsigned int len; 153 } UlpNmea; 154 155 156 /** AGPS type */ 157 typedef int8_t AGpsExtType; 158 #define LOC_AGPS_TYPE_INVALID -1 159 #define LOC_AGPS_TYPE_ANY 0 160 #define LOC_AGPS_TYPE_SUPL 1 161 #define LOC_AGPS_TYPE_C2K 2 162 #define LOC_AGPS_TYPE_WWAN_ANY 3 163 #define LOC_AGPS_TYPE_WIFI 4 164 #define LOC_AGPS_TYPE_SUPL_ES 5 165 166 /** SSID length */ 167 #define SSID_BUF_SIZE (32+1) 168 169 typedef int16_t AGpsBearerType; 170 #define AGPS_APN_BEARER_INVALID 0 171 #define AGPS_APN_BEARER_IPV4 1 172 #define AGPS_APN_BEARER_IPV6 2 173 #define AGPS_APN_BEARER_IPV4V6 3 174 175 typedef uint32_t LocApnTypeMask; 176 /**< Denotes APN type for Default/Internet traffic */ 177 #define LOC_APN_TYPE_MASK_DEFAULT ((LocApnTypeMask)0x00000001) 178 /**< Denotes APN type for IP Multimedia Subsystem */ 179 #define LOC_APN_TYPE_MASK_IMS ((LocApnTypeMask)0x00000002) 180 /**< Denotes APN type for Multimedia Messaging Service */ 181 #define LOC_APN_TYPE_MASK_MMS ((LocApnTypeMask)0x00000004) 182 /**< Denotes APN type for Dial Up Network */ 183 #define LOC_APN_TYPE_MASK_DUN ((LocApnTypeMask)0x00000008) 184 /**< Denotes APN type for Secure User Plane Location */ 185 #define LOC_APN_TYPE_MASK_SUPL ((LocApnTypeMask)0x00000010) 186 /**< Denotes APN type for High Priority Mobile Data */ 187 #define LOC_APN_TYPE_MASK_HIPRI ((LocApnTypeMask)0x00000020) 188 /**< Denotes APN type for over the air administration */ 189 #define LOC_APN_TYPE_MASK_FOTA ((LocApnTypeMask)0x00000040) 190 /**< Denotes APN type for Carrier Branded Services */ 191 #define LOC_APN_TYPE_MASK_CBS ((LocApnTypeMask)0x00000080) 192 /**< Denotes APN type for Initial Attach */ 193 #define LOC_APN_TYPE_MASK_IA ((LocApnTypeMask)0x00000100) 194 /**< Denotes APN type for emergency */ 195 #define LOC_APN_TYPE_MASK_EMERGENCY ((LocApnTypeMask)0x00000200) 196 197 typedef uint32_t AGpsTypeMask; 198 #define AGPS_ATL_TYPE_SUPL ((AGpsTypeMask)0x00000001) 199 #define AGPS_ATL_TYPE_SUPL_ES ((AGpsTypeMask)0x00000002) 200 #define AGPS_ATL_TYPE_WWAN ((AGpsTypeMask)0x00000004) 201 202 typedef struct { 203 void* statusV4Cb; 204 AGpsTypeMask atlType; 205 } AgpsCbInfo; 206 207 typedef struct { 208 void* visibilityControlCb; 209 void* isInEmergencySession; 210 } NfwCbInfo; 211 212 /** GPS extended callback structure. */ 213 typedef struct { 214 /** set to sizeof(LocGpsCallbacks) */ 215 uint32_t size; 216 loc_gps_set_capabilities set_capabilities_cb; 217 loc_gps_acquire_wakelock acquire_wakelock_cb; 218 loc_gps_release_wakelock release_wakelock_cb; 219 loc_gps_create_thread create_thread_cb; 220 loc_gps_request_utc_time request_utc_time_cb; 221 } GpsExtCallbacks; 222 223 /** Callback to report the xtra server url to the client. 224 * The client should use this url when downloading xtra unless overwritten 225 * in the gps.conf file 226 */ 227 typedef void (* report_xtra_server)(const char*, const char*, const char*); 228 229 /** Callback structure for the XTRA interface. */ 230 typedef struct { 231 loc_gps_xtra_download_request download_request_cb; 232 loc_gps_create_thread create_thread_cb; 233 report_xtra_server report_xtra_server_cb; 234 } GpsXtraExtCallbacks; 235 236 /** Represents the status of AGPS. */ 237 typedef struct { 238 /** set to sizeof(AGpsExtStatus) */ 239 uint32_t size; 240 241 AGpsExtType type; 242 LocAGpsStatusValue status; 243 uint32_t ipv4_addr; 244 struct sockaddr_storage addr; 245 char ssid[SSID_BUF_SIZE]; 246 char password[SSID_BUF_SIZE]; 247 } AGpsExtStatus; 248 249 /** Callback with AGPS status information. 250 * Can only be called from a thread created by create_thread_cb. 251 */ 252 typedef void (* agps_status_extended)(AGpsExtStatus* status); 253 254 /** Callback structure for the AGPS interface. */ 255 typedef struct { 256 agps_status_extended status_cb; 257 loc_gps_create_thread create_thread_cb; 258 } AGpsExtCallbacks; 259 260 261 typedef void (*loc_ni_notify_callback)(LocGpsNiNotification *notification, bool esEnalbed); 262 /** GPS NI callback structure. */ 263 typedef struct 264 { 265 /** 266 * Sends the notification request from HAL to GPSLocationProvider. 267 */ 268 loc_ni_notify_callback notify_cb; 269 } GpsNiExtCallbacks; 270 271 typedef enum loc_server_type { 272 LOC_AGPS_CDMA_PDE_SERVER, 273 LOC_AGPS_CUSTOM_PDE_SERVER, 274 LOC_AGPS_MPC_SERVER, 275 LOC_AGPS_SUPL_SERVER, 276 LOC_AGPS_MO_SUPL_SERVER 277 } LocServerType; 278 279 typedef enum loc_position_mode_type { 280 LOC_POSITION_MODE_INVALID = -1, 281 LOC_POSITION_MODE_STANDALONE = 0, 282 LOC_POSITION_MODE_MS_BASED, 283 LOC_POSITION_MODE_MS_ASSISTED, 284 LOC_POSITION_MODE_RESERVED_1, 285 LOC_POSITION_MODE_RESERVED_2, 286 LOC_POSITION_MODE_RESERVED_3, 287 LOC_POSITION_MODE_RESERVED_4, 288 LOC_POSITION_MODE_RESERVED_5 289 290 } LocPositionMode; 291 292 /** 293 * @brief Minimum allowed value for fix interval. 294 * 295 * This value is a sanity limit in GPS framework. The hardware has own internal 296 * limits that may not match this value 297 * 298 * @sa GPS_DEFAULT_FIX_INTERVAL_MS 299 */ 300 301 #define GPS_MIN_POSSIBLE_FIX_INTERVAL_MS 100 302 /** 303 * @brief Default value for fix interval. 304 * 305 * This value is used by default whenever appropriate. 306 * 307 * @sa GPS_MIN_POSSIBLE_FIX_INTERVAL_MS 308 */ 309 #define GPS_DEFAULT_FIX_INTERVAL_MS 1000 310 311 /** Flags to indicate which values are valid in a GpsLocationExtended. */ 312 typedef uint64_t GpsLocationExtendedFlags; 313 /** GpsLocationExtended has valid pdop, hdop, vdop. */ 314 #define GPS_LOCATION_EXTENDED_HAS_DOP 0x0001 315 /** GpsLocationExtended has valid altitude mean sea level. */ 316 #define GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL 0x0002 317 /** UlpLocation has valid magnetic deviation. */ 318 #define GPS_LOCATION_EXTENDED_HAS_MAG_DEV 0x0004 319 /** UlpLocation has valid mode indicator. */ 320 #define GPS_LOCATION_EXTENDED_HAS_MODE_IND 0x0008 321 /** GpsLocationExtended has valid vertical uncertainty */ 322 #define GPS_LOCATION_EXTENDED_HAS_VERT_UNC 0x0010 323 /** GpsLocationExtended has valid speed uncertainty */ 324 #define GPS_LOCATION_EXTENDED_HAS_SPEED_UNC 0x0020 325 /** GpsLocationExtended has valid heading uncertainty */ 326 #define GPS_LOCATION_EXTENDED_HAS_BEARING_UNC 0x0040 327 /** GpsLocationExtended has valid horizontal reliability */ 328 #define GPS_LOCATION_EXTENDED_HAS_HOR_RELIABILITY 0x0080 329 /** GpsLocationExtended has valid vertical reliability */ 330 #define GPS_LOCATION_EXTENDED_HAS_VERT_RELIABILITY 0x0100 331 /** GpsLocationExtended has valid Horizontal Elliptical Uncertainty (Semi-Major Axis) */ 332 #define GPS_LOCATION_EXTENDED_HAS_HOR_ELIP_UNC_MAJOR 0x0200 333 /** GpsLocationExtended has valid Horizontal Elliptical Uncertainty (Semi-Minor Axis) */ 334 #define GPS_LOCATION_EXTENDED_HAS_HOR_ELIP_UNC_MINOR 0x0400 335 /** GpsLocationExtended has valid Elliptical Horizontal Uncertainty Azimuth */ 336 #define GPS_LOCATION_EXTENDED_HAS_HOR_ELIP_UNC_AZIMUTH 0x0800 337 /** GpsLocationExtended has valid gnss sv used in position data */ 338 #define GPS_LOCATION_EXTENDED_HAS_GNSS_SV_USED_DATA 0x1000 339 /** GpsLocationExtended has valid navSolutionMask */ 340 #define GPS_LOCATION_EXTENDED_HAS_NAV_SOLUTION_MASK 0x2000 341 /** GpsLocationExtended has valid LocPosTechMask */ 342 #define GPS_LOCATION_EXTENDED_HAS_POS_TECH_MASK 0x4000 343 /** GpsLocationExtended has valid LocSvInfoSource */ 344 #define GPS_LOCATION_EXTENDED_HAS_SV_SOURCE_INFO 0x8000 345 /** GpsLocationExtended has valid position dynamics data */ 346 #define GPS_LOCATION_EXTENDED_HAS_POS_DYNAMICS_DATA 0x10000 347 /** GpsLocationExtended has GPS Time */ 348 #define GPS_LOCATION_EXTENDED_HAS_GPS_TIME 0x20000 349 /** GpsLocationExtended has Extended Dilution of Precision */ 350 #define GPS_LOCATION_EXTENDED_HAS_EXT_DOP 0x40000 351 /** GpsLocationExtended has North standard deviation */ 352 #define GPS_LOCATION_EXTENDED_HAS_NORTH_STD_DEV 0x80000 353 /** GpsLocationExtended has East standard deviation*/ 354 #define GPS_LOCATION_EXTENDED_HAS_EAST_STD_DEV 0x100000 355 /** GpsLocationExtended has North Velocity */ 356 #define GPS_LOCATION_EXTENDED_HAS_NORTH_VEL 0x200000 357 /** GpsLocationExtended has East Velocity */ 358 #define GPS_LOCATION_EXTENDED_HAS_EAST_VEL 0x400000 359 /** GpsLocationExtended has up Velocity */ 360 #define GPS_LOCATION_EXTENDED_HAS_UP_VEL 0x800000 361 /** GpsLocationExtended has North Velocity Uncertainty */ 362 #define GPS_LOCATION_EXTENDED_HAS_NORTH_VEL_UNC 0x1000000 363 /** GpsLocationExtended has East Velocity Uncertainty */ 364 #define GPS_LOCATION_EXTENDED_HAS_EAST_VEL_UNC 0x2000000 365 /** GpsLocationExtended has up Velocity Uncertainty */ 366 #define GPS_LOCATION_EXTENDED_HAS_UP_VEL_UNC 0x4000000 367 /** GpsLocationExtended has Clock Bias */ 368 #define GPS_LOCATION_EXTENDED_HAS_CLOCK_BIAS 0x8000000 369 /** GpsLocationExtended has Clock Bias std deviation*/ 370 #define GPS_LOCATION_EXTENDED_HAS_CLOCK_BIAS_STD_DEV 0x10000000 371 /** GpsLocationExtended has Clock drift*/ 372 #define GPS_LOCATION_EXTENDED_HAS_CLOCK_DRIFT 0x20000000 373 /** GpsLocationExtended has Clock drift std deviation**/ 374 #define GPS_LOCATION_EXTENDED_HAS_CLOCK_DRIFT_STD_DEV 0x40000000 375 /** GpsLocationExtended has leap seconds **/ 376 #define GPS_LOCATION_EXTENDED_HAS_LEAP_SECONDS 0x80000000 377 /** GpsLocationExtended has time uncertainty **/ 378 #define GPS_LOCATION_EXTENDED_HAS_TIME_UNC 0x100000000 379 /** GpsLocationExtended has heading rate **/ 380 #define GPS_LOCATION_EXTENDED_HAS_HEADING_RATE 0x200000000 381 /** GpsLocationExtended has multiband signals **/ 382 #define GPS_LOCATION_EXTENDED_HAS_MULTIBAND 0x400000000 383 /** GpsLocationExtended has sensor calibration confidence */ 384 #define GPS_LOCATION_EXTENDED_HAS_CALIBRATION_CONFIDENCE 0x800000000 385 /** GpsLocationExtended has sensor calibration status */ 386 #define GPS_LOCATION_EXTENDED_HAS_CALIBRATION_STATUS 0x1000000000 387 /** GpsLocationExtended has the engine type that produced this 388 * position, the bit mask will only be set when there are two 389 * or more position engines running in the system */ 390 #define GPS_LOCATION_EXTENDED_HAS_OUTPUT_ENG_TYPE 0x2000000000 391 /** GpsLocationExtended has the engine mask that indicates the 392 * set of engines contribute to the fix. */ 393 #define GPS_LOCATION_EXTENDED_HAS_OUTPUT_ENG_MASK 0x4000000000 394 /** GpsLocationExtended has dgnss correction source */ 395 #define GPS_LOCATION_EXTENDED_HAS_DGNSS_CORRECTION_SOURCE_TYPE 0x8000000000 396 /** GpsLocationExtended has dgnss correction source ID */ 397 #define GPS_LOCATION_EXTENDED_HAS_DGNSS_CORRECTION_SOURCE_ID 0x10000000000 398 /** GpsLocationExtended has dgnss constellation usage */ 399 #define GPS_LOCATION_EXTENDED_HAS_DGNSS_CONSTELLATION_USAGE 0x20000000000 400 /** GpsLocationExtended has dgnss ref station Id */ 401 #define GPS_LOCATION_EXTENDED_HAS_DGNSS_REF_STATION_ID 0x40000000000 402 /** GpsLocationExtended has dgnss data age */ 403 #define GPS_LOCATION_EXTENDED_HAS_DGNSS_DATA_AGE 0x80000000000 404 405 typedef uint32_t LocNavSolutionMask; 406 /* Bitmask to specify whether SBAS ionospheric correction is used */ 407 #define LOC_NAV_MASK_SBAS_CORRECTION_IONO ((LocNavSolutionMask)0x0001) 408 /* Bitmask to specify whether SBAS fast correction is used */ 409 #define LOC_NAV_MASK_SBAS_CORRECTION_FAST ((LocNavSolutionMask)0x0002) 410 /**< Bitmask to specify whether SBAS long-tem correction is used */ 411 #define LOC_NAV_MASK_SBAS_CORRECTION_LONG ((LocNavSolutionMask)0x0004) 412 /**< Bitmask to specify whether SBAS integrity information is used */ 413 #define LOC_NAV_MASK_SBAS_INTEGRITY ((LocNavSolutionMask)0x0008) 414 /**< Bitmask to specify whether Position Report is DGNSS corrected */ 415 #define LOC_NAV_MASK_DGNSS_CORRECTION ((LocNavSolutionMask)0x0010) 416 /**< Bitmask to specify whether Position Report is RTK corrected */ 417 #define LOC_NAV_MASK_RTK_CORRECTION ((LocNavSolutionMask)0x0020) 418 /**< Bitmask to specify whether Position Report is PPP corrected */ 419 #define LOC_NAV_MASK_PPP_CORRECTION ((LocNavSolutionMask)0x0040) 420 /**< Bitmask to specify whether Position Report is RTK fixed corrected */ 421 #define LOC_NAV_MASK_RTK_FIXED_CORRECTION ((LocNavSolutionMask)0x0080) 422 423 typedef uint32_t LocPosDataMask; 424 /* Bitmask to specify whether Navigation data has Forward Acceleration */ 425 #define LOC_NAV_DATA_HAS_LONG_ACCEL ((LocPosDataMask)0x0001) 426 /* Bitmask to specify whether Navigation data has Sideward Acceleration */ 427 #define LOC_NAV_DATA_HAS_LAT_ACCEL ((LocPosDataMask)0x0002) 428 /* Bitmask to specify whether Navigation data has Vertical Acceleration */ 429 #define LOC_NAV_DATA_HAS_VERT_ACCEL ((LocPosDataMask)0x0004) 430 /* Bitmask to specify whether Navigation data has Heading Rate */ 431 #define LOC_NAV_DATA_HAS_YAW_RATE ((LocPosDataMask)0x0008) 432 /* Bitmask to specify whether Navigation data has Body pitch */ 433 #define LOC_NAV_DATA_HAS_PITCH ((LocPosDataMask)0x0010) 434 /* Bitmask to specify whether Navigation data has Forward Acceleration Unc */ 435 #define LOC_NAV_DATA_HAS_LONG_ACCEL_UNC ((LocPosDataMask)0x0020) 436 /* Bitmask to specify whether Navigation data has Sideward Acceleration Unc*/ 437 #define LOC_NAV_DATA_HAS_LAT_ACCEL_UNC ((LocPosDataMask)0x0040) 438 /* Bitmask to specify whether Navigation data has Vertical Acceleration Unc*/ 439 #define LOC_NAV_DATA_HAS_VERT_ACCEL_UNC ((LocPosDataMask)0x0080) 440 /* Bitmask to specify whether Navigation data has Heading Rate Unc*/ 441 #define LOC_NAV_DATA_HAS_YAW_RATE_UNC ((LocPosDataMask)0x0100) 442 /* Bitmask to specify whether Navigation data has Body pitch Unc*/ 443 #define LOC_NAV_DATA_HAS_PITCH_UNC ((LocPosDataMask)0x0200) 444 445 typedef uint32_t GnssAdditionalSystemInfoMask; 446 /* Bitmask to specify whether Tauc is valid */ 447 #define GNSS_ADDITIONAL_SYSTEMINFO_HAS_TAUC ((GnssAdditionalSystemInfoMask)0x0001) 448 /* Bitmask to specify whether leapSec is valid */ 449 #define GNSS_ADDITIONAL_SYSTEMINFO_HAS_LEAP_SEC ((GnssAdditionalSystemInfoMask)0x0002) 450 451 452 /** GPS PRN Range */ 453 #define GPS_SV_PRN_MIN 1 454 #define GPS_SV_PRN_MAX 32 455 #define SBAS_SV_PRN_MIN 33 456 #define SBAS_SV_PRN_MAX 64 457 #define GLO_SV_PRN_MIN 65 458 #define GLO_SV_PRN_MAX 96 459 #define QZSS_SV_PRN_MIN 193 460 #define QZSS_SV_PRN_MAX 197 461 #define BDS_SV_PRN_MIN 201 462 #define BDS_SV_PRN_MAX 237 463 #define GAL_SV_PRN_MIN 301 464 #define GAL_SV_PRN_MAX 336 465 #define NAVIC_SV_PRN_MIN 401 466 #define NAVIC_SV_PRN_MAX 414 467 468 typedef enum { 469 LOC_RELIABILITY_NOT_SET = 0, 470 LOC_RELIABILITY_VERY_LOW = 1, 471 LOC_RELIABILITY_LOW = 2, 472 LOC_RELIABILITY_MEDIUM = 3, 473 LOC_RELIABILITY_HIGH = 4 474 }LocReliability; 475 476 typedef enum { 477 LOC_IN_EMERGENCY_UNKNOWN = 0, 478 LOC_IN_EMERGENCY_SET = 1, 479 LOC_IN_EMERGENCY_NOT_SET = 2 480 }LocInEmergency; 481 482 typedef struct { 483 struct timespec32_t apTimeStamp; 484 /*boottime received from pps-ktimer*/ 485 float apTimeStampUncertaintyMs; 486 /* timestamp uncertainty in milli seconds */ 487 }Gnss_ApTimeStampStructType; 488 489 typedef struct { 490 uint64_t gps_sv_used_ids_mask; 491 uint64_t glo_sv_used_ids_mask; 492 uint64_t gal_sv_used_ids_mask; 493 uint64_t bds_sv_used_ids_mask; 494 uint64_t qzss_sv_used_ids_mask; 495 uint64_t navic_sv_used_ids_mask; 496 } GnssSvUsedInPosition; 497 498 typedef struct { 499 uint64_t gps_l1ca_sv_used_ids_mask; // GPS L1CA 500 uint64_t gps_l1c_sv_used_ids_mask; // GPS L1C 501 uint64_t gps_l2_sv_used_ids_mask; // GPS L2 502 uint64_t gps_l5_sv_used_ids_mask; // GPS L5 503 uint64_t glo_g1_sv_used_ids_mask; // GLO G1 504 uint64_t glo_g2_sv_used_ids_mask; // GLO G2 505 uint64_t gal_e1_sv_used_ids_mask; // GAL E1 506 uint64_t gal_e5a_sv_used_ids_mask; // GAL E5A 507 uint64_t gal_e5b_sv_used_ids_mask; // GAL E5B 508 uint64_t bds_b1i_sv_used_ids_mask; // BDS B1I 509 uint64_t bds_b1c_sv_used_ids_mask; // BDS B1C 510 uint64_t bds_b2i_sv_used_ids_mask; // BDS B2I 511 uint64_t bds_b2ai_sv_used_ids_mask; // BDS B2AI 512 uint64_t qzss_l1ca_sv_used_ids_mask; // QZSS L1CA 513 uint64_t qzss_l1s_sv_used_ids_mask; // QZSS L1S 514 uint64_t qzss_l2_sv_used_ids_mask; // QZSS L2 515 uint64_t qzss_l5_sv_used_ids_mask; // QZSS L5 516 uint64_t sbas_l1_sv_used_ids_mask; // SBAS L1 517 uint64_t bds_b2aq_sv_used_ids_mask; // BDS B2AQ 518 } GnssSvMbUsedInPosition; 519 520 /* Body Frame parameters */ 521 typedef struct { 522 /** Contains Body frame LocPosDataMask bits. */ 523 uint32_t bodyFrameDatamask; 524 /* Forward Acceleration in body frame (m/s2)*/ 525 float longAccel; 526 /** Uncertainty of Forward Acceleration in body frame */ 527 float longAccelUnc; 528 /* Sideward Acceleration in body frame (m/s2)*/ 529 float latAccel; 530 /** Uncertainty of Side-ward Acceleration in body frame */ 531 float latAccelUnc; 532 /* Vertical Acceleration in body frame (m/s2)*/ 533 float vertAccel; 534 /** Uncertainty of Vertical Acceleration in body frame */ 535 float vertAccelUnc; 536 /* Heading Rate (Radians/second) */ 537 float yawRate; 538 /** Uncertainty of Heading Rate */ 539 float yawRateUnc; 540 /* Body pitch (Radians) */ 541 float pitch; 542 /** Uncertainty of Body pitch */ 543 float pitchRadUnc; 544 }LocPositionDynamics; 545 546 typedef struct { 547 548 /** Position dilution of precision. 549 Range: 1 (highest accuracy) to 50 (lowest accuracy) */ 550 float PDOP; 551 552 /** Horizontal dilution of precision. 553 Range: 1 (highest accuracy) to 50 (lowest accuracy) */ 554 float HDOP; 555 556 /** Vertical dilution of precision. 557 Range: 1 (highest accuracy) to 50 (lowest accuracy) */ 558 float VDOP; 559 560 /** geometric dilution of precision. 561 Range: 1 (highest accuracy) to 50 (lowest accuracy) */ 562 float GDOP; 563 564 /** time dilution of precision. 565 Range: 1 (highest accuracy) to 50 (lowest accuracy) */ 566 float TDOP; 567 }LocExtDOP; 568 569 /* GPS Time structure */ 570 typedef struct { 571 572 /**< Current GPS week as calculated from midnight, Jan. 6, 1980. \n 573 - Units: Weeks */ 574 uint16_t gpsWeek; 575 576 /**< Amount of time into the current GPS week. \n 577 - Units: Milliseconds */ 578 uint32_t gpsTimeOfWeekMs; 579 }GPSTimeStruct; 580 581 typedef uint8_t CarrierPhaseAmbiguityType; 582 #define CARRIER_PHASE_AMBIGUITY_RESOLUTION_NONE ((CarrierPhaseAmbiguityType)0) 583 #define CARRIER_PHASE_AMBIGUITY_RESOLUTION_FLOAT ((CarrierPhaseAmbiguityType)1) 584 #define CARRIER_PHASE_AMBIGUITY_RESOLUTION_FIXED ((CarrierPhaseAmbiguityType)2) 585 586 587 typedef enum { 588 LOC_DGNSS_CORR_SOURCE_TYPE_INVALID = 0, /**< Invalid DGNSS correction source type \n */ 589 LOC_DGNSS_CORR_SOURCE_TYPE_RTCM = 1, /**< DGNSS correction source type RTCM \n */ 590 LOC_DGNSS_CORR_SOURCE_TYPE_3GPP = 2, /**< DGNSS correction source type 3GPP \n */ 591 }LocDgnssCorrectionSourceType; 592 593 typedef uint16_t GnssMeasUsageStatusBitMask; 594 /** Used in fix */ 595 #define GNSS_MEAS_USED_IN_PVT ((GnssMeasUsageStatusBitMask)0x00000001ul) 596 /** Measurement is Bad */ 597 #define GNSS_MEAS_USAGE_STATUS_BAD_MEAS ((GnssMeasUsageStatusBitMask)0x00000002ul) 598 /** Measurement has too low C/N */ 599 #define GNSS_MEAS_USAGE_STATUS_CNO_TOO_LOW ((GnssMeasUsageStatusBitMask)0x00000004ul) 600 /** Measurement has too low elevation */ 601 #define GNSS_MEAS_USAGE_STATUS_ELEVATION_TOO_LOW ((GnssMeasUsageStatusBitMask)0x00000008ul) 602 /** No ephemeris available for this measurement */ 603 #define GNSS_MEAS_USAGE_STATUS_NO_EPHEMERIS ((GnssMeasUsageStatusBitMask)0x00000010ul) 604 /** No corrections available for the measurement */ 605 #define GNSS_MEAS_USAGE_STATUS_NO_CORRECTIONS ((GnssMeasUsageStatusBitMask)0x00000020ul) 606 /** Corrections has timed out for the measurement */ 607 #define GNSS_MEAS_USAGE_STATUS_CORRECTION_TIMEOUT ((GnssMeasUsageStatusBitMask)0x00000040ul) 608 /** Measurement is unhealthy */ 609 #define GNSS_MEAS_USAGE_STATUS_UNHEALTHY ((GnssMeasUsageStatusBitMask)0x00000080ul) 610 /** Configuration is disabled for this measurement */ 611 #define GNSS_MEAS_USAGE_STATUS_CONFIG_DISABLED ((GnssMeasUsageStatusBitMask)0x00000100ul) 612 /** Measurement not used for other reasons */ 613 #define GNSS_MEAS_USAGE_STATUS_OTHER ((GnssMeasUsageStatusBitMask)0x00000200ul) 614 615 /** Flags to indicate valid fields in epMeasUsageInfo */ 616 typedef uint16_t GnssMeasUsageInfoValidityMask; 617 #define GNSS_PSEUDO_RANGE_RESIDUAL_VALID ((GnssMeasUsageInfoValidityMask)0x00000001ul) 618 #define GNSS_DOPPLER_RESIDUAL_VALID ((GnssMeasUsageInfoValidityMask)0x00000002ul) 619 #define GNSS_CARRIER_PHASE_RESIDUAL_VALID ((GnssMeasUsageInfoValidityMask)0x00000004ul) 620 #define GNSS_CARRIER_PHASE_AMBIGUITY_TYPE_VALID ((GnssMeasUsageInfoValidityMask)0x00000008ul) 621 622 typedef uint16_t GnssSvPolyStatusMask; 623 #define GNSS_SV_POLY_SRC_ALM_CORR_V02 ((GnssSvPolyStatusMask)0x01) 624 #define GNSS_SV_POLY_GLO_STR4_V02 ((GnssSvPolyStatusMask)0x02) 625 #define GNSS_SV_POLY_DELETE_V02 ((GnssSvPolyStatusMask)0x04) 626 #define GNSS_SV_POLY_SRC_GAL_FNAV_OR_INAV_V02 ((GnssSvPolyStatusMask)0x08) 627 typedef uint16_t GnssSvPolyStatusMaskValidity; 628 #define GNSS_SV_POLY_SRC_ALM_CORR_VALID_V02 ((GnssSvPolyStatusMaskValidity)0x01) 629 #define GNSS_SV_POLY_GLO_STR4_VALID_V02 ((GnssSvPolyStatusMaskValidity)0x02) 630 #define GNSS_SV_POLY_DELETE_VALID_V02 ((GnssSvPolyStatusMaskValidity)0x04) 631 #define GNSS_SV_POLY_SRC_GAL_FNAV_OR_INAV_VALID_V02 ((GnssSvPolyStatusMaskValidity)0x08) 632 633 634 typedef struct { 635 /** Specifies GNSS signal type 636 Mandatory Field*/ 637 GnssSignalTypeMask gnssSignalType; 638 /** Specifies GNSS Constellation Type 639 Mandatory Field*/ 640 Gnss_LocSvSystemEnumType gnssConstellation; 641 /** GNSS SV ID. 642 For GPS: 1 to 32 643 For GLONASS: 65 to 96. When slot-number to SV ID mapping is unknown, set as 255. 644 For SBAS: 120 to 151 645 For QZSS-L1CA:193 to 197 646 For BDS: 201 to 237 647 For GAL: 301 to 336 */ 648 uint16_t gnssSvId; 649 /** GLONASS frequency number + 7. 650 Valid only for a GLONASS system and 651 is to be ignored for all other systems. 652 Range: 1 to 14 */ 653 uint8_t gloFrequency; 654 /** Carrier phase ambiguity type. */ 655 CarrierPhaseAmbiguityType carrierPhaseAmbiguityType; 656 /** Validity mask */ 657 GnssMeasUsageStatusBitMask measUsageStatusMask; 658 /** Specifies measurement usage status 659 Mandatory Field*/ 660 GnssMeasUsageInfoValidityMask validityMask; 661 /** Computed pseudorange residual. 662 Unit: Meters */ 663 float pseudorangeResidual; 664 /** Computed doppler residual. 665 Unit: Meters/sec*/ 666 float dopplerResidual; 667 /** Computed carrier phase residual. 668 Unit: Cycles*/ 669 float carrierPhaseResidual; 670 /** Carrier phase ambiguity value. 671 Unit: Cycles*/ 672 float carrierPhasAmbiguity; 673 } GpsMeasUsageInfo; 674 675 676 /** Represents gps location extended. */ 677 typedef struct { 678 /** set to sizeof(GpsLocationExtended) */ 679 uint32_t size; 680 /** Contains GpsLocationExtendedFlags bits. */ 681 uint64_t flags; 682 /** Contains the Altitude wrt mean sea level */ 683 float altitudeMeanSeaLevel; 684 /** Contains Position Dilusion of Precision. */ 685 float pdop; 686 /** Contains Horizontal Dilusion of Precision. */ 687 float hdop; 688 /** Contains Vertical Dilusion of Precision. */ 689 float vdop; 690 /** Contains Magnetic Deviation. */ 691 float magneticDeviation; 692 /** vertical uncertainty in meters */ 693 float vert_unc; 694 /** speed uncertainty in m/s */ 695 float speed_unc; 696 /** heading uncertainty in degrees (0 to 359.999) */ 697 float bearing_unc; 698 /** horizontal reliability. */ 699 LocReliability horizontal_reliability; 700 /** vertical reliability. */ 701 LocReliability vertical_reliability; 702 /* Horizontal Elliptical Uncertainty (Semi-Major Axis) */ 703 float horUncEllipseSemiMajor; 704 /* Horizontal Elliptical Uncertainty (Semi-Minor Axis) */ 705 float horUncEllipseSemiMinor; 706 /* Elliptical Horizontal Uncertainty Azimuth */ 707 float horUncEllipseOrientAzimuth; 708 709 Gnss_ApTimeStampStructType timeStamp; 710 /** Gnss sv used in position data */ 711 GnssSvUsedInPosition gnss_sv_used_ids; 712 /** Gnss sv used in position data for multiband */ 713 GnssSvMbUsedInPosition gnss_mb_sv_used_ids; 714 /** Nav solution mask to indicate sbas corrections */ 715 LocNavSolutionMask navSolutionMask; 716 /** Position technology used in computing this fix */ 717 LocPosTechMask tech_mask; 718 /** SV Info source used in computing this fix */ 719 LocSvInfoSource sv_source; 720 /** Body Frame Dynamics: 4wayAcceleration and pitch set with validity */ 721 GnssLocationPositionDynamics bodyFrameData; 722 /** GPS Time */ 723 GPSTimeStruct gpsTime; 724 GnssSystemTime gnssSystemTime; 725 /** Dilution of precision associated with this position*/ 726 LocExtDOP extDOP; 727 /** North standard deviation. 728 Unit: Meters */ 729 float northStdDeviation; 730 /** East standard deviation. 731 Unit: Meters */ 732 float eastStdDeviation; 733 /** North Velocity. 734 Unit: Meters/sec */ 735 float northVelocity; 736 /** East Velocity. 737 Unit: Meters/sec */ 738 float eastVelocity; 739 /** Up Velocity. 740 Unit: Meters/sec */ 741 float upVelocity; 742 /** North Velocity standard deviation. 743 Unit: Meters/sec */ 744 float northVelocityStdDeviation; 745 /** East Velocity standard deviation. 746 Unit: Meters/sec */ 747 float eastVelocityStdDeviation; 748 /** Up Velocity standard deviation 749 Unit: Meters/sec */ 750 float upVelocityStdDeviation; 751 /** Estimated clock bias. Unit: Nano seconds */ 752 float clockbiasMeter; 753 /** Estimated clock bias std deviation. Unit: Nano seconds */ 754 float clockBiasStdDeviationMeter; 755 /** Estimated clock drift. Unit: Meters/sec */ 756 float clockDrift; 757 /** Estimated clock drift std deviation. Unit: Meters/sec */ 758 float clockDriftStdDeviation; 759 /** Number of valid reference stations. Range:[0-4] */ 760 uint8_t numValidRefStations; 761 /** Reference station(s) number */ 762 uint16_t referenceStation[4]; 763 /** Number of measurements received for use in fix. 764 Shall be used as maximum index in-to svUsageInfo[]. 765 Set to 0, if svUsageInfo reporting is not supported. 766 Range: 0-EP_GNSS_MAX_MEAS */ 767 uint8_t numOfMeasReceived; 768 /** Measurement Usage Information */ 769 GpsMeasUsageInfo measUsageInfo[GNSS_SV_MAX]; 770 /** Leap Seconds */ 771 uint8_t leapSeconds; 772 /** Time uncertainty in milliseconds */ 773 float timeUncMs; 774 /** Heading Rate is in NED frame. 775 Range: 0 to 359.999. 946 776 Unit: Degrees per Seconds */ 777 float headingRateDeg; 778 /** Sensor calibration confidence percent. Range: 0 - 100 */ 779 uint8_t calibrationConfidence; 780 DrCalibrationStatusMask calibrationStatus; 781 /** location engine type. When the fix. when the type is set to 782 LOC_ENGINE_SRC_FUSED, the fix is the propagated/aggregated 783 reports from all engines running on the system (e.g.: 784 DR/SPE/PPE). To check which location engine contributes to 785 the fused output, check for locOutputEngMask. */ 786 LocOutputEngineType locOutputEngType; 787 /** when loc output eng type is set to fused, this field 788 indicates the set of engines contribute to the fix. */ 789 PositioningEngineMask locOutputEngMask; 790 791 /** DGNSS Correction Source for position report: RTCM, 3GPP 792 * etc. */ 793 LocDgnssCorrectionSourceType dgnssCorrectionSourceType; 794 795 /** If DGNSS is used, the SourceID is a 32bit number identifying 796 * the DGNSS source ID */ 797 uint32_t dgnssCorrectionSourceID; 798 799 /** If DGNSS is used, which constellation was DGNSS used for to 800 * produce the pos report. */ 801 GnssConstellationTypeMask dgnssConstellationUsage; 802 803 /** If DGNSS is used, DGNSS Reference station ID used for 804 * position report */ 805 uint16_t dgnssRefStationId; 806 807 /** If DGNSS is used, DGNSS data age in milli-seconds */ 808 uint32_t dgnssDataAgeMsec; 809 } GpsLocationExtended; 810 811 enum loc_sess_status { 812 LOC_SESS_SUCCESS, 813 LOC_SESS_INTERMEDIATE, 814 LOC_SESS_FAILURE 815 }; 816 817 // struct that contains complete position info from engine 818 typedef struct { 819 UlpLocation location; 820 GpsLocationExtended locationExtended; 821 enum loc_sess_status sessionStatus; 822 } EngineLocationInfo; 823 824 // Nmea sentence types mask 825 typedef uint32_t NmeaSentenceTypesMask; 826 #define LOC_NMEA_MASK_GGA_V02 ((NmeaSentenceTypesMask)0x00000001) /**< Enable GGA type */ 827 #define LOC_NMEA_MASK_RMC_V02 ((NmeaSentenceTypesMask)0x00000002) /**< Enable RMC type */ 828 #define LOC_NMEA_MASK_GSV_V02 ((NmeaSentenceTypesMask)0x00000004) /**< Enable GSV type */ 829 #define LOC_NMEA_MASK_GSA_V02 ((NmeaSentenceTypesMask)0x00000008) /**< Enable GSA type */ 830 #define LOC_NMEA_MASK_VTG_V02 ((NmeaSentenceTypesMask)0x00000010) /**< Enable VTG type */ 831 #define LOC_NMEA_MASK_PQXFI_V02 ((NmeaSentenceTypesMask)0x00000020) /**< Enable PQXFI type */ 832 #define LOC_NMEA_MASK_PSTIS_V02 ((NmeaSentenceTypesMask)0x00000040) /**< Enable PSTIS type */ 833 #define LOC_NMEA_MASK_GLGSV_V02 ((NmeaSentenceTypesMask)0x00000080) /**< Enable GLGSV type */ 834 #define LOC_NMEA_MASK_GNGSA_V02 ((NmeaSentenceTypesMask)0x00000100) /**< Enable GNGSA type */ 835 #define LOC_NMEA_MASK_GNGNS_V02 ((NmeaSentenceTypesMask)0x00000200) /**< Enable GNGNS type */ 836 #define LOC_NMEA_MASK_GARMC_V02 ((NmeaSentenceTypesMask)0x00000400) /**< Enable GARMC type */ 837 #define LOC_NMEA_MASK_GAGSV_V02 ((NmeaSentenceTypesMask)0x00000800) /**< Enable GAGSV type */ 838 #define LOC_NMEA_MASK_GAGSA_V02 ((NmeaSentenceTypesMask)0x00001000) /**< Enable GAGSA type */ 839 #define LOC_NMEA_MASK_GAVTG_V02 ((NmeaSentenceTypesMask)0x00002000) /**< Enable GAVTG type */ 840 #define LOC_NMEA_MASK_GAGGA_V02 ((NmeaSentenceTypesMask)0x00004000) /**< Enable GAGGA type */ 841 #define LOC_NMEA_MASK_PQGSA_V02 ((NmeaSentenceTypesMask)0x00008000) /**< Enable PQGSA type */ 842 #define LOC_NMEA_MASK_PQGSV_V02 ((NmeaSentenceTypesMask)0x00010000) /**< Enable PQGSV type */ 843 #define LOC_NMEA_MASK_DEBUG_V02 ((NmeaSentenceTypesMask)0x00020000) /**< Enable DEBUG type */ 844 #define LOC_NMEA_MASK_GPDTM_V02 ((NmeaSentenceTypesMask)0x00040000) /**< Enable GPDTM type */ 845 #define LOC_NMEA_MASK_GNGGA_V02 ((NmeaSentenceTypesMask)0x00080000) /**< Enable GNGGA type */ 846 #define LOC_NMEA_MASK_GNRMC_V02 ((NmeaSentenceTypesMask)0x00100000) /**< Enable GNRMC type */ 847 #define LOC_NMEA_MASK_GNVTG_V02 ((NmeaSentenceTypesMask)0x00200000) /**< Enable GNVTG type */ 848 #define LOC_NMEA_MASK_GAGNS_V02 ((NmeaSentenceTypesMask)0x00400000) /**< Enable GAGNS type */ 849 #define LOC_NMEA_MASK_GBGGA_V02 ((NmeaSentenceTypesMask)0x00800000) /**< Enable GBGGA type */ 850 #define LOC_NMEA_MASK_GBGSA_V02 ((NmeaSentenceTypesMask)0x01000000) /**< Enable GBGSA type */ 851 #define LOC_NMEA_MASK_GBGSV_V02 ((NmeaSentenceTypesMask)0x02000000) /**< Enable GBGSV type */ 852 #define LOC_NMEA_MASK_GBRMC_V02 ((NmeaSentenceTypesMask)0x04000000) /**< Enable GBRMC type */ 853 #define LOC_NMEA_MASK_GBVTG_V02 ((NmeaSentenceTypesMask)0x08000000) /**< Enable GBVTG type */ 854 #define LOC_NMEA_MASK_GQGSV_V02 ((NmeaSentenceTypesMask)0x10000000) /**< Enable GQGSV type */ 855 #define LOC_NMEA_MASK_GIGSV_V02 ((NmeaSentenceTypesMask)0x20000000) /**< Enable GIGSV type */ 856 #define LOC_NMEA_MASK_GNDTM_V02 ((NmeaSentenceTypesMask)0x40000000) /**< Enable GNDTM type */ 857 858 859 // all bitmasks of general supported NMEA sentenses - debug is not part of this 860 #define LOC_NMEA_ALL_GENERAL_SUPPORTED_MASK (LOC_NMEA_MASK_GGA_V02 | LOC_NMEA_MASK_RMC_V02 | \ 861 LOC_NMEA_MASK_GSV_V02 | LOC_NMEA_MASK_GSA_V02 | LOC_NMEA_MASK_VTG_V02 | \ 862 LOC_NMEA_MASK_PQXFI_V02 | LOC_NMEA_MASK_PSTIS_V02 | LOC_NMEA_MASK_GLGSV_V02 | \ 863 LOC_NMEA_MASK_GNGSA_V02 | LOC_NMEA_MASK_GNGNS_V02 | LOC_NMEA_MASK_GARMC_V02 | \ 864 LOC_NMEA_MASK_GAGSV_V02 | LOC_NMEA_MASK_GAGSA_V02 | LOC_NMEA_MASK_GAVTG_V02 | \ 865 LOC_NMEA_MASK_GAGGA_V02 | LOC_NMEA_MASK_PQGSA_V02 | LOC_NMEA_MASK_PQGSV_V02 | \ 866 LOC_NMEA_MASK_GPDTM_V02 | LOC_NMEA_MASK_GNGGA_V02 | LOC_NMEA_MASK_GNRMC_V02 | \ 867 LOC_NMEA_MASK_GNVTG_V02 | LOC_NMEA_MASK_GAGNS_V02 | LOC_NMEA_MASK_GBGGA_V02 | \ 868 LOC_NMEA_MASK_GBGSA_V02 | LOC_NMEA_MASK_GBGSV_V02 | LOC_NMEA_MASK_GBRMC_V02 | \ 869 LOC_NMEA_MASK_GBVTG_V02 | LOC_NMEA_MASK_GQGSV_V02 | LOC_NMEA_MASK_GIGSV_V02 | \ 870 LOC_NMEA_MASK_GNDTM_V02) 871 872 typedef enum { 873 LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC = 0, 874 LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM, 875 LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU, 876 LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON, 877 LOC_ENG_IF_REQUEST_SENDER_ID_MODEM, 878 LOC_ENG_IF_REQUEST_SENDER_ID_UNKNOWN 879 } loc_if_req_sender_id_e_type; 880 881 882 #define smaller_of(a, b) (((a) > (b)) ? (b) : (a)) 883 #define MAX_APN_LEN 100 884 885 // This will be overridden by the individual adapters 886 // if necessary. 887 #define DEFAULT_IMPL(rtv) \ 888 { \ 889 LOC_LOGD("%s: default implementation invoked", __func__); \ 890 return rtv; \ 891 } 892 893 enum loc_api_adapter_err { 894 LOC_API_ADAPTER_ERR_SUCCESS = 0, 895 LOC_API_ADAPTER_ERR_GENERAL_FAILURE = 1, 896 LOC_API_ADAPTER_ERR_UNSUPPORTED = 2, 897 LOC_API_ADAPTER_ERR_INVALID_HANDLE = 4, 898 LOC_API_ADAPTER_ERR_INVALID_PARAMETER = 5, 899 LOC_API_ADAPTER_ERR_ENGINE_BUSY = 6, 900 LOC_API_ADAPTER_ERR_PHONE_OFFLINE = 7, 901 LOC_API_ADAPTER_ERR_TIMEOUT = 8, 902 LOC_API_ADAPTER_ERR_SERVICE_NOT_PRESENT = 9, 903 LOC_API_ADAPTER_ERR_INTERNAL = 10, 904 905 /* equating engine down to phone offline, as they are the same errror */ 906 LOC_API_ADAPTER_ERR_ENGINE_DOWN = LOC_API_ADAPTER_ERR_PHONE_OFFLINE, 907 LOC_API_ADAPTER_ERR_FAILURE = 101, 908 LOC_API_ADAPTER_ERR_UNKNOWN 909 }; 910 911 enum loc_api_adapter_event_index { 912 LOC_API_ADAPTER_REPORT_POSITION = 0, // Position report comes in loc_parsed_position_s_type 913 LOC_API_ADAPTER_REPORT_SATELLITE, // Satellite in view report 914 LOC_API_ADAPTER_REPORT_NMEA_1HZ, // NMEA report at 1HZ rate 915 LOC_API_ADAPTER_REPORT_NMEA_POSITION, // NMEA report at position report rate 916 LOC_API_ADAPTER_REQUEST_NI_NOTIFY_VERIFY, // NI notification/verification request 917 LOC_API_ADAPTER_REQUEST_ASSISTANCE_DATA, // Assistance data, eg: time, predicted orbits request 918 LOC_API_ADAPTER_REQUEST_LOCATION_SERVER, // Request for location server 919 LOC_API_ADAPTER_REPORT_IOCTL, // Callback report for loc_ioctl 920 LOC_API_ADAPTER_REPORT_STATUS, // Misc status report: eg, engine state 921 LOC_API_ADAPTER_REQUEST_WIFI, // 922 LOC_API_ADAPTER_SENSOR_STATUS, // 923 LOC_API_ADAPTER_REQUEST_TIME_SYNC, // 924 LOC_API_ADAPTER_REPORT_SPI, // 925 LOC_API_ADAPTER_REPORT_NI_GEOFENCE, // 926 LOC_API_ADAPTER_GEOFENCE_GEN_ALERT, // 927 LOC_API_ADAPTER_REPORT_GENFENCE_BREACH, // 928 LOC_API_ADAPTER_PEDOMETER_CTRL, // 929 LOC_API_ADAPTER_MOTION_CTRL, // 930 LOC_API_ADAPTER_REQUEST_WIFI_AP_DATA, // Wifi ap data 931 LOC_API_ADAPTER_BATCH_FULL, // Batching on full 932 LOC_API_ADAPTER_BATCHED_POSITION_REPORT, // Batching on fix 933 LOC_API_ADAPTER_BATCHED_GENFENCE_BREACH_REPORT, // 934 LOC_API_ADAPTER_GNSS_MEASUREMENT_REPORT, // GNSS Measurement Report 935 LOC_API_ADAPTER_GNSS_SV_POLYNOMIAL_REPORT, // GNSS SV Polynomial Report 936 LOC_API_ADAPTER_GDT_UPLOAD_BEGIN_REQ, // GDT upload start request 937 LOC_API_ADAPTER_GDT_UPLOAD_END_REQ, // GDT upload end request 938 LOC_API_ADAPTER_GNSS_MEASUREMENT, // GNSS Measurement report 939 LOC_API_ADAPTER_REQUEST_TIMEZONE, // Timezone injection request 940 LOC_API_ADAPTER_REPORT_GENFENCE_DWELL_REPORT, // Geofence dwell report 941 LOC_API_ADAPTER_REQUEST_SRN_DATA, // request srn data from AP 942 LOC_API_ADAPTER_REQUEST_POSITION_INJECTION, // Position injection request 943 LOC_API_ADAPTER_BATCH_STATUS, // batch status 944 LOC_API_ADAPTER_FDCL_SERVICE_REQ, // FDCL service request 945 LOC_API_ADAPTER_REPORT_UNPROPAGATED_POSITION, // Unpropagated Position report 946 LOC_API_ADAPTER_BS_OBS_DATA_SERVICE_REQ, // BS observation data request 947 LOC_API_ADAPTER_GNSS_SV_EPHEMERIS_REPORT, // GNSS SV Ephemeris Report 948 LOC_API_ADAPTER_LOC_SYSTEM_INFO, // Location system info event 949 LOC_API_ADAPTER_GNSS_NHZ_MEASUREMENT_REPORT, // GNSS SV nHz measurement report 950 LOC_API_ADAPTER_EVENT_REPORT_INFO, // Event report info 951 LOC_API_ADAPTER_EVENT_MAX 952 }; 953 954 #define LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT (1<<LOC_API_ADAPTER_REPORT_POSITION) 955 #define LOC_API_ADAPTER_BIT_SATELLITE_REPORT (1<<LOC_API_ADAPTER_REPORT_SATELLITE) 956 #define LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT (1<<LOC_API_ADAPTER_REPORT_NMEA_1HZ) 957 #define LOC_API_ADAPTER_BIT_NMEA_POSITION_REPORT (1<<LOC_API_ADAPTER_REPORT_NMEA_POSITION) 958 #define LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST (1<<LOC_API_ADAPTER_REQUEST_NI_NOTIFY_VERIFY) 959 #define LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST (1<<LOC_API_ADAPTER_REQUEST_ASSISTANCE_DATA) 960 #define LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST (1<<LOC_API_ADAPTER_REQUEST_LOCATION_SERVER) 961 #define LOC_API_ADAPTER_BIT_IOCTL_REPORT (1<<LOC_API_ADAPTER_REPORT_IOCTL) 962 #define LOC_API_ADAPTER_BIT_STATUS_REPORT (1<<LOC_API_ADAPTER_REPORT_STATUS) 963 #define LOC_API_ADAPTER_BIT_REQUEST_WIFI (1<<LOC_API_ADAPTER_REQUEST_WIFI) 964 #define LOC_API_ADAPTER_BIT_SENSOR_STATUS (1<<LOC_API_ADAPTER_SENSOR_STATUS) 965 #define LOC_API_ADAPTER_BIT_REQUEST_TIME_SYNC (1<<LOC_API_ADAPTER_REQUEST_TIME_SYNC) 966 #define LOC_API_ADAPTER_BIT_REPORT_SPI (1<<LOC_API_ADAPTER_REPORT_SPI) 967 #define LOC_API_ADAPTER_BIT_REPORT_NI_GEOFENCE (1<<LOC_API_ADAPTER_REPORT_NI_GEOFENCE) 968 #define LOC_API_ADAPTER_BIT_GEOFENCE_GEN_ALERT (1<<LOC_API_ADAPTER_GEOFENCE_GEN_ALERT) 969 #define LOC_API_ADAPTER_BIT_REPORT_GENFENCE_BREACH (1<<LOC_API_ADAPTER_REPORT_GENFENCE_BREACH) 970 #define LOC_API_ADAPTER_BIT_BATCHED_GENFENCE_BREACH_REPORT (1<<LOC_API_ADAPTER_BATCHED_GENFENCE_BREACH_REPORT) 971 #define LOC_API_ADAPTER_BIT_PEDOMETER_CTRL (1<<LOC_API_ADAPTER_PEDOMETER_CTRL) 972 #define LOC_API_ADAPTER_BIT_MOTION_CTRL (1<<LOC_API_ADAPTER_MOTION_CTRL) 973 #define LOC_API_ADAPTER_BIT_REQUEST_WIFI_AP_DATA (1<<LOC_API_ADAPTER_REQUEST_WIFI_AP_DATA) 974 #define LOC_API_ADAPTER_BIT_BATCH_FULL (1<<LOC_API_ADAPTER_BATCH_FULL) 975 #define LOC_API_ADAPTER_BIT_BATCHED_POSITION_REPORT (1<<LOC_API_ADAPTER_BATCHED_POSITION_REPORT) 976 #define LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT_REPORT (1<<LOC_API_ADAPTER_GNSS_MEASUREMENT_REPORT) 977 #define LOC_API_ADAPTER_BIT_GNSS_SV_POLYNOMIAL_REPORT (1<<LOC_API_ADAPTER_GNSS_SV_POLYNOMIAL_REPORT) 978 #define LOC_API_ADAPTER_BIT_GDT_UPLOAD_BEGIN_REQ (1<<LOC_API_ADAPTER_GDT_UPLOAD_BEGIN_REQ) 979 #define LOC_API_ADAPTER_BIT_GDT_UPLOAD_END_REQ (1<<LOC_API_ADAPTER_GDT_UPLOAD_END_REQ) 980 #define LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT (1<<LOC_API_ADAPTER_GNSS_MEASUREMENT) 981 #define LOC_API_ADAPTER_BIT_REQUEST_TIMEZONE (1<<LOC_API_ADAPTER_REQUEST_TIMEZONE) 982 #define LOC_API_ADAPTER_BIT_REPORT_GENFENCE_DWELL (1<<LOC_API_ADAPTER_REPORT_GENFENCE_DWELL_REPORT) 983 #define LOC_API_ADAPTER_BIT_REQUEST_SRN_DATA (1<<LOC_API_ADAPTER_REQUEST_SRN_DATA) 984 #define LOC_API_ADAPTER_BIT_POSITION_INJECTION_REQUEST (1<<LOC_API_ADAPTER_REQUEST_POSITION_INJECTION) 985 #define LOC_API_ADAPTER_BIT_BATCH_STATUS (1<<LOC_API_ADAPTER_BATCH_STATUS) 986 #define LOC_API_ADAPTER_BIT_FDCL_SERVICE_REQ (1ULL<<LOC_API_ADAPTER_FDCL_SERVICE_REQ) 987 #define LOC_API_ADAPTER_BIT_PARSED_UNPROPAGATED_POSITION_REPORT (1ULL<<LOC_API_ADAPTER_REPORT_UNPROPAGATED_POSITION) 988 #define LOC_API_ADAPTER_BIT_BS_OBS_DATA_SERVICE_REQ (1ULL<<LOC_API_ADAPTER_BS_OBS_DATA_SERVICE_REQ) 989 #define LOC_API_ADAPTER_BIT_GNSS_SV_EPHEMERIS_REPORT (1ULL<<LOC_API_ADAPTER_GNSS_SV_EPHEMERIS_REPORT) 990 #define LOC_API_ADAPTER_BIT_LOC_SYSTEM_INFO (1ULL<<LOC_API_ADAPTER_LOC_SYSTEM_INFO) 991 #define LOC_API_ADAPTER_BIT_GNSS_NHZ_MEASUREMENT (1ULL<<LOC_API_ADAPTER_GNSS_NHZ_MEASUREMENT_REPORT) 992 #define LOC_API_ADAPTER_BIT_EVENT_REPORT_INFO (1ULL<<LOC_API_ADAPTER_EVENT_REPORT_INFO) 993 994 typedef uint64_t LOC_API_ADAPTER_EVENT_MASK_T; 995 996 typedef enum loc_api_adapter_msg_to_check_supported { 997 LOC_API_ADAPTER_MESSAGE_LOCATION_BATCHING, // Batching 1.0 998 LOC_API_ADAPTER_MESSAGE_BATCHED_GENFENCE_BREACH, // Geofence Batched Breach 999 LOC_API_ADAPTER_MESSAGE_DISTANCE_BASE_TRACKING, // DBT 2.0 1000 LOC_API_ADAPTER_MESSAGE_ADAPTIVE_LOCATION_BATCHING, // Batching 1.5 1001 LOC_API_ADAPTER_MESSAGE_DISTANCE_BASE_LOCATION_BATCHING, // Batching 2.0 1002 LOC_API_ADAPTER_MESSAGE_UPDATE_TBF_ON_THE_FLY, // Updating Tracking TBF On The Fly 1003 LOC_API_ADAPTER_MESSAGE_OUTDOOR_TRIP_BATCHING, // Outdoor Trip Batching 1004 1005 LOC_API_ADAPTER_MESSAGE_MAX 1006 } LocCheckingMessagesID; 1007 1008 typedef int IzatDevId_t; 1009 1010 typedef uint32_t LOC_GPS_LOCK_MASK; 1011 #define isGpsLockNone(lock) ((lock) == 0) 1012 #define isGpsLockMO(lock) ((lock) & ((LOC_GPS_LOCK_MASK)1)) 1013 #define isGpsLockMT(lock) ((lock) & ((LOC_GPS_LOCK_MASK)2)) 1014 #define isGpsLockAll(lock) (((lock) & ((LOC_GPS_LOCK_MASK)3)) == 3) 1015 1016 /*++ *********************************************** 1017 ** Satellite Measurement and Satellite Polynomial 1018 ** Structure definitions 1019 ** *********************************************** 1020 --*/ 1021 #define GNSS_SV_POLY_VELOCITY_COEF_MAX_SIZE 12 1022 #define GNSS_SV_POLY_XYZ_0_TH_ORDER_COEFF_MAX_SIZE 3 1023 #define GNSS_SV_POLY_XYZ_N_TH_ORDER_COEFF_MAX_SIZE 9 1024 #define GNSS_SV_POLY_SV_CLKBIAS_COEFF_MAX_SIZE 4 1025 /** Max number of GNSS SV measurement */ 1026 #define GNSS_LOC_SV_MEAS_LIST_MAX_SIZE 128 1027 1028 enum ulp_gnss_sv_measurement_valid_flags{ 1029 1030 ULP_GNSS_SV_MEAS_GPS_TIME = 0, 1031 ULP_GNSS_SV_MEAS_PSUEDO_RANGE, 1032 ULP_GNSS_SV_MEAS_MS_IN_WEEK, 1033 ULP_GNSS_SV_MEAS_SUB_MSEC, 1034 ULP_GNSS_SV_MEAS_CARRIER_PHASE, 1035 ULP_GNSS_SV_MEAS_DOPPLER_SHIFT, 1036 ULP_GNSS_SV_MEAS_CNO, 1037 ULP_GNSS_SV_MEAS_LOSS_OF_LOCK, 1038 1039 ULP_GNSS_SV_MEAS_MAX_VALID_FLAGS 1040 }; 1041 1042 #define ULP_GNSS_SV_MEAS_BIT_GPS_TIME (1<<ULP_GNSS_SV_MEAS_GPS_TIME) 1043 #define ULP_GNSS_SV_MEAS_BIT_PSUEDO_RANGE (1<<ULP_GNSS_SV_MEAS_PSUEDO_RANGE) 1044 #define ULP_GNSS_SV_MEAS_BIT_MS_IN_WEEK (1<<ULP_GNSS_SV_MEAS_MS_IN_WEEK) 1045 #define ULP_GNSS_SV_MEAS_BIT_SUB_MSEC (1<<ULP_GNSS_SV_MEAS_SUB_MSEC) 1046 #define ULP_GNSS_SV_MEAS_BIT_CARRIER_PHASE (1<<ULP_GNSS_SV_MEAS_CARRIER_PHASE) 1047 #define ULP_GNSS_SV_MEAS_BIT_DOPPLER_SHIFT (1<<ULP_GNSS_SV_MEAS_DOPPLER_SHIFT) 1048 #define ULP_GNSS_SV_MEAS_BIT_CNO (1<<ULP_GNSS_SV_MEAS_CNO) 1049 #define ULP_GNSS_SV_MEAS_BIT_LOSS_OF_LOCK (1<<ULP_GNSS_SV_MEAS_LOSS_OF_LOCK) 1050 1051 enum ulp_gnss_sv_poly_valid_flags{ 1052 1053 ULP_GNSS_SV_POLY_GLO_FREQ = 0, 1054 ULP_GNSS_SV_POLY_T0, 1055 ULP_GNSS_SV_POLY_IODE, 1056 ULP_GNSS_SV_POLY_FLAG, 1057 ULP_GNSS_SV_POLY_POLYCOEFF_XYZ0, 1058 ULP_GNSS_SV_POLY_POLYCOEFF_XYZN, 1059 ULP_GNSS_SV_POLY_POLYCOEFF_OTHER, 1060 ULP_GNSS_SV_POLY_SV_POSUNC, 1061 ULP_GNSS_SV_POLY_IONODELAY, 1062 ULP_GNSS_SV_POLY_IONODOT, 1063 ULP_GNSS_SV_POLY_SBAS_IONODELAY, 1064 ULP_GNSS_SV_POLY_SBAS_IONODOT, 1065 ULP_GNSS_SV_POLY_TROPODELAY, 1066 ULP_GNSS_SV_POLY_ELEVATION, 1067 ULP_GNSS_SV_POLY_ELEVATIONDOT, 1068 ULP_GNSS_SV_POLY_ELEVATIONUNC, 1069 ULP_GNSS_SV_POLY_VELO_COEFF, 1070 ULP_GNSS_SV_POLY_ENHANCED_IOD, 1071 ULP_GNSS_SV_POLY_GPS_ISC_L1CA, 1072 ULP_GNSS_SV_POLY_GPS_ISC_L2C, 1073 ULP_GNSS_SV_POLY_GPS_ISC_L5I5, 1074 ULP_GNSS_SV_POLY_GPS_ISC_L5Q5, 1075 ULP_GNSS_SV_POLY_GPS_TGD, 1076 ULP_GNSS_SV_POLY_GLO_TGD_G1G2, 1077 ULP_GNSS_SV_POLY_BDS_TGD_B1, 1078 ULP_GNSS_SV_POLY_BDS_TGD_B2, 1079 ULP_GNSS_SV_POLY_BDS_TGD_B2A, 1080 ULP_GNSS_SV_POLY_BDS_ISC_B2A, 1081 ULP_GNSS_SV_POLY_GAL_BGD_E1E5A, 1082 ULP_GNSS_SV_POLY_GAL_BGD_E1E5B, 1083 ULP_GNSS_SV_POLY_NAVIC_TGD_L5 1084 }; 1085 1086 #define ULP_GNSS_SV_POLY_BIT_GLO_FREQ (1<<ULP_GNSS_SV_POLY_GLO_FREQ) 1087 #define ULP_GNSS_SV_POLY_BIT_T0 (1<<ULP_GNSS_SV_POLY_T0) 1088 #define ULP_GNSS_SV_POLY_BIT_IODE (1<<ULP_GNSS_SV_POLY_IODE) 1089 #define ULP_GNSS_SV_POLY_BIT_FLAG (1<<ULP_GNSS_SV_POLY_FLAG) 1090 #define ULP_GNSS_SV_POLY_BIT_POLYCOEFF_XYZ0 (1<<ULP_GNSS_SV_POLY_POLYCOEFF_XYZ0) 1091 #define ULP_GNSS_SV_POLY_BIT_POLYCOEFF_XYZN (1<<ULP_GNSS_SV_POLY_POLYCOEFF_XYZN) 1092 #define ULP_GNSS_SV_POLY_BIT_POLYCOEFF_OTHER (1<<ULP_GNSS_SV_POLY_POLYCOEFF_OTHER) 1093 #define ULP_GNSS_SV_POLY_BIT_SV_POSUNC (1<<ULP_GNSS_SV_POLY_SV_POSUNC) 1094 #define ULP_GNSS_SV_POLY_BIT_IONODELAY (1<<ULP_GNSS_SV_POLY_IONODELAY) 1095 #define ULP_GNSS_SV_POLY_BIT_IONODOT (1<<ULP_GNSS_SV_POLY_IONODOT) 1096 #define ULP_GNSS_SV_POLY_BIT_SBAS_IONODELAY (1<<ULP_GNSS_SV_POLY_SBAS_IONODELAY) 1097 #define ULP_GNSS_SV_POLY_BIT_SBAS_IONODOT (1<<ULP_GNSS_SV_POLY_SBAS_IONODOT) 1098 #define ULP_GNSS_SV_POLY_BIT_TROPODELAY (1<<ULP_GNSS_SV_POLY_TROPODELAY) 1099 #define ULP_GNSS_SV_POLY_BIT_ELEVATION (1<<ULP_GNSS_SV_POLY_ELEVATION) 1100 #define ULP_GNSS_SV_POLY_BIT_ELEVATIONDOT (1<<ULP_GNSS_SV_POLY_ELEVATIONDOT) 1101 #define ULP_GNSS_SV_POLY_BIT_ELEVATIONUNC (1<<ULP_GNSS_SV_POLY_ELEVATIONUNC) 1102 #define ULP_GNSS_SV_POLY_BIT_VELO_COEFF (1<<ULP_GNSS_SV_POLY_VELO_COEFF) 1103 #define ULP_GNSS_SV_POLY_BIT_ENHANCED_IOD (1<<ULP_GNSS_SV_POLY_ENHANCED_IOD) 1104 #define ULP_GNSS_SV_POLY_BIT_GPS_ISC_L1CA (1<<ULP_GNSS_SV_POLY_GPS_ISC_L1CA) 1105 #define ULP_GNSS_SV_POLY_BIT_GPS_ISC_L2C (1<<ULP_GNSS_SV_POLY_GPS_ISC_L2C) 1106 #define ULP_GNSS_SV_POLY_BIT_GPS_ISC_L5I5 (1<<ULP_GNSS_SV_POLY_GPS_ISC_L5I5) 1107 #define ULP_GNSS_SV_POLY_BIT_GPS_ISC_L5Q5 (1<<ULP_GNSS_SV_POLY_GPS_ISC_L5Q5) 1108 #define ULP_GNSS_SV_POLY_BIT_GPS_TGD (1<<ULP_GNSS_SV_POLY_GPS_TGD) 1109 #define ULP_GNSS_SV_POLY_BIT_GLO_TGD_G1G2 (1<<ULP_GNSS_SV_POLY_GLO_TGD_G1G2) 1110 #define ULP_GNSS_SV_POLY_BIT_BDS_TGD_B1 (1<<ULP_GNSS_SV_POLY_BDS_TGD_B1) 1111 #define ULP_GNSS_SV_POLY_BIT_BDS_TGD_B2 (1<<ULP_GNSS_SV_POLY_BDS_TGD_B2) 1112 #define ULP_GNSS_SV_POLY_BIT_BDS_TGD_B2A (1<<ULP_GNSS_SV_POLY_BDS_TGD_B2A) 1113 #define ULP_GNSS_SV_POLY_BIT_BDS_ISC_B2A (1<<ULP_GNSS_SV_POLY_BDS_ISC_B2A) 1114 #define ULP_GNSS_SV_POLY_BIT_GAL_BGD_E1E5A (1<<ULP_GNSS_SV_POLY_GAL_BGD_E1E5A) 1115 #define ULP_GNSS_SV_POLY_BIT_GAL_BGD_E1E5B (1<<ULP_GNSS_SV_POLY_GAL_BGD_E1E5B) 1116 #define ULP_GNSS_SV_POLY_BIT_NAVIC_TGD_L5 (1<<ULP_GNSS_SV_POLY_NAVIC_TGD_L5) 1117 1118 typedef enum 1119 { 1120 GNSS_LOC_FREQ_SOURCE_INVALID = 0, 1121 /**< Source of the frequency is invalid */ 1122 GNSS_LOC_FREQ_SOURCE_EXTERNAL = 1, 1123 /**< Source of the frequency is from external injection */ 1124 GNSS_LOC_FREQ_SOURCE_PE_CLK_REPORT = 2, 1125 /**< Source of the frequency is from Navigation engine */ 1126 GNSS_LOC_FREQ_SOURCE_UNKNOWN = 3 1127 /**< Source of the frequency is unknown */ 1128 } Gnss_LocSourceofFreqEnumType; 1129 1130 typedef struct 1131 { 1132 uint32_t size; 1133 float clockDrift; 1134 /**< Receiver clock Drift \n 1135 - Units: meter per sec \n 1136 */ 1137 float clockDriftUnc; 1138 /**< Receiver clock Drift uncertainty \n 1139 - Units: meter per sec \n 1140 */ 1141 Gnss_LocSourceofFreqEnumType sourceOfFreq; 1142 }Gnss_LocRcvrClockFrequencyInfoStructType; 1143 1144 typedef struct 1145 { 1146 uint32_t size; 1147 uint8_t leapSec; 1148 /**< GPS time leap second delta to UTC time \n 1149 - Units: sec \n 1150 */ 1151 uint8_t leapSecUnc; 1152 /**< Uncertainty for GPS leap second \n 1153 - Units: sec \n 1154 */ 1155 }Gnss_LeapSecondInfoStructType; 1156 1157 typedef enum 1158 { 1159 GNSS_LOC_SYS_TIME_BIAS_VALID = 0x01, 1160 /**< System time bias valid */ 1161 GNSS_LOC_SYS_TIME_BIAS_UNC_VALID = 0x02, 1162 /**< System time bias uncertainty valid */ 1163 }Gnss_LocInterSystemBiasValidMaskType; 1164 1165 typedef struct 1166 { 1167 uint32_t size; 1168 uint32_t validMask; 1169 /* Validity mask as per Gnss_LocInterSystemBiasValidMaskType */ 1170 1171 float timeBias; 1172 /**< System-1 to System-2 Time Bias \n 1173 - Units: msec \n 1174 */ 1175 float timeBiasUnc; 1176 /**< System-1 to System-2 Time Bias uncertainty \n 1177 - Units: msec \n 1178 */ 1179 } Gnss_InterSystemBiasStructType; 1180 1181 1182 typedef struct { 1183 1184 uint32_t size; 1185 1186 uint8_t systemRtc_valid; 1187 /**< Validity indicator for System RTC */ 1188 1189 uint64_t systemRtcMs; 1190 /**< Platform system RTC value \n 1191 - Units: msec \n 1192 */ 1193 1194 }Gnss_LocGnssTimeExtStructType; 1195 1196 typedef enum 1197 { 1198 GNSS_LOC_MEAS_STATUS_NULL = 0x00000000, 1199 /**< No information state */ 1200 GNSS_LOC_MEAS_STATUS_SM_VALID = 0x00000001, 1201 /**< Code phase is known */ 1202 GNSS_LOC_MEAS_STATUS_SB_VALID = 0x00000002, 1203 /**< Sub-bit time is known */ 1204 GNSS_LOC_MEAS_STATUS_MS_VALID = 0x00000004, 1205 /**< Satellite time is known */ 1206 GNSS_LOC_MEAS_STATUS_BE_CONFIRM = 0x00000008, 1207 /**< Bit edge is confirmed from signal */ 1208 GNSS_LOC_MEAS_STATUS_VELOCITY_VALID = 0x00000010, 1209 /**< Satellite Doppler measured */ 1210 GNSS_LOC_MEAS_STATUS_VELOCITY_FINE = 0x00000020, 1211 /**< TRUE: Fine Doppler measured, FALSE: Coarse Doppler measured */ 1212 GNSS_LOC_MEAS_STATUS_FROM_RNG_DIFF = 0x00000200, 1213 /**< Range update from Satellite differences */ 1214 GNSS_LOC_MEAS_STATUS_FROM_VE_DIFF = 0x00000400, 1215 /**< Doppler update from Satellite differences */ 1216 GNSS_LOC_MEAS_STATUS_DONT_USE_X = 0x00000800, 1217 /**< Don't use measurement if bit is set */ 1218 GNSS_LOC_MEAS_STATUS_DONT_USE_M = 0x000001000, 1219 /**< Don't use measurement if bit is set */ 1220 GNSS_LOC_MEAS_STATUS_DONT_USE_D = 0x000002000, 1221 /**< Don't use measurement if bit is set */ 1222 GNSS_LOC_MEAS_STATUS_DONT_USE_S = 0x000004000, 1223 /**< Don't use measurement if bit is set */ 1224 GNSS_LOC_MEAS_STATUS_DONT_USE_P = 0x000008000 1225 /**< Don't use measurement if bit is set */ 1226 }Gnss_LocSvMeasStatusMaskType; 1227 1228 typedef struct 1229 { 1230 uint32_t size; 1231 uint32_t svMs; 1232 /**< Satellite time milisecond.\n 1233 For GPS, BDS, GAL range of 0 thru (604800000-1) \n 1234 For GLONASS range of 0 thru (86400000-1) \n 1235 Valid when PD_LOC_MEAS_STATUS_MS_VALID bit is set in measurement status \n 1236 Note: All SV times in the current measurement block are alredy propagated to common reference time epoch. \n 1237 - Units: msec \n 1238 */ 1239 float svSubMs; 1240 /**<Satellite time sub-millisecond. \n 1241 Total SV Time = svMs + svSubMs \n 1242 - Units: msec \n 1243 */ 1244 float svTimeUncMs; 1245 /**< Satellite Time uncertainty \n 1246 - Units: msec \n 1247 */ 1248 float dopplerShift; 1249 /**< Satellite Doppler \n 1250 - Units: meter per sec \n 1251 */ 1252 float dopplerShiftUnc; 1253 /**< Satellite Doppler uncertainty\n 1254 - Units: meter per sec \n 1255 */ 1256 }Gnss_LocSVTimeSpeedStructType; 1257 1258 typedef enum 1259 { 1260 GNSS_SV_STATE_IDLE = 0, 1261 GNSS_SV_STATE_SEARCH = 1, 1262 GNSS_SV_STATE_SEARCH_VERIFY = 2, 1263 GNSS_SV_STATE_BIT_EDGE = 3, 1264 GNSS_SV_STATE_VERIFY_TRACK = 4, 1265 GNSS_SV_STATE_TRACK = 5, 1266 GNSS_SV_STATE_RESTART = 6, 1267 GNSS_SV_STATE_DPO_TRACK = 7 1268 } Gnss_LocSVStateEnumType; 1269 1270 typedef enum 1271 { 1272 GNSS_LOC_SVINFO_MASK_HAS_EPHEMERIS = 0x01, 1273 /**< Ephemeris is available for this SV */ 1274 GNSS_LOC_SVINFO_MASK_HAS_ALMANAC = 0x02 1275 /**< Almanac is available for this SV */ 1276 }Gnss_LocSvInfoMaskT; 1277 1278 typedef enum 1279 { 1280 GNSS_LOC_SV_SRCH_STATUS_IDLE = 1, 1281 /**< SV is not being actively processed */ 1282 GNSS_LOC_SV_SRCH_STATUS_SEARCH = 2, 1283 /**< The system is searching for this SV */ 1284 GNSS_LOC_SV_SRCH_STATUS_TRACK = 3 1285 /**< SV is being tracked */ 1286 }Gnss_LocSvSearchStatusEnumT; 1287 1288 typedef uint32_t LocSvDgnssMeasStatusMask; 1289 #define LOC_MASK_DGNSS_EPOCH_TIME_VALID 0x1 /**< DGNSS Epoch time is valid */ 1290 #define LOC_MASK_DGNSS_MEAS_STATUS_PR_VALID 0x2 /**< Pseudo Range correction is valid */ 1291 #define LOC_MASK_DGNSS_MEAS_STATUS_PRR_VALID 0x4 /**< Pseudo Range rate correction is valid */ 1292 1293 typedef struct { 1294 LocSvDgnssMeasStatusMask dgnssMeasStatus; 1295 /**< Bitmask indicating the DGNSS SV measurement status. */ 1296 1297 uint32_t diffDataEpochTimeMsec; 1298 /**< Age of differential data in Milli Seconds with respect to the Measurement time. */ 1299 1300 float prCorrMeters; 1301 /**< Pseudo Range correction in meters. */ 1302 1303 float prrCorrMetersPerSec; 1304 /**< Pseudo Range rate correction in meters per second. */ 1305 } Gnss_LocDgnssSVMeasurement; 1306 1307 typedef struct 1308 { 1309 uint32_t size; 1310 Gnss_LocSvSystemEnumType gnssSystem; 1311 // 0 signal type mask indicates invalid value 1312 GnssSignalTypeMask gnssSignalTypeMask; 1313 uint16_t gnssSvId; 1314 /**< GNSS SV ID. 1315 \begin{itemize1} 1316 \item Range: \begin{itemize1} 1317 \item For GPS: 1 to 32 1318 \item For GLONASS: 1 to 32 1319 \item For SBAS: 120 to 151 1320 \item For BDS: 201 to 237 1321 \end{itemize1} \end{itemize1} 1322 The GPS and GLONASS SVs can be disambiguated using the system field. 1323 */ 1324 uint8_t gloFrequency; 1325 /**< GLONASS frequency number + 7 \n 1326 Valid only for GLONASS System \n 1327 Shall be ignored for all other systems \n 1328 - Range: 1 to 14 \n 1329 */ 1330 Gnss_LocSvSearchStatusEnumT svStatus; 1331 /**< Satellite search state \n 1332 @ENUM() 1333 */ 1334 bool healthStatus_valid; 1335 /**< SV Health Status validity flag\n 1336 - 0: Not valid \n 1337 - 1: Valid \n 1338 */ 1339 uint8_t healthStatus; 1340 /**< Health status. 1341 \begin{itemize1} 1342 \item Range: 0 to 1; 0 = unhealthy, \n 1 = healthy, 2 = unknown 1343 \vspace{-0.18in} \end{itemize1} 1344 */ 1345 Gnss_LocSvInfoMaskT svInfoMask; 1346 /**< Indicates whether almanac and ephemeris information is available. \n 1347 @MASK() 1348 */ 1349 uint64_t measurementStatus; 1350 /**< Bitmask indicating SV measurement status. 1351 Valid bitmasks: \n 1352 If any MSB bit in 0xFFC0000000000000 DONT_USE is set, the measurement 1353 must not be used by the client. 1354 @MASK() 1355 */ 1356 uint16_t CNo; 1357 /**< Carrier to Noise ratio \n 1358 - Units: 0.1 dBHz \n 1359 */ 1360 uint16_t gloRfLoss; 1361 /**< GLONASS Rf loss reference to Antenna. \n 1362 - Units: dB, Scale: 0.1 \n 1363 */ 1364 bool lossOfLock; 1365 /**< Loss of signal lock indicator \n 1366 - 0: Signal in continuous track \n 1367 - 1: Signal not in track \n 1368 */ 1369 int16_t measLatency; 1370 /**< Age of the measurement. Positive value means measurement precedes ref time. \n 1371 - Units: msec \n 1372 */ 1373 Gnss_LocSVTimeSpeedStructType svTimeSpeed; 1374 /**< Unfiltered SV Time and Speed information 1375 */ 1376 float dopplerAccel; 1377 /**< Satellite Doppler Accelertion\n 1378 - Units: Hz/s \n 1379 */ 1380 bool multipathEstValid; 1381 /**< Multipath estimate validity flag\n 1382 - 0: Multipath estimate not valid \n 1383 - 1: Multipath estimate valid \n 1384 */ 1385 float multipathEstimate; 1386 /**< Estimate of multipath in measurement\n 1387 - Units: Meters \n 1388 */ 1389 bool fineSpeedValid; 1390 /**< Fine speed validity flag\n 1391 - 0: Fine speed not valid \n 1392 - 1: Fine speed valid \n 1393 */ 1394 float fineSpeed; 1395 /**< Carrier phase derived speed \n 1396 - Units: m/s \n 1397 */ 1398 bool fineSpeedUncValid; 1399 /**< Fine speed uncertainty validity flag\n 1400 - 0: Fine speed uncertainty not valid \n 1401 - 1: Fine speed uncertainty valid \n 1402 */ 1403 float fineSpeedUnc; 1404 /**< Carrier phase derived speed \n 1405 - Units: m/s \n 1406 */ 1407 bool carrierPhaseValid; 1408 /**< Carrier Phase measurement validity flag\n 1409 - 0: Carrier Phase not valid \n 1410 - 1: Carrier Phase valid \n 1411 */ 1412 double carrierPhase; 1413 /**< Carrier phase measurement [L1 cycles] \n 1414 */ 1415 bool cycleSlipCountValid; 1416 /**< Cycle slup count validity flag\n 1417 - 0: Not valid \n 1418 - 1: Valid \n 1419 */ 1420 uint8_t cycleSlipCount; 1421 /**< Increments when a CSlip is detected */ 1422 1423 bool svDirectionValid; 1424 /**< Validity flag for SV direction */ 1425 1426 float svAzimuth; 1427 /**< Satellite Azimuth 1428 - Units: radians \n 1429 */ 1430 float svElevation; 1431 /**< Satellite Elevation 1432 - Units: radians \n 1433 */ 1434 uint64_t validMeasStatusMask; 1435 /**< Bitmask indicating SV measurement status Validity. 1436 Valid bitmasks: \n 1437 If any MSB bit in 0xFFC0000000000000 DONT_USE is set, the measurement 1438 must not be used by the client. 1439 @MASK() 1440 */ 1441 bool carrierPhaseUncValid; 1442 /**< Validity flag for SV direction */ 1443 1444 float carrierPhaseUnc; 1445 1446 /** < DGNSS Measurements Report for SVs */ 1447 Gnss_LocDgnssSVMeasurement dgnssSvMeas; 1448 } Gnss_SVMeasurementStructType; 1449 1450 1451 typedef uint64_t GpsSvMeasHeaderFlags; 1452 #define GNSS_SV_MEAS_HEADER_HAS_LEAP_SECOND 0x00000001 1453 #define GNSS_SV_MEAS_HEADER_HAS_CLOCK_FREQ 0x00000002 1454 #define GNSS_SV_MEAS_HEADER_HAS_AP_TIMESTAMP 0x00000004 1455 #define GNSS_SV_MEAS_HEADER_HAS_GPS_GLO_INTER_SYSTEM_BIAS 0x00000008 1456 #define GNSS_SV_MEAS_HEADER_HAS_GPS_BDS_INTER_SYSTEM_BIAS 0x00000010 1457 #define GNSS_SV_MEAS_HEADER_HAS_GPS_GAL_INTER_SYSTEM_BIAS 0x00000020 1458 #define GNSS_SV_MEAS_HEADER_HAS_BDS_GLO_INTER_SYSTEM_BIAS 0x00000040 1459 #define GNSS_SV_MEAS_HEADER_HAS_GAL_GLO_INTER_SYSTEM_BIAS 0x00000080 1460 #define GNSS_SV_MEAS_HEADER_HAS_GAL_BDS_INTER_SYSTEM_BIAS 0x00000100 1461 #define GNSS_SV_MEAS_HEADER_HAS_GPS_SYSTEM_TIME 0x00000200 1462 #define GNSS_SV_MEAS_HEADER_HAS_GAL_SYSTEM_TIME 0x00000400 1463 #define GNSS_SV_MEAS_HEADER_HAS_BDS_SYSTEM_TIME 0x00000800 1464 #define GNSS_SV_MEAS_HEADER_HAS_QZSS_SYSTEM_TIME 0x00001000 1465 #define GNSS_SV_MEAS_HEADER_HAS_GLO_SYSTEM_TIME 0x00002000 1466 #define GNSS_SV_MEAS_HEADER_HAS_GPS_SYSTEM_TIME_EXT 0x00004000 1467 #define GNSS_SV_MEAS_HEADER_HAS_GAL_SYSTEM_TIME_EXT 0x00008000 1468 #define GNSS_SV_MEAS_HEADER_HAS_BDS_SYSTEM_TIME_EXT 0x00010000 1469 #define GNSS_SV_MEAS_HEADER_HAS_QZSS_SYSTEM_TIME_EXT 0x00020000 1470 #define GNSS_SV_MEAS_HEADER_HAS_GLO_SYSTEM_TIME_EXT 0x00040000 1471 #define GNSS_SV_MEAS_HEADER_HAS_GPSL1L5_TIME_BIAS 0x00080000 1472 #define GNSS_SV_MEAS_HEADER_HAS_GALE1E5A_TIME_BIAS 0x00100000 1473 #define GNSS_SV_MEAS_HEADER_HAS_GPS_NAVIC_INTER_SYSTEM_BIAS 0x00200000 1474 #define GNSS_SV_MEAS_HEADER_HAS_GAL_NAVIC_INTER_SYSTEM_BIAS 0x00400000 1475 #define GNSS_SV_MEAS_HEADER_HAS_GLO_NAVIC_INTER_SYSTEM_BIAS 0x00800000 1476 #define GNSS_SV_MEAS_HEADER_HAS_BDS_NAVIC_INTER_SYSTEM_BIAS 0x01000000 1477 #define GNSS_SV_MEAS_HEADER_HAS_NAVIC_SYSTEM_TIME 0x02000000 1478 #define GNSS_SV_MEAS_HEADER_HAS_NAVIC_SYSTEM_TIME_EXT 0x04000000 1479 #define GNSS_SV_MEAS_HEADER_HAS_DGNSS_CORRECTION_SOURCE_TYPE 0x08000000 1480 #define GNSS_SV_MEAS_HEADER_HAS_DGNSS_CORRECTION_SOURCE_ID 0x010000000 1481 #define GNSS_SV_MEAS_HEADER_HAS_DGNSS_REF_STATION_ID 0x020000000 1482 1483 typedef struct 1484 { 1485 uint32_t size; 1486 // see defines in GNSS_SV_MEAS_HEADER_HAS_XXX_XXX 1487 uint64_t flags; 1488 1489 Gnss_LeapSecondInfoStructType leapSec; 1490 1491 Gnss_LocRcvrClockFrequencyInfoStructType clockFreq; /* Freq */ 1492 1493 Gnss_ApTimeStampStructType apBootTimeStamp; 1494 1495 Gnss_InterSystemBiasStructType gpsGloInterSystemBias; 1496 Gnss_InterSystemBiasStructType gpsBdsInterSystemBias; 1497 Gnss_InterSystemBiasStructType gpsGalInterSystemBias; 1498 Gnss_InterSystemBiasStructType bdsGloInterSystemBias; 1499 Gnss_InterSystemBiasStructType galGloInterSystemBias; 1500 Gnss_InterSystemBiasStructType galBdsInterSystemBias; 1501 Gnss_InterSystemBiasStructType gpsNavicInterSystemBias; 1502 Gnss_InterSystemBiasStructType galNavicInterSystemBias; 1503 Gnss_InterSystemBiasStructType gloNavicInterSystemBias; 1504 Gnss_InterSystemBiasStructType bdsNavicInterSystemBias; 1505 Gnss_InterSystemBiasStructType gpsL1L5TimeBias; 1506 Gnss_InterSystemBiasStructType galE1E5aTimeBias; 1507 1508 GnssSystemTimeStructType gpsSystemTime; 1509 GnssSystemTimeStructType galSystemTime; 1510 GnssSystemTimeStructType bdsSystemTime; 1511 GnssSystemTimeStructType qzssSystemTime; 1512 GnssSystemTimeStructType navicSystemTime; 1513 GnssGloTimeStructType gloSystemTime; 1514 1515 /** GPS system RTC time information. */ 1516 Gnss_LocGnssTimeExtStructType gpsSystemTimeExt; 1517 /** GAL system RTC time information. */ 1518 Gnss_LocGnssTimeExtStructType galSystemTimeExt; 1519 /** BDS system RTC time information. */ 1520 Gnss_LocGnssTimeExtStructType bdsSystemTimeExt; 1521 /** QZSS system RTC time information. */ 1522 Gnss_LocGnssTimeExtStructType qzssSystemTimeExt; 1523 /** GLONASS system RTC time information. */ 1524 Gnss_LocGnssTimeExtStructType gloSystemTimeExt; 1525 /** NAVIC system RTC time information. */ 1526 Gnss_LocGnssTimeExtStructType navicSystemTimeExt; 1527 1528 /** Receiver tick at frame count */ 1529 uint64_t refCountTicks; 1530 1531 /** DGNSS corrections source type RTCM, 3GPP etc, if DGNSS was 1532 * used for these measurements. */ 1533 LocDgnssCorrectionSourceType dgnssCorrectionSourceType; 1534 1535 /** DGNSS SourceID: 32bit number identifying the DGNSS source 1536 * ID, if DGNSS was used for these measurements. */ 1537 uint32_t dgnssCorrectionSourceID; 1538 1539 /** DGNSS Ref station ID: 32bit number identifying the DGNSS 1540 * ref station ID, if DGNSS was used for these measurements. */ 1541 uint16_t dgnssRefStationId; 1542 1543 } GnssSvMeasurementHeader; 1544 1545 typedef struct { 1546 uint32_t size; 1547 bool isNhz; 1548 GnssSvMeasurementHeader svMeasSetHeader; 1549 uint32_t svMeasCount; 1550 Gnss_SVMeasurementStructType svMeas[GNSS_LOC_SV_MEAS_LIST_MAX_SIZE]; 1551 1552 } GnssSvMeasurementSet; 1553 1554 typedef struct { 1555 uint32_t size; // set to sizeof(GnssMeasurements) 1556 GnssSvMeasurementSet gnssSvMeasurementSet; 1557 GnssMeasurementsNotification gnssMeasNotification; 1558 } GnssMeasurements; 1559 1560 typedef enum 1561 { 1562 GNSS_SV_POLY_COEFF_VALID = 0x01, 1563 /**< SV position in orbit coefficients are valid */ 1564 GNSS_SV_POLY_IONO_VALID = 0x02, 1565 /**< Iono estimates are valid */ 1566 1567 GNSS_SV_POLY_TROPO_VALID = 0x04, 1568 /**< Tropo estimates are valid */ 1569 1570 GNSS_SV_POLY_ELEV_VALID = 0x08, 1571 /**< Elevation, rate, uncertainty are valid */ 1572 1573 GNSS_SV_POLY_SRC_ALM_CORR = 0x10, 1574 /**< Polynomials based on XTRA */ 1575 1576 GNSS_SV_POLY_SBAS_IONO_VALID = 0x20, 1577 /**< SBAS IONO and rate are valid */ 1578 1579 GNSS_SV_POLY_GLO_STR4 = 0x40 1580 /**< GLONASS String 4 has been received */ 1581 }Gnss_SvPolyStatusMaskType; 1582 1583 1584 typedef struct 1585 { 1586 uint32_t size; 1587 uint16_t gnssSvId; 1588 /* GPS: 1-32, GLO: 65-96, 0: Invalid, 1589 SBAS: 120-151, BDS:201-237,GAL:301 to 336 1590 All others are reserved 1591 */ 1592 int8_t freqNum; 1593 /* Freq index, only valid if u_SysInd is GLO */ 1594 1595 GnssSvPolyStatusMaskValidity svPolyStatusMaskValidity; 1596 GnssSvPolyStatusMask svPolyStatusMask; 1597 1598 uint32_t is_valid; 1599 1600 uint16_t iode; 1601 /* Ephemeris reference time 1602 GPS:Issue of Data Ephemeris used [unitless]. 1603 GLO: Tb 7-bit, refer to ICD02 1604 */ 1605 double T0; 1606 /* Reference time for polynominal calculations 1607 GPS: Secs in week. 1608 GLO: Full secs since Jan/01/96 1609 */ 1610 double polyCoeffXYZ0[GNSS_SV_POLY_XYZ_0_TH_ORDER_COEFF_MAX_SIZE]; 1611 /* C0X, C0Y, C0Z */ 1612 double polyCoefXYZN[GNSS_SV_POLY_XYZ_N_TH_ORDER_COEFF_MAX_SIZE]; 1613 /* C1X, C2X ... C2Z, C3Z */ 1614 float polyCoefOther[GNSS_SV_POLY_SV_CLKBIAS_COEFF_MAX_SIZE]; 1615 /* C0T, C1T, C2T, C3T */ 1616 float svPosUnc; /* SV position uncertainty [m]. */ 1617 float ionoDelay; /* Ionospheric delay at d_T0 [m]. */ 1618 float ionoDot; /* Iono delay rate [m/s]. */ 1619 float sbasIonoDelay;/* SBAS Ionospheric delay at d_T0 [m]. */ 1620 float sbasIonoDot; /* SBAS Iono delay rate [m/s]. */ 1621 float tropoDelay; /* Tropospheric delay [m]. */ 1622 float elevation; /* Elevation [rad] at d_T0 */ 1623 float elevationDot; /* Elevation rate [rad/s] */ 1624 float elevationUnc; /* SV elevation [rad] uncertainty */ 1625 double velCoef[GNSS_SV_POLY_VELOCITY_COEF_MAX_SIZE]; 1626 /* Coefficients of velocity poly */ 1627 uint32_t enhancedIOD; /* Enhanced Reference Time */ 1628 float gpsIscL1ca; 1629 float gpsIscL2c; 1630 float gpsIscL5I5; 1631 float gpsIscL5Q5; 1632 float gpsTgd; 1633 float gloTgdG1G2; 1634 float bdsTgdB1; 1635 float bdsTgdB2; 1636 float bdsTgdB2a; 1637 float bdsIscB2a; 1638 float galBgdE1E5a; 1639 float galBgdE1E5b; 1640 float navicTgdL5; 1641 } GnssSvPolynomial; 1642 1643 typedef enum { 1644 GNSS_EPH_ACTION_UPDATE_SRC_UNKNOWN_V02 = 0, /**<Update ephemeris. Source of ephemeris is unknown */ 1645 GNSS_EPH_ACTION_UPDATE_SRC_OTA_V02 = 1, /**<Update ephemeris. Source of ephemeris is OTA */ 1646 GNSS_EPH_ACTION_UPDATE_SRC_NETWORK_V02 = 2, /**<Update ephemeris. Source of ephemeris is Network */ 1647 GNSS_EPH_ACTION_UPDATE_MAX_V02 = 999, /**<Max value for update ephemeris action. DO NOT USE */ 1648 GNSS_EPH_ACTION_DELETE_SRC_UNKNOWN_V02 = 1000, /**<Delete previous ephemeris from unknown source */ 1649 GNSS_EPH_ACTION_DELETE_SRC_NETWORK_V02 = 1001, /**<Delete previous ephemeris from network */ 1650 GNSS_EPH_ACTION_DELETE_SRC_OTA_V02 = 1002, /**<Delete previous ephemeris from OTA */ 1651 GNSS_EPH_ACTION_DELETE_MAX_V02 = 1999, /**<Max value for delete ephemeris action. DO NOT USE */ 1652 } GnssEphAction; 1653 1654 typedef enum { 1655 GAL_EPH_SIGNAL_SRC_UNKNOWN_V02 = 0, /**< GALILEO signal is unknown */ 1656 GAL_EPH_SIGNAL_SRC_E1B_V02 = 1, /**< GALILEO signal is E1B */ 1657 GAL_EPH_SIGNAL_SRC_E5A_V02 = 2, /**< GALILEO signal is E5A */ 1658 GAL_EPH_SIGNAL_SRC_E5B_V02 = 3, /**< GALILEO signal is E5B */ 1659 } GalEphSignalSource; 1660 1661 typedef struct { 1662 uint16_t gnssSvId; 1663 /**< GNSS SV ID. 1664 - Type: uint16 1665 \begin{itemize1} 1666 \item Range: \begin{itemize1} 1667 \item For GPS: 1 to 32 1668 \item For QZSS: 193 to 197 1669 \item For BDS: 201 to 237 1670 \item For GAL: 301 to 336 1671 \vspace{-0.18in} \end{itemize1} \end{itemize1} */ 1672 1673 GnssEphAction updateAction; 1674 /**< Specifies the action and source of ephemeris. \n 1675 - Type: int32 enum */ 1676 1677 uint16_t IODE; 1678 /**< Issue of data ephemeris used (unit-less). \n 1679 GPS: IODE 8 bits.\n 1680 BDS: AODE 5 bits. \n 1681 GAL: SIS IOD 10 bits. \n 1682 - Type: uint16 1683 - Units: Unit-less */ 1684 1685 double aSqrt; 1686 /**< Square root of semi-major axis. \n 1687 - Type: double 1688 - Units: Square Root of Meters */ 1689 1690 double deltaN; 1691 /**< Mean motion difference from computed value. \n 1692 - Type: double 1693 - Units: Radians/Second */ 1694 1695 double m0; 1696 /**< Mean anomaly at reference time. \n 1697 - Type: double 1698 - Units: Radians */ 1699 1700 double eccentricity; 1701 /**< Eccentricity . \n 1702 - Type: double 1703 - Units: Unit-less */ 1704 1705 double omega0; 1706 /**< Longitude of ascending node of orbital plane at the weekly epoch. \n 1707 - Type: double 1708 - Units: Radians */ 1709 1710 double i0; 1711 /**< Inclination angle at reference time. \n 1712 - Type: double 1713 - Units: Radians */ 1714 1715 double omega; 1716 /**< Argument of Perigee. \n 1717 - Type: double 1718 - Units: Radians */ 1719 1720 double omegaDot; 1721 /**< Rate of change of right ascension. \n 1722 - Type: double 1723 - Units: Radians/Second */ 1724 1725 double iDot; 1726 /**< Rate of change of inclination angle. \n 1727 - Type: double 1728 - Units: Radians/Second */ 1729 1730 double cUc; 1731 /**< Amplitude of the cosine harmonic correction term to the argument of latitude. \n 1732 - Type: double 1733 - Units: Radians */ 1734 1735 double cUs; 1736 /**< Amplitude of the sine harmonic correction term to the argument of latitude. \n 1737 - Type: double 1738 - Units: Radians */ 1739 1740 double cRc; 1741 /**< Amplitude of the cosine harmonic correction term to the orbit radius. \n 1742 - Type: double 1743 - Units: Meters */ 1744 1745 double cRs; 1746 /**< Amplitude of the sine harmonic correction term to the orbit radius. \n 1747 - Type: double 1748 - Units: Meters */ 1749 1750 double cIc; 1751 /**< Amplitude of the cosine harmonic correction term to the angle of inclination. \n 1752 - Type: double 1753 - Units: Radians */ 1754 1755 double cIs; 1756 /**< Amplitude of the sine harmonic correction term to the angle of inclination. \n 1757 - Type: double 1758 - Units: Radians */ 1759 1760 uint32_t toe; 1761 /**< Reference time of ephemeris. \n 1762 - Type: uint32 1763 - Units: Seconds */ 1764 1765 uint32_t toc; 1766 /**< Clock data reference time of week. \n 1767 - Type: uint32 1768 - Units: Seconds */ 1769 1770 double af0; 1771 /**< Clock bias correction coefficient. \n 1772 - Type: double 1773 - Units: Seconds */ 1774 1775 double af1; 1776 /**< Clock drift coefficient. \n 1777 - Type: double 1778 - Units: Seconds/Second */ 1779 1780 double af2; 1781 /**< Clock drift rate correction coefficient. \n 1782 - Type: double 1783 - Units: Seconds/Seconds^2 */ 1784 1785 } GnssEphCommon; 1786 1787 /* GPS Navigation Model Info */ 1788 typedef struct { 1789 GnssEphCommon commonEphemerisData; 1790 /**< Common ephemeris data. */ 1791 1792 uint8_t signalHealth; 1793 /**< Signal health. \n 1794 Bit 0 : L5 Signal Health. \n 1795 Bit 1 : L2 Signal Health. \n 1796 Bit 2 : L1 Signal Health. \n 1797 - Type: uint8 1798 - Values: 3 bit mask of signal health, where set bit indicates unhealthy signal */ 1799 1800 uint8_t URAI; 1801 /**< User Range Accuracy Index. \n 1802 - Type: uint8 1803 - Units: Unit-less */ 1804 1805 uint8_t codeL2; 1806 /**< Indicates which codes are commanded ON for the L2 channel (2-bits). \n 1807 - Type: uint8 1808 Valid Values: \n 1809 - 00 : Reserved 1810 - 01 : P code ON 1811 - 10 : C/A code ON */ 1812 1813 uint8_t dataFlagL2P; 1814 /**< L2 P-code indication flag. \n 1815 - Type: uint8 1816 - Value 1 indicates that the Nav data stream was commanded OFF on the P-code of the L2 channel. */ 1817 1818 double tgd; 1819 /**< Time of group delay. \n 1820 - Type: double 1821 - Units: Seconds */ 1822 1823 uint8_t fitInterval; 1824 /**< Indicates the curve-fit interval used by the CS. \n 1825 - Type: uint8 1826 Valid Values: 1827 - 0 : Four hours 1828 - 1 : Greater than four hours */ 1829 1830 uint16_t IODC; 1831 /**< Issue of Data, Clock. \n 1832 - Type: uint16 1833 - Units: Unit-less */ 1834 } GpsEphemeris; 1835 1836 /* GLONASS Navigation Model Info */ 1837 typedef struct { 1838 1839 uint16_t gnssSvId; 1840 /**< GNSS SV ID. 1841 - Type: uint16 1842 - Range: 65 to 96 if known. When the slot number to SV ID mapping is unknown, set to 255 */ 1843 1844 GnssEphAction updateAction; 1845 /**< Specifies the action and source of ephemeris. \n 1846 - Type: int32 enum */ 1847 1848 uint8_t bnHealth; 1849 /**< SV health flags. \n 1850 - Type: uint8 1851 Valid Values: \n 1852 - 0 : Healthy 1853 - 1 : Unhealthy */ 1854 1855 uint8_t lnHealth; 1856 /**< Ln SV health flags. GLONASS-M. \n 1857 - Type: uint8 1858 Valid Values: \n 1859 - 0 : Healthy 1860 - 1 : Unhealthy */ 1861 1862 uint8_t tb; 1863 /**< Index of a time interval within current day according to UTC(SU) + 03 hours 00 min. \n 1864 - Type: uint8 1865 - Units: Unit-less */ 1866 1867 uint8_t ft; 1868 /**< SV accuracy index. \n 1869 - Type: uint8 1870 - Units: Unit-less */ 1871 1872 uint8_t gloM; 1873 /**< GLONASS-M flag. \n 1874 - Type: uint8 1875 Valid Values: \n 1876 - 0 : GLONASS 1877 - 1 : GLONASS-M */ 1878 1879 uint8_t enAge; 1880 /**< Characterizes "Age" of current information. \n 1881 - Type: uint8 1882 - Units: Days */ 1883 1884 uint8_t gloFrequency; 1885 /**< GLONASS frequency number + 8. \n 1886 - Type: uint8 1887 - Range: 1 to 14 1888 */ 1889 1890 uint8_t p1; 1891 /**< Time interval between two adjacent values of tb parameter. \n 1892 - Type: uint8 1893 - Units: Minutes */ 1894 1895 uint8_t p2; 1896 /**< Flag of oddness ("1") or evenness ("0") of the value of tb \n 1897 for intervals 30 or 60 minutes. \n 1898 - Type: uint8 */ 1899 1900 float deltaTau; 1901 /**< Time difference between navigation RF signal transmitted in L2 sub-band \n 1902 and aviation RF signal transmitted in L1 sub-band. \n 1903 - Type: floating point 1904 - Units: Seconds */ 1905 1906 double position[3]; 1907 /**< Satellite XYZ position. \n 1908 - Type: array of doubles 1909 - Units: Meters */ 1910 1911 double velocity[3]; 1912 /**< Satellite XYZ velocity. \n 1913 - Type: array of doubles 1914 - Units: Meters/Second */ 1915 1916 double acceleration[3]; 1917 /**< Satellite XYZ sola-luni acceleration. \n 1918 - Type: array of doubles 1919 - Units: Meters/Second^2 */ 1920 1921 float tauN; 1922 /**< Satellite clock correction relative to GLONASS time. \n 1923 - Type: floating point 1924 - Units: Seconds */ 1925 1926 float gamma; 1927 /**< Relative deviation of predicted carrier frequency value \n 1928 from nominal value at the instant tb. \n 1929 - Type: floating point 1930 - Units: Unit-less */ 1931 1932 double toe; 1933 /**< Complete ephemeris time, including N4, NT and Tb. \n 1934 [(N4-1)*1461 + (NT-1)]*86400 + tb*900 \n 1935 - Type: double 1936 - Units: Seconds */ 1937 1938 uint16_t nt; 1939 /**< Current date, calendar number of day within four-year interval. \n 1940 Starting from the 1-st of January in a leap year. \n 1941 - Type: uint16 1942 - Units: Days */ 1943 } GlonassEphemeris; 1944 1945 /* BDS Navigation Model Info */ 1946 typedef struct { 1947 1948 GnssEphCommon commonEphemerisData; 1949 /**< Common ephemeris data. */ 1950 1951 uint8_t svHealth; 1952 /**< Satellite health information applied to both B1 and B2 (SatH1). \n 1953 - Type: uint8 1954 Valid Values: \n 1955 - 0 : Healthy 1956 - 1 : Unhealthy */ 1957 1958 uint8_t AODC; 1959 /**< Age of data clock. \n 1960 - Type: uint8 1961 - Units: Hours */ 1962 1963 double tgd1; 1964 /**< Equipment group delay differential on B1 signal. \n 1965 - Type: double 1966 - Units: Nano-Seconds */ 1967 1968 double tgd2; 1969 /**< Equipment group delay differential on B2 signal. \n 1970 - Type: double 1971 - Units: Nano-Seconds */ 1972 1973 uint8_t URAI; 1974 /**< User range accuracy index (4-bits). \n 1975 - Type: uint8 1976 - Units: Unit-less */ 1977 } BdsEphemeris; 1978 1979 /* GALIELO Navigation Model Info */ 1980 typedef struct { 1981 1982 GnssEphCommon commonEphemerisData; 1983 /**< Common ephemeris data. */ 1984 1985 GalEphSignalSource dataSourceSignal; 1986 /**< Galileo Signal Source. \n 1987 Valid Values: \n 1988 - GAL_EPH_SIGNAL_SRC_UNKNOWN (0) -- GALILEO signal is unknown 1989 - GAL_EPH_SIGNAL_SRC_E1B (1) -- GALILEO signal is E1B 1990 - GAL_EPH_SIGNAL_SRC_E5A (2) -- GALILEO signal is E5A 1991 - GAL_EPH_SIGNAL_SRC_E5B (3) -- GALILEO signal is E5B */ 1992 1993 uint8_t sisIndex; 1994 /**< Signal-in-space index for dual frequency E1-E5b/E5a depending on dataSignalSource. \n 1995 - Type: uint8 1996 - Units: Unit-less */ 1997 1998 double bgdE1E5a; 1999 /**< E1-E5a Broadcast group delay from F/Nav (E5A). \n 2000 - Type: double 2001 - Units: Seconds */ 2002 2003 double bgdE1E5b; 2004 /**< E1-E5b Broadcast group delay from I/Nav (E1B or E5B). \n 2005 For E1B or E5B signal, both bgdE1E5a and bgdE1E5b are valid. \n 2006 For E5A signal, only bgdE1E5a is valid. \n 2007 Signal source identified using dataSignalSource. \n 2008 - Type: double 2009 - Units: Seconds */ 2010 2011 uint8_t svHealth; 2012 /**< SV health status of signal identified by dataSourceSignal. \n 2013 - Type: uint8 2014 Valid Values: \n 2015 - 0 : Healthy 2016 - 1 : Unhealthy */ 2017 } GalileoEphemeris; 2018 2019 /** GPS Navigation model for each SV */ 2020 typedef struct { 2021 uint16_t numOfEphemeris; 2022 GpsEphemeris gpsEphemerisData[GNSS_EPHEMERIS_LIST_MAX_SIZE_V02]; 2023 } GpsEphemerisResponse; 2024 2025 /** GLONASS Navigation model for each SV */ 2026 typedef struct { 2027 uint16_t numOfEphemeris; 2028 GlonassEphemeris gloEphemerisData[GNSS_EPHEMERIS_LIST_MAX_SIZE_V02]; 2029 } GlonassEphemerisResponse; 2030 2031 /** BDS Navigation model for each SV */ 2032 typedef struct { 2033 uint16_t numOfEphemeris; 2034 BdsEphemeris bdsEphemerisData[GNSS_EPHEMERIS_LIST_MAX_SIZE_V02]; 2035 } BdsEphemerisResponse; 2036 2037 /** GALILEO Navigation model for each SV */ 2038 typedef struct { 2039 uint16_t numOfEphemeris; 2040 GalileoEphemeris galEphemerisData[GNSS_EPHEMERIS_LIST_MAX_SIZE_V02]; 2041 } GalileoEphemerisResponse; 2042 2043 /** QZSS Navigation model for each SV */ 2044 typedef struct { 2045 uint16_t numOfEphemeris; 2046 GpsEphemeris qzssEphemerisData[GNSS_EPHEMERIS_LIST_MAX_SIZE_V02]; 2047 } QzssEphemerisResponse; 2048 2049 2050 typedef struct { 2051 /** Indicates GNSS Constellation Type 2052 Mandatory field */ 2053 Gnss_LocSvSystemEnumType gnssConstellation; 2054 2055 /** GPS System Time of the ephemeris report */ 2056 bool isSystemTimeValid; 2057 GnssSystemTimeStructType systemTime; 2058 2059 union { 2060 /** GPS Ephemeris */ 2061 GpsEphemerisResponse gpsEphemeris; 2062 /** GLONASS Ephemeris */ 2063 GlonassEphemerisResponse glonassEphemeris; 2064 /** BDS Ephemeris */ 2065 BdsEphemerisResponse bdsEphemeris; 2066 /** GALILEO Ephemeris */ 2067 GalileoEphemerisResponse galileoEphemeris; 2068 /** QZSS Ephemeris */ 2069 QzssEphemerisResponse qzssEphemeris; 2070 } ephInfo; 2071 } GnssSvEphemerisReport; 2072 2073 typedef struct { 2074 /** GPS System Time of the iono model report */ 2075 bool isSystemTimeValid; 2076 GnssSystemTimeStructType systemTime; 2077 2078 /** Indicates GNSS Constellation Type */ 2079 Gnss_LocSvSystemEnumType gnssConstellation; 2080 2081 float alpha0; 2082 /**< Klobuchar Model Parameter Alpha 0. 2083 - Type: float 2084 - Unit: Seconds 2085 */ 2086 2087 float alpha1; 2088 /**< Klobuchar Model Parameter Alpha 1. 2089 - Type: float 2090 - Unit: Seconds / Semi-Circle 2091 */ 2092 2093 float alpha2; 2094 /**< Klobuchar Model Parameter Alpha 2. 2095 - Type: float 2096 - Unit: Seconds / Semi-Circle^2 2097 */ 2098 2099 float alpha3; 2100 /**< Klobuchar Model Parameter Alpha 3. 2101 - Type: float 2102 - Unit: Seconds / Semi-Circle^3 2103 */ 2104 2105 float beta0; 2106 /**< Klobuchar Model Parameter Beta 0. 2107 - Type: float 2108 - Unit: Seconds 2109 */ 2110 2111 float beta1; 2112 /**< Klobuchar Model Parameter Beta 1. 2113 - Type: float 2114 - Unit: Seconds / Semi-Circle 2115 */ 2116 2117 float beta2; 2118 /**< Klobuchar Model Parameter Beta 2. 2119 - Type: float 2120 - Unit: Seconds / Semi-Circle^2 2121 */ 2122 2123 float beta3; 2124 /**< Klobuchar Model Parameter Beta 3. 2125 - Type: float 2126 - Unit: Seconds / Semi-Circle^3 2127 */ 2128 } GnssKlobucharIonoModel; 2129 2130 typedef struct { 2131 /** GPS System Time of the report */ 2132 bool isSystemTimeValid; 2133 GnssSystemTimeStructType systemTime; 2134 2135 GnssAdditionalSystemInfoMask validityMask; 2136 double tauC; 2137 int8_t leapSec; 2138 } GnssAdditionalSystemInfo; 2139 2140 /* Various Short Range Node Technology type*/ 2141 typedef enum { 2142 SRN_AP_DATA_TECH_TYPE_NONE, 2143 SRN_AP_DATA_TECH_TYPE_BT, 2144 SRN_AP_DATA_TECH_TYPE_BTLE, 2145 SRN_AP_DATA_TECH_TYPE_NFC, 2146 SRN_AP_DATA_TECH_TYPE_MOBILE_CODE, 2147 SRN_AP_DATA_TECH_TYPE_OTHER 2148 } Gnss_SrnTech; 2149 2150 /* Mac Address type requested by modem */ 2151 typedef enum { 2152 SRN_AP_DATA_PUBLIC_MAC_ADDR_TYPE_INVALID, /* No valid mac address type send */ 2153 SRN_AP_DATA_PUBLIC_MAC_ADDR_TYPE_PUBLIC, /* SRN AP MAC Address type PUBLIC */ 2154 SRN_AP_DATA_PUBLIC_MAC_ADDR_TYPE_PRIVATE, /* SRN AP MAC Address type PRIVATE */ 2155 SRN_AP_DATA_PUBLIC_MAC_ADDR_TYPE_OTHER, /* SRN AP MAC Address type OTHER */ 2156 }Gnss_Srn_MacAddr_Type; 2157 2158 typedef struct 2159 { 2160 uint32_t size; 2161 Gnss_SrnTech srnTechType; /* SRN Technology type in request */ 2162 bool srnRequest; /* scan - start(true) or stop(false) */ 2163 bool e911Mode; /* If in E911 emergency */ 2164 Gnss_Srn_MacAddr_Type macAddrType; /* SRN AP MAC Address type */ 2165 } GnssSrnDataReq; 2166 2167 /* Provides the current GNSS SV Type configuration to the client. 2168 * This is fetched via direct call to GNSS Adapter bypassing 2169 * Location API */ 2170 typedef std::function<void( 2171 const GnssSvTypeConfig& config 2172 )> GnssSvTypeConfigCallback; 2173 2174 /* 2175 * Represents the status of AGNSS augmented to support IPv4. 2176 */ 2177 struct AGnssExtStatusIpV4 { 2178 AGpsExtType type; 2179 LocApnTypeMask apnTypeMask; 2180 LocAGpsStatusValue status; 2181 /* 2182 * 32-bit IPv4 address. 2183 */ 2184 uint32_t ipV4Addr; 2185 }; 2186 2187 /* 2188 * Represents the status of AGNSS augmented to support IPv6. 2189 */ 2190 struct AGnssExtStatusIpV6 { 2191 AGpsExtType type; 2192 LocApnTypeMask apnTypeMask; 2193 LocAGpsStatusValue status; 2194 /* 2195 * 128-bit IPv6 address. 2196 */ 2197 uint8_t ipV6Addr[16]; 2198 }; 2199 2200 /* 2201 * Represents the the Nfw Notification structure 2202 */ 2203 #define GNSS_MAX_NFW_APP_STRING_LEN 64 2204 #define GNSS_MAX_NFW_STRING_LEN 20 2205 2206 typedef enum { 2207 GNSS_NFW_CTRL_PLANE = 0, 2208 GNSS_NFW_SUPL = 1, 2209 GNSS_NFW_IMS = 10, 2210 GNSS_NFW_SIM = 11, 2211 GNSS_NFW_OTHER_PROTOCOL_STACK = 100 2212 } GnssNfwProtocolStack; 2213 2214 typedef enum { 2215 GNSS_NFW_CARRIER = 0, 2216 GNSS_NFW_OEM = 10, 2217 GNSS_NFW_MODEM_CHIPSET_VENDOR = 11, 2218 GNSS_NFW_GNSS_CHIPSET_VENDOR = 12, 2219 GNSS_NFW_OTHER_CHIPSET_VENDOR = 13, 2220 GNSS_NFW_AUTOMOBILE_CLIENT = 20, 2221 GNSS_NFW_OTHER_REQUESTOR = 100 2222 } GnssNfwRequestor; 2223 2224 typedef enum { 2225 GNSS_NFW_REJECTED = 0, 2226 GNSS_NFW_ACCEPTED_NO_LOCATION_PROVIDED = 1, 2227 GNSS_NFW_ACCEPTED_LOCATION_PROVIDED = 2, 2228 } GnssNfwResponseType; 2229 2230 typedef struct { 2231 char proxyAppPackageName[GNSS_MAX_NFW_APP_STRING_LEN]; 2232 GnssNfwProtocolStack protocolStack; 2233 char otherProtocolStackName[GNSS_MAX_NFW_STRING_LEN]; 2234 GnssNfwRequestor requestor; 2235 char requestorId[GNSS_MAX_NFW_STRING_LEN]; 2236 GnssNfwResponseType responseType; 2237 bool inEmergencyMode; 2238 bool isCachedLocation; 2239 } GnssNfwNotification; 2240 2241 /* ODCPI Request Info */ 2242 enum OdcpiRequestType { 2243 ODCPI_REQUEST_TYPE_START, 2244 ODCPI_REQUEST_TYPE_STOP 2245 }; 2246 struct OdcpiRequestInfo { 2247 uint32_t size; 2248 OdcpiRequestType type; 2249 uint32_t tbfMillis; 2250 bool isEmergencyMode; 2251 }; 2252 /* Callback to send ODCPI request to framework */ 2253 typedef std::function<void(const OdcpiRequestInfo& request)> OdcpiRequestCallback; 2254 2255 /* 2256 * Callback with AGNSS(IpV4) status information. 2257 * 2258 * @param status Will be of type AGnssExtStatusIpV4. 2259 */ 2260 typedef void (*AgnssStatusIpV4Cb)(AGnssExtStatusIpV4 status); 2261 2262 /* 2263 * Callback with NFW information. 2264 */ 2265 typedef void(*NfwStatusCb)(GnssNfwNotification notification); 2266 typedef bool(*IsInEmergencySession)(void); 2267 2268 /* 2269 * Callback with AGNSS(IpV6) status information. 2270 * 2271 * @param status Will be of type AGnssExtStatusIpV6. 2272 */ 2273 typedef void (*AgnssStatusIpV6Cb)(AGnssExtStatusIpV6 status); 2274 2275 /* Constructs for interaction with loc_net_iface library */ 2276 typedef void (*LocAgpsOpenResultCb)(bool isSuccess, AGpsExtType agpsType, const char* apn, 2277 AGpsBearerType bearerType, void* userDataPtr); 2278 2279 typedef void (*LocAgpsCloseResultCb)(bool isSuccess, AGpsExtType agpsType, void* userDataPtr); 2280 2281 enum PowerStateType { 2282 POWER_STATE_UNKNOWN = 0, 2283 POWER_STATE_SUSPEND = 1, 2284 POWER_STATE_RESUME = 2, 2285 POWER_STATE_SHUTDOWN = 3 2286 }; 2287 2288 /* Shared resources of LocIpc */ 2289 #define LOC_IPC_HAL "/dev/socket/location/socket_hal" 2290 #define LOC_IPC_XTRA "/dev/socket/location/xtra/socket_xtra" 2291 2292 #define SOCKET_DIR_LOCATION "/dev/socket/location/" 2293 #define SOCKET_DIR_EHUB "/dev/socket/location/ehub/" 2294 #define SOCKET_TO_LOCATION_HAL_DAEMON "/dev/socket/loc_client/hal_daemon" 2295 2296 #define SOCKET_LOC_CLIENT_DIR "/dev/socket/loc_client/" 2297 #define EAP_LOC_CLIENT_DIR "/data/vendor/location/extap_locclient/" 2298 2299 #define LOC_CLIENT_NAME_PREFIX "toclient" 2300 // Please note that the socket name for all location hal daemon client need 2301 // to start with LOC_CLIENT_NAME_PREFIX so that upon hal daemon restarts, 2302 // every client can get the notification that hal daemon has restarted. 2303 #define LOC_INTAPI_NAME_PREFIX LOC_CLIENT_NAME_PREFIX "_intapi" 2304 2305 typedef uint64_t NetworkHandle; 2306 #define NETWORK_HANDLE_UNKNOWN ~0 2307 #define MAX_NETWORK_HANDLES 10 2308 2309 #ifdef __cplusplus 2310 } 2311 #endif /* __cplusplus */ 2312 2313 #endif /* GPS_EXTENDED_C_H */ 2314