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