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