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