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