1 /* Copyright (c) 2013-2017 The Linux Foundation. All rights reserved. 2 * 3 * Redistribution and use in source and binary forms, with or without 4 * modification, are permitted provided that the following conditions are 5 * met: 6 * * Redistributions of source code must retain the above copyright 7 * notice, this list of conditions and the following disclaimer. 8 * * Redistributions in binary form must reproduce the above 9 * copyright notice, this list of conditions and the following 10 * disclaimer in the documentation and/or other materials provided 11 * with the distribution. 12 * * Neither the name of The Linux Foundation nor the names of its 13 * contributors may be used to endorse or promote products derived 14 * from this software without specific prior written permission. 15 * 16 * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED 17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 20 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 21 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 22 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR 23 * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 24 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 25 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 26 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 */ 28 29 #ifndef 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 #include <time.h> 39 40 /** 41 * @file 42 * @brief C++ declarations for GPS types 43 */ 44 45 #ifdef __cplusplus 46 extern "C" { 47 #endif /* __cplusplus */ 48 49 /** Location has valid source information. */ 50 #define LOCATION_HAS_SOURCE_INFO 0x0020 51 /** LocGpsLocation has valid "is indoor?" flag */ 52 #define LOC_GPS_LOCATION_HAS_IS_INDOOR 0x0040 53 /** LocGpsLocation has valid floor number */ 54 #define LOC_GPS_LOCATION_HAS_FLOOR_NUMBER 0x0080 55 /** LocGpsLocation has valid map URL*/ 56 #define LOC_GPS_LOCATION_HAS_MAP_URL 0x0100 57 /** LocGpsLocation has valid map index */ 58 #define LOC_GPS_LOCATION_HAS_MAP_INDEX 0x0200 59 60 /** Sizes for indoor fields */ 61 #define GPS_LOCATION_MAP_URL_SIZE 400 62 #define GPS_LOCATION_MAP_INDEX_SIZE 16 63 64 /** Position source is ULP */ 65 #define ULP_LOCATION_IS_FROM_HYBRID 0x0001 66 /** Position source is GNSS only */ 67 #define ULP_LOCATION_IS_FROM_GNSS 0x0002 68 /** Position source is ZPP only */ 69 #define ULP_LOCATION_IS_FROM_ZPP 0x0004 70 /** Position is from a Geofence Breach Event */ 71 #define ULP_LOCATION_IS_FROM_GEOFENCE 0X0008 72 /** Position is from Hardware FLP */ 73 #define ULP_LOCATION_IS_FROM_HW_FLP 0x0010 74 /** Position is from NLP */ 75 #define ULP_LOCATION_IS_FROM_NLP 0x0020 76 /** Position is from PIP */ 77 #define ULP_LOCATION_IS_FROM_PIP 0x0040 78 /** Position is from external DR solution*/ 79 #define ULP_LOCATION_IS_FROM_EXT_DR 0X0080 80 81 #define ULP_MIN_INTERVAL_INVALID 0xffffffff 82 #define ULP_MAX_NMEA_STRING_SIZE 201 83 84 /*Emergency SUPL*/ 85 #define LOC_GPS_NI_TYPE_EMERGENCY_SUPL 4 86 87 #define LOC_AGPS_CERTIFICATE_MAX_LENGTH 2000 88 #define LOC_AGPS_CERTIFICATE_MAX_SLOTS 10 89 90 typedef uint32_t LocPosTechMask; 91 #define LOC_POS_TECH_MASK_DEFAULT ((LocPosTechMask)0x00000000) 92 #define LOC_POS_TECH_MASK_SATELLITE ((LocPosTechMask)0x00000001) 93 #define LOC_POS_TECH_MASK_CELLID ((LocPosTechMask)0x00000002) 94 #define LOC_POS_TECH_MASK_WIFI ((LocPosTechMask)0x00000004) 95 #define LOC_POS_TECH_MASK_SENSORS ((LocPosTechMask)0x00000008) 96 #define LOC_POS_TECH_MASK_REFERENCE_LOCATION ((LocPosTechMask)0x00000010) 97 #define LOC_POS_TECH_MASK_INJECTED_COARSE_POSITION ((LocPosTechMask)0x00000020) 98 #define LOC_POS_TECH_MASK_AFLT ((LocPosTechMask)0x00000040) 99 #define LOC_POS_TECH_MASK_HYBRID ((LocPosTechMask)0x00000080) 100 101 enum loc_registration_mask_status { 102 LOC_REGISTRATION_MASK_ENABLED, 103 LOC_REGISTRATION_MASK_DISABLED, 104 LOC_REGISTRATION_MASK_SET 105 }; 106 107 typedef enum { 108 LOC_SUPPORTED_FEATURE_ODCPI_2_V02 = 0, /**< Support ODCPI version 2 feature */ 109 LOC_SUPPORTED_FEATURE_WIFI_AP_DATA_INJECT_2_V02 /**< Support Wifi AP data inject version 2 feature */ 110 } loc_supported_feature_enum; 111 112 typedef struct { 113 /** set to sizeof(UlpLocation) */ 114 size_t size; 115 LocGpsLocation gpsLocation; 116 /* Provider indicator for HYBRID or GPS */ 117 uint16_t position_source; 118 LocPosTechMask tech_mask; 119 /*allows HAL to pass additional information related to the location */ 120 int rawDataSize; /* in # of bytes */ 121 void * rawData; 122 bool is_indoor; 123 float floor_number; 124 char map_url[GPS_LOCATION_MAP_URL_SIZE]; 125 unsigned char map_index[GPS_LOCATION_MAP_INDEX_SIZE]; 126 } UlpLocation; 127 128 typedef struct { 129 /** set to sizeof(UlpNmea) */ 130 size_t size; 131 char nmea_str[ULP_MAX_NMEA_STRING_SIZE]; 132 unsigned int len; 133 } UlpNmea; 134 135 136 /** AGPS type */ 137 typedef int16_t AGpsExtType; 138 #define LOC_AGPS_TYPE_INVALID -1 139 #define LOC_AGPS_TYPE_ANY 0 140 #define LOC_AGPS_TYPE_SUPL 1 141 #define LOC_AGPS_TYPE_C2K 2 142 #define LOC_AGPS_TYPE_WWAN_ANY 3 143 #define LOC_AGPS_TYPE_WIFI 4 144 #define LOC_AGPS_TYPE_SUPL_ES 5 145 146 /** SSID length */ 147 #define SSID_BUF_SIZE (32+1) 148 149 typedef int16_t AGpsBearerType; 150 #define AGPS_APN_BEARER_INVALID -1 151 #define AGPS_APN_BEARER_IPV4 0 152 #define AGPS_APN_BEARER_IPV6 1 153 #define AGPS_APN_BEARER_IPV4V6 2 154 155 /** GPS extended callback structure. */ 156 typedef struct { 157 /** set to sizeof(LocGpsCallbacks) */ 158 size_t size; 159 loc_gps_set_capabilities set_capabilities_cb; 160 loc_gps_acquire_wakelock acquire_wakelock_cb; 161 loc_gps_release_wakelock release_wakelock_cb; 162 loc_gps_create_thread create_thread_cb; 163 loc_gps_request_utc_time request_utc_time_cb; 164 } GpsExtCallbacks; 165 166 /** Callback to report the xtra server url to the client. 167 * The client should use this url when downloading xtra unless overwritten 168 * in the gps.conf file 169 */ 170 typedef void (* report_xtra_server)(const char*, const char*, const char*); 171 172 /** Callback structure for the XTRA interface. */ 173 typedef struct { 174 loc_gps_xtra_download_request download_request_cb; 175 loc_gps_create_thread create_thread_cb; 176 report_xtra_server report_xtra_server_cb; 177 } GpsXtraExtCallbacks; 178 179 /** Represents the status of AGPS. */ 180 typedef struct { 181 /** set to sizeof(AGpsExtStatus) */ 182 size_t size; 183 184 AGpsExtType type; 185 LocAGpsStatusValue status; 186 uint32_t ipv4_addr; 187 struct sockaddr_storage addr; 188 char ssid[SSID_BUF_SIZE]; 189 char password[SSID_BUF_SIZE]; 190 } AGpsExtStatus; 191 192 /** Callback with AGPS status information. 193 * Can only be called from a thread created by create_thread_cb. 194 */ 195 typedef void (* agps_status_extended)(AGpsExtStatus* status); 196 197 /** Callback structure for the AGPS interface. */ 198 typedef struct { 199 agps_status_extended status_cb; 200 loc_gps_create_thread create_thread_cb; 201 } AGpsExtCallbacks; 202 203 204 typedef void (*loc_ni_notify_callback)(LocGpsNiNotification *notification, bool esEnalbed); 205 /** GPS NI callback structure. */ 206 typedef struct 207 { 208 /** 209 * Sends the notification request from HAL to GPSLocationProvider. 210 */ 211 loc_ni_notify_callback notify_cb; 212 } GpsNiExtCallbacks; 213 214 typedef enum loc_server_type { 215 LOC_AGPS_CDMA_PDE_SERVER, 216 LOC_AGPS_CUSTOM_PDE_SERVER, 217 LOC_AGPS_MPC_SERVER, 218 LOC_AGPS_SUPL_SERVER 219 } LocServerType; 220 221 typedef enum loc_position_mode_type { 222 LOC_POSITION_MODE_INVALID = -1, 223 LOC_POSITION_MODE_STANDALONE = 0, 224 LOC_POSITION_MODE_MS_BASED, 225 LOC_POSITION_MODE_MS_ASSISTED, 226 LOC_POSITION_MODE_RESERVED_1, 227 LOC_POSITION_MODE_RESERVED_2, 228 LOC_POSITION_MODE_RESERVED_3, 229 LOC_POSITION_MODE_RESERVED_4, 230 LOC_POSITION_MODE_RESERVED_5 231 232 } LocPositionMode; 233 234 /** 235 * @brief Minimum allowed value for fix interval. 236 * 237 * This value is a sanity limit in GPS framework. The hardware has own internal 238 * limits that may not match this value 239 * 240 * @sa GPS_DEFAULT_FIX_INTERVAL_MS 241 */ 242 243 #define GPS_MIN_POSSIBLE_FIX_INTERVAL_MS 100 244 /** 245 * @brief Default value for fix interval. 246 * 247 * This value is used by default whenever appropriate. 248 * 249 * @sa GPS_MIN_POSSIBLE_FIX_INTERVAL_MS 250 */ 251 #define GPS_DEFAULT_FIX_INTERVAL_MS 1000 252 253 /** Flags to indicate which values are valid in a GpsLocationExtended. */ 254 typedef uint16_t GpsLocationExtendedFlags; 255 /** GpsLocationExtended has valid pdop, hdop, vdop. */ 256 #define GPS_LOCATION_EXTENDED_HAS_DOP 0x0001 257 /** GpsLocationExtended has valid altitude mean sea level. */ 258 #define GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL 0x0002 259 /** UlpLocation has valid magnetic deviation. */ 260 #define GPS_LOCATION_EXTENDED_HAS_MAG_DEV 0x0004 261 /** UlpLocation has valid mode indicator. */ 262 #define GPS_LOCATION_EXTENDED_HAS_MODE_IND 0x0008 263 /** GpsLocationExtended has valid vertical uncertainty */ 264 #define GPS_LOCATION_EXTENDED_HAS_VERT_UNC 0x0010 265 /** GpsLocationExtended has valid speed uncertainty */ 266 #define GPS_LOCATION_EXTENDED_HAS_SPEED_UNC 0x0020 267 /** GpsLocationExtended has valid heading uncertainty */ 268 #define GPS_LOCATION_EXTENDED_HAS_BEARING_UNC 0x0040 269 /** GpsLocationExtended has valid horizontal reliability */ 270 #define GPS_LOCATION_EXTENDED_HAS_HOR_RELIABILITY 0x0080 271 /** GpsLocationExtended has valid vertical reliability */ 272 #define GPS_LOCATION_EXTENDED_HAS_VERT_RELIABILITY 0x0100 273 /** GpsLocationExtended has valid Horizontal Elliptical Uncertainty (Semi-Major Axis) */ 274 #define GPS_LOCATION_EXTENDED_HAS_HOR_ELIP_UNC_MAJOR 0x0200 275 /** GpsLocationExtended has valid Horizontal Elliptical Uncertainty (Semi-Minor Axis) */ 276 #define GPS_LOCATION_EXTENDED_HAS_HOR_ELIP_UNC_MINOR 0x0400 277 /** GpsLocationExtended has valid Elliptical Horizontal Uncertainty Azimuth */ 278 #define GPS_LOCATION_EXTENDED_HAS_HOR_ELIP_UNC_AZIMUTH 0x0800 279 /** GpsLocationExtended has valid gnss sv used in position data */ 280 #define GPS_LOCATION_EXTENDED_HAS_GNSS_SV_USED_DATA 0x1000 281 /** GpsLocationExtended has valid navSolutionMask */ 282 #define GPS_LOCATION_EXTENDED_HAS_NAV_SOLUTION_MASK 0x2000 283 284 typedef uint32_t LocNavSolutionMask; 285 /* Bitmask to specify whether SBAS ionospheric correction is used */ 286 #define LOC_NAV_MASK_SBAS_CORRECTION_IONO ((LocNavSolutionMask)0x0001) 287 /* Bitmask to specify whether SBAS fast correction is used */ 288 #define LOC_NAV_MASK_SBAS_CORRECTION_FAST ((LocNavSolutionMask)0x0002) 289 /**< Bitmask to specify whether SBAS long-tem correction is used */ 290 #define LOC_NAV_MASK_SBAS_CORRECTION_LONG ((LocNavSolutionMask)0x0004) 291 /**< Bitmask to specify whether SBAS integrity information is used */ 292 #define LOC_NAV_MASK_SBAS_INTEGRITY ((LocNavSolutionMask)0x0008) 293 294 /** GPS PRN Range */ 295 #define GPS_SV_PRN_MIN 1 296 #define GPS_SV_PRN_MAX 32 297 #define GLO_SV_PRN_MIN 65 298 #define GLO_SV_PRN_MAX 96 299 #define QZSS_SV_PRN_MIN 193 300 #define QZSS_SV_PRN_MAX 197 301 #define BDS_SV_PRN_MIN 201 302 #define BDS_SV_PRN_MAX 235 303 #define GAL_SV_PRN_MIN 301 304 #define GAL_SV_PRN_MAX 336 305 306 typedef uint32_t LocPosTechMask; 307 #define LOC_POS_TECH_MASK_DEFAULT ((LocPosTechMask)0x00000000) 308 #define LOC_POS_TECH_MASK_SATELLITE ((LocPosTechMask)0x00000001) 309 #define LOC_POS_TECH_MASK_CELLID ((LocPosTechMask)0x00000002) 310 #define LOC_POS_TECH_MASK_WIFI ((LocPosTechMask)0x00000004) 311 #define LOC_POS_TECH_MASK_SENSORS ((LocPosTechMask)0x00000008) 312 #define LOC_POS_TECH_MASK_REFERENCE_LOCATION ((LocPosTechMask)0x00000010) 313 #define LOC_POS_TECH_MASK_INJECTED_COARSE_POSITION ((LocPosTechMask)0x00000020) 314 #define LOC_POS_TECH_MASK_AFLT ((LocPosTechMask)0x00000040) 315 #define LOC_POS_TECH_MASK_HYBRID ((LocPosTechMask)0x00000080) 316 317 typedef enum { 318 LOC_RELIABILITY_NOT_SET = 0, 319 LOC_RELIABILITY_VERY_LOW = 1, 320 LOC_RELIABILITY_LOW = 2, 321 LOC_RELIABILITY_MEDIUM = 3, 322 LOC_RELIABILITY_HIGH = 4 323 }LocReliability; 324 325 typedef struct { 326 struct timespec apTimeStamp; 327 /*boottime received from pps-ktimer*/ 328 float apTimeStampUncertaintyMs; 329 /* timestamp uncertainty in milli seconds */ 330 }Gnss_ApTimeStampStructType; 331 332 typedef struct { 333 uint64_t gps_sv_used_ids_mask; 334 uint64_t glo_sv_used_ids_mask; 335 uint64_t gal_sv_used_ids_mask; 336 uint64_t bds_sv_used_ids_mask; 337 uint64_t qzss_sv_used_ids_mask; 338 } GnssSvUsedInPosition; 339 340 /** Represents gps location extended. */ 341 typedef struct { 342 /** set to sizeof(GpsLocationExtended) */ 343 size_t size; 344 /** Contains GpsLocationExtendedFlags bits. */ 345 uint16_t flags; 346 /** Contains the Altitude wrt mean sea level */ 347 float altitudeMeanSeaLevel; 348 /** Contains Position Dilusion of Precision. */ 349 float pdop; 350 /** Contains Horizontal Dilusion of Precision. */ 351 float hdop; 352 /** Contains Vertical Dilusion of Precision. */ 353 float vdop; 354 /** Contains Magnetic Deviation. */ 355 float magneticDeviation; 356 /** vertical uncertainty in meters */ 357 float vert_unc; 358 /** speed uncertainty in m/s */ 359 float speed_unc; 360 /** heading uncertainty in degrees (0 to 359.999) */ 361 float bearing_unc; 362 /** horizontal reliability. */ 363 LocReliability horizontal_reliability; 364 /** vertical reliability. */ 365 LocReliability vertical_reliability; 366 /* Horizontal Elliptical Uncertainty (Semi-Major Axis) */ 367 float horUncEllipseSemiMajor; 368 /* Horizontal Elliptical Uncertainty (Semi-Minor Axis) */ 369 float horUncEllipseSemiMinor; 370 /* Elliptical Horizontal Uncertainty Azimuth */ 371 float horUncEllipseOrientAzimuth; 372 373 Gnss_ApTimeStampStructType timeStamp; 374 /** Gnss sv used in position data */ 375 GnssSvUsedInPosition gnss_sv_used_ids; 376 /** Nav solution mask to indicate sbas corrections */ 377 LocNavSolutionMask navSolutionMask; 378 /** Position technology used in computing this fix */ 379 LocPosTechMask tech_mask; 380 } GpsLocationExtended; 381 382 enum loc_sess_status { 383 LOC_SESS_SUCCESS, 384 LOC_SESS_INTERMEDIATE, 385 LOC_SESS_FAILURE 386 }; 387 388 // Nmea sentence types mask 389 typedef uint32_t NmeaSentenceTypesMask; 390 #define LOC_NMEA_MASK_GGA_V02 ((NmeaSentenceTypesMask)0x00000001) /**< Enable GGA type */ 391 #define LOC_NMEA_MASK_RMC_V02 ((NmeaSentenceTypesMask)0x00000002) /**< Enable RMC type */ 392 #define LOC_NMEA_MASK_GSV_V02 ((NmeaSentenceTypesMask)0x00000004) /**< Enable GSV type */ 393 #define LOC_NMEA_MASK_GSA_V02 ((NmeaSentenceTypesMask)0x00000008) /**< Enable GSA type */ 394 #define LOC_NMEA_MASK_VTG_V02 ((NmeaSentenceTypesMask)0x00000010) /**< Enable VTG type */ 395 #define LOC_NMEA_MASK_PQXFI_V02 ((NmeaSentenceTypesMask)0x00000020) /**< Enable PQXFI type */ 396 #define LOC_NMEA_MASK_PSTIS_V02 ((NmeaSentenceTypesMask)0x00000040) /**< Enable PSTIS type */ 397 #define LOC_NMEA_MASK_GLGSV_V02 ((NmeaSentenceTypesMask)0x00000080) /**< Enable GLGSV type */ 398 #define LOC_NMEA_MASK_GNGSA_V02 ((NmeaSentenceTypesMask)0x00000100) /**< Enable GNGSA type */ 399 #define LOC_NMEA_MASK_GNGNS_V02 ((NmeaSentenceTypesMask)0x00000200) /**< Enable GNGNS type */ 400 #define LOC_NMEA_MASK_GARMC_V02 ((NmeaSentenceTypesMask)0x00000400) /**< Enable GARMC type */ 401 #define LOC_NMEA_MASK_GAGSV_V02 ((NmeaSentenceTypesMask)0x00000800) /**< Enable GAGSV type */ 402 #define LOC_NMEA_MASK_GAGSA_V02 ((NmeaSentenceTypesMask)0x00001000) /**< Enable GAGSA type */ 403 #define LOC_NMEA_MASK_GAVTG_V02 ((NmeaSentenceTypesMask)0x00002000) /**< Enable GAVTG type */ 404 #define LOC_NMEA_MASK_GAGGA_V02 ((NmeaSentenceTypesMask)0x00004000) /**< Enable GAGGA type */ 405 #define LOC_NMEA_MASK_PQGSA_V02 ((NmeaSentenceTypesMask)0x00008000) /**< Enable PQGSA type */ 406 #define LOC_NMEA_MASK_PQGSV_V02 ((NmeaSentenceTypesMask)0x00010000) /**< Enable PQGSV type */ 407 #define LOC_NMEA_MASK_DEBUG_V02 ((NmeaSentenceTypesMask)0x00020000) /**< Enable DEBUG type */ 408 409 #define LOC_NMEA_ALL_SUPPORTED_MASK (LOC_NMEA_MASK_GGA_V02 | LOC_NMEA_MASK_RMC_V02 | \ 410 LOC_NMEA_MASK_GSV_V02 | LOC_NMEA_MASK_GSA_V02 | LOC_NMEA_MASK_VTG_V02 | \ 411 LOC_NMEA_MASK_PQXFI_V02 | LOC_NMEA_MASK_PSTIS_V02 | LOC_NMEA_MASK_GLGSV_V02 | \ 412 LOC_NMEA_MASK_GNGSA_V02 | LOC_NMEA_MASK_GNGNS_V02 | LOC_NMEA_MASK_GARMC_V02 | \ 413 LOC_NMEA_MASK_GAGSV_V02 | LOC_NMEA_MASK_GAGSA_V02 | LOC_NMEA_MASK_GAVTG_V02 | \ 414 LOC_NMEA_MASK_GAGGA_V02 | LOC_NMEA_MASK_PQGSA_V02 | LOC_NMEA_MASK_PQGSV_V02 | \ 415 LOC_NMEA_MASK_DEBUG_V02 ) 416 417 typedef enum { 418 LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC = 0, 419 LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM, 420 LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU, 421 LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON, 422 LOC_ENG_IF_REQUEST_SENDER_ID_MODEM, 423 LOC_ENG_IF_REQUEST_SENDER_ID_UNKNOWN 424 } loc_if_req_sender_id_e_type; 425 426 427 #define smaller_of(a, b) (((a) > (b)) ? (b) : (a)) 428 #define MAX_APN_LEN 100 429 430 // This will be overridden by the individual adapters 431 // if necessary. 432 #define DEFAULT_IMPL(rtv) \ 433 { \ 434 LOC_LOGD("%s: default implementation invoked", __func__); \ 435 return rtv; \ 436 } 437 438 enum loc_api_adapter_err { 439 LOC_API_ADAPTER_ERR_SUCCESS = 0, 440 LOC_API_ADAPTER_ERR_GENERAL_FAILURE = 1, 441 LOC_API_ADAPTER_ERR_UNSUPPORTED = 2, 442 LOC_API_ADAPTER_ERR_INVALID_HANDLE = 4, 443 LOC_API_ADAPTER_ERR_INVALID_PARAMETER = 5, 444 LOC_API_ADAPTER_ERR_ENGINE_BUSY = 6, 445 LOC_API_ADAPTER_ERR_PHONE_OFFLINE = 7, 446 LOC_API_ADAPTER_ERR_TIMEOUT = 8, 447 LOC_API_ADAPTER_ERR_SERVICE_NOT_PRESENT = 9, 448 LOC_API_ADAPTER_ERR_INTERNAL = 10, 449 LOC_API_ADAPTER_ERR_ALREADY_INITIALIZED = 11, 450 LOC_API_ADAPTER_ERR_OCCUPIED = 12, 451 452 /* equating engine down to phone offline, as they are the same errror */ 453 LOC_API_ADAPTER_ERR_ENGINE_DOWN = LOC_API_ADAPTER_ERR_PHONE_OFFLINE, 454 LOC_API_ADAPTER_ERR_FAILURE = 101, 455 LOC_API_ADAPTER_ERR_UNKNOWN 456 }; 457 458 enum loc_api_adapter_event_index { 459 LOC_API_ADAPTER_REPORT_POSITION = 0, // Position report comes in loc_parsed_position_s_type 460 LOC_API_ADAPTER_REPORT_SATELLITE, // Satellite in view report 461 LOC_API_ADAPTER_REPORT_NMEA_1HZ, // NMEA report at 1HZ rate 462 LOC_API_ADAPTER_REPORT_NMEA_POSITION, // NMEA report at position report rate 463 LOC_API_ADAPTER_REQUEST_NI_NOTIFY_VERIFY, // NI notification/verification request 464 LOC_API_ADAPTER_REQUEST_ASSISTANCE_DATA, // Assistance data, eg: time, predicted orbits request 465 LOC_API_ADAPTER_REQUEST_LOCATION_SERVER, // Request for location server 466 LOC_API_ADAPTER_REPORT_IOCTL, // Callback report for loc_ioctl 467 LOC_API_ADAPTER_REPORT_STATUS, // Misc status report: eg, engine state 468 LOC_API_ADAPTER_REQUEST_WIFI, // 469 LOC_API_ADAPTER_SENSOR_STATUS, // 470 LOC_API_ADAPTER_REQUEST_TIME_SYNC, // 471 LOC_API_ADAPTER_REPORT_SPI, // 472 LOC_API_ADAPTER_REPORT_NI_GEOFENCE, // 473 LOC_API_ADAPTER_GEOFENCE_GEN_ALERT, // 474 LOC_API_ADAPTER_REPORT_GENFENCE_BREACH, // 475 LOC_API_ADAPTER_PEDOMETER_CTRL, // 476 LOC_API_ADAPTER_MOTION_CTRL, // 477 LOC_API_ADAPTER_REQUEST_WIFI_AP_DATA, // Wifi ap data 478 LOC_API_ADAPTER_BATCH_FULL, // Batching on full 479 LOC_API_ADAPTER_BATCHED_POSITION_REPORT, // Batching on fix 480 LOC_API_ADAPTER_BATCHED_GENFENCE_BREACH_REPORT, // 481 LOC_API_ADAPTER_GNSS_MEASUREMENT_REPORT, //GNSS Measurement Report 482 LOC_API_ADAPTER_GNSS_SV_POLYNOMIAL_REPORT, //GNSS SV Polynomial Report 483 LOC_API_ADAPTER_GDT_UPLOAD_BEGIN_REQ, // GDT upload start request 484 LOC_API_ADAPTER_GDT_UPLOAD_END_REQ, // GDT upload end request 485 LOC_API_ADAPTER_GNSS_MEASUREMENT, // GNSS Measurement report 486 LOC_API_ADAPTER_REQUEST_TIMEZONE, // Timezone injection request 487 LOC_API_ADAPTER_REPORT_GENFENCE_DWELL_REPORT, // Geofence dwell report 488 LOC_API_ADAPTER_REQUEST_SRN_DATA, // request srn data from AP 489 LOC_API_ADAPTER_EVENT_MAX 490 }; 491 492 #define LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT (1<<LOC_API_ADAPTER_REPORT_POSITION) 493 #define LOC_API_ADAPTER_BIT_SATELLITE_REPORT (1<<LOC_API_ADAPTER_REPORT_SATELLITE) 494 #define LOC_API_ADAPTER_BIT_NMEA_1HZ_REPORT (1<<LOC_API_ADAPTER_REPORT_NMEA_1HZ) 495 #define LOC_API_ADAPTER_BIT_NMEA_POSITION_REPORT (1<<LOC_API_ADAPTER_REPORT_NMEA_POSITION) 496 #define LOC_API_ADAPTER_BIT_NI_NOTIFY_VERIFY_REQUEST (1<<LOC_API_ADAPTER_REQUEST_NI_NOTIFY_VERIFY) 497 #define LOC_API_ADAPTER_BIT_ASSISTANCE_DATA_REQUEST (1<<LOC_API_ADAPTER_REQUEST_ASSISTANCE_DATA) 498 #define LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST (1<<LOC_API_ADAPTER_REQUEST_LOCATION_SERVER) 499 #define LOC_API_ADAPTER_BIT_IOCTL_REPORT (1<<LOC_API_ADAPTER_REPORT_IOCTL) 500 #define LOC_API_ADAPTER_BIT_STATUS_REPORT (1<<LOC_API_ADAPTER_REPORT_STATUS) 501 #define LOC_API_ADAPTER_BIT_REQUEST_WIFI (1<<LOC_API_ADAPTER_REQUEST_WIFI) 502 #define LOC_API_ADAPTER_BIT_SENSOR_STATUS (1<<LOC_API_ADAPTER_SENSOR_STATUS) 503 #define LOC_API_ADAPTER_BIT_REQUEST_TIME_SYNC (1<<LOC_API_ADAPTER_REQUEST_TIME_SYNC) 504 #define LOC_API_ADAPTER_BIT_REPORT_SPI (1<<LOC_API_ADAPTER_REPORT_SPI) 505 #define LOC_API_ADAPTER_BIT_REPORT_NI_GEOFENCE (1<<LOC_API_ADAPTER_REPORT_NI_GEOFENCE) 506 #define LOC_API_ADAPTER_BIT_GEOFENCE_GEN_ALERT (1<<LOC_API_ADAPTER_GEOFENCE_GEN_ALERT) 507 #define LOC_API_ADAPTER_BIT_REPORT_GENFENCE_BREACH (1<<LOC_API_ADAPTER_REPORT_GENFENCE_BREACH) 508 #define LOC_API_ADAPTER_BIT_BATCHED_GENFENCE_BREACH_REPORT (1<<LOC_API_ADAPTER_BATCHED_GENFENCE_BREACH_REPORT) 509 #define LOC_API_ADAPTER_BIT_PEDOMETER_CTRL (1<<LOC_API_ADAPTER_PEDOMETER_CTRL) 510 #define LOC_API_ADAPTER_BIT_MOTION_CTRL (1<<LOC_API_ADAPTER_MOTION_CTRL) 511 #define LOC_API_ADAPTER_BIT_REQUEST_WIFI_AP_DATA (1<<LOC_API_ADAPTER_REQUEST_WIFI_AP_DATA) 512 #define LOC_API_ADAPTER_BIT_BATCH_FULL (1<<LOC_API_ADAPTER_BATCH_FULL) 513 #define LOC_API_ADAPTER_BIT_BATCHED_POSITION_REPORT (1<<LOC_API_ADAPTER_BATCHED_POSITION_REPORT) 514 #define LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT_REPORT (1<<LOC_API_ADAPTER_GNSS_MEASUREMENT_REPORT) 515 #define LOC_API_ADAPTER_BIT_GNSS_SV_POLYNOMIAL_REPORT (1<<LOC_API_ADAPTER_GNSS_SV_POLYNOMIAL_REPORT) 516 #define LOC_API_ADAPTER_BIT_GDT_UPLOAD_BEGIN_REQ (1<<LOC_API_ADAPTER_GDT_UPLOAD_BEGIN_REQ) 517 #define LOC_API_ADAPTER_BIT_GDT_UPLOAD_END_REQ (1<<LOC_API_ADAPTER_GDT_UPLOAD_END_REQ) 518 #define LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT (1<<LOC_API_ADAPTER_GNSS_MEASUREMENT) 519 #define LOC_API_ADAPTER_BIT_REQUEST_TIMEZONE (1<<LOC_API_ADAPTER_REQUEST_TIMEZONE) 520 #define LOC_API_ADAPTER_BIT_REPORT_GENFENCE_DWELL (1<<LOC_API_ADAPTER_REPORT_GENFENCE_DWELL_REPORT) 521 #define LOC_API_ADAPTER_BIT_REQUEST_SRN_DATA (1<<LOC_API_ADAPTER_REQUEST_SRN_DATA) 522 523 524 typedef unsigned int LOC_API_ADAPTER_EVENT_MASK_T; 525 526 typedef enum loc_api_adapter_msg_to_check_supported { 527 LOC_API_ADAPTER_MESSAGE_LOCATION_BATCHING, // Batching 1.0 528 LOC_API_ADAPTER_MESSAGE_BATCHED_GENFENCE_BREACH, // Geofence Batched Breach 529 LOC_API_ADAPTER_MESSAGE_DISTANCE_BASE_TRACKING, // DBT 2.0 530 LOC_API_ADAPTER_MESSAGE_ADAPTIVE_LOCATION_BATCHING, // Batching 1.5 531 LOC_API_ADAPTER_MESSAGE_DISTANCE_BASE_LOCATION_BATCHING, // Batching 2.0 532 LOC_API_ADAPTER_MESSAGE_UPDATE_TBF_ON_THE_FLY, // Updating Tracking TBF On The Fly 533 534 LOC_API_ADAPTER_MESSAGE_MAX 535 } LocCheckingMessagesID; 536 537 typedef int IzatDevId_t; 538 539 typedef uint32_t LOC_GPS_LOCK_MASK; 540 #define isGpsLockNone(lock) ((lock) == 0) 541 #define isGpsLockMO(lock) ((lock) & ((LOC_GPS_LOCK_MASK)1)) 542 #define isGpsLockMT(lock) ((lock) & ((LOC_GPS_LOCK_MASK)2)) 543 #define isGpsLockAll(lock) (((lock) & ((LOC_GPS_LOCK_MASK)3)) == 3) 544 545 /*++ *********************************************** 546 ** Satellite Measurement and Satellite Polynomial 547 ** Structure definitions 548 ** *********************************************** 549 --*/ 550 #define GNSS_SV_POLY_VELOCITY_COEF_MAX_SIZE 12 551 #define GNSS_SV_POLY_XYZ_0_TH_ORDER_COEFF_MAX_SIZE 3 552 #define GNSS_SV_POLY_XYZ_N_TH_ORDER_COEFF_MAX_SIZE 9 553 #define GNSS_SV_POLY_SV_CLKBIAS_COEFF_MAX_SIZE 4 554 #define GNSS_LOC_SV_MEAS_LIST_MAX_SIZE 16 555 556 enum ulp_gnss_sv_measurement_valid_flags{ 557 558 ULP_GNSS_SV_MEAS_GPS_TIME = 0, 559 ULP_GNSS_SV_MEAS_PSUEDO_RANGE, 560 ULP_GNSS_SV_MEAS_MS_IN_WEEK, 561 ULP_GNSS_SV_MEAS_SUB_MSEC, 562 ULP_GNSS_SV_MEAS_CARRIER_PHASE, 563 ULP_GNSS_SV_MEAS_DOPPLER_SHIFT, 564 ULP_GNSS_SV_MEAS_CNO, 565 ULP_GNSS_SV_MEAS_LOSS_OF_LOCK, 566 567 ULP_GNSS_SV_MEAS_MAX_VALID_FLAGS 568 }; 569 570 #define ULP_GNSS_SV_MEAS_BIT_GPS_TIME (1<<ULP_GNSS_SV_MEAS_GPS_TIME) 571 #define ULP_GNSS_SV_MEAS_BIT_PSUEDO_RANGE (1<<ULP_GNSS_SV_MEAS_PSUEDO_RANGE) 572 #define ULP_GNSS_SV_MEAS_BIT_MS_IN_WEEK (1<<ULP_GNSS_SV_MEAS_MS_IN_WEEK) 573 #define ULP_GNSS_SV_MEAS_BIT_SUB_MSEC (1<<ULP_GNSS_SV_MEAS_SUB_MSEC) 574 #define ULP_GNSS_SV_MEAS_BIT_CARRIER_PHASE (1<<ULP_GNSS_SV_MEAS_CARRIER_PHASE) 575 #define ULP_GNSS_SV_MEAS_BIT_DOPPLER_SHIFT (1<<ULP_GNSS_SV_MEAS_DOPPLER_SHIFT) 576 #define ULP_GNSS_SV_MEAS_BIT_CNO (1<<ULP_GNSS_SV_MEAS_CNO) 577 #define ULP_GNSS_SV_MEAS_BIT_LOSS_OF_LOCK (1<<ULP_GNSS_SV_MEAS_LOSS_OF_LOCK) 578 579 enum ulp_gnss_sv_poly_valid_flags{ 580 581 ULP_GNSS_SV_POLY_GLO_FREQ = 0, 582 ULP_GNSS_SV_POLY_T0, 583 ULP_GNSS_SV_POLY_IODE, 584 ULP_GNSS_SV_POLY_FLAG, 585 ULP_GNSS_SV_POLY_POLYCOEFF_XYZ0, 586 ULP_GNSS_SV_POLY_POLYCOEFF_XYZN, 587 ULP_GNSS_SV_POLY_POLYCOEFF_OTHER, 588 ULP_GNSS_SV_POLY_SV_POSUNC, 589 ULP_GNSS_SV_POLY_IONODELAY, 590 ULP_GNSS_SV_POLY_IONODOT, 591 ULP_GNSS_SV_POLY_SBAS_IONODELAY, 592 ULP_GNSS_SV_POLY_SBAS_IONODOT, 593 ULP_GNSS_SV_POLY_TROPODELAY, 594 ULP_GNSS_SV_POLY_ELEVATION, 595 ULP_GNSS_SV_POLY_ELEVATIONDOT, 596 ULP_GNSS_SV_POLY_ELEVATIONUNC, 597 ULP_GNSS_SV_POLY_VELO_COEFF, 598 ULP_GNSS_SV_POLY_ENHANCED_IOD, 599 600 ULP_GNSS_SV_POLY_VALID_FLAGS 601 602 }; 603 604 #define ULP_GNSS_SV_POLY_BIT_GLO_FREQ (1<<ULP_GNSS_SV_POLY_GLO_FREQ) 605 #define ULP_GNSS_SV_POLY_BIT_T0 (1<<ULP_GNSS_SV_POLY_T0) 606 #define ULP_GNSS_SV_POLY_BIT_IODE (1<<ULP_GNSS_SV_POLY_IODE) 607 #define ULP_GNSS_SV_POLY_BIT_FLAG (1<<ULP_GNSS_SV_POLY_FLAG) 608 #define ULP_GNSS_SV_POLY_BIT_POLYCOEFF_XYZ0 (1<<ULP_GNSS_SV_POLY_POLYCOEFF_XYZ0) 609 #define ULP_GNSS_SV_POLY_BIT_POLYCOEFF_XYZN (1<<ULP_GNSS_SV_POLY_POLYCOEFF_XYZN) 610 #define ULP_GNSS_SV_POLY_BIT_POLYCOEFF_OTHER (1<<ULP_GNSS_SV_POLY_POLYCOEFF_OTHER) 611 #define ULP_GNSS_SV_POLY_BIT_SV_POSUNC (1<<ULP_GNSS_SV_POLY_SV_POSUNC) 612 #define ULP_GNSS_SV_POLY_BIT_IONODELAY (1<<ULP_GNSS_SV_POLY_IONODELAY) 613 #define ULP_GNSS_SV_POLY_BIT_IONODOT (1<<ULP_GNSS_SV_POLY_IONODOT) 614 #define ULP_GNSS_SV_POLY_BIT_SBAS_IONODELAY (1<<ULP_GNSS_SV_POLY_SBAS_IONODELAY) 615 #define ULP_GNSS_SV_POLY_BIT_SBAS_IONODOT (1<<ULP_GNSS_SV_POLY_SBAS_IONODOT) 616 #define ULP_GNSS_SV_POLY_BIT_TROPODELAY (1<<ULP_GNSS_SV_POLY_TROPODELAY) 617 #define ULP_GNSS_SV_POLY_BIT_ELEVATION (1<<ULP_GNSS_SV_POLY_ELEVATION) 618 #define ULP_GNSS_SV_POLY_BIT_ELEVATIONDOT (1<<ULP_GNSS_SV_POLY_ELEVATIONDOT) 619 #define ULP_GNSS_SV_POLY_BIT_ELEVATIONUNC (1<<ULP_GNSS_SV_POLY_ELEVATIONUNC) 620 #define ULP_GNSS_SV_POLY_BIT_VELO_COEFF (1<<ULP_GNSS_SV_POLY_VELO_COEFF) 621 #define ULP_GNSS_SV_POLY_BIT_ENHANCED_IOD (1<<ULP_GNSS_SV_POLY_ENHANCED_IOD) 622 623 624 typedef enum 625 { 626 GNSS_LOC_SV_SYSTEM_GPS = 1, 627 /**< GPS satellite. */ 628 GNSS_LOC_SV_SYSTEM_GALILEO = 2, 629 /**< GALILEO satellite. */ 630 GNSS_LOC_SV_SYSTEM_SBAS = 3, 631 /**< SBAS satellite. */ 632 GNSS_LOC_SV_SYSTEM_COMPASS = 4, 633 /**< COMPASS satellite. */ 634 GNSS_LOC_SV_SYSTEM_GLONASS = 5, 635 /**< GLONASS satellite. */ 636 GNSS_LOC_SV_SYSTEM_BDS = 6 637 /**< BDS satellite. */ 638 } Gnss_LocSvSystemEnumType; 639 640 typedef enum 641 { 642 GNSS_LOC_FREQ_SOURCE_INVALID = 0, 643 /**< Source of the frequency is invalid */ 644 GNSS_LOC_FREQ_SOURCE_EXTERNAL = 1, 645 /**< Source of the frequency is from external injection */ 646 GNSS_LOC_FREQ_SOURCE_PE_CLK_REPORT = 2, 647 /**< Source of the frequency is from Navigation engine */ 648 GNSS_LOC_FREQ_SOURCE_UNKNOWN = 3 649 /**< Source of the frequency is unknown */ 650 } Gnss_LocSourceofFreqEnumType; 651 652 typedef struct 653 { 654 size_t size; 655 float clockDrift; 656 /**< Receiver clock Drift \n 657 - Units: meter per sec \n 658 */ 659 float clockDriftUnc; 660 /**< Receiver clock Drift uncertainty \n 661 - Units: meter per sec \n 662 */ 663 Gnss_LocSourceofFreqEnumType sourceOfFreq; 664 }Gnss_LocRcvrClockFrequencyInfoStructType; 665 666 typedef struct 667 { 668 size_t size; 669 uint8_t leapSec; 670 /**< GPS time leap second delta to UTC time \n 671 - Units: sec \n 672 */ 673 uint8_t leapSecUnc; 674 /**< Uncertainty for GPS leap second \n 675 - Units: sec \n 676 */ 677 }Gnss_LeapSecondInfoStructType; 678 679 typedef enum 680 { 681 GNSS_LOC_SYS_TIME_BIAS_VALID = 0x01, 682 /**< System time bias valid */ 683 GNSS_LOC_SYS_TIME_BIAS_UNC_VALID = 0x02, 684 /**< System time bias uncertainty valid */ 685 }Gnss_LocInterSystemBiasValidMaskType; 686 687 typedef struct 688 { 689 size_t size; 690 uint32_t validMask; 691 /* Validity mask as per Gnss_LocInterSystemBiasValidMaskType */ 692 693 float timeBias; 694 /**< System-1 to System-2 Time Bias \n 695 - Units: msec \n 696 */ 697 float timeBiasUnc; 698 /**< System-1 to System-2 Time Bias uncertainty \n 699 - Units: msec \n 700 */ 701 }Gnss_InterSystemBiasStructType; 702 703 704 typedef struct 705 { 706 size_t size; 707 uint16_t systemWeek; 708 /**< System week number for GPS, BDS and GAL satellite systems. \n 709 Set to 65535 when invalid or not available. \n 710 Not valid for GLONASS system. \n 711 */ 712 713 uint32_t systemMsec; 714 /**< System time msec. Time of Week for GPS, BDS, GAL and 715 Time of Day for GLONASS. 716 - Units: msec \n 717 */ 718 float systemClkTimeBias; 719 /**< System clock time bias \n 720 - Units: msec \n 721 System time = systemMsec - systemClkTimeBias \n 722 */ 723 float systemClkTimeUncMs; 724 /**< Single sided maximum time bias uncertainty \n 725 - Units: msec \n 726 */ 727 }Gnss_LocSystemTimeStructType; 728 729 typedef struct { 730 731 size_t size; 732 uint8_t gloFourYear; 733 /**< GLONASS four year number from 1996. Refer to GLONASS ICD.\n 734 Applicable only for GLONASS and shall be ignored for other constellations. \n 735 If unknown shall be set to 255 736 */ 737 738 uint16_t gloDays; 739 /**< GLONASS day number in four years. Refer to GLONASS ICD. 740 Applicable only for GLONASS and shall be ignored for other constellations. \n 741 If unknown shall be set to 65535 742 */ 743 744 uint32_t gloMsec; 745 /**< GLONASS time of day in msec. Refer to GLONASS ICD. 746 - Units: msec \n 747 */ 748 749 float gloClkTimeBias; 750 /**< System clock time bias (sub-millisecond) \n 751 - Units: msec \n 752 System time = systemMsec - systemClkTimeBias \n 753 */ 754 755 float gloClkTimeUncMs; 756 /**< Single sided maximum time bias uncertainty \n 757 - Units: msec \n 758 */ 759 }Gnss_LocGloTimeStructType; /* Type */ 760 761 typedef struct { 762 763 size_t size; 764 uint32_t refFCount; 765 /**< Receiver frame counter value at reference tick */ 766 767 uint8_t systemRtc_valid; 768 /**< Validity indicator for System RTC */ 769 770 uint64_t systemRtcMs; 771 /**< Platform system RTC value \n 772 - Units: msec \n 773 */ 774 775 uint32_t sourceOfTime; 776 /**< Source of time information */ 777 778 }Gnss_LocGnssTimeExtStructType; 779 780 781 782 typedef enum 783 { 784 GNSS_LOC_MEAS_STATUS_NULL = 0x00000000, 785 /**< No information state */ 786 GNSS_LOC_MEAS_STATUS_SM_VALID = 0x00000001, 787 /**< Code phase is known */ 788 GNSS_LOC_MEAS_STATUS_SB_VALID = 0x00000002, 789 /**< Sub-bit time is known */ 790 GNSS_LOC_MEAS_STATUS_MS_VALID = 0x00000004, 791 /**< Satellite time is known */ 792 GNSS_LOC_MEAS_STATUS_BE_CONFIRM = 0x00000008, 793 /**< Bit edge is confirmed from signal */ 794 GNSS_LOC_MEAS_STATUS_VELOCITY_VALID = 0x00000010, 795 /**< Satellite Doppler measured */ 796 GNSS_LOC_MEAS_STATUS_VELOCITY_FINE = 0x00000020, 797 /**< TRUE: Fine Doppler measured, FALSE: Coarse Doppler measured */ 798 GNSS_LOC_MEAS_STATUS_FROM_RNG_DIFF = 0x00000200, 799 /**< Range update from Satellite differences */ 800 GNSS_LOC_MEAS_STATUS_FROM_VE_DIFF = 0x00000400, 801 /**< Doppler update from Satellite differences */ 802 GNSS_LOC_MEAS_STATUS_DONT_USE_X = 0x00000800, 803 /**< Don't use measurement if bit is set */ 804 GNSS_LOC_MEAS_STATUS_DONT_USE_M = 0x000001000, 805 /**< Don't use measurement if bit is set */ 806 GNSS_LOC_MEAS_STATUS_DONT_USE_D = 0x000002000, 807 /**< Don't use measurement if bit is set */ 808 GNSS_LOC_MEAS_STATUS_DONT_USE_S = 0x000004000, 809 /**< Don't use measurement if bit is set */ 810 GNSS_LOC_MEAS_STATUS_DONT_USE_P = 0x000008000 811 /**< Don't use measurement if bit is set */ 812 }Gnss_LocSvMeasStatusMaskType; 813 814 typedef struct 815 { 816 size_t size; 817 uint32_t svMs; 818 /**< Satellite time milisecond.\n 819 For GPS, BDS, GAL range of 0 thru (604800000-1) \n 820 For GLONASS range of 0 thru (86400000-1) \n 821 Valid when PD_LOC_MEAS_STATUS_MS_VALID bit is set in measurement status \n 822 Note: All SV times in the current measurement block are alredy propagated to common reference time epoch. \n 823 - Units: msec \n 824 */ 825 float svSubMs; 826 /**<Satellite time sub-millisecond. \n 827 Total SV Time = svMs + svSubMs \n 828 - Units: msec \n 829 */ 830 float svTimeUncMs; 831 /**< Satellite Time uncertainty \n 832 - Units: msec \n 833 */ 834 float dopplerShift; 835 /**< Satellite Doppler \n 836 - Units: meter per sec \n 837 */ 838 float dopplerShiftUnc; 839 /**< Satellite Doppler uncertainty\n 840 - Units: meter per sec \n 841 */ 842 }Gnss_LocSVTimeSpeedStructType; 843 844 typedef enum 845 { 846 GNSS_SV_STATE_IDLE = 0, 847 GNSS_SV_STATE_SEARCH = 1, 848 GNSS_SV_STATE_SEARCH_VERIFY = 2, 849 GNSS_SV_STATE_BIT_EDGE = 3, 850 GNSS_SV_STATE_VERIFY_TRACK = 4, 851 GNSS_SV_STATE_TRACK = 5, 852 GNSS_SV_STATE_RESTART = 6, 853 GNSS_SV_STATE_DPO_TRACK = 7 854 } Gnss_LocSVStateEnumType; 855 856 typedef enum 857 { 858 GNSS_LOC_SVINFO_MASK_HAS_EPHEMERIS = 0x01, 859 /**< Ephemeris is available for this SV */ 860 GNSS_LOC_SVINFO_MASK_HAS_ALMANAC = 0x02 861 /**< Almanac is available for this SV */ 862 }Gnss_LocSvInfoMaskT; 863 864 typedef enum 865 { 866 GNSS_LOC_SV_SRCH_STATUS_IDLE = 1, 867 /**< SV is not being actively processed */ 868 GNSS_LOC_SV_SRCH_STATUS_SEARCH = 2, 869 /**< The system is searching for this SV */ 870 GNSS_LOC_SV_SRCH_STATUS_TRACK = 3 871 /**< SV is being tracked */ 872 }Gnss_LocSvSearchStatusEnumT; 873 874 875 typedef struct 876 { 877 size_t size; 878 uint16_t gnssSvId; 879 /**< GNSS SV ID. 880 \begin{itemize1} 881 \item Range: \begin{itemize1} 882 \item For GPS: 1 to 32 883 \item For GLONASS: 1 to 32 884 \item For SBAS: 120 to 151 885 \item For BDS: 201 to 237 886 \end{itemize1} \end{itemize1} 887 The GPS and GLONASS SVs can be disambiguated using the system field. 888 */ 889 uint8_t gloFrequency; 890 /**< GLONASS frequency number + 7 \n 891 Valid only for GLONASS System \n 892 Shall be ignored for all other systems \n 893 - Range: 1 to 14 \n 894 */ 895 Gnss_LocSvSearchStatusEnumT svStatus; 896 /**< Satellite search state \n 897 @ENUM() 898 */ 899 bool healthStatus_valid; 900 /**< SV Health Status validity flag\n 901 - 0: Not valid \n 902 - 1: Valid \n 903 */ 904 uint8_t healthStatus; 905 /**< Health status. 906 \begin{itemize1} 907 \item Range: 0 to 1; 0 = unhealthy, \n 1 = healthy, 2 = unknown 908 \vspace{-0.18in} \end{itemize1} 909 */ 910 Gnss_LocSvInfoMaskT svInfoMask; 911 /**< Indicates whether almanac and ephemeris information is available. \n 912 @MASK() 913 */ 914 uint64_t measurementStatus; 915 /**< Bitmask indicating SV measurement status. 916 Valid bitmasks: \n 917 @MASK() 918 */ 919 uint16_t CNo; 920 /**< Carrier to Noise ratio \n 921 - Units: 0.1 dBHz \n 922 */ 923 uint16_t gloRfLoss; 924 /**< GLONASS Rf loss reference to Antenna. \n 925 - Units: dB, Scale: 0.1 \n 926 */ 927 bool lossOfLock; 928 /**< Loss of signal lock indicator \n 929 - 0: Signal in continuous track \n 930 - 1: Signal not in track \n 931 */ 932 int16_t measLatency; 933 /**< Age of the measurement. Positive value means measurement precedes ref time. \n 934 - Units: msec \n 935 */ 936 Gnss_LocSVTimeSpeedStructType svTimeSpeed; 937 /**< Unfiltered SV Time and Speed information 938 */ 939 float dopplerAccel; 940 /**< Satellite Doppler Accelertion\n 941 - Units: Hz/s \n 942 */ 943 bool multipathEstValid; 944 /**< Multipath estimate validity flag\n 945 - 0: Multipath estimate not valid \n 946 - 1: Multipath estimate valid \n 947 */ 948 float multipathEstimate; 949 /**< Estimate of multipath in measurement\n 950 - Units: Meters \n 951 */ 952 bool fineSpeedValid; 953 /**< Fine speed validity flag\n 954 - 0: Fine speed not valid \n 955 - 1: Fine speed valid \n 956 */ 957 float fineSpeed; 958 /**< Carrier phase derived speed \n 959 - Units: m/s \n 960 */ 961 bool fineSpeedUncValid; 962 /**< Fine speed uncertainty validity flag\n 963 - 0: Fine speed uncertainty not valid \n 964 - 1: Fine speed uncertainty valid \n 965 */ 966 float fineSpeedUnc; 967 /**< Carrier phase derived speed \n 968 - Units: m/s \n 969 */ 970 bool carrierPhaseValid; 971 /**< Carrier Phase measurement validity flag\n 972 - 0: Carrier Phase not valid \n 973 - 1: Carrier Phase valid \n 974 */ 975 double carrierPhase; 976 /**< Carrier phase measurement [L1 cycles] \n 977 */ 978 bool cycleSlipCountValid; 979 /**< Cycle slup count validity flag\n 980 - 0: Not valid \n 981 - 1: Valid \n 982 */ 983 uint8_t cycleSlipCount; 984 /**< Increments when a CSlip is detected */ 985 986 bool svDirectionValid; 987 /**< Validity flag for SV direction */ 988 989 float svAzimuth; 990 /**< Satellite Azimuth 991 - Units: radians \n 992 */ 993 float svElevation; 994 /**< Satellite Elevation 995 - Units: radians \n 996 */ 997 } Gnss_SVMeasurementStructType; 998 999 /**< Maximum number of satellites in measurement block for given system. */ 1000 1001 typedef struct 1002 { 1003 size_t size; 1004 Gnss_LocSvSystemEnumType system; 1005 /**< Specifies the Satellite System Type 1006 */ 1007 bool isSystemTimeValid; 1008 /**< Indicates whether System Time is Valid:\n 1009 - 0x01 (TRUE) -- System Time is valid \n 1010 - 0x00 (FALSE) -- System Time is not valid 1011 */ 1012 Gnss_LocSystemTimeStructType systemTime; 1013 /**< System Time Information \n 1014 */ 1015 bool isGloTime_valid; 1016 Gnss_LocGloTimeStructType gloTime; 1017 1018 bool isSystemTimeExt_valid; 1019 Gnss_LocGnssTimeExtStructType systemTimeExt; 1020 1021 uint8_t numSvs; 1022 /* Number of SVs in this report block */ 1023 1024 Gnss_SVMeasurementStructType svMeasurement[GNSS_LOC_SV_MEAS_LIST_MAX_SIZE]; 1025 /**< Satellite measurement Information \n 1026 */ 1027 } Gnss_ClockMeasurementStructType; 1028 1029 1030 typedef struct 1031 { 1032 size_t size; 1033 uint8_t seqNum; 1034 /**< Current message Number */ 1035 uint8_t maxMessageNum; 1036 /**< Maximum number of message that will be sent for present time epoch. */ 1037 1038 bool leapSecValid; 1039 Gnss_LeapSecondInfoStructType leapSec; 1040 1041 Gnss_InterSystemBiasStructType gpsGloInterSystemBias; 1042 1043 Gnss_InterSystemBiasStructType gpsBdsInterSystemBias; 1044 1045 Gnss_InterSystemBiasStructType gpsGalInterSystemBias; 1046 1047 Gnss_InterSystemBiasStructType bdsGloInterSystemBias; 1048 1049 Gnss_InterSystemBiasStructType galGloInterSystemBias; 1050 1051 Gnss_InterSystemBiasStructType galBdsInterSystemBias; 1052 1053 bool clockFreqValid; 1054 Gnss_LocRcvrClockFrequencyInfoStructType clockFreq; /* Freq */ 1055 bool gnssMeasValid; 1056 Gnss_ClockMeasurementStructType gnssMeas; 1057 Gnss_ApTimeStampStructType timeStamp; 1058 1059 } GnssSvMeasurementSet; 1060 1061 typedef enum 1062 { 1063 GNSS_SV_POLY_COEFF_VALID = 0x01, 1064 /**< SV position in orbit coefficients are valid */ 1065 GNSS_SV_POLY_IONO_VALID = 0x02, 1066 /**< Iono estimates are valid */ 1067 1068 GNSS_SV_POLY_TROPO_VALID = 0x04, 1069 /**< Tropo estimates are valid */ 1070 1071 GNSS_SV_POLY_ELEV_VALID = 0x08, 1072 /**< Elevation, rate, uncertainty are valid */ 1073 1074 GNSS_SV_POLY_SRC_ALM_CORR = 0x10, 1075 /**< Polynomials based on XTRA */ 1076 1077 GNSS_SV_POLY_SBAS_IONO_VALID = 0x20, 1078 /**< SBAS IONO and rate are valid */ 1079 1080 GNSS_SV_POLY_GLO_STR4 = 0x40 1081 /**< GLONASS String 4 has been received */ 1082 }Gnss_SvPolyStatusMaskType; 1083 1084 1085 typedef struct 1086 { 1087 size_t size; 1088 uint16_t gnssSvId; 1089 /* GPS: 1-32, GLO: 65-96, 0: Invalid, 1090 SBAS: 120-151, BDS:201-237,GAL:301 to 336 1091 All others are reserved 1092 */ 1093 int8_t freqNum; 1094 /* Freq index, only valid if u_SysInd is GLO */ 1095 1096 uint8_t svPolyFlags; 1097 /* Indicate the validity of the elements 1098 as per Gnss_SvPolyStatusMaskType 1099 */ 1100 1101 uint32_t is_valid; 1102 1103 uint16_t iode; 1104 /* Ephemeris reference time 1105 GPS:Issue of Data Ephemeris used [unitless]. 1106 GLO: Tb 7-bit, refer to ICD02 1107 */ 1108 double T0; 1109 /* Reference time for polynominal calculations 1110 GPS: Secs in week. 1111 GLO: Full secs since Jan/01/96 1112 */ 1113 double polyCoeffXYZ0[GNSS_SV_POLY_XYZ_0_TH_ORDER_COEFF_MAX_SIZE]; 1114 /* C0X, C0Y, C0Z */ 1115 double polyCoefXYZN[GNSS_SV_POLY_XYZ_N_TH_ORDER_COEFF_MAX_SIZE]; 1116 /* C1X, C2X ... C2Z, C3Z */ 1117 float polyCoefOther[GNSS_SV_POLY_SV_CLKBIAS_COEFF_MAX_SIZE]; 1118 /* C0T, C1T, C2T, C3T */ 1119 float svPosUnc; /* SV position uncertainty [m]. */ 1120 float ionoDelay; /* Ionospheric delay at d_T0 [m]. */ 1121 float ionoDot; /* Iono delay rate [m/s]. */ 1122 float sbasIonoDelay;/* SBAS Ionospheric delay at d_T0 [m]. */ 1123 float sbasIonoDot; /* SBAS Iono delay rate [m/s]. */ 1124 float tropoDelay; /* Tropospheric delay [m]. */ 1125 float elevation; /* Elevation [rad] at d_T0 */ 1126 float elevationDot; /* Elevation rate [rad/s] */ 1127 float elevationUnc; /* SV elevation [rad] uncertainty */ 1128 double velCoef[GNSS_SV_POLY_VELOCITY_COEF_MAX_SIZE]; 1129 /* Coefficients of velocity poly */ 1130 uint32_t enhancedIOD; /* Enhanced Reference Time */ 1131 } GnssSvPolynomial; 1132 1133 /* Various Short Range Node Technology type*/ 1134 typedef enum { 1135 SRN_AP_DATA_TECH_TYPE_NONE, 1136 SRN_AP_DATA_TECH_TYPE_BT, 1137 SRN_AP_DATA_TECH_TYPE_BTLE, 1138 SRN_AP_DATA_TECH_TYPE_NFC, 1139 SRN_AP_DATA_TECH_TYPE_MOBILE_CODE, 1140 SRN_AP_DATA_TECH_TYPE_OTHER 1141 } Gnss_SrnTech; 1142 1143 /* Mac Address type requested by modem */ 1144 typedef enum { 1145 SRN_AP_DATA_PUBLIC_MAC_ADDR_TYPE_INVALID, /* No valid mac address type send */ 1146 SRN_AP_DATA_PUBLIC_MAC_ADDR_TYPE_PUBLIC, /* SRN AP MAC Address type PUBLIC */ 1147 SRN_AP_DATA_PUBLIC_MAC_ADDR_TYPE_PRIVATE, /* SRN AP MAC Address type PRIVATE */ 1148 SRN_AP_DATA_PUBLIC_MAC_ADDR_TYPE_OTHER, /* SRN AP MAC Address type OTHER */ 1149 }Gnss_Srn_MacAddr_Type; 1150 1151 typedef struct 1152 { 1153 size_t size; 1154 Gnss_SrnTech srnTechType; /* SRN Technology type in request */ 1155 bool srnRequest; /* scan - start(true) or stop(false) */ 1156 bool e911Mode; /* If in E911 emergency */ 1157 Gnss_Srn_MacAddr_Type macAddrType; /* SRN AP MAC Address type */ 1158 } GnssSrnDataReq; 1159 1160 1161 #ifdef __cplusplus 1162 } 1163 #endif /* __cplusplus */ 1164 1165 #endif /* GPS_EXTENDED_C_H */ 1166