1 /* Copyright (c) 2018-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 LOCATIONDATATYPES_H
30 #define LOCATIONDATATYPES_H
31 
32 #include <vector>
33 #include <stdint.h>
34 #include <functional>
35 #include <list>
36 #include <string.h>
37 
38 #define GNSS_NI_REQUESTOR_MAX  (256)
39 #define GNSS_NI_MESSAGE_ID_MAX (2048)
40 #define GNSS_SV_MAX            (128)
41 #define GNSS_MEASUREMENTS_MAX  (128)
42 #define GNSS_UTC_TIME_OFFSET   (3657)
43 
44 #define GNSS_BUGREPORT_GPS_MIN    (1)
45 #define GNSS_BUGREPORT_SBAS_MIN   (120)
46 #define GNSS_BUGREPORT_GLO_MIN    (1)
47 #define GNSS_BUGREPORT_QZSS_MIN   (193)
48 #define GNSS_BUGREPORT_BDS_MIN    (1)
49 #define GNSS_BUGREPORT_GAL_MIN    (1)
50 #define GNSS_BUGREPORT_NAVIC_MIN  (1)
51 
52 #define GNSS_MAX_NAME_LENGTH    (8)
53 
54 typedef enum {
55     LOCATION_ERROR_SUCCESS = 0,
56     LOCATION_ERROR_GENERAL_FAILURE,
57     LOCATION_ERROR_CALLBACK_MISSING,
58     LOCATION_ERROR_INVALID_PARAMETER,
59     LOCATION_ERROR_ID_EXISTS,
60     LOCATION_ERROR_ID_UNKNOWN,
61     LOCATION_ERROR_ALREADY_STARTED,
62     LOCATION_ERROR_GEOFENCES_AT_MAX,
63     LOCATION_ERROR_NOT_SUPPORTED
64 } LocationError;
65 
66 // Flags to indicate which values are valid in a Location
67 typedef uint16_t LocationFlagsMask;
68 typedef enum {
69     LOCATION_HAS_LAT_LONG_BIT          = (1<<0), // location has valid latitude and longitude
70     LOCATION_HAS_ALTITUDE_BIT          = (1<<1), // location has valid altitude
71     LOCATION_HAS_SPEED_BIT             = (1<<2), // location has valid speed
72     LOCATION_HAS_BEARING_BIT           = (1<<3), // location has valid bearing
73     LOCATION_HAS_ACCURACY_BIT          = (1<<4), // location has valid accuracy
74     LOCATION_HAS_VERTICAL_ACCURACY_BIT = (1<<5), // location has valid vertical accuracy
75     LOCATION_HAS_SPEED_ACCURACY_BIT    = (1<<6), // location has valid speed accuracy
76     LOCATION_HAS_BEARING_ACCURACY_BIT  = (1<<7), // location has valid bearing accuracy
77     LOCATION_HAS_SPOOF_MASK            = (1<<8), // location has valid spoof mask
78     LOCATION_HAS_ELAPSED_REAL_TIME     = (1<<9), // location has valid elapsed real time
79 } LocationFlagsBits;
80 
81 typedef uint16_t LocationTechnologyMask;
82 typedef enum {
83     LOCATION_TECHNOLOGY_GNSS_BIT     = (1<<0), // location was calculated using GNSS
84     LOCATION_TECHNOLOGY_CELL_BIT     = (1<<1), // location was calculated using Cell
85     LOCATION_TECHNOLOGY_WIFI_BIT     = (1<<2), // location was calculated using WiFi
86     LOCATION_TECHNOLOGY_SENSORS_BIT  = (1<<3), // location was calculated using Sensors
87 } LocationTechnologyBits;
88 
89 typedef uint32_t LocationSpoofMask;
90 typedef enum {
91     LOCATION_POSTION_SPOOFED             = (1<<0), // location position spoofed
92     LOCATION_TIME_SPOOFED                = (1<<1), // location time spoofed
93     LOCATION_NAVIGATION_DATA_SPOOFED     = (1<<2), // location navigation data spoofed
94 } LocationSpoofBits;
95 
96 typedef enum {
97     LOCATION_RELIABILITY_NOT_SET = 0,
98     LOCATION_RELIABILITY_VERY_LOW,
99     LOCATION_RELIABILITY_LOW,
100     LOCATION_RELIABILITY_MEDIUM,
101     LOCATION_RELIABILITY_HIGH,
102 } LocationReliability;
103 
104 typedef uint32_t GnssLocationNavSolutionMask;
105 typedef enum {
106     LOCATION_SBAS_CORRECTION_IONO_BIT  = (1<<0), // SBAS ionospheric correction is used
107     LOCATION_SBAS_CORRECTION_FAST_BIT  = (1<<1), // SBAS fast correction is used
108     LOCATION_SBAS_CORRECTION_LONG_BIT  = (1<<2), // SBAS long-tem correction is used
109     LOCATION_SBAS_INTEGRITY_BIT        = (1<<3), // SBAS integrity information is used
110     LOCATION_NAV_CORRECTION_DGNSS_BIT  = (1<<4), // Position Report is DGNSS corrected
111     LOCATION_NAV_CORRECTION_RTK_BIT    = (1<<5), // Position Report is RTK corrected
112     LOCATION_NAV_CORRECTION_PPP_BIT    = (1<<6) // Position Report is PPP corrected
113 } GnssLocationNavSolutionBits;
114 
115 typedef uint32_t GnssLocationPosTechMask;
116 typedef enum {
117     LOCATION_POS_TECH_DEFAULT_BIT                  = 0,
118     LOCATION_POS_TECH_SATELLITE_BIT                = (1<<0),
119     LOCATION_POS_TECH_CELLID_BIT                   = (1<<1),
120     LOCATION_POS_TECH_WIFI_BIT                     = (1<<2),
121     LOCATION_POS_TECH_SENSORS_BIT                  = (1<<3),
122     LOCATION_POS_TECH_REFERENCE_LOCATION_BIT       = (1<<4),
123     LOCATION_POS_TECH_INJECTED_COARSE_POSITION_BIT = (1<<5),
124     LOCATION_POS_TECH_AFLT_BIT                     = (1<<6),
125     LOCATION_POS_TECH_HYBRID_BIT                   = (1<<7),
126     LOCATION_POS_TECH_PPE_BIT                      = (1<<8)
127 } GnssLocationPosTechBits;
128 
129 typedef uint32_t GnssLocationPosDataMask;
130 typedef enum {
131     LOCATION_NAV_DATA_HAS_LONG_ACCEL_BIT  = (1<<0), // Navigation data has Forward Acceleration
132     LOCATION_NAV_DATA_HAS_LAT_ACCEL_BIT   = (1<<1), // Navigation data has Sideward Acceleration
133     LOCATION_NAV_DATA_HAS_VERT_ACCEL_BIT  = (1<<2), // Navigation data has Vertical Acceleration
134     LOCATION_NAV_DATA_HAS_YAW_RATE_BIT    = (1<<3), // Navigation data has Heading Rate
135     LOCATION_NAV_DATA_HAS_PITCH_BIT       = (1<<4),  // Navigation data has Body pitch
136     // Navigation data has Forward Acceleration uncertainty
137     LOCATION_NAV_DATA_HAS_LONG_ACCEL_UNC_BIT = (1<<5),
138     // Navigation data has Sideward Acceleration uncertainty
139     LOCATION_NAV_DATA_HAS_LAT_ACCEL_UNC_BIT  = (1<<6),
140     // Navigation data has Vertical Acceleration uncertainty
141     LOCATION_NAV_DATA_HAS_VERT_ACCEL_UNC_BIT = (1<<7),
142     // Navigation data has Heading Rate uncertainty
143     LOCATION_NAV_DATA_HAS_YAW_RATE_UNC_BIT   = (1<<8),
144     // Navigation data has Body pitch uncertainty
145     LOCATION_NAV_DATA_HAS_PITCH_UNC_BIT      = (1<<9)
146 } GnssLocationPosDataBits;
147 
148 typedef uint32_t GnssLocationInfoFlagMask;
149 typedef enum {
150     GNSS_LOCATION_INFO_ALTITUDE_MEAN_SEA_LEVEL_BIT      = (1<<0), // valid altitude mean sea level
151     GNSS_LOCATION_INFO_DOP_BIT                          = (1<<1), // valid pdop, hdop, and vdop
152     GNSS_LOCATION_INFO_MAGNETIC_DEVIATION_BIT           = (1<<2), // valid magnetic deviation
153     GNSS_LOCATION_INFO_HOR_RELIABILITY_BIT              = (1<<3), // valid horizontal reliability
154     GNSS_LOCATION_INFO_VER_RELIABILITY_BIT              = (1<<4), // valid vertical reliability
155     GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MAJOR_BIT = (1<<5), // valid elipsode semi major
156     GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MINOR_BIT = (1<<6), // valid elipsode semi minor
157     GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_AZIMUTH_BIT    = (1<<7), // valid accuracy elipsode azimuth
158     GNSS_LOCATION_INFO_GNSS_SV_USED_DATA_BIT            = (1<<8), // valid svUsedInPosition,
159                                                                   //       numOfMeasReceived
160                                                                   //       and measUsageInfo
161     GNSS_LOCATION_INFO_NAV_SOLUTION_MASK_BIT            = (1<<9), // valid navSolutionMask
162     GNSS_LOCATION_INFO_POS_TECH_MASK_BIT                = (1<<10),// valid LocPosTechMask
163     GNSS_LOCATION_INFO_SV_SOURCE_INFO_BIT               = (1<<11),// valid LocSvInfoSource
164     GNSS_LOCATION_INFO_POS_DYNAMICS_DATA_BIT            = (1<<12),// valid position dynamics data
165     GNSS_LOCATION_INFO_EXT_DOP_BIT                      = (1<<13),// valid gdop, tdop
166     GNSS_LOCATION_INFO_NORTH_STD_DEV_BIT                = (1<<14),// valid North standard deviation
167     GNSS_LOCATION_INFO_EAST_STD_DEV_BIT                 = (1<<15),// valid East standard deviation
168     GNSS_LOCATION_INFO_NORTH_VEL_BIT                    = (1<<16),// valid North Velocity
169     GNSS_LOCATION_INFO_EAST_VEL_BIT                     = (1<<17),// valid East Velocity
170     GNSS_LOCATION_INFO_UP_VEL_BIT                       = (1<<18),// valid Up Velocity
171     GNSS_LOCATION_INFO_NORTH_VEL_UNC_BIT                = (1<<19),// valid North Velocity Uncertainty
172     GNSS_LOCATION_INFO_EAST_VEL_UNC_BIT                 = (1<<20),// valid East Velocity Uncertainty
173     GNSS_LOCATION_INFO_UP_VEL_UNC_BIT                   = (1<<21),// valid Up Velocity Uncertainty
174     GNSS_LOCATION_INFO_LEAP_SECONDS_BIT                 = (1<<22),// valid leap seconds
175     GNSS_LOCATION_INFO_TIME_UNC_BIT                     = (1<<23),// valid time uncertainty
176     GNSS_LOCATION_INFO_NUM_SV_USED_IN_POSITION_BIT      = (1<<24), // number of SV used in position
177     GNSS_LOCATION_INFO_CALIBRATION_CONFIDENCE_BIT       = (1<<25), // valid sensor cal confidence
178     GNSS_LOCATION_INFO_CALIBRATION_STATUS_BIT           = (1<<26), // valid sensor cal status
179     GNSS_LOCATION_INFO_OUTPUT_ENG_TYPE_BIT              = (1<<27), // valid output engine type
180     GNSS_LOCATION_INFO_OUTPUT_ENG_MASK_BIT              = (1<<28), // valid output engine mask
181     GNSS_LOCATION_INFO_CONFORMITY_INDEX_BIT             = (1<<29), // valid conformity index
182 } GnssLocationInfoFlagBits;
183 
184 typedef enum {
185     GEOFENCE_BREACH_ENTER = 0,
186     GEOFENCE_BREACH_EXIT,
187     GEOFENCE_BREACH_DWELL_IN,
188     GEOFENCE_BREACH_DWELL_OUT,
189     GEOFENCE_BREACH_UNKNOWN,
190 } GeofenceBreachType;
191 
192 typedef uint16_t GeofenceBreachTypeMask;
193 typedef enum {
194     GEOFENCE_BREACH_ENTER_BIT     = (1<<0),
195     GEOFENCE_BREACH_EXIT_BIT      = (1<<1),
196     GEOFENCE_BREACH_DWELL_IN_BIT  = (1<<2),
197     GEOFENCE_BREACH_DWELL_OUT_BIT = (1<<3),
198 } GeofenceBreachTypeBits;
199 
200 typedef enum {
201     GEOFENCE_STATUS_AVAILABILE_NO = 0,
202     GEOFENCE_STATUS_AVAILABILE_YES,
203 } GeofenceStatusAvailable;
204 
205 typedef uint32_t LocationCapabilitiesMask;
206 typedef enum {
207     // supports startTracking API with minInterval param
208     LOCATION_CAPABILITIES_TIME_BASED_TRACKING_BIT           = (1<<0),
209     // supports startBatching API with minInterval param
210     LOCATION_CAPABILITIES_TIME_BASED_BATCHING_BIT           = (1<<1),
211     // supports startTracking API with minDistance param
212     LOCATION_CAPABILITIES_DISTANCE_BASED_TRACKING_BIT       = (1<<2),
213     // supports startBatching API with minDistance param
214     LOCATION_CAPABILITIES_DISTANCE_BASED_BATCHING_BIT       = (1<<3),
215     // supports addGeofences API
216     LOCATION_CAPABILITIES_GEOFENCE_BIT                      = (1<<4),
217     // supports GnssMeasurementsCallback
218     LOCATION_CAPABILITIES_GNSS_MEASUREMENTS_BIT             = (1<<5),
219     // supports startTracking/startBatching API with LocationOptions.mode of MSB (Ms Based)
220     LOCATION_CAPABILITIES_GNSS_MSB_BIT                      = (1<<6),
221     // supports startTracking/startBatching API with LocationOptions.mode of MSA (MS Assisted)
222     LOCATION_CAPABILITIES_GNSS_MSA_BIT                      = (1<<7),
223     // supports debug nmea sentences in the debugNmeaCallback
224     LOCATION_CAPABILITIES_DEBUG_NMEA_BIT                    = (1<<8),
225     // support outdoor trip batching
226     LOCATION_CAPABILITIES_OUTDOOR_TRIP_BATCHING_BIT         = (1<<9),
227     // support constellation enablement
228     LOCATION_CAPABILITIES_CONSTELLATION_ENABLEMENT_BIT      = (1<<10),
229     // support agpm
230     LOCATION_CAPABILITIES_AGPM_BIT                          = (1<<11),
231     // support location privacy
232     LOCATION_CAPABILITIES_PRIVACY_BIT                       = (1<<12),
233     // support measurement corrections
234     LOCATION_CAPABILITIES_MEASUREMENTS_CORRECTION_BIT       = (1<<13),
235 } LocationCapabilitiesBits;
236 
237 typedef enum {
238     LOCATION_TECHNOLOGY_TYPE_GNSS = 0,
239 } LocationTechnologyType;
240 
241 // Configures how GPS is locked when GPS is disabled (through GnssDisable)
242 enum {
243     GNSS_CONFIG_GPS_LOCK_NONE = 0, // gps is not locked when GPS is disabled (GnssDisable)
244     GNSS_CONFIG_GPS_LOCK_MO,       // gps mobile originated (MO) is locked when GPS is disabled
245     GNSS_CONFIG_GPS_LOCK_NI,       // gps network initiated (NI) is locked when GPS is disabled
246     GNSS_CONFIG_GPS_LOCK_MO_AND_NI,// gps MO and NI is locked when GPS is disabled
247 };
248 typedef int32_t GnssConfigGpsLock;
249 
250 // SUPL version
251 typedef enum {
252     GNSS_CONFIG_SUPL_VERSION_1_0_0 = 1,
253     GNSS_CONFIG_SUPL_VERSION_2_0_0,
254     GNSS_CONFIG_SUPL_VERSION_2_0_2,
255     GNSS_CONFIG_SUPL_VERSION_2_0_4,
256 } GnssConfigSuplVersion;
257 
258 // LTE Positioning Profile
259 typedef enum {
260     GNSS_CONFIG_LPP_PROFILE_RRLP_ON_LTE = 0,              // RRLP on LTE (Default)
261     GNSS_CONFIG_LPP_PROFILE_USER_PLANE,                   // LPP User Plane (UP) on LTE
262     GNSS_CONFIG_LPP_PROFILE_CONTROL_PLANE,                // LPP_Control_Plane (CP)
263     GNSS_CONFIG_LPP_PROFILE_USER_PLANE_AND_CONTROL_PLANE, // Both LPP UP and CP
264 } GnssConfigLppProfile;
265 
266 // Technology for LPPe Control Plane
267 typedef uint16_t GnssConfigLppeControlPlaneMask;
268 typedef enum {
269     GNSS_CONFIG_LPPE_CONTROL_PLANE_DBH_BIT                  = (1<<0), // DBH
270     GNSS_CONFIG_LPPE_CONTROL_PLANE_WLAN_AP_MEASUREMENTS_BIT = (1<<1), // WLAN_AP_MEASUREMENTS
271     GNSS_CONFIG_LPPE_CONTROL_PLANE_SRN_AP_MEASUREMENTS_BIT = (1<<2), // SRN_AP_MEASUREMENTS
272     GNSS_CONFIG_LPPE_CONTROL_PLANE_SENSOR_BARO_MEASUREMENTS_BIT = (1<<3),
273                                                              // SENSOR_BARO_MEASUREMENTS
274 } GnssConfigLppeControlPlaneBits;
275 
276 // Technology for LPPe User Plane
277 typedef uint16_t GnssConfigLppeUserPlaneMask;
278 typedef enum {
279     GNSS_CONFIG_LPPE_USER_PLANE_DBH_BIT                  = (1<<0), // DBH
280     GNSS_CONFIG_LPPE_USER_PLANE_WLAN_AP_MEASUREMENTS_BIT = (1<<1), // WLAN_AP_MEASUREMENTS
281     GNSS_CONFIG_LPPE_USER_PLANE_SRN_AP_MEASUREMENTS_BIT = (1<<2), // SRN_AP_MEASUREMENTS
282     GNSS_CONFIG_LPPE_USER_PLANE_SENSOR_BARO_MEASUREMENTS_BIT = (1<<3),
283                                                             // SENSOR_BARO_MEASUREMENTS
284 } GnssConfigLppeUserPlaneBits;
285 
286 // Positioning Protocol on A-GLONASS system
287 typedef uint16_t GnssConfigAGlonassPositionProtocolMask;
288 typedef enum {
289     GNSS_CONFIG_RRC_CONTROL_PLANE_BIT = (1<<0),  // RRC Control Plane
290     GNSS_CONFIG_RRLP_USER_PLANE_BIT   = (1<<1),  // RRLP User Plane
291     GNSS_CONFIG_LLP_USER_PLANE_BIT    = (1<<2),  // LPP User Plane
292     GNSS_CONFIG_LLP_CONTROL_PLANE_BIT = (1<<3),  // LPP Control Plane
293 } GnssConfigAGlonassPositionProtocolBits;
294 
295 typedef enum {
296     GNSS_CONFIG_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_NO = 0,
297     GNSS_CONFIG_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_YES,
298 } GnssConfigEmergencyPdnForEmergencySupl;
299 
300 typedef enum {
301     GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_NO = 0,
302     GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_YES,
303 } GnssConfigSuplEmergencyServices;
304 
305 typedef uint16_t GnssConfigSuplModeMask;
306 typedef enum {
307     GNSS_CONFIG_SUPL_MODE_MSB_BIT = (1<<0),
308     GNSS_CONFIG_SUPL_MODE_MSA_BIT = (1<<1),
309 } GnssConfigSuplModeBits;
310 
311 typedef uint32_t GnssConfigFlagsMask;
312 typedef enum {
313     GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT                   = (1<<0),
314     GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT               = (1<<1),
315     GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT        = (1<<2),
316     GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT                = (1<<3),
317     GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT         = (1<<4),
318     GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT            = (1<<5),
319     GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT = (1<<6),
320     GNSS_CONFIG_FLAGS_EM_PDN_FOR_EM_SUPL_VALID_BIT         = (1<<7),
321     GNSS_CONFIG_FLAGS_SUPL_EM_SERVICES_BIT                 = (1<<8),
322     GNSS_CONFIG_FLAGS_SUPL_MODE_BIT                        = (1<<9),
323     GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT               = (1<<10),
324     GNSS_CONFIG_FLAGS_EMERGENCY_EXTENSION_SECONDS_BIT      = (1<<11),
325 } GnssConfigFlagsBits;
326 
327 typedef enum {
328     GNSS_NI_ENCODING_TYPE_NONE = 0,
329     GNSS_NI_ENCODING_TYPE_GSM_DEFAULT,
330     GNSS_NI_ENCODING_TYPE_UTF8,
331     GNSS_NI_ENCODING_TYPE_UCS2,
332 } GnssNiEncodingType;
333 
334 typedef enum {
335     GNSS_NI_TYPE_VOICE = 0,
336     GNSS_NI_TYPE_SUPL,
337     GNSS_NI_TYPE_CONTROL_PLANE,
338     GNSS_NI_TYPE_EMERGENCY_SUPL
339 } GnssNiType;
340 
341 typedef uint16_t GnssNiOptionsMask;
342 typedef enum {
343     GNSS_NI_OPTIONS_NOTIFICATION_BIT     = (1<<0),
344     GNSS_NI_OPTIONS_VERIFICATION_BIT     = (1<<1),
345     GNSS_NI_OPTIONS_PRIVACY_OVERRIDE_BIT = (1<<2),
346 } GnssNiOptionsBits;
347 
348 typedef enum {
349     GNSS_NI_RESPONSE_ACCEPT = 1,
350     GNSS_NI_RESPONSE_DENY,
351     GNSS_NI_RESPONSE_NO_RESPONSE,
352     GNSS_NI_RESPONSE_IGNORE,
353 } GnssNiResponse;
354 
355 typedef enum {
356     GNSS_SV_TYPE_UNKNOWN = 0,
357     GNSS_SV_TYPE_GPS,
358     GNSS_SV_TYPE_SBAS,
359     GNSS_SV_TYPE_GLONASS,
360     GNSS_SV_TYPE_QZSS,
361     GNSS_SV_TYPE_BEIDOU,
362     GNSS_SV_TYPE_GALILEO,
363     GNSS_SV_TYPE_NAVIC,
364 } GnssSvType;
365 
366 typedef enum {
367     GNSS_EPH_TYPE_UNKNOWN = 0,
368     GNSS_EPH_TYPE_EPHEMERIS,
369     GNSS_EPH_TYPE_ALMANAC,
370 } GnssEphemerisType;
371 
372 typedef enum {
373     GNSS_EPH_SOURCE_UNKNOWN = 0,
374     GNSS_EPH_SOURCE_DEMODULATED,
375     GNSS_EPH_SOURCE_SUPL_PROVIDED,
376     GNSS_EPH_SOURCE_OTHER_SERVER_PROVIDED,
377     GNSS_EPH_SOURCE_LOCAL,
378 } GnssEphemerisSource;
379 
380 typedef enum {
381     GNSS_EPH_HEALTH_UNKNOWN = 0,
382     GNSS_EPH_HEALTH_GOOD,
383     GNSS_EPH_HEALTH_BAD,
384 } GnssEphemerisHealth;
385 
386 typedef uint16_t GnssSvOptionsMask;
387 typedef enum {
388     GNSS_SV_OPTIONS_HAS_EPHEMER_BIT             = (1<<0),
389     GNSS_SV_OPTIONS_HAS_ALMANAC_BIT             = (1<<1),
390     GNSS_SV_OPTIONS_USED_IN_FIX_BIT             = (1<<2),
391     GNSS_SV_OPTIONS_HAS_CARRIER_FREQUENCY_BIT   = (1<<3),
392     GNSS_SV_OPTIONS_HAS_GNSS_SIGNAL_TYPE_BIT    = (1<<4)
393 } GnssSvOptionsBits;
394 
395 typedef enum {
396     GNSS_ASSISTANCE_TYPE_SUPL = 0,
397     GNSS_ASSISTANCE_TYPE_C2K,
398     GNSS_ASSISTANCE_TYPE_SUPL_EIMS,
399     GNSS_ASSISTANCE_TYPE_SUPL_IMS,
400 } GnssAssistanceType;
401 
402 typedef enum {
403     GNSS_SUPL_MODE_STANDALONE = 0,
404     GNSS_SUPL_MODE_MSB,
405     GNSS_SUPL_MODE_MSA,
406 } GnssSuplMode;
407 
408 typedef enum {
409     BATCHING_MODE_ROUTINE = 0,   // positions are reported when batched positions memory is full
410     BATCHING_MODE_TRIP,          // positions are reported when a certain distance is covered
411     BATCHING_MODE_NO_AUTO_REPORT // no report of positions automatically, instead queried on demand
412 } BatchingMode;
413 
414 typedef enum {
415     BATCHING_STATUS_TRIP_COMPLETED = 0,
416     BATCHING_STATUS_POSITION_AVAILABE,
417     BATCHING_STATUS_POSITION_UNAVAILABLE
418 } BatchingStatus;
419 
420 typedef uint16_t GnssMeasurementsAdrStateMask;
421 typedef enum {
422     GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_UNKNOWN                 = 0,
423     GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_VALID_BIT               = (1<<0),
424     GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_RESET_BIT               = (1<<1),
425     GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_CYCLE_SLIP_BIT          = (1<<2),
426     GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_HALF_CYCLE_RESOLVED_BIT = (1<<3),
427 } GnssMeasurementsAdrStateBits;
428 
429 typedef enum {
430     GNSS_MEASUREMENTS_CODE_TYPE_A       = 0,
431     GNSS_MEASUREMENTS_CODE_TYPE_B       = 1,
432     GNSS_MEASUREMENTS_CODE_TYPE_C       = 2,
433     GNSS_MEASUREMENTS_CODE_TYPE_I       = 3,
434     GNSS_MEASUREMENTS_CODE_TYPE_L       = 4,
435     GNSS_MEASUREMENTS_CODE_TYPE_M       = 5,
436     GNSS_MEASUREMENTS_CODE_TYPE_P       = 6,
437     GNSS_MEASUREMENTS_CODE_TYPE_Q       = 7,
438     GNSS_MEASUREMENTS_CODE_TYPE_S       = 8,
439     GNSS_MEASUREMENTS_CODE_TYPE_W       = 9,
440     GNSS_MEASUREMENTS_CODE_TYPE_X       = 10,
441     GNSS_MEASUREMENTS_CODE_TYPE_Y       = 11,
442     GNSS_MEASUREMENTS_CODE_TYPE_Z       = 12,
443     GNSS_MEASUREMENTS_CODE_TYPE_N       = 13,
444     GNSS_MEASUREMENTS_CODE_TYPE_OTHER   = 255,
445 } GnssMeasurementsCodeType;
446 
447 typedef uint32_t GnssMeasurementsDataFlagsMask;
448 typedef enum {
449     GNSS_MEASUREMENTS_DATA_SV_ID_BIT                        = (1<<0),
450     GNSS_MEASUREMENTS_DATA_SV_TYPE_BIT                      = (1<<1),
451     GNSS_MEASUREMENTS_DATA_STATE_BIT                        = (1<<2),
452     GNSS_MEASUREMENTS_DATA_RECEIVED_SV_TIME_BIT             = (1<<3),
453     GNSS_MEASUREMENTS_DATA_RECEIVED_SV_TIME_UNCERTAINTY_BIT = (1<<4),
454     GNSS_MEASUREMENTS_DATA_CARRIER_TO_NOISE_BIT             = (1<<5),
455     GNSS_MEASUREMENTS_DATA_PSEUDORANGE_RATE_BIT             = (1<<6),
456     GNSS_MEASUREMENTS_DATA_PSEUDORANGE_RATE_UNCERTAINTY_BIT = (1<<7),
457     GNSS_MEASUREMENTS_DATA_ADR_STATE_BIT                    = (1<<8),
458     GNSS_MEASUREMENTS_DATA_ADR_BIT                          = (1<<9),
459     GNSS_MEASUREMENTS_DATA_ADR_UNCERTAINTY_BIT              = (1<<10),
460     GNSS_MEASUREMENTS_DATA_CARRIER_FREQUENCY_BIT            = (1<<11),
461     GNSS_MEASUREMENTS_DATA_CARRIER_CYCLES_BIT               = (1<<12),
462     GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_BIT                = (1<<13),
463     GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_UNCERTAINTY_BIT    = (1<<14),
464     GNSS_MEASUREMENTS_DATA_MULTIPATH_INDICATOR_BIT          = (1<<15),
465     GNSS_MEASUREMENTS_DATA_SIGNAL_TO_NOISE_RATIO_BIT        = (1<<16),
466     GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT       = (1<<17),
467     GNSS_MEASUREMENTS_DATA_FULL_ISB_BIT                     = (1<<18),
468     GNSS_MEASUREMENTS_DATA_FULL_ISB_UNCERTAINTY_BIT         = (1<<19),
469     GNSS_MEASUREMENTS_DATA_SATELLITE_ISB_BIT                = (1<<20),
470     GNSS_MEASUREMENTS_DATA_SATELLITE_ISB_UNCERTAINTY_BIT    = (1<<21),
471 } GnssMeasurementsDataFlagsBits;
472 
473 typedef uint32_t GnssMeasurementsStateMask;
474 typedef enum {
475     GNSS_MEASUREMENTS_STATE_UNKNOWN_BIT               = 0,
476     GNSS_MEASUREMENTS_STATE_CODE_LOCK_BIT             = (1<<0),
477     GNSS_MEASUREMENTS_STATE_BIT_SYNC_BIT              = (1<<1),
478     GNSS_MEASUREMENTS_STATE_SUBFRAME_SYNC_BIT         = (1<<2),
479     GNSS_MEASUREMENTS_STATE_TOW_DECODED_BIT           = (1<<3),
480     GNSS_MEASUREMENTS_STATE_MSEC_AMBIGUOUS_BIT        = (1<<4),
481     GNSS_MEASUREMENTS_STATE_SYMBOL_SYNC_BIT           = (1<<5),
482     GNSS_MEASUREMENTS_STATE_GLO_STRING_SYNC_BIT       = (1<<6),
483     GNSS_MEASUREMENTS_STATE_GLO_TOD_DECODED_BIT       = (1<<7),
484     GNSS_MEASUREMENTS_STATE_BDS_D2_BIT_SYNC_BIT       = (1<<8),
485     GNSS_MEASUREMENTS_STATE_BDS_D2_SUBFRAME_SYNC_BIT  = (1<<9),
486     GNSS_MEASUREMENTS_STATE_GAL_E1BC_CODE_LOCK_BIT    = (1<<10),
487     GNSS_MEASUREMENTS_STATE_GAL_E1C_2ND_CODE_LOCK_BIT = (1<<11),
488     GNSS_MEASUREMENTS_STATE_GAL_E1B_PAGE_SYNC_BIT     = (1<<12),
489     GNSS_MEASUREMENTS_STATE_SBAS_SYNC_BIT             = (1<<13),
490     GNSS_MEASUREMENTS_STATE_TOW_KNOWN_BIT             = (1<<14),
491     GNSS_MEASUREMENTS_STATE_GLO_TOD_KNOWN_BIT         = (1<<15),
492     GNSS_MEASUREMENTS_STATE_2ND_CODE_LOCK_BIT         = (1<<16),
493 } GnssMeasurementsStateBits;
494 
495 typedef uint16_t GnssSingleSatCorrectionMask;
496 typedef enum {
497     GNSS_MC_UNKNOWN_BIT                     = 0,
498     GNSS_MC_HAS_SAT_IS_LOS_PROBABILITY_BIT  = (1 << 0),
499     GNSS_MC_HAS_EXCESS_PATH_LENGTH_BIT      = (1 << 1),
500     GNSS_MC_HAS_EXCESS_PATH_LENGTH_UNC_BIT  = (1 << 2),
501     GNSS_MC_HAS_REFLECTING_PLANE_BIT        = (1 << 3),
502 } GnssSingleSatCorrectionBits;
503 
504 typedef enum {
505     GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_UNKNOWN = 0,
506     GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_PRESENT,
507     GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_NOT_PRESENT,
508 } GnssMeasurementsMultipathIndicator;
509 
510 typedef uint32_t GnssMeasurementsClockFlagsMask;
511 typedef enum {
512     GNSS_MEASUREMENTS_CLOCK_FLAGS_LEAP_SECOND_BIT                  = (1<<0),
513     GNSS_MEASUREMENTS_CLOCK_FLAGS_TIME_BIT                         = (1<<1),
514     GNSS_MEASUREMENTS_CLOCK_FLAGS_TIME_UNCERTAINTY_BIT             = (1<<2),
515     GNSS_MEASUREMENTS_CLOCK_FLAGS_FULL_BIAS_BIT                    = (1<<3),
516     GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_BIT                         = (1<<4),
517     GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_UNCERTAINTY_BIT             = (1<<5),
518     GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_BIT                        = (1<<6),
519     GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_UNCERTAINTY_BIT            = (1<<7),
520     GNSS_MEASUREMENTS_CLOCK_FLAGS_HW_CLOCK_DISCONTINUITY_COUNT_BIT = (1<<8),
521     GNSS_MEASUREMENTS_CLOCK_FLAGS_ELAPSED_REAL_TIME_BIT            = (1<<9),
522 } GnssMeasurementsClockFlagsBits;
523 
524 typedef uint32_t GnssAidingDataSvMask;
525 typedef enum {
526     GNSS_AIDING_DATA_SV_EPHEMERIS_BIT    = (1<<0), // ephemeris
527     GNSS_AIDING_DATA_SV_ALMANAC_BIT      = (1<<1), // almanac
528     GNSS_AIDING_DATA_SV_HEALTH_BIT       = (1<<2), // health
529     GNSS_AIDING_DATA_SV_DIRECTION_BIT    = (1<<3), // direction
530     GNSS_AIDING_DATA_SV_STEER_BIT        = (1<<4), // steer
531     GNSS_AIDING_DATA_SV_ALMANAC_CORR_BIT = (1<<5), // almanac correction
532     GNSS_AIDING_DATA_SV_BLACKLIST_BIT    = (1<<6), // blacklist SVs
533     GNSS_AIDING_DATA_SV_SA_DATA_BIT      = (1<<7), // sensitivity assistance data
534     GNSS_AIDING_DATA_SV_NO_EXIST_BIT     = (1<<8), // SV does not exist
535     GNSS_AIDING_DATA_SV_IONOSPHERE_BIT   = (1<<9), // ionosphere correction
536     GNSS_AIDING_DATA_SV_TIME_BIT         = (1<<10),// reset satellite time
537     GNSS_AIDING_DATA_SV_MB_DATA          = (1<<11),// delete multiband data
538     GNSS_AIDING_DATA_SV_POLY_BIT         = (1<<12),// poly
539 } GnssAidingDataSvBits;
540 
541 typedef uint32_t GnssAidingDataSvTypeMask;
542 typedef enum {
543     GNSS_AIDING_DATA_SV_TYPE_GPS_BIT      = (1<<0),
544     GNSS_AIDING_DATA_SV_TYPE_GLONASS_BIT  = (1<<1),
545     GNSS_AIDING_DATA_SV_TYPE_QZSS_BIT     = (1<<2),
546     GNSS_AIDING_DATA_SV_TYPE_BEIDOU_BIT   = (1<<3),
547     GNSS_AIDING_DATA_SV_TYPE_GALILEO_BIT  = (1<<4),
548     GNSS_AIDING_DATA_SV_TYPE_NAVIC_BIT    = (1<<5),
549 } GnssAidingDataSvTypeBits;
550 
551 /* Gnss constellation type mask */
552 typedef uint16_t GnssConstellationTypeMask;
553 typedef enum {
554     GNSS_CONSTELLATION_TYPE_GPS_BIT      = (1<<0),
555     GNSS_CONSTELLATION_TYPE_GLONASS_BIT  = (1<<1),
556     GNSS_CONSTELLATION_TYPE_QZSS_BIT     = (1<<2),
557     GNSS_CONSTELLATION_TYPE_BEIDOU_BIT   = (1<<3),
558     GNSS_CONSTELLATION_TYPE_GALILEO_BIT  = (1<<4),
559     GNSS_CONSTELLATION_TYPE_SBAS_BIT     = (1<<5),
560     GNSS_CONSTELLATION_TYPE_NAVIC_BIT    = (1<<6),
561 } GnssConstellationTypeBits;
562 
563 #define GNSS_CONSTELLATION_TYPE_MASK_ALL\
564         (GNSS_CONSTELLATION_TYPE_GPS_BIT     | GNSS_CONSTELLATION_TYPE_GLONASS_BIT |\
565          GNSS_CONSTELLATION_TYPE_QZSS_BIT    | GNSS_CONSTELLATION_TYPE_BEIDOU_BIT  |\
566          GNSS_CONSTELLATION_TYPE_GALILEO_BIT | GNSS_CONSTELLATION_TYPE_SBAS_BIT    |\
567          GNSS_CONSTELLATION_TYPE_NAVIC_BIT)
568 
569 /** GNSS Signal Type and RF Band */
570 typedef uint32_t GnssSignalTypeMask;
571 typedef enum {
572     /** GPS L1CA Signal */
573     GNSS_SIGNAL_GPS_L1CA            = (1<<0),
574     /** GPS L1C Signal */
575     GNSS_SIGNAL_GPS_L1C             = (1<<1),
576     /** GPS L2 RF Band */
577     GNSS_SIGNAL_GPS_L2              = (1<<2),
578     /** GPS L5 RF Band */
579     GNSS_SIGNAL_GPS_L5              = (1<<3),
580     /** GLONASS G1 (L1OF) RF Band */
581     GNSS_SIGNAL_GLONASS_G1          = (1<<4),
582     /** GLONASS G2 (L2OF) RF Band */
583     GNSS_SIGNAL_GLONASS_G2          = (1<<5),
584     /** GALILEO E1 RF Band */
585     GNSS_SIGNAL_GALILEO_E1          = (1<<6),
586     /** GALILEO E5A RF Band */
587     GNSS_SIGNAL_GALILEO_E5A         = (1<<7),
588     /** GALILEO E5B RF Band */
589     GNSS_SIGNAL_GALILEO_E5B         = (1<<8),
590     /** BEIDOU B1 RF Band */
591     GNSS_SIGNAL_BEIDOU_B1           = (1<<9),
592     /** BEIDOU B2 RF Band */
593     GNSS_SIGNAL_BEIDOU_B2           = (1<<10),
594     /** QZSS L1CA RF Band */
595     GNSS_SIGNAL_QZSS_L1CA           = (1<<11),
596     /** QZSS L1S RF Band */
597     GNSS_SIGNAL_QZSS_L1S            = (1<<12),
598     /** QZSS L2 RF Band */
599     GNSS_SIGNAL_QZSS_L2             = (1<<13),
600     /** QZSS L5 RF Band */
601     GNSS_SIGNAL_QZSS_L5             = (1<<14),
602     /** SBAS L1 RF Band */
603     GNSS_SIGNAL_SBAS_L1             = (1<<15),
604     /** BEIDOU B1I RF Band */
605     GNSS_SIGNAL_BEIDOU_B1I          = (1<<16),
606     /** BEIDOU B1C RF Band */
607     GNSS_SIGNAL_BEIDOU_B1C          = (1<<17),
608     /** BEIDOU B2I RF Band */
609     GNSS_SIGNAL_BEIDOU_B2I          = (1<<18),
610     /** BEIDOU B2AI RF Band */
611     GNSS_SIGNAL_BEIDOU_B2AI         = (1<<19),
612     /** NAVIC L5 RF Band */
613     GNSS_SIGNAL_NAVIC_L5            = (1<<20),
614     /** BEIDOU B2A_Q RF Band */
615     GNSS_SIGNAL_BEIDOU_B2AQ         = (1<<21),
616 } GnssSignalTypeBits;
617 
618 #define GNSS_SIGNAL_TYPE_MASK_ALL\
619     (GNSS_SIGNAL_GPS_L1CA | GNSS_SIGNAL_GPS_L1C | GNSS_SIGNAL_GPS_L2 |\
620      GNSS_SIGNAL_GPS_L5| GNSS_SIGNAL_GLONASS_G1 | GNSS_SIGNAL_GLONASS_G2 |\
621      GNSS_SIGNAL_GALILEO_E1 | GNSS_SIGNAL_GALILEO_E5A | GNSS_SIGNAL_GALILEO_E5B |\
622      GNSS_SIGNAL_BEIDOU_B1I | GNSS_SIGNAL_BEIDOU_B1C | GNSS_SIGNAL_BEIDOU_B2I|\
623      GNSS_SIGNAL_BEIDOU_B2AI | GNSS_SIGNAL_QZSS_L1CA | GNSS_SIGNAL_QZSS_L1S |\
624      GNSS_SIGNAL_QZSS_L2| GNSS_SIGNAL_QZSS_L5 | GNSS_SIGNAL_SBAS_L1 |\
625      GNSS_SIGNAL_NAVIC_L5 | GNSS_SIGNAL_BEIDOU_B2AQ)
626 
627 typedef enum
628 {
629     GNSS_LOC_SV_SYSTEM_UNKNOWN                = 0,
630     /** unknown sv system. */
631     GNSS_LOC_SV_SYSTEM_MIN                    = 1,
632     /**< Min enum of valid SV system. */
633     GNSS_LOC_SV_SYSTEM_GPS                    = 1,
634     /**< GPS satellite. */
635     GNSS_LOC_SV_SYSTEM_GALILEO                = 2,
636     /**< GALILEO satellite. */
637     GNSS_LOC_SV_SYSTEM_SBAS                   = 3,
638     /**< SBAS satellite. */
639     GNSS_LOC_SV_SYSTEM_GLONASS                = 4,
640     /**< GLONASS satellite. */
641     GNSS_LOC_SV_SYSTEM_BDS                    = 5,
642     /**< BDS satellite. */
643     GNSS_LOC_SV_SYSTEM_QZSS                   = 6,
644     /**< QZSS satellite. */
645     GNSS_LOC_SV_SYSTEM_NAVIC                  = 7,
646     /**< NAVIC satellite. */
647     GNSS_LOC_SV_SYSTEM_MAX                    = 7,
648     /**< Max enum of valid SV system. */
649 } Gnss_LocSvSystemEnumType;
650 
651 typedef enum {
652     GNSS_LOC_SIGNAL_TYPE_GPS_L1CA = 0,          /**<  GPS L1CA Signal  */
653     GNSS_LOC_SIGNAL_TYPE_GPS_L1C = 1,           /**<  GPS L1C Signal  */
654     GNSS_LOC_SIGNAL_TYPE_GPS_L2C_L = 2,         /**<  GPS L2C_L RF Band  */
655     GNSS_LOC_SIGNAL_TYPE_GPS_L5_Q = 3,          /**<  GPS L5_Q RF Band  */
656     GNSS_LOC_SIGNAL_TYPE_GLONASS_G1 = 4,        /**<  GLONASS G1 (L1OF) RF Band  */
657     GNSS_LOC_SIGNAL_TYPE_GLONASS_G2 = 5,        /**<  GLONASS G2 (L2OF) RF Band  */
658     GNSS_LOC_SIGNAL_TYPE_GALILEO_E1_C = 6,      /**<  GALILEO E1_C RF Band  */
659     GNSS_LOC_SIGNAL_TYPE_GALILEO_E5A_Q = 7,     /**<  GALILEO E5A_Q RF Band  */
660     GNSS_LOC_SIGNAL_TYPE_GALILEO_E5B_Q = 8,     /**<  GALILEO E5B_Q RF Band  */
661     GNSS_LOC_SIGNAL_TYPE_BEIDOU_B1_I = 9,       /**<  BEIDOU B1_I RF Band  */
662     GNSS_LOC_SIGNAL_TYPE_BEIDOU_B1C = 10,       /**<  BEIDOU B1C RF Band  */
663     GNSS_LOC_SIGNAL_TYPE_BEIDOU_B2_I = 11,      /**<  BEIDOU B2_I RF Band  */
664     GNSS_LOC_SIGNAL_TYPE_BEIDOU_B2A_I = 12,     /**<  BEIDOU B2A_I RF Band  */
665     GNSS_LOC_SIGNAL_TYPE_QZSS_L1CA = 13,        /**<  QZSS L1CA RF Band  */
666     GNSS_LOC_SIGNAL_TYPE_QZSS_L1S = 14,         /**<  QZSS L1S RF Band  */
667     GNSS_LOC_SIGNAL_TYPE_QZSS_L2C_L = 15,       /**<  QZSS L2C_L RF Band  */
668     GNSS_LOC_SIGNAL_TYPE_QZSS_L5_Q = 16,        /**<  QZSS L5_Q RF Band  */
669     GNSS_LOC_SIGNAL_TYPE_SBAS_L1_CA = 17,       /**<  SBAS L1_CA RF Band  */
670     GNSS_LOC_SIGNAL_TYPE_NAVIC_L5 = 18,         /**<  NAVIC L5 RF Band */
671     GNSS_LOC_SIGNAL_TYPE_BEIDOU_B2A_Q = 19,     /**<  BEIDOU B2A_Q RF Band  */
672     GNSS_LOC_MAX_NUMBER_OF_SIGNAL_TYPES = 20    /**<  Maximum number of signal types */
673 } Gnss_LocSignalEnumType;
674 
675 typedef uint32_t PositioningEngineMask;
676 typedef enum {
677     STANDARD_POSITIONING_ENGINE = (1 << 0),
678     DEAD_RECKONING_ENGINE       = (1 << 1),
679     PRECISE_POSITIONING_ENGINE  = (1 << 2)
680 } PositioningEngineBits;
681 #define POSITION_ENGINE_MASK_ALL \
682         (STANDARD_POSITIONING_ENGINE|DEAD_RECKONING_ENGINE|PRECISE_POSITIONING_ENGINE)
683 
684 typedef uint64_t GnssDataMask;
685 typedef enum {
686     // Jammer Indicator is available
687     GNSS_LOC_DATA_JAMMER_IND_BIT = (1ULL << 0),
688     // AGC is available
689     GNSS_LOC_DATA_AGC_BIT = (1ULL << 1)
690 } GnssDataBits;
691 
692 typedef uint32_t GnssSystemTimeStructTypeFlags;
693 typedef enum {
694     GNSS_SYSTEM_TIME_WEEK_VALID             = (1 << 0),
695     GNSS_SYSTEM_TIME_WEEK_MS_VALID          = (1 << 1),
696     GNSS_SYSTEM_CLK_TIME_BIAS_VALID         = (1 << 2),
697     GNSS_SYSTEM_CLK_TIME_BIAS_UNC_VALID     = (1 << 3),
698     GNSS_SYSTEM_REF_FCOUNT_VALID            = (1 << 4),
699     GNSS_SYSTEM_NUM_CLOCK_RESETS_VALID      = (1 << 5)
700 } GnssSystemTimeTypeBits;
701 
702 typedef uint32_t GnssGloTimeStructTypeFlags;
703 typedef enum {
704     GNSS_CLO_DAYS_VALID                     = (1 << 0),
705     GNSS_GLO_MSEC_VALID                     = (1 << 1),
706     GNSS_GLO_CLK_TIME_BIAS_VALID            = (1 << 2),
707     GNSS_GLO_CLK_TIME_BIAS_UNC_VALID        = (1 << 3),
708     GNSS_GLO_REF_FCOUNT_VALID               = (1 << 4),
709     GNSS_GLO_NUM_CLOCK_RESETS_VALID         = (1 << 5),
710     GNSS_GLO_FOUR_YEAR_VALID                = (1 << 6)
711 } GnssGloTimeTypeBits;
712 
713 typedef struct {
714     GnssAidingDataSvMask svMask;         // bitwise OR of GnssAidingDataSvBits
715     GnssAidingDataSvTypeMask svTypeMask; // bitwise OR of GnssAidingDataSvTypeBits
716 } GnssAidingDataSv;
717 
718 typedef uint32_t GnssAidingDataCommonMask;
719 typedef enum {
720     GNSS_AIDING_DATA_COMMON_POSITION_BIT      = (1<<0), // position estimate
721     GNSS_AIDING_DATA_COMMON_TIME_BIT          = (1<<1), // reset all clock values
722     GNSS_AIDING_DATA_COMMON_UTC_BIT           = (1<<2), // UTC estimate
723     GNSS_AIDING_DATA_COMMON_RTI_BIT           = (1<<3), // RTI
724     GNSS_AIDING_DATA_COMMON_FREQ_BIAS_EST_BIT = (1<<4), // frequency bias estimate
725     GNSS_AIDING_DATA_COMMON_CELLDB_BIT        = (1<<5), // all celldb info
726 } GnssAidingDataCommonBits;
727 
728 typedef struct {
729     GnssAidingDataCommonMask mask; // bitwise OR of GnssAidingDataCommonBits
730 } GnssAidingDataCommon;
731 
732 typedef struct {
733     bool deleteAll;              // if true, delete all aiding data and ignore other params
734     GnssAidingDataSv sv;         // SV specific aiding data
735     GnssAidingDataCommon common; // common aiding data
736     PositioningEngineMask posEngineMask; // engines to perform the delete operation on.
737 } GnssAidingData;
738 
739 typedef uint16_t DrCalibrationStatusMask;
740 typedef enum {
741     // Indicate that roll calibration is needed. Need to take more turns on level ground
742     DR_ROLL_CALIBRATION_NEEDED  = (1<<0),
743     // Indicate that pitch calibration is needed. Need to take more turns on level ground
744     DR_PITCH_CALIBRATION_NEEDED = (1<<1),
745     // Indicate that yaw calibration is needed. Need to accelerate in a straight line
746     DR_YAW_CALIBRATION_NEEDED   = (1<<2),
747     // Indicate that odo calibration is needed. Need to accelerate in a straight line
748     DR_ODO_CALIBRATION_NEEDED   = (1<<3),
749     // Indicate that gyro calibration is needed. Need to take more turns on level ground
750     DR_GYRO_CALIBRATION_NEEDED  = (1<<4)
751 } DrCalibrationStatusBits;
752 
753 typedef struct {
754     uint32_t size;           // set to sizeof(Location)
755     LocationFlagsMask flags; // bitwise OR of LocationFlagsBits to mark which params are valid
756     uint64_t timestamp;      // UTC timestamp for location fix, milliseconds since January 1, 1970
757     double latitude;         // in degrees
758     double longitude;        // in degrees
759     double altitude;         // in meters above the WGS 84 reference ellipsoid
760     float speed;             // in meters per second
761     float bearing;           // in degrees; range [0, 360)
762     float accuracy;          // in meters
763     float verticalAccuracy;  // in meters
764     float speedAccuracy;     // in meters/second
765     float bearingAccuracy;   // in degrees (0 to 359.999)
766     LocationTechnologyMask techMask;
767     LocationSpoofMask      spoofMask;
768     uint64_t elapsedRealTime;    // in ns
769     uint64_t elapsedRealTimeUnc; // in ns
770 } Location;
771 
772 typedef enum {
773     LOC_REQ_ENGINE_FUSED_BIT = (1<<0),
774     LOC_REQ_ENGINE_SPE_BIT   = (1<<1),
775     LOC_REQ_ENGINE_PPE_BIT   = (1<<2),
776 } LocReqEngineTypeMask;
777 
778 typedef enum {
779     LOC_OUTPUT_ENGINE_FUSED   = 0,
780     /** This is the GNSS fix from modem */
781     LOC_OUTPUT_ENGINE_SPE     = 1,
782     /** This is the GNSS fix with correction PPP/RTK correction */
783     LOC_OUTPUT_ENGINE_PPE     = 2,
784     LOC_OUTPUT_ENGINE_COUNT,
785 } LocOutputEngineType;
786 
787 struct LocationOptions {
788     uint32_t size;          // set to sizeof(LocationOptions)
789     uint32_t minInterval; // in milliseconds
790     uint32_t minDistance; // in meters. if minDistance > 0, gnssSvCallback/gnssNmeaCallback/
791                           // gnssMeasurementsCallback may not be called
792     GnssSuplMode mode;    // Standalone/MS-Based/MS-Assisted
793     // behavior when this field is 0:
794     //  if engine hub is running, this will be fused fix,
795     //  if engine hub is not running, this will be SPE fix
796     LocReqEngineTypeMask locReqEngTypeMask;
797 
LocationOptionsLocationOptions798     inline LocationOptions() :
799             size(0), minInterval(0), minDistance(0), mode(GNSS_SUPL_MODE_STANDALONE),
800             locReqEngTypeMask((LocReqEngineTypeMask)0) {}
801 };
802 
803 typedef enum {
804     GNSS_POWER_MODE_INVALID = 0,
805     GNSS_POWER_MODE_M1,  /* Improved Accuracy Mode */
806     GNSS_POWER_MODE_M2,  /* Normal Mode */
807     GNSS_POWER_MODE_M3,  /* Background Mode */
808     GNSS_POWER_MODE_M4,  /* Background Mode */
809     GNSS_POWER_MODE_M5   /* Background Mode */
810 } GnssPowerMode;
811 
812 struct TrackingOptions : LocationOptions {
813     GnssPowerMode powerMode; /* Power Mode to be used for time based tracking
814                                 sessions */
815     uint32_t tbm;  /* Time interval between measurements specified in millis.
816                       Applicable to background power modes */
817 
TrackingOptionsTrackingOptions818     inline TrackingOptions() :
819             LocationOptions(), powerMode(GNSS_POWER_MODE_INVALID), tbm(0) {}
TrackingOptionsTrackingOptions820     inline TrackingOptions(uint32_t s, GnssPowerMode m, uint32_t t) :
821             LocationOptions(), powerMode(m), tbm(t) { LocationOptions::size = s; }
TrackingOptionsTrackingOptions822     inline TrackingOptions(const LocationOptions& options) :
823             LocationOptions(options), powerMode(GNSS_POWER_MODE_INVALID), tbm(0) {}
setLocationOptionsTrackingOptions824     inline void setLocationOptions(const LocationOptions& options) {
825         size = sizeof(TrackingOptions);
826         minInterval = options.minInterval;
827         minDistance = options.minDistance;
828         mode = options.mode;
829         locReqEngTypeMask = options.locReqEngTypeMask;
830     }
getLocationOptionsTrackingOptions831     inline LocationOptions getLocationOptions() {
832         LocationOptions locOption;
833         locOption.size = sizeof(locOption);
834         locOption.minDistance = minDistance;
835         locOption.minInterval = minInterval;
836         locOption.mode = mode;
837         locOption.locReqEngTypeMask = locReqEngTypeMask;
838         return locOption;
839     }
840 };
841 
842 struct BatchingOptions : LocationOptions {
843     BatchingMode batchingMode;
844 
BatchingOptionsBatchingOptions845     inline BatchingOptions() :
846             LocationOptions(), batchingMode(BATCHING_MODE_ROUTINE) {}
BatchingOptionsBatchingOptions847     inline BatchingOptions(uint32_t s, BatchingMode m) :
848             LocationOptions(), batchingMode(m) { LocationOptions::size = s; }
BatchingOptionsBatchingOptions849     inline BatchingOptions(const LocationOptions& options) :
850             LocationOptions(options), batchingMode(BATCHING_MODE_ROUTINE) {}
setLocationOptionsBatchingOptions851     inline void setLocationOptions(const LocationOptions& options) {
852         minInterval = options.minInterval;
853         minDistance = options.minDistance;
854         mode = options.mode;
855     }
856 };
857 
858 typedef struct {
859     uint32_t size;
860     BatchingStatus batchingStatus;
861 } BatchingStatusInfo;
862 
863 typedef struct {
864     uint32_t size;                          // set to sizeof(GeofenceOption)
865     GeofenceBreachTypeMask breachTypeMask;  // bitwise OR of GeofenceBreachTypeBits
866     uint32_t responsiveness;                // in milliseconds
867     uint32_t dwellTime;                     // in seconds
868 } GeofenceOption;
869 
870 typedef struct {
871     uint32_t size;    // set to sizeof(GeofenceInfo)
872     double latitude;  // in degrees
873     double longitude; // in degrees
874     double radius;    // in meters
875 } GeofenceInfo;
876 
877 typedef struct {
878     uint32_t size;             // set to sizeof(GeofenceBreachNotification)
879     uint32_t count;            // number of ids in array
880     uint32_t* ids;           // array of ids that have breached
881     Location location;       // location associated with breach
882     GeofenceBreachType type; // type of breach
883     uint64_t timestamp;      // timestamp of breach
884 } GeofenceBreachNotification;
885 
886 typedef struct {
887     uint32_t size;                       // set to sizeof(GeofenceBreachNotification)
888     GeofenceStatusAvailable available; // GEOFENCE_STATUS_AVAILABILE_NO/_YES
889     LocationTechnologyType techType;   // GNSS
890 } GeofenceStatusNotification;
891 
892 typedef struct {
893     uint64_t gpsSvUsedIdsMask;
894     uint64_t gloSvUsedIdsMask;
895     uint64_t galSvUsedIdsMask;
896     uint64_t bdsSvUsedIdsMask;
897     uint64_t qzssSvUsedIdsMask;
898     uint64_t navicSvUsedIdsMask;
899 } GnssLocationSvUsedInPosition;
900 
901 typedef struct {
902     /** GnssSignalType mask */
903     GnssSignalTypeMask gnssSignalType;
904    /** Specifies GNSS Constellation Type */
905     Gnss_LocSvSystemEnumType gnssConstellation;
906     /** Unique SV Identifier.
907      *  For SV Range of supported constellation, please refer to
908      *  the comment section of svId in GnssSv.
909      *  For GLONASS:  When slot-number to SV ID mapping is unknown, set as 255.
910      */
911     uint16_t gnssSvId;
912 } GnssMeasUsageInfo;
913 
914 /** @struct
915     Body Frame parameters
916 */
917 typedef struct {
918     GnssLocationPosDataMask bodyFrameDataMask; // Contains Body frame LocPosDataMask bits
919     float longAccel;                           // Forward Acceleration in body frame (m/s2)
920     float latAccel;                            // Sideward Acceleration in body frame (m/s2)
921     float vertAccel;                           // Vertical Acceleration in body frame (m/s2)
922     float yawRate;                             // Heading Rate (Radians/second)
923     float pitch;                               // Body pitch (Radians)
924     float longAccelUnc;   // Uncertainty of Forward Acceleration in body frame
925     float latAccelUnc;    // Uncertainty of Side-ward Acceleration in body frame
926     float vertAccelUnc;   // Uncertainty of Vertical Acceleration in body frame
927     float yawRateUnc;     // Uncertainty of Heading Rate
928     float pitchUnc;       // Uncertainty of Body pitch
929 } GnssLocationPositionDynamics;
930 
931 typedef struct {
932     /** Validity mask for below fields */
933     GnssSystemTimeStructTypeFlags validityMask;
934     /** Extended week number at reference tick.
935     Unit: Week.
936     Set to 65535 if week number is unknown.
937     For GPS:
938       Calculated from midnight, Jan. 6, 1980.
939       OTA decoded 10 bit GPS week is extended to map between:
940       [NV6264 to (NV6264 + 1023)].
941       NV6264: Minimum GPS week number configuration.
942       Default value of NV6264: 1738
943     For BDS:
944       Calculated from 00:00:00 on January 1, 2006 of Coordinated Universal Time (UTC).
945     For GAL:
946       Calculated from 00:00 UT on Sunday August 22, 1999 (midnight between August 21 and August 22).
947    */
948     uint16_t systemWeek;
949     /** Time in to the current week at reference tick.
950        Unit: Millisecond. Range: 0 to 604799999.
951        Check for systemClkTimeUncMs before use */
952     uint32_t systemMsec;
953     /** System clock time bias (sub-millisecond)
954         Units: Millisecond
955         Note: System time (TOW Millisecond) = systemMsec - systemClkTimeBias.
956         Check for systemClkTimeUncMs before use. */
957     float systemClkTimeBias;
958     /** Single sided maximum time bias uncertainty
959         Units: Millisecond */
960     float systemClkTimeUncMs;
961     /** FCount (free running HW timer) value. Don't use for relative time purpose
962          due to possible discontinuities.
963          Unit: Millisecond */
964     uint32_t refFCount;
965     /** Number of clock resets/discontinuities detected, affecting the local hardware counter value. */
966     uint32_t numClockResets;
967 } GnssSystemTimeStructType;
968 
969 typedef struct {
970     /** GLONASS day number in four years. Refer to GLONASS ICD.
971         Applicable only for GLONASS and shall be ignored for other constellations.
972         If unknown shall be set to 65535 */
973     uint16_t gloDays;
974     /** Validity mask for below fields */
975     GnssGloTimeStructTypeFlags validityMask;
976     /** GLONASS time of day in Millisecond. Refer to GLONASS ICD.
977         Units: Millisecond
978         Check for gloClkTimeUncMs before use */
979     uint32_t gloMsec;
980     /** GLONASS clock time bias (sub-millisecond)
981         Units: Millisecond
982         Note: GLO time (TOD Millisecond) = gloMsec - gloClkTimeBias.
983         Check for gloClkTimeUncMs before use. */
984     float gloClkTimeBias;
985     /** Single sided maximum time bias uncertainty
986         Units: Millisecond */
987     float gloClkTimeUncMs;
988     /** FCount (free running HW timer) value. Don't use for relative time purpose
989         due to possible discontinuities.
990         Unit: Millisecond */
991     uint32_t  refFCount;
992     /** Number of clock resets/discontinuities detected, affecting the local hardware counter value. */
993     uint32_t numClockResets;
994     /** GLONASS four year number from 1996. Refer to GLONASS ICD.
995         Applicable only for GLONASS and shall be ignored for other constellations.
996         If unknown shall be set to 255 */
997     uint8_t gloFourYear;
998 } GnssGloTimeStructType;
999 
1000 typedef union {
1001     GnssSystemTimeStructType gpsSystemTime;
1002     GnssSystemTimeStructType galSystemTime;
1003     GnssSystemTimeStructType bdsSystemTime;
1004     GnssSystemTimeStructType qzssSystemTime;
1005     GnssGloTimeStructType    gloSystemTime;
1006     GnssSystemTimeStructType navicSystemTime;
1007 } SystemTimeStructUnion;
1008     /** Time applicability of PVT report */
1009 typedef struct {
1010     /** Specifies GNSS system time reported. Mandatory field */
1011     Gnss_LocSvSystemEnumType gnssSystemTimeSrc;
1012     /** Reporting of GPS system time is recommended.
1013       If GPS time is unknown & other satellite system time is known,
1014       it should be reported.
1015       Mandatory field
1016      */
1017     SystemTimeStructUnion u;
1018 } GnssSystemTime;
1019 
1020 typedef struct {
1021     uint32_t size;                      // set to sizeof(GnssLocationInfo)
1022     Location location;                  // basic locaiton info, latitude, longitude, and etc
1023     GnssLocationInfoFlagMask flags;     // bitwise OR of GnssLocationInfoBits for param validity
1024     float altitudeMeanSeaLevel;         // altitude wrt mean sea level
1025     float pdop;                         // position dilusion of precision
1026     float hdop;                         // horizontal dilusion of precision
1027     float vdop;                         // vertical dilusion of precision
1028     float gdop;                         // geometric  dilution of precision
1029     float tdop;                         // time dilution of precision
1030     float magneticDeviation;            // magnetic deviation
1031     LocationReliability horReliability; // horizontal reliability
1032     LocationReliability verReliability; // vertical reliability
1033     float horUncEllipseSemiMajor;       // horizontal elliptical accuracy semi-major axis
1034     float horUncEllipseSemiMinor;       // horizontal elliptical accuracy semi-minor axis
1035     float horUncEllipseOrientAzimuth;   // horizontal elliptical accuracy azimuth
1036     float northStdDeviation;            // North standard deviation Unit: Meters
1037     float eastStdDeviation;             // East standard deviation. Unit: Meters
1038     float northVelocity;                // North Velocity.Unit: Meters/sec
1039     float eastVelocity;                 // East Velocity Unit Meters/sec
1040     float upVelocity;                   // Up Velocity. Unit Meters/sec
1041     float northVelocityStdDeviation;
1042     float eastVelocityStdDeviation;
1043     float upVelocityStdDeviation;
1044     uint16_t numSvUsedInPosition;
1045     GnssLocationSvUsedInPosition svUsedInPosition;// Gnss sv used in position data
1046     GnssLocationNavSolutionMask navSolutionMask;  // Nav solution mask to indicate sbas corrections
1047     GnssLocationPosTechMask posTechMask;          // Position technology used in computing this fix
1048     GnssLocationPositionDynamics bodyFrameData;   // Body Frame Dynamics: 4wayAcceleration and
1049                                                   // pitch set with validity
1050     GnssSystemTime gnssSystemTime;            // GNSS System Time
1051     uint8_t numOfMeasReceived; // Number of measurements received for use in fix.
1052     GnssMeasUsageInfo measUsageInfo[GNSS_SV_MAX]; // GNSS Measurement Usage info
1053     uint8_t leapSeconds;                          // leap second
1054     float timeUncMs;                              // Time uncertainty in milliseconds
1055     uint8_t calibrationConfidence;                // Sensor calibration confidence percent,
1056                                                   // in range of [0, 100]
1057     DrCalibrationStatusMask calibrationStatus;    // Sensor calibration status
1058     // location engine type. When the fix. when the type is set to
1059     // LOC_ENGINE_SRC_FUSED, the fix is the propagated/aggregated
1060     // reports from all engines running on the system (e.g.:
1061     // DR/SPE/PPE). To check which location engine contributes to
1062     // the fused output, check for locOutputEngMask.
1063     LocOutputEngineType locOutputEngType;
1064     // when loc output eng type is set to fused, this field
1065     // indicates the set of engines contribute to the fix.
1066     PositioningEngineMask locOutputEngMask;
1067     /* When robust location is enabled, this field
1068      * will how well the various input data considered for
1069      * navigation solution conform to expectations.
1070      * Range: 0 (least conforming) to 1 (most conforming) */
1071     float conformityIndex;
1072 } GnssLocationInfoNotification;
1073 
1074 typedef struct {
1075     uint32_t size;                           // set to sizeof(GnssNiNotification)
1076     GnssNiType type;                       // type of NI (Voice, SUPL, Control Plane)
1077     GnssNiOptionsMask options;             // bitwise OR of GnssNiOptionsBits
1078     uint32_t timeout;                      // time (seconds) to wait for user input
1079     GnssNiResponse timeoutResponse;        // the response that should be sent when timeout expires
1080     char requestor[GNSS_NI_REQUESTOR_MAX]; // the requestor that is making the request
1081     GnssNiEncodingType requestorEncoding;  // the encoding type for requestor
1082     char message[GNSS_NI_MESSAGE_ID_MAX];  // the message to show user
1083     GnssNiEncodingType messageEncoding;    // the encoding type for message
1084     char extras[GNSS_NI_MESSAGE_ID_MAX];
1085 } GnssNiNotification;
1086 
1087 // carrier frequency of the signal tracked
1088 #define GPS_L1CA_CARRIER_FREQUENCY      (1575420000.0)
1089 #define GPS_L1C_CARRIER_FREQUENCY       (1575420000.0)
1090 #define GPS_L2C_L_CARRIER_FREQUENCY     (1227600000.0)
1091 #define GPS_L5_Q_CARRIER_FREQUENCY      (1176450000.0)
1092 #define GLONASS_G1_CARRIER_FREQUENCY    (1602000000.0)
1093 #define GLONASS_G2_CARRIER_FREQUENCY    (1246000000.0)
1094 #define GALILEO_E1_C_CARRIER_FREQUENCY  (1575420000.0)
1095 #define GALILEO_E5A_Q_CARRIER_FREQUENCY (1176450000.0)
1096 #define GALILEO_E5B_Q_CARRIER_FREQUENCY (1207140000.0)
1097 #define BEIDOU_B1_I_CARRIER_FREQUENCY   (1561098000.0)
1098 #define BEIDOU_B1C_CARRIER_FREQUENCY    (1575420000.0)
1099 #define BEIDOU_B2_I_CARRIER_FREQUENCY   (1207140000.0)
1100 #define BEIDOU_B2A_I_CARRIER_FREQUENCY  (1176450000.0)
1101 #define BEIDOU_B2A_Q_CARRIER_FREQUENCY  (1176450000.0)
1102 #define QZSS_L1CA_CARRIER_FREQUENCY     (1575420000.0)
1103 #define QZSS_L1S_CARRIER_FREQUENCY      (1575420000.0)
1104 #define QZSS_L2C_L_CARRIER_FREQUENCY    (1227600000.0)
1105 #define QZSS_L5_Q_CARRIER_FREQUENCY     (1176450000.0)
1106 #define SBAS_L1_CA_CARRIER_FREQUENCY    (1575420000.0)
1107 #define NAVIC_L5_CARRIER_FREQUENCY      (1176450000.0)
1108 
1109 typedef struct {
1110     uint32_t size;       // set to sizeof(GnssSv)
1111     // Unique SV Identifier.
1112     // SV Range for supported constellation is specified as below:
1113     //    - For GPS:     1 to 32
1114     //    - For GLONASS: 65 to 96
1115     //    - For SBAS:    120 to 158 and 183 to 191
1116     //    - For QZSS:    193 to 197
1117     //    - For BDS:     201 to 237
1118     //    - For GAL:     301 to 336
1119     //    - For NAVIC:   401 to 41
1120     uint16_t svId;
1121     GnssSvType type;   // type of SV (GPS, SBAS, GLONASS, QZSS, BEIDOU, GALILEO, NAVIC)
1122     float cN0Dbhz;     // signal strength
1123     float elevation;   // elevation of SV (in degrees)
1124     float azimuth;     // azimuth of SV (in degrees)
1125     GnssSvOptionsMask gnssSvOptionsMask; // Bitwise OR of GnssSvOptionsBits
1126     float carrierFrequencyHz; // carrier frequency of the signal tracked
1127     GnssSignalTypeMask gnssSignalTypeMask; // Specifies GNSS signal type
1128     double basebandCarrierToNoiseDbHz; // baseband signal strength
1129 } GnssSv;
1130 
1131 struct GnssConfigSetAssistanceServer {
1132     uint32_t size;             // set to sizeof(GnssConfigSetAssistanceServer)
1133     GnssAssistanceType type; // SUPL or C2K
1134     const char* hostName;    // null terminated string
1135     uint32_t port;           // port of server
1136 
equalsGnssConfigSetAssistanceServer1137     inline bool equals(const GnssConfigSetAssistanceServer& config) {
1138         if (config.type == type && config.port == port &&
1139                ((NULL == config.hostName && NULL == hostName) ||
1140                 (NULL != config.hostName && NULL != hostName &&
1141                      0 == strcmp(config.hostName, hostName)))) {
1142             return true;
1143         }
1144         return false;
1145     }
1146 };
1147 
1148 typedef struct {
1149     // set to sizeof(GnssMeasurementsData)
1150     uint32_t size;
1151     // bitwise OR of GnssMeasurementsDataFlagsBits
1152     GnssMeasurementsDataFlagsMask flags;
1153     // Unique SV Identifier
1154     // For SV Range of supported constellation,
1155     // please refer to the comment section of svId in GnssSv.
1156     int16_t svId;
1157     GnssSvType svType;
1158     double timeOffsetNs;
1159     GnssMeasurementsStateMask stateMask;       // bitwise OR of GnssMeasurementsStateBits
1160     int64_t receivedSvTimeNs;
1161     int64_t receivedSvTimeUncertaintyNs;
1162     double carrierToNoiseDbHz;
1163     double pseudorangeRateMps;
1164     double pseudorangeRateUncertaintyMps;
1165     GnssMeasurementsAdrStateMask adrStateMask; // bitwise OR of GnssMeasurementsAdrStateBits
1166     double adrMeters;
1167     double adrUncertaintyMeters;
1168     float carrierFrequencyHz;
1169     int64_t carrierCycles;
1170     double carrierPhase;
1171     double carrierPhaseUncertainty;
1172     GnssMeasurementsMultipathIndicator multipathIndicator;
1173     double signalToNoiseRatioDb;
1174     double agcLevelDb;
1175     GnssMeasurementsCodeType codeType;
1176     char otherCodeTypeName[GNSS_MAX_NAME_LENGTH];
1177     double basebandCarrierToNoiseDbHz;
1178     GnssSignalTypeMask gnssSignalType;
1179     double fullInterSignalBiasNs;
1180     double fullInterSignalBiasUncertaintyNs;
1181     double satelliteInterSignalBiasNs;
1182     double satelliteInterSignalBiasUncertaintyNs;
1183 } GnssMeasurementsData;
1184 
1185 typedef struct {
1186     GnssSvType svType;
1187     float carrierFrequencyHz;
1188     GnssMeasurementsCodeType codeType;
1189     char otherCodeTypeName[GNSS_MAX_NAME_LENGTH];
1190 } GnssMeasurementsSignalType;
1191 
1192 typedef struct {
1193     uint32_t size;                          // set to sizeof(GnssReflectingPlane)
1194     double latitudeDegrees;
1195     double longitudeDegrees;
1196     double altitudeMeters;
1197     double azimuthDegrees;
1198 } GnssReflectingPlane;
1199 
1200 typedef struct {
1201     uint32_t size;                          // set to sizeof(GnssSingleSatCorrection)
1202     GnssSingleSatCorrectionMask flags;
1203     GnssSvType svType;
1204     uint16_t svId;
1205     float carrierFrequencyHz;
1206     float probSatIsLos;
1207     float excessPathLengthMeters;
1208     float excessPathLengthUncertaintyMeters;
1209     GnssReflectingPlane reflectingPlane;
1210 } GnssSingleSatCorrection;
1211 
1212 typedef struct {
1213     uint32_t size;                          // set to sizeof(GnssMeasurementCorrections)
1214     double latitudeDegrees;
1215     double longitudeDegrees;
1216     double altitudeMeters;
1217     double horizontalPositionUncertaintyMeters;
1218     double verticalPositionUncertaintyMeters;
1219     uint64_t toaGpsNanosecondsOfWeek;
1220     std::vector<GnssSingleSatCorrection> satCorrections;
1221     bool hasEnvironmentBearing;
1222     float environmentBearingDegrees;
1223     float environmentBearingUncertaintyDegrees;
1224 } GnssMeasurementCorrections;
1225 
1226 typedef struct {
1227     uint32_t size;                          // set to sizeof(GnssMeasurementsClock)
1228     GnssMeasurementsClockFlagsMask flags; // bitwise OR of GnssMeasurementsClockFlagsBits
1229     int16_t leapSecond;
1230     int64_t timeNs;
1231     double timeUncertaintyNs;
1232     int64_t fullBiasNs;
1233     double biasNs;
1234     double biasUncertaintyNs;
1235     double driftNsps;
1236     double driftUncertaintyNsps;
1237     uint32_t hwClockDiscontinuityCount;
1238     GnssMeasurementsSignalType referenceSignalTypeForIsb;
1239     uint64_t elapsedRealTime;    // in ns
1240     uint64_t elapsedRealTimeUnc; // in ns
1241 } GnssMeasurementsClock;
1242 
1243 typedef struct {
1244     uint32_t size;                 // set to sizeof(GnssSvNotification)
1245     uint32_t count;                // number of SVs in the GnssSv array
1246     bool gnssSignalTypeMaskValid;
1247     GnssSv gnssSvs[GNSS_SV_MAX]; // information on a number of SVs
1248 } GnssSvNotification;
1249 
1250 typedef struct {
1251     uint32_t size;         // set to sizeof(GnssNmeaNotification)
1252     uint64_t timestamp;  // timestamp
1253     const char* nmea;    // nmea text
1254     uint32_t length;       // length of the nmea text
1255 } GnssNmeaNotification;
1256 
1257 typedef struct {
1258     uint32_t size;                 // set to sizeof(GnssDataNotification)
1259     GnssDataMask  gnssDataMask[GNSS_LOC_MAX_NUMBER_OF_SIGNAL_TYPES];  // bitwise OR of GnssDataBits
1260     double        jammerInd[GNSS_LOC_MAX_NUMBER_OF_SIGNAL_TYPES];     // Jammer Indication
1261     double        agc[GNSS_LOC_MAX_NUMBER_OF_SIGNAL_TYPES];           // Automatic gain control
1262 } GnssDataNotification;
1263 
1264 typedef struct {
1265     uint32_t size;         // set to sizeof(GnssMeasurementsNotification)
1266     uint32_t count;        // number of items in GnssMeasurements array
1267     GnssMeasurementsData measurements[GNSS_MEASUREMENTS_MAX];
1268     GnssMeasurementsClock clock; // clock
1269 } GnssMeasurementsNotification;
1270 
1271 #define GNSS_SV_POLY_VELOCITY_COEF_MAX_SIZE         12
1272 #define GNSS_SV_POLY_XYZ_0_TH_ORDER_COEFF_MAX_SIZE  3
1273 #define GNSS_SV_POLY_XYZ_N_TH_ORDER_COEFF_MAX_SIZE  9
1274 #define GNSS_SV_POLY_SV_CLKBIAS_COEFF_MAX_SIZE      4
1275 
1276 typedef uint16_t GnssSvPolyStatusMask;
1277 #define GNSS_SV_POLY_SRC_ALM_CORR_V02 ((GnssSvPolyStatusMask)0x01)
1278 #define GNSS_SV_POLY_GLO_STR4_V02 ((GnssSvPolyStatusMask)0x02)
1279 #define GNSS_SV_POLY_DELETE_V02 ((GnssSvPolyStatusMask)0x04)
1280 #define GNSS_SV_POLY_SRC_GAL_FNAV_OR_INAV_V02 ((GnssSvPolyStatusMask)0x08)
1281 typedef uint16_t GnssSvPolyStatusMaskValidity;
1282 #define GNSS_SV_POLY_SRC_ALM_CORR_VALID_V02 ((GnssSvPolyStatusMaskValidity)0x01)
1283 #define GNSS_SV_POLY_GLO_STR4_VALID_V02 ((GnssSvPolyStatusMaskValidity)0x02)
1284 #define GNSS_SV_POLY_DELETE_VALID_V02 ((GnssSvPolyStatusMaskValidity)0x04)
1285 #define GNSS_SV_POLY_SRC_GAL_FNAV_OR_INAV_VALID_V02 ((GnssSvPolyStatusMaskValidity)0x08)
1286 
1287 typedef struct {
1288     uint32_t      size;
1289     uint16_t     gnssSvId;
1290     /* GPS: 1-32, GLO: 65-96, 0: Invalid,
1291        SBAS: 120-151, BDS:201-237,GAL:301 to 336
1292        All others are reserved
1293     */
1294     int8_t      freqNum;
1295     /* Freq index, only valid if u_SysInd is GLO */
1296 
1297     GnssSvPolyStatusMaskValidity svPolyStatusMaskValidity;
1298     GnssSvPolyStatusMask         svPolyStatusMask;
1299 
1300     uint32_t    is_valid;
1301 
1302     uint16_t     iode;
1303     /* Ephemeris reference time
1304        GPS:Issue of Data Ephemeris used [unitless].
1305        GLO: Tb 7-bit, refer to ICD02
1306     */
1307     double      T0;
1308     /* Reference time for polynominal calculations
1309        GPS: Secs in week.
1310        GLO: Full secs since Jan/01/96
1311     */
1312     double      polyCoeffXYZ0[GNSS_SV_POLY_XYZ_0_TH_ORDER_COEFF_MAX_SIZE];
1313     /* C0X, C0Y, C0Z */
1314     double      polyCoefXYZN[GNSS_SV_POLY_XYZ_N_TH_ORDER_COEFF_MAX_SIZE];
1315     /* C1X, C2X ... C2Z, C3Z */
1316     float       polyCoefOther[GNSS_SV_POLY_SV_CLKBIAS_COEFF_MAX_SIZE];
1317     /* C0T, C1T, C2T, C3T */
1318     float       svPosUnc;       /* SV position uncertainty [m]. */
1319     float       ionoDelay;    /* Ionospheric delay at d_T0 [m]. */
1320     float       ionoDot;      /* Iono delay rate [m/s].  */
1321     float       sbasIonoDelay;/* SBAS Ionospheric delay at d_T0 [m]. */
1322     float       sbasIonoDot;  /* SBAS Iono delay rate [m/s].  */
1323     float       tropoDelay;   /* Tropospheric delay [m]. */
1324     float       elevation;    /* Elevation [rad] at d_T0 */
1325     float       elevationDot;      /* Elevation rate [rad/s] */
1326     float       elevationUnc;      /* SV elevation [rad] uncertainty */
1327     double      velCoef[GNSS_SV_POLY_VELOCITY_COEF_MAX_SIZE];
1328     /* Coefficients of velocity poly */
1329     uint32_t    enhancedIOD;    /*  Enhanced Reference Time */
1330     float gpsIscL1ca;
1331     float gpsIscL2c;
1332     float gpsIscL5I5;
1333     float gpsIscL5Q5;
1334     float gpsTgd;
1335     float gloTgdG1G2;
1336     float bdsTgdB1;
1337     float bdsTgdB2;
1338     float bdsTgdB2a;
1339     float bdsIscB2a;
1340     float galBgdE1E5a;
1341     float galBgdE1E5b;
1342     float navicTgdL5;
1343 } GnssSvPolynomial;
1344 
1345 typedef uint32_t GnssSvId;
1346 
1347 struct GnssSvIdSource{
1348     uint32_t size;              // set to sizeof(GnssSvIdSource)
1349     GnssSvType constellation;   // constellation for the sv to blacklist
1350     GnssSvId svId;              // Unique SV Identifier,
1351                                 // For SV Range of supported constellation,
1352                                 // please refer to the comment section of svId in GnssSv.
1353 };
1354 inline bool operator ==(GnssSvIdSource const& left, GnssSvIdSource const& right) {
1355     return left.size == right.size &&
1356             left.constellation == right.constellation && left.svId == right.svId;
1357 }
1358 
1359 #define GNSS_SV_CONFIG_ALL_BITS_ENABLED_MASK ((uint64_t)0xFFFFFFFFFFFFFFFF)
1360 typedef struct {
1361     uint32_t size; // set to sizeof(GnssSvIdConfig)
1362 
1363     // GLONASS - SV 65 maps to bit 0
1364 #define GNSS_SV_CONFIG_GLO_INITIAL_SV_ID 65
1365     uint64_t gloBlacklistSvMask;
1366 
1367     // BEIDOU - SV 201 maps to bit 0
1368 #define GNSS_SV_CONFIG_BDS_INITIAL_SV_ID 201
1369     uint64_t bdsBlacklistSvMask;
1370 
1371     // QZSS - SV 193 maps to bit 0
1372 #define GNSS_SV_CONFIG_QZSS_INITIAL_SV_ID 193
1373     uint64_t qzssBlacklistSvMask;
1374 
1375     // GAL - SV 301 maps to bit 0
1376 #define GNSS_SV_CONFIG_GAL_INITIAL_SV_ID 301
1377     uint64_t galBlacklistSvMask;
1378 
1379     // SBAS - SV 120 to 158, maps to 0 to 38
1380     //        SV 183 to 191, maps to 39 to 47
1381 #define GNSS_SV_CONFIG_SBAS_INITIAL_SV_ID     120
1382 #define GNSS_SV_CONFIG_SBAS_INITIAL_SV_LENGTH 39
1383 #define GNSS_SV_CONFIG_SBAS_INITIAL2_SV_ID    183
1384     uint64_t sbasBlacklistSvMask;
1385 
1386     //Navic - SV 401 maps to bit 0
1387 #define GNSS_SV_CONFIG_NAVIC_INITIAL_SV_ID 401
1388     uint64_t navicBlacklistSvMask;
1389 } GnssSvIdConfig;
1390 
1391 struct GnssConfig{
1392     uint32_t size;  // set to sizeof(GnssConfig)
1393     GnssConfigFlagsMask flags; // bitwise OR of GnssConfigFlagsBits to mark which params are valid
1394     GnssConfigGpsLock gpsLock;
1395     GnssConfigSuplVersion suplVersion;
1396     GnssConfigSetAssistanceServer assistanceServer;
1397     GnssConfigLppProfile lppProfile;
1398     GnssConfigLppeControlPlaneMask lppeControlPlaneMask;
1399     GnssConfigLppeUserPlaneMask lppeUserPlaneMask;
1400     GnssConfigAGlonassPositionProtocolMask aGlonassPositionProtocolMask;
1401     GnssConfigEmergencyPdnForEmergencySupl emergencyPdnForEmergencySupl;
1402     GnssConfigSuplEmergencyServices suplEmergencyServices;
1403     GnssConfigSuplModeMask suplModeMask; //bitwise OR of GnssConfigSuplModeBits
1404     std::vector<GnssSvIdSource> blacklistedSvIds;
1405     uint32_t emergencyExtensionSeconds;
1406 
equalsGnssConfig1407     inline bool equals(const GnssConfig& config) {
1408         if (flags == config.flags &&
1409                 gpsLock == config.gpsLock &&
1410                 suplVersion == config.suplVersion &&
1411                 assistanceServer.equals(config.assistanceServer) &&
1412                 lppProfile == config.lppProfile &&
1413                 lppeControlPlaneMask == config.lppeControlPlaneMask &&
1414                 lppeUserPlaneMask == config.lppeUserPlaneMask &&
1415                 aGlonassPositionProtocolMask == config.aGlonassPositionProtocolMask &&
1416                 emergencyPdnForEmergencySupl == config.emergencyPdnForEmergencySupl &&
1417                 suplEmergencyServices == config.suplEmergencyServices &&
1418                 suplModeMask == config.suplModeMask  &&
1419                 blacklistedSvIds == config.blacklistedSvIds &&
1420                 emergencyExtensionSeconds == config.emergencyExtensionSeconds) {
1421             return true;
1422         }
1423         return false;
1424     }
1425 };
1426 
1427 typedef struct {
1428     uint32_t size;                        // set to sizeof
1429     bool                                mValid;
1430     Location                            mLocation;
1431     double                              verticalAccuracyMeters;
1432     double                              speedAccuracyMetersPerSecond;
1433     double                              bearingAccuracyDegrees;
1434     timespec                            mUtcReported;
1435 } GnssDebugLocation;
1436 
1437 typedef struct {
1438     uint32_t size;                        // set to sizeof
1439     bool                                mValid;
1440     int64_t                             timeEstimate;
1441     float                               timeUncertaintyNs;
1442     float                               frequencyUncertaintyNsPerSec;
1443 } GnssDebugTime;
1444 
1445 typedef struct {
1446     // set to sizeof
1447     uint32_t size;
1448     // Unique SV Identifier
1449     // For SV Range of supported constellation,
1450     // please refer to the comment section of svId in GnssSv.
1451     uint32_t                            svid;
1452     GnssSvType                          constellation;
1453     GnssEphemerisType                   mEphemerisType;
1454     GnssEphemerisSource                 mEphemerisSource;
1455     GnssEphemerisHealth                 mEphemerisHealth;
1456     float                               ephemerisAgeSeconds;
1457     bool                                serverPredictionIsAvailable;
1458     float                               serverPredictionAgeSeconds;
1459 } GnssDebugSatelliteInfo;
1460 
1461 typedef struct {
1462     uint32_t size;                        // set to sizeof
1463     GnssDebugLocation                   mLocation;
1464     GnssDebugTime                       mTime;
1465     std::vector<GnssDebugSatelliteInfo> mSatelliteInfo;
1466 } GnssDebugReport;
1467 
1468 typedef uint32_t LeapSecondSysInfoMask;
1469 typedef enum {
1470     // current leap second info is available. This info will only
1471     // be available if the leap second change info is not available.
1472     //
1473     // If leap second change info is avaiable, to figure out
1474     // the current leap second info, compare current gps time with
1475     // the gps timestamp of leap second change to know whether to choose
1476     // leapSecondBefore or leapSecondAfter as current leap second.
1477     LEAP_SECOND_SYS_INFO_CURRENT_LEAP_SECONDS_BIT = (1ULL << 0),
1478     // the last known leap change event is available.
1479     // The info can be available on two scenario:
1480     // 1: this leap second change event has been scheduled and yet to happen
1481     // 2: this leap second change event has already happened and next
1482     //    leap second change event has not yet been scheduled.
1483     LEAP_SECOND_SYS_INFO_LEAP_SECOND_CHANGE_BIT = (1ULL << 1),
1484 } LeapSecondSysInfoDataBits;
1485 
1486 struct LeapSecondChangeInfo {
1487     // GPS timestamp that corrresponds to the last known
1488     // leap second change event.
1489     //
1490     // The info can be available on two scenario:
1491     // 1: this leap second change event has been scheduled and yet to happen
1492     // 2: this leap second change event has already happened and next
1493     //    leap second change event has not yet been scheduled.
1494     GnssSystemTimeStructType gpsTimestampLsChange;
1495     // Number of leap seconds prior to the leap second change event
1496     // that corresponds to the timestamp at gpsTimestampLsChange.
1497     uint8_t leapSecondsBeforeChange;
1498     // Number of leap seconds after the leap second change event
1499     // that corresponds to the timestamp at gpsTimestampLsChange.
1500     uint8_t leapSecondsAfterChange;
1501 };
1502 
1503 struct LeapSecondSystemInfo {
1504     LeapSecondSysInfoMask leapSecondInfoMask;
1505     uint8_t               leapSecondCurrent;
1506     LeapSecondChangeInfo  leapSecondChangeInfo;
1507 };
1508 
1509 typedef uint32_t LocationSystemInfoMask;
1510 typedef enum {
1511     // contains current leap second or leap second change info
1512     LOCATION_SYS_INFO_LEAP_SECOND = (1ULL << 0),
1513 } LocationSystemInfoDataBits;
1514 
1515 struct LocationSystemInfo {
1516     LocationSystemInfoMask systemInfoMask;
1517     LeapSecondSystemInfo   leapSecondSysInfo;
1518 };
1519 
1520 /* Mask indicating enabled or disabled constellations */
1521 typedef uint64_t GnssSvTypesMask;
1522 typedef enum {
1523     GNSS_SV_TYPES_MASK_GLO_BIT  = (1<<0),
1524     GNSS_SV_TYPES_MASK_BDS_BIT  = (1<<1),
1525     GNSS_SV_TYPES_MASK_QZSS_BIT = (1<<2),
1526     GNSS_SV_TYPES_MASK_GAL_BIT  = (1<<3),
1527     GNSS_SV_TYPES_MASK_NAVIC_BIT  = (1<<4),
1528 } GnssSvTypesMaskBits;
1529 
1530 /* This SV Type config is injected directly to GNSS Adapter
1531  * bypassing Location API */
1532 typedef struct {
1533     uint32_t size; // set to sizeof(GnssSvTypeConfig)
1534     // Enabled Constellations
1535     GnssSvTypesMask enabledSvTypesMask;
1536     // Disabled Constellations
1537     GnssSvTypesMask blacklistedSvTypesMask;
1538 } GnssSvTypeConfig;
1539 
1540 // Specify parameters related to lever arm
1541 struct LeverArmParams {
1542     // Offset along the vehicle forward axis
1543     float forwardOffsetMeters;
1544     // Offset along the vehicle starboard axis
1545     float sidewaysOffsetMeters;
1546     // Offset along the vehicle up axis
1547     float upOffsetMeters;
1548 };
1549 
1550 typedef uint32_t LeverArmTypeMask;
1551 
1552 enum LeverArmTypeBits {
1553     // Lever arm regarding the VRP (Vehicle Reference Point) w.r.t
1554     // the origin (at the GPS Antenna)
1555     LEVER_ARM_TYPE_GNSS_TO_VRP_BIT = (1<<0),
1556     // Lever arm regarding GNSS Antenna w.r.t the origin at the IMU
1557     // e.g.: inertial measurement unit for DR (dead reckoning
1558     // engine)
1559     LEVER_ARM_TYPE_DR_IMU_TO_GNSS_BIT = (1<<1),
1560     // Lever arm regarding GNSS Antenna w.r.t the origin at the
1561     // IMU (inertial measurement unit) for VEPP (vision enhanced
1562     // precise positioning engine)
1563     LEVER_ARM_TYPE_VEPP_IMU_TO_GNSS_BIT = (1<<2)
1564 };
1565 
1566 struct LeverArmConfigInfo {
1567     // Valid mask for the types of lever arm parameters provided
1568     LeverArmTypeMask leverArmValidMask;
1569     // Lever arm regarding the VRP (Vehicle Reference Point) w.r.t the origin
1570     // (at the GPS Antenna)
1571     LeverArmParams   gnssToVRP;
1572     // Lever arm parameters regarding GNSS Antenna w.r.t the origin at the IMU
1573     // (inertial measurement unit) for DR (dead reckoning engine)
1574     LeverArmParams   drImuToGnss;
1575     // Lever arm regarding GNSS Antenna w.r.t the origin at the IMU
1576     // (inertial measurement unit) for VEPP (vision enhanced precise position engine)
1577     LeverArmParams   veppImuToGnss;
1578 };
1579 
1580 /* Provides the capabilities of the system
1581    capabilities callback is called once soon after createInstance is called */
1582 typedef std::function<void(
1583     LocationCapabilitiesMask capabilitiesMask // bitwise OR of LocationCapabilitiesBits
1584 )> capabilitiesCallback;
1585 
1586 /* Used by tracking, batching, and miscellanous APIs
1587    responseCallback is called for every Tracking, Batching API, and Miscellanous API */
1588 typedef std::function<void(
1589     LocationError err, // if not SUCCESS, then id is not valid
1590     uint32_t id        // id to be associated to the request
1591 )> responseCallback;
1592 
1593 /* Used by APIs that gets more than one LocationError in it's response
1594    collectiveResponseCallback is called for every geofence API call.
1595    ids array and LocationError array are only valid until collectiveResponseCallback returns. */
1596 typedef std::function<void(
1597     uint32_t count, // number of locations in arrays
1598     LocationError* errs, // array of LocationError associated to the request
1599     uint32_t* ids // array of ids to be associated to the request
1600 )> collectiveResponseCallback;
1601 
1602 /* Used for startTracking API, optional can be NULL
1603    trackingCallback is called when delivering a location in a tracking session
1604    broadcasted to all clients, no matter if a session has started by client */
1605 typedef std::function<void(
1606     Location location
1607 )> trackingCallback;
1608 
1609 /* Used for startBatching API, optional can be NULL
1610    batchingCallback is called when delivering locations in a batching session.
1611    broadcasted to all clients, no matter if a session has started by client */
1612 typedef std::function<void(
1613     uint32_t count,      // number of locations in array
1614     Location* location, // array of locations
1615     BatchingOptions batchingOptions // Batching options
1616 )> batchingCallback;
1617 
1618 typedef std::function<void(
1619     BatchingStatusInfo batchingStatus, // batch status
1620     std::list<uint32_t> & listOfCompletedTrips
1621 )> batchingStatusCallback;
1622 
1623 /* Gives GNSS Location information, optional can be NULL
1624     gnssLocationInfoCallback is called only during a tracking session
1625     broadcasted to all clients, no matter if a session has started by client */
1626 typedef std::function<void(
1627     GnssLocationInfoNotification gnssLocationInfoNotification
1628 )> gnssLocationInfoCallback;
1629 
1630 /* Gives default combined location information from all engines and
1631    location information individually from selected engines.
1632    This callback is only used when there are multiple engines
1633    running in the system.
1634 
1635    optional can be NULL
1636 
1637    engineLocationsInfoCallback is called only during a tracking session
1638    broadcasted to all clients, no matter if a session has started by client */
1639 typedef std::function<void(
1640     uint32_t count,
1641     GnssLocationInfoNotification* engineLocationInfoNotification
1642 )> engineLocationsInfoCallback;
1643 
1644 /* Used for addGeofences API, optional can be NULL
1645    geofenceBreachCallback is called when any number of geofences have a state change */
1646 typedef std::function<void(
1647     GeofenceBreachNotification geofenceBreachNotification
1648 )> geofenceBreachCallback;
1649 
1650 /* Used for addGeofences API, optional can be NULL
1651        geofenceStatusCallback is called when any number of geofences have a status change */
1652 typedef std::function<void(
1653     GeofenceStatusNotification geofenceStatusNotification
1654 )> geofenceStatusCallback;
1655 
1656 /* Network Initiated request, optional can be NULL
1657    This callback should be responded to by calling gnssNiResponse */
1658 typedef std::function<void(
1659     uint32_t id, // id that should be used to respond by calling gnssNiResponse
1660     GnssNiNotification gnssNiNotification
1661 )> gnssNiCallback;
1662 
1663 /* Gives GNSS SV information, optional can be NULL
1664     gnssSvCallback is called only during a tracking session
1665     broadcasted to all clients, no matter if a session has started by client */
1666 typedef std::function<void(
1667     GnssSvNotification gnssSvNotification
1668 )> gnssSvCallback;
1669 
1670 /* Gives GNSS NMEA data, optional can be NULL
1671     gnssNmeaCallback is called only during a tracking session
1672     broadcasted to all clients, no matter if a session has started by client */
1673 typedef std::function<void(
1674     GnssNmeaNotification gnssNmeaNotification
1675 )> gnssNmeaCallback;
1676 
1677 /* Gives GNSS data, optional can be NULL
1678     gnssDataCallback is called only during a tracking session
1679     broadcasted to all clients, no matter if a session has started by client */
1680 typedef std::function<void(
1681     GnssDataNotification gnssDataNotification
1682 )> gnssDataCallback;
1683 
1684 /* Gives GNSS Measurements information, optional can be NULL
1685     gnssMeasurementsCallback is called only during a tracking session
1686     broadcasted to all clients, no matter if a session has started by client */
1687 typedef std::function<void(
1688     GnssMeasurementsNotification gnssMeasurementsNotification
1689 )> gnssMeasurementsCallback;
1690 
1691 /* Gives GNSS SV poly information, optional can be NULL
1692     gnssSvPolyCallback is called only during a tracking session
1693     broadcasted to all clients that registers for the poly */
1694 typedef std::function<void(
1695     GnssSvPolynomial gnssSvPolynomialNotification
1696 )> gnssSvPolynomialCallback;
1697 
1698 
1699 /* Provides the current GNSS configuration to the client */
1700 typedef std::function<void(
1701     GnssConfig& config
1702 )> gnssConfigCallback;
1703 
1704 /* LocationSystemInfoCb is for receiving rare occuring location
1705    system information update. optional, can be NULL.
1706 */
1707 typedef std::function<void(
1708     LocationSystemInfo locationSystemInfo
1709 )> locationSystemInfoCallback;
1710 
1711 typedef std::function<void(
1712 )> locationApiDestroyCompleteCallback;
1713 
1714 typedef uint16_t LocationAdapterTypeMask;
1715 typedef enum {
1716     LOCATION_ADAPTER_GNSS_TYPE_BIT      = (1<<0), // adapter type is GNSS
1717     LOCATION_ADAPTER_BATCHING_TYPE_BIT  = (1<<1), // adapter type is BATCHING
1718     LOCATION_ADAPTER_GEOFENCE_TYPE_BIT  = (1<<2)  // adapter type is geo fence
1719 } LocationAdapterTypeBits;
1720 
1721 typedef struct {
1722     uint32_t size; // set to sizeof(LocationCallbacks)
1723     capabilitiesCallback capabilitiesCb;             // mandatory
1724     responseCallback responseCb;                     // mandatory
1725     collectiveResponseCallback collectiveResponseCb; // mandatory
1726     trackingCallback trackingCb;                     // optional
1727     batchingCallback batchingCb;                     // optional
1728     geofenceBreachCallback geofenceBreachCb;         // optional
1729     geofenceStatusCallback geofenceStatusCb;         // optional
1730     gnssLocationInfoCallback gnssLocationInfoCb;     // optional
1731     gnssNiCallback gnssNiCb;                         // optional
1732     gnssSvCallback gnssSvCb;                         // optional
1733     gnssNmeaCallback gnssNmeaCb;                     // optional
1734     gnssDataCallback gnssDataCb;                     // optional
1735     gnssMeasurementsCallback gnssMeasurementsCb;     // optional
1736     batchingStatusCallback batchingStatusCb;         // optional
1737     locationSystemInfoCallback locationSystemInfoCb; // optional
1738     engineLocationsInfoCallback engineLocationsInfoCb;     // optional
1739     gnssSvPolynomialCallback gnssSvPolynomialCb;       // optional
1740 } LocationCallbacks;
1741 
1742 typedef struct {
1743     uint32_t size;                        // set to sizeof
1744     double x;
1745     double xUncertainty;
1746     double y;
1747     double yUncertainty;
1748     double z;
1749     double zUncertainty;
1750 } GnssCoordinate;
1751 
1752 typedef struct {
1753     uint32_t size;                        // set to sizeof
1754     double carrierFrequencyMHz;
1755     GnssCoordinate phaseCenterOffsetCoordinateMillimeters;
1756     std::vector<std::vector<double>> phaseCenterVariationCorrectionMillimeters;
1757     std::vector<std::vector<double>> phaseCenterVariationCorrectionUncertaintyMillimeters;
1758     std::vector<std::vector<double>> signalGainCorrectionDbi;
1759     std::vector<std::vector<double>> signalGainCorrectionUncertaintyDbi;
1760 } GnssAntennaInformation;
1761 #endif /* LOCATIONDATATYPES_H */
1762