Katz Yamada | 0fc49e8 | 2018-02-28 11:22:58 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2018 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> |
Harikrishnan Hariharan | 59269e1 | 2018-07-01 00:43:09 +0530 | [diff] [blame^] | 36 | #include <string.h> |
Katz Yamada | 0fc49e8 | 2018-02-28 11:22:58 -0800 | [diff] [blame] | 37 | |
| 38 | #define GNSS_NI_REQUESTOR_MAX (256) |
| 39 | #define GNSS_NI_MESSAGE_ID_MAX (2048) |
| 40 | #define GNSS_SV_MAX (64) |
| 41 | #define GNSS_MEASUREMENTS_MAX (64) |
| 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 | |
| 51 | typedef enum { |
| 52 | LOCATION_ERROR_SUCCESS = 0, |
| 53 | LOCATION_ERROR_GENERAL_FAILURE, |
| 54 | LOCATION_ERROR_CALLBACK_MISSING, |
| 55 | LOCATION_ERROR_INVALID_PARAMETER, |
| 56 | LOCATION_ERROR_ID_EXISTS, |
| 57 | LOCATION_ERROR_ID_UNKNOWN, |
| 58 | LOCATION_ERROR_ALREADY_STARTED, |
| 59 | LOCATION_ERROR_GEOFENCES_AT_MAX, |
| 60 | LOCATION_ERROR_NOT_SUPPORTED |
| 61 | } LocationError; |
| 62 | |
| 63 | // Flags to indicate which values are valid in a Location |
| 64 | typedef uint16_t LocationFlagsMask; |
| 65 | typedef enum { |
| 66 | LOCATION_HAS_LAT_LONG_BIT = (1<<0), // location has valid latitude and longitude |
| 67 | LOCATION_HAS_ALTITUDE_BIT = (1<<1), // location has valid altitude |
| 68 | LOCATION_HAS_SPEED_BIT = (1<<2), // location has valid speed |
| 69 | LOCATION_HAS_BEARING_BIT = (1<<3), // location has valid bearing |
| 70 | LOCATION_HAS_ACCURACY_BIT = (1<<4), // location has valid accuracy |
| 71 | LOCATION_HAS_VERTICAL_ACCURACY_BIT = (1<<5), // location has valid vertical accuracy |
| 72 | LOCATION_HAS_SPEED_ACCURACY_BIT = (1<<6), // location has valid speed accuracy |
| 73 | LOCATION_HAS_BEARING_ACCURACY_BIT = (1<<7), // location has valid bearing accuracy |
haohuang | 17015dd | 2018-04-16 15:12:49 +0800 | [diff] [blame] | 74 | LOCATION_HAS_SPOOF_MASK = (1<<8), // location has valid spoof mask |
Katz Yamada | 0fc49e8 | 2018-02-28 11:22:58 -0800 | [diff] [blame] | 75 | } LocationFlagsBits; |
| 76 | |
| 77 | typedef uint16_t LocationTechnologyMask; |
| 78 | typedef enum { |
| 79 | LOCATION_TECHNOLOGY_GNSS_BIT = (1<<0), // location was calculated using GNSS |
| 80 | LOCATION_TECHNOLOGY_CELL_BIT = (1<<1), // location was calculated using Cell |
| 81 | LOCATION_TECHNOLOGY_WIFI_BIT = (1<<2), // location was calculated using WiFi |
| 82 | LOCATION_TECHNOLOGY_SENSORS_BIT = (1<<3), // location was calculated using Sensors |
| 83 | } LocationTechnologyBits; |
| 84 | |
haohuang | 17015dd | 2018-04-16 15:12:49 +0800 | [diff] [blame] | 85 | typedef uint32_t LocationSpoofMask; |
| 86 | typedef enum { |
| 87 | LOCATION_POSTION_SPOOFED = (1<<0), // location position spoofed |
| 88 | LOCATION_TIME_SPOOFED = (1<<1), // location time spoofed |
| 89 | LOCATION_NAVIGATION_DATA_SPOOFED = (1<<2), // location navigation data spoofed |
| 90 | } LocationSpoofBits; |
| 91 | |
Katz Yamada | 0fc49e8 | 2018-02-28 11:22:58 -0800 | [diff] [blame] | 92 | typedef enum { |
| 93 | LOCATION_RELIABILITY_NOT_SET = 0, |
| 94 | LOCATION_RELIABILITY_VERY_LOW, |
| 95 | LOCATION_RELIABILITY_LOW, |
| 96 | LOCATION_RELIABILITY_MEDIUM, |
| 97 | LOCATION_RELIABILITY_HIGH, |
| 98 | } LocationReliability; |
| 99 | |
| 100 | typedef uint32_t GnssLocationNavSolutionMask; |
| 101 | typedef enum { |
| 102 | LOCATION_SBAS_CORRECTION_IONO_BIT = (1<<0), // SBAS ionospheric correction is used |
| 103 | LOCATION_SBAS_CORRECTION_FAST_BIT = (1<<1), // SBAS fast correction is used |
| 104 | LOCATION_SBAS_CORRECTION_LONG_BIT = (1<<2), // SBAS long-tem correction is used |
| 105 | LOCATION_SBAS_INTEGRITY_BIT = (1<<3), // SBAS integrity information is used |
| 106 | LOCATION_NAV_CORRECTION_DGNSS_BIT = (1<<4), // Position Report is DGNSS corrected |
| 107 | LOCATION_NAV_CORRECTION_RTK_BIT = (1<<5), // Position Report is RTK corrected |
| 108 | LOCATION_NAV_CORRECTION_PPP_BIT = (1<<6) // Position Report is PPP corrected |
| 109 | } GnssLocationNavSolutionBits; |
| 110 | |
| 111 | typedef uint32_t GnssLocationPosTechMask; |
| 112 | typedef enum { |
| 113 | LOCATION_POS_TECH_DEFAULT_BIT = 0, |
| 114 | LOCATION_POS_TECH_SATELLITE_BIT = (1<<0), |
| 115 | LOCATION_POS_TECH_CELLID_BIT = (1<<1), |
| 116 | LOCATION_POS_TECH_WIFI_BIT = (1<<2), |
| 117 | LOCATION_POS_TECH_SENSORS_BIT = (1<<3), |
| 118 | LOCATION_POS_TECH_REFERENCE_LOCATION_BIT = (1<<4), |
| 119 | LOCATION_POS_TECH_INJECTED_COARSE_POSITION_BIT = (1<<5), |
| 120 | LOCATION_POS_TECH_AFLT_BIT = (1<<6), |
| 121 | LOCATION_POS_TECH_HYBRID_BIT = (1<<7), |
| 122 | LOCATION_POS_TECH_PPE_BIT = (1<<8) |
| 123 | } GnssLocationPosTechBits; |
| 124 | |
| 125 | typedef uint32_t GnssLocationPosDataMask; |
| 126 | typedef enum { |
| 127 | LOCATION_NAV_DATA_HAS_LONG_ACCEL_BIT = (1<<0), // Navigation data has Forward Acceleration |
| 128 | LOCATION_NAV_DATA_HAS_LAT_ACCEL_BIT = (1<<1), // Navigation data has Sideward Acceleration |
| 129 | LOCATION_NAV_DATA_HAS_VERT_ACCEL_BIT = (1<<2), // Navigation data has Vertical Acceleration |
| 130 | LOCATION_NAV_DATA_HAS_YAW_RATE_BIT = (1<<3), // Navigation data has Heading Rate |
| 131 | LOCATION_NAV_DATA_HAS_PITCH_BIT = (1<<4) // Navigation data has Body pitch |
| 132 | } GnssLocationPosDataBits; |
| 133 | |
| 134 | typedef uint32_t GnssLocationInfoFlagMask; |
| 135 | typedef enum { |
| 136 | GNSS_LOCATION_INFO_ALTITUDE_MEAN_SEA_LEVEL_BIT = (1<<0), // valid altitude mean sea level |
| 137 | GNSS_LOCATION_INFO_DOP_BIT = (1<<1), // valid pdop, hdop, and vdop |
| 138 | GNSS_LOCATION_INFO_MAGNETIC_DEVIATION_BIT = (1<<2), // valid magnetic deviation |
| 139 | GNSS_LOCATION_INFO_HOR_RELIABILITY_BIT = (1<<3), // valid horizontal reliability |
| 140 | GNSS_LOCATION_INFO_VER_RELIABILITY_BIT = (1<<4), // valid vertical reliability |
| 141 | GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MAJOR_BIT = (1<<5), // valid elipsode semi major |
| 142 | GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_SEMI_MINOR_BIT = (1<<6), // valid elipsode semi minor |
| 143 | GNSS_LOCATION_INFO_HOR_ACCURACY_ELIP_AZIMUTH_BIT = (1<<7), // valid accuracy elipsode azimuth |
| 144 | GNSS_LOCATION_INFO_GNSS_SV_USED_DATA_BIT = (1<<8), // valid gnss sv used in pos data |
| 145 | GNSS_LOCATION_INFO_NAV_SOLUTION_MASK_BIT = (1<<9), // valid navSolutionMask |
| 146 | GNSS_LOCATION_INFO_POS_TECH_MASK_BIT = (1<<10),// valid LocPosTechMask |
| 147 | GNSS_LOCATION_INFO_SV_SOURCE_INFO_BIT = (1<<11),// valid LocSvInfoSource |
| 148 | GNSS_LOCATION_INFO_POS_DYNAMICS_DATA_BIT = (1<<12),// valid position dynamics data |
Bhavna Sharma | ee8213f | 2018-05-25 14:34:08 -0700 | [diff] [blame] | 149 | GNSS_LOCATION_INFO_EXT_DOP_BIT = (1<<13),// valid gdop, tdop |
| 150 | GNSS_LOCATION_INFO_NORTH_STD_DEV_BIT = (1<<14),// valid North standard deviation |
| 151 | GNSS_LOCATION_INFO_EAST_STD_DEV_BIT = (1<<15),// valid East standard deviation |
| 152 | GNSS_LOCATION_INFO_NORTH_VEL_BIT = (1<<16),// valid North Velocity |
| 153 | GNSS_LOCATION_INFO_EAST_VEL_BIT = (1<<17),// valid East Velocity |
| 154 | GNSS_LOCATION_INFO_UP_VEL_BIT = (1<<18),// valid Up Velocity |
| 155 | GNSS_LOCATION_INFO_NORTH_VEL_UNC_BIT = (1<<19),// valid North Velocity Uncertainty |
| 156 | GNSS_LOCATION_INFO_EAST_VEL_UNC_BIT = (1<<20),// valid East Velocity Uncertainty |
| 157 | GNSS_LOCATION_INFO_UP_VEL_UNC_BIT = (1<<21),// valid Up Velocity Uncertainty |
| 158 | GNSS_LOCATION_INFO_LEAP_SECONDS_BIT = (1<<22),// valid leap seconds |
| 159 | GNSS_LOCATION_INFO_TIME_UNC_BIT = (1<<23) // valid time uncertainty |
Katz Yamada | 0fc49e8 | 2018-02-28 11:22:58 -0800 | [diff] [blame] | 160 | } GnssLocationInfoFlagBits; |
| 161 | |
| 162 | typedef enum { |
| 163 | GEOFENCE_BREACH_ENTER = 0, |
| 164 | GEOFENCE_BREACH_EXIT, |
| 165 | GEOFENCE_BREACH_DWELL_IN, |
| 166 | GEOFENCE_BREACH_DWELL_OUT, |
| 167 | GEOFENCE_BREACH_UNKNOWN, |
| 168 | } GeofenceBreachType; |
| 169 | |
| 170 | typedef uint16_t GeofenceBreachTypeMask; |
| 171 | typedef enum { |
| 172 | GEOFENCE_BREACH_ENTER_BIT = (1<<0), |
| 173 | GEOFENCE_BREACH_EXIT_BIT = (1<<1), |
| 174 | GEOFENCE_BREACH_DWELL_IN_BIT = (1<<2), |
| 175 | GEOFENCE_BREACH_DWELL_OUT_BIT = (1<<3), |
| 176 | } GeofenceBreachTypeBits; |
| 177 | |
| 178 | typedef enum { |
| 179 | GEOFENCE_STATUS_AVAILABILE_NO = 0, |
| 180 | GEOFENCE_STATUS_AVAILABILE_YES, |
| 181 | } GeofenceStatusAvailable; |
| 182 | |
| 183 | typedef uint32_t LocationCapabilitiesMask; |
| 184 | typedef enum { |
| 185 | // supports startTracking API with minInterval param |
| 186 | LOCATION_CAPABILITIES_TIME_BASED_TRACKING_BIT = (1<<0), |
| 187 | // supports startBatching API with minInterval param |
| 188 | LOCATION_CAPABILITIES_TIME_BASED_BATCHING_BIT = (1<<1), |
| 189 | // supports startTracking API with minDistance param |
| 190 | LOCATION_CAPABILITIES_DISTANCE_BASED_TRACKING_BIT = (1<<2), |
| 191 | // supports startBatching API with minDistance param |
| 192 | LOCATION_CAPABILITIES_DISTANCE_BASED_BATCHING_BIT = (1<<3), |
| 193 | // supports addGeofences API |
| 194 | LOCATION_CAPABILITIES_GEOFENCE_BIT = (1<<4), |
| 195 | // supports GnssMeasurementsCallback |
| 196 | LOCATION_CAPABILITIES_GNSS_MEASUREMENTS_BIT = (1<<5), |
| 197 | // supports startTracking/startBatching API with LocationOptions.mode of MSB (Ms Based) |
| 198 | LOCATION_CAPABILITIES_GNSS_MSB_BIT = (1<<6), |
| 199 | // supports startTracking/startBatching API with LocationOptions.mode of MSA (MS Assisted) |
| 200 | LOCATION_CAPABILITIES_GNSS_MSA_BIT = (1<<7), |
| 201 | // supports debug nmea sentences in the debugNmeaCallback |
| 202 | LOCATION_CAPABILITIES_DEBUG_NMEA_BIT = (1<<8), |
| 203 | // support outdoor trip batching |
Dante Russo | 271cfd8 | 2018-06-04 16:55:56 -0700 | [diff] [blame] | 204 | LOCATION_CAPABILITIES_OUTDOOR_TRIP_BATCHING_BIT = (1<<9), |
| 205 | // support constellation enablement |
| 206 | LOCATION_CAPABILITIES_CONSTELLATION_ENABLEMENT_BIT = (1<<10), |
| 207 | // support agpm |
| 208 | LOCATION_CAPABILITIES_AGPM_BIT = (1<<11), |
Katz Yamada | 0fc49e8 | 2018-02-28 11:22:58 -0800 | [diff] [blame] | 209 | } LocationCapabilitiesBits; |
| 210 | |
| 211 | typedef enum { |
| 212 | LOCATION_TECHNOLOGY_TYPE_GNSS = 0, |
| 213 | } LocationTechnologyType; |
| 214 | |
| 215 | // Configures how GPS is locked when GPS is disabled (through GnssDisable) |
| 216 | typedef enum { |
| 217 | GNSS_CONFIG_GPS_LOCK_NONE = 0, // gps is not locked when GPS is disabled (GnssDisable) |
| 218 | GNSS_CONFIG_GPS_LOCK_MO, // gps mobile originated (MO) is locked when GPS is disabled |
| 219 | GNSS_CONFIG_GPS_LOCK_NI, // gps network initiated (NI) is locked when GPS is disabled |
| 220 | GNSS_CONFIG_GPS_LOCK_MO_AND_NI,// gps MO and NI is locked when GPS is disabled |
| 221 | } GnssConfigGpsLock; |
| 222 | |
| 223 | // SUPL version |
| 224 | typedef enum { |
| 225 | GNSS_CONFIG_SUPL_VERSION_1_0_0 = 1, |
| 226 | GNSS_CONFIG_SUPL_VERSION_2_0_0, |
| 227 | GNSS_CONFIG_SUPL_VERSION_2_0_2, |
| 228 | } GnssConfigSuplVersion; |
| 229 | |
| 230 | // LTE Positioning Profile |
| 231 | typedef enum { |
| 232 | GNSS_CONFIG_LPP_PROFILE_RRLP_ON_LTE = 0, // RRLP on LTE (Default) |
| 233 | GNSS_CONFIG_LPP_PROFILE_USER_PLANE, // LPP User Plane (UP) on LTE |
| 234 | GNSS_CONFIG_LPP_PROFILE_CONTROL_PLANE, // LPP_Control_Plane (CP) |
| 235 | GNSS_CONFIG_LPP_PROFILE_USER_PLANE_AND_CONTROL_PLANE, // Both LPP UP and CP |
| 236 | } GnssConfigLppProfile; |
| 237 | |
| 238 | // Technology for LPPe Control Plane |
| 239 | typedef uint16_t GnssConfigLppeControlPlaneMask; |
| 240 | typedef enum { |
| 241 | GNSS_CONFIG_LPPE_CONTROL_PLANE_DBH_BIT = (1<<0), // DBH |
| 242 | GNSS_CONFIG_LPPE_CONTROL_PLANE_WLAN_AP_MEASUREMENTS_BIT = (1<<1), // WLAN_AP_MEASUREMENTS |
| 243 | GNSS_CONFIG_LPPE_CONTROL_PLANE_SRN_AP_MEASUREMENTS_BIT = (1<<2), // SRN_AP_MEASUREMENTS |
| 244 | GNSS_CONFIG_LPPE_CONTROL_PLANE_SENSOR_BARO_MEASUREMENTS_BIT = (1<<3), |
| 245 | // SENSOR_BARO_MEASUREMENTS |
| 246 | } GnssConfigLppeControlPlaneBits; |
| 247 | |
| 248 | // Technology for LPPe User Plane |
| 249 | typedef uint16_t GnssConfigLppeUserPlaneMask; |
| 250 | typedef enum { |
| 251 | GNSS_CONFIG_LPPE_USER_PLANE_DBH_BIT = (1<<0), // DBH |
| 252 | GNSS_CONFIG_LPPE_USER_PLANE_WLAN_AP_MEASUREMENTS_BIT = (1<<1), // WLAN_AP_MEASUREMENTS |
| 253 | GNSS_CONFIG_LPPE_USER_PLANE_SRN_AP_MEASUREMENTS_BIT = (1<<2), // SRN_AP_MEASUREMENTS |
| 254 | GNSS_CONFIG_LPPE_USER_PLANE_SENSOR_BARO_MEASUREMENTS_BIT = (1<<3), |
| 255 | // SENSOR_BARO_MEASUREMENTS |
| 256 | } GnssConfigLppeUserPlaneBits; |
| 257 | |
| 258 | // Positioning Protocol on A-GLONASS system |
| 259 | typedef uint16_t GnssConfigAGlonassPositionProtocolMask; |
| 260 | typedef enum { |
| 261 | GNSS_CONFIG_RRC_CONTROL_PLANE_BIT = (1<<0), // RRC Control Plane |
| 262 | GNSS_CONFIG_RRLP_USER_PLANE_BIT = (1<<1), // RRLP User Plane |
| 263 | GNSS_CONFIG_LLP_USER_PLANE_BIT = (1<<2), // LPP User Plane |
| 264 | GNSS_CONFIG_LLP_CONTROL_PLANE_BIT = (1<<3), // LPP Control Plane |
| 265 | } GnssConfigAGlonassPositionProtocolBits; |
| 266 | |
| 267 | typedef enum { |
| 268 | GNSS_CONFIG_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_NO = 0, |
| 269 | GNSS_CONFIG_EMERGENCY_PDN_FOR_EMERGENCY_SUPL_YES, |
| 270 | } GnssConfigEmergencyPdnForEmergencySupl; |
| 271 | |
| 272 | typedef enum { |
| 273 | GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_NO = 0, |
| 274 | GNSS_CONFIG_SUPL_EMERGENCY_SERVICES_YES, |
| 275 | } GnssConfigSuplEmergencyServices; |
| 276 | |
| 277 | typedef uint16_t GnssConfigSuplModeMask; |
| 278 | typedef enum { |
| 279 | GNSS_CONFIG_SUPL_MODE_MSB_BIT = (1<<0), |
| 280 | GNSS_CONFIG_SUPL_MODE_MSA_BIT = (1<<1), |
| 281 | } GnssConfigSuplModeBits; |
| 282 | |
| 283 | typedef uint32_t GnssConfigFlagsMask; |
| 284 | typedef enum { |
| 285 | GNSS_CONFIG_FLAGS_GPS_LOCK_VALID_BIT = (1<<0), |
| 286 | GNSS_CONFIG_FLAGS_SUPL_VERSION_VALID_BIT = (1<<1), |
| 287 | GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT = (1<<2), |
| 288 | GNSS_CONFIG_FLAGS_LPP_PROFILE_VALID_BIT = (1<<3), |
| 289 | GNSS_CONFIG_FLAGS_LPPE_CONTROL_PLANE_VALID_BIT = (1<<4), |
| 290 | GNSS_CONFIG_FLAGS_LPPE_USER_PLANE_VALID_BIT = (1<<5), |
| 291 | GNSS_CONFIG_FLAGS_AGLONASS_POSITION_PROTOCOL_VALID_BIT = (1<<6), |
| 292 | GNSS_CONFIG_FLAGS_EM_PDN_FOR_EM_SUPL_VALID_BIT = (1<<7), |
| 293 | GNSS_CONFIG_FLAGS_SUPL_EM_SERVICES_BIT = (1<<8), |
| 294 | GNSS_CONFIG_FLAGS_SUPL_MODE_BIT = (1<<9), |
Saurabh Srivastava | eaf7e54 | 2018-05-20 19:29:46 +0530 | [diff] [blame] | 295 | GNSS_CONFIG_FLAGS_BLACKLISTED_SV_IDS_BIT = (1<<10), |
Katz Yamada | 0fc49e8 | 2018-02-28 11:22:58 -0800 | [diff] [blame] | 296 | } GnssConfigFlagsBits; |
| 297 | |
| 298 | typedef enum { |
| 299 | GNSS_NI_ENCODING_TYPE_NONE = 0, |
| 300 | GNSS_NI_ENCODING_TYPE_GSM_DEFAULT, |
| 301 | GNSS_NI_ENCODING_TYPE_UTF8, |
| 302 | GNSS_NI_ENCODING_TYPE_UCS2, |
| 303 | } GnssNiEncodingType; |
| 304 | |
| 305 | typedef enum { |
| 306 | GNSS_NI_TYPE_VOICE = 0, |
| 307 | GNSS_NI_TYPE_SUPL, |
| 308 | GNSS_NI_TYPE_CONTROL_PLANE, |
| 309 | GNSS_NI_TYPE_EMERGENCY_SUPL |
| 310 | } GnssNiType; |
| 311 | |
| 312 | typedef uint16_t GnssNiOptionsMask; |
| 313 | typedef enum { |
| 314 | GNSS_NI_OPTIONS_NOTIFICATION_BIT = (1<<0), |
| 315 | GNSS_NI_OPTIONS_VERIFICATION_BIT = (1<<1), |
| 316 | GNSS_NI_OPTIONS_PRIVACY_OVERRIDE_BIT = (1<<2), |
| 317 | } GnssNiOptionsBits; |
| 318 | |
| 319 | typedef enum { |
| 320 | GNSS_NI_RESPONSE_ACCEPT = 1, |
| 321 | GNSS_NI_RESPONSE_DENY, |
| 322 | GNSS_NI_RESPONSE_NO_RESPONSE, |
| 323 | GNSS_NI_RESPONSE_IGNORE, |
| 324 | } GnssNiResponse; |
| 325 | |
| 326 | typedef enum { |
| 327 | GNSS_SV_TYPE_UNKNOWN = 0, |
| 328 | GNSS_SV_TYPE_GPS, |
| 329 | GNSS_SV_TYPE_SBAS, |
| 330 | GNSS_SV_TYPE_GLONASS, |
| 331 | GNSS_SV_TYPE_QZSS, |
| 332 | GNSS_SV_TYPE_BEIDOU, |
| 333 | GNSS_SV_TYPE_GALILEO, |
| 334 | } GnssSvType; |
| 335 | |
| 336 | typedef enum { |
| 337 | GNSS_EPH_TYPE_UNKNOWN = 0, |
| 338 | GNSS_EPH_TYPE_EPHEMERIS, |
| 339 | GNSS_EPH_TYPE_ALMANAC, |
| 340 | } GnssEphemerisType; |
| 341 | |
| 342 | typedef enum { |
| 343 | GNSS_EPH_SOURCE_UNKNOWN = 0, |
| 344 | GNSS_EPH_SOURCE_DEMODULATED, |
| 345 | GNSS_EPH_SOURCE_SUPL_PROVIDED, |
| 346 | GNSS_EPH_SOURCE_OTHER_SERVER_PROVIDED, |
| 347 | GNSS_EPH_SOURCE_LOCAL, |
| 348 | } GnssEphemerisSource; |
| 349 | |
| 350 | typedef enum { |
| 351 | GNSS_EPH_HEALTH_UNKNOWN = 0, |
| 352 | GNSS_EPH_HEALTH_GOOD, |
| 353 | GNSS_EPH_HEALTH_BAD, |
| 354 | } GnssEphemerisHealth; |
| 355 | |
| 356 | typedef uint16_t GnssSvOptionsMask; |
| 357 | typedef enum { |
Mike Cailean | 7dfa87b | 2018-02-06 16:36:27 -0800 | [diff] [blame] | 358 | GNSS_SV_OPTIONS_HAS_EPHEMER_BIT = (1<<0), |
| 359 | GNSS_SV_OPTIONS_HAS_ALMANAC_BIT = (1<<1), |
| 360 | GNSS_SV_OPTIONS_USED_IN_FIX_BIT = (1<<2), |
| 361 | GNSS_SV_OPTIONS_HAS_CARRIER_FREQUENCY_BIT = (1<<3), |
Katz Yamada | 0fc49e8 | 2018-02-28 11:22:58 -0800 | [diff] [blame] | 362 | } GnssSvOptionsBits; |
| 363 | |
| 364 | typedef enum { |
| 365 | GNSS_ASSISTANCE_TYPE_SUPL = 0, |
| 366 | GNSS_ASSISTANCE_TYPE_C2K, |
| 367 | } GnssAssistanceType; |
| 368 | |
| 369 | typedef enum { |
| 370 | GNSS_SUPL_MODE_STANDALONE = 0, |
| 371 | GNSS_SUPL_MODE_MSB, |
| 372 | GNSS_SUPL_MODE_MSA, |
| 373 | } GnssSuplMode; |
| 374 | |
| 375 | typedef enum { |
| 376 | BATCHING_MODE_ROUTINE = 0, // positions are reported when batched positions memory is full |
| 377 | BATCHING_MODE_TRIP, // positions are reported when a certain distance is covered |
| 378 | BATCHING_MODE_NO_AUTO_REPORT // no report of positions automatically, instead queried on demand |
| 379 | } BatchingMode; |
| 380 | |
| 381 | typedef enum { |
| 382 | BATCHING_STATUS_TRIP_COMPLETED = 0, |
| 383 | BATCHING_STATUS_POSITION_AVAILABE, |
| 384 | BATCHING_STATUS_POSITION_UNAVAILABLE |
| 385 | } BatchingStatus; |
| 386 | |
| 387 | typedef uint16_t GnssMeasurementsAdrStateMask; |
| 388 | typedef enum { |
| 389 | GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_UNKNOWN = 0, |
| 390 | GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_VALID_BIT = (1<<0), |
| 391 | GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_RESET_BIT = (1<<1), |
| 392 | GNSS_MEASUREMENTS_ACCUMULATED_DELTA_RANGE_STATE_CYCLE_SLIP_BIT = (1<<2), |
| 393 | } GnssMeasurementsAdrStateBits; |
| 394 | |
| 395 | typedef uint32_t GnssMeasurementsDataFlagsMask; |
| 396 | typedef enum { |
| 397 | GNSS_MEASUREMENTS_DATA_SV_ID_BIT = (1<<0), |
| 398 | GNSS_MEASUREMENTS_DATA_SV_TYPE_BIT = (1<<1), |
| 399 | GNSS_MEASUREMENTS_DATA_STATE_BIT = (1<<2), |
| 400 | GNSS_MEASUREMENTS_DATA_RECEIVED_SV_TIME_BIT = (1<<3), |
| 401 | GNSS_MEASUREMENTS_DATA_RECEIVED_SV_TIME_UNCERTAINTY_BIT = (1<<4), |
| 402 | GNSS_MEASUREMENTS_DATA_CARRIER_TO_NOISE_BIT = (1<<5), |
| 403 | GNSS_MEASUREMENTS_DATA_PSEUDORANGE_RATE_BIT = (1<<6), |
| 404 | GNSS_MEASUREMENTS_DATA_PSEUDORANGE_RATE_UNCERTAINTY_BIT = (1<<7), |
| 405 | GNSS_MEASUREMENTS_DATA_ADR_STATE_BIT = (1<<8), |
| 406 | GNSS_MEASUREMENTS_DATA_ADR_BIT = (1<<9), |
| 407 | GNSS_MEASUREMENTS_DATA_ADR_UNCERTAINTY_BIT = (1<<10), |
| 408 | GNSS_MEASUREMENTS_DATA_CARRIER_FREQUENCY_BIT = (1<<11), |
| 409 | GNSS_MEASUREMENTS_DATA_CARRIER_CYCLES_BIT = (1<<12), |
| 410 | GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_BIT = (1<<13), |
| 411 | GNSS_MEASUREMENTS_DATA_CARRIER_PHASE_UNCERTAINTY_BIT = (1<<14), |
| 412 | GNSS_MEASUREMENTS_DATA_MULTIPATH_INDICATOR_BIT = (1<<15), |
| 413 | GNSS_MEASUREMENTS_DATA_SIGNAL_TO_NOISE_RATIO_BIT = (1<<16), |
| 414 | GNSS_MEASUREMENTS_DATA_AUTOMATIC_GAIN_CONTROL_BIT = (1<<17), |
| 415 | } GnssMeasurementsDataFlagsBits; |
| 416 | |
| 417 | typedef uint32_t GnssMeasurementsStateMask; |
| 418 | typedef enum { |
| 419 | GNSS_MEASUREMENTS_STATE_UNKNOWN_BIT = 0, |
| 420 | GNSS_MEASUREMENTS_STATE_CODE_LOCK_BIT = (1<<0), |
| 421 | GNSS_MEASUREMENTS_STATE_BIT_SYNC_BIT = (1<<1), |
| 422 | GNSS_MEASUREMENTS_STATE_SUBFRAME_SYNC_BIT = (1<<2), |
| 423 | GNSS_MEASUREMENTS_STATE_TOW_DECODED_BIT = (1<<3), |
| 424 | GNSS_MEASUREMENTS_STATE_MSEC_AMBIGUOUS_BIT = (1<<4), |
| 425 | GNSS_MEASUREMENTS_STATE_SYMBOL_SYNC_BIT = (1<<5), |
| 426 | GNSS_MEASUREMENTS_STATE_GLO_STRING_SYNC_BIT = (1<<6), |
| 427 | GNSS_MEASUREMENTS_STATE_GLO_TOD_DECODED_BIT = (1<<7), |
| 428 | GNSS_MEASUREMENTS_STATE_BDS_D2_BIT_SYNC_BIT = (1<<8), |
| 429 | GNSS_MEASUREMENTS_STATE_BDS_D2_SUBFRAME_SYNC_BIT = (1<<9), |
| 430 | GNSS_MEASUREMENTS_STATE_GAL_E1BC_CODE_LOCK_BIT = (1<<10), |
| 431 | GNSS_MEASUREMENTS_STATE_GAL_E1C_2ND_CODE_LOCK_BIT = (1<<11), |
| 432 | GNSS_MEASUREMENTS_STATE_GAL_E1B_PAGE_SYNC_BIT = (1<<12), |
| 433 | GNSS_MEASUREMENTS_STATE_SBAS_SYNC_BIT = (1<<13), |
| 434 | } GnssMeasurementsStateBits; |
| 435 | |
| 436 | typedef enum { |
| 437 | GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_UNKNOWN = 0, |
| 438 | GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_PRESENT, |
| 439 | GNSS_MEASUREMENTS_MULTIPATH_INDICATOR_NOT_PRESENT, |
| 440 | } GnssMeasurementsMultipathIndicator; |
| 441 | |
| 442 | typedef uint32_t GnssMeasurementsClockFlagsMask; |
| 443 | typedef enum { |
| 444 | GNSS_MEASUREMENTS_CLOCK_FLAGS_LEAP_SECOND_BIT = (1<<0), |
| 445 | GNSS_MEASUREMENTS_CLOCK_FLAGS_TIME_BIT = (1<<1), |
| 446 | GNSS_MEASUREMENTS_CLOCK_FLAGS_TIME_UNCERTAINTY_BIT = (1<<2), |
| 447 | GNSS_MEASUREMENTS_CLOCK_FLAGS_FULL_BIAS_BIT = (1<<3), |
| 448 | GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_BIT = (1<<4), |
| 449 | GNSS_MEASUREMENTS_CLOCK_FLAGS_BIAS_UNCERTAINTY_BIT = (1<<5), |
| 450 | GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_BIT = (1<<6), |
| 451 | GNSS_MEASUREMENTS_CLOCK_FLAGS_DRIFT_UNCERTAINTY_BIT = (1<<7), |
| 452 | GNSS_MEASUREMENTS_CLOCK_FLAGS_HW_CLOCK_DISCONTINUITY_COUNT_BIT = (1<<8), |
| 453 | } GnssMeasurementsClockFlagsBits; |
| 454 | |
| 455 | typedef uint32_t GnssAidingDataSvMask; |
| 456 | typedef enum { |
| 457 | GNSS_AIDING_DATA_SV_EPHEMERIS_BIT = (1<<0), // ephemeris |
| 458 | GNSS_AIDING_DATA_SV_ALMANAC_BIT = (1<<1), // almanac |
| 459 | GNSS_AIDING_DATA_SV_HEALTH_BIT = (1<<2), // health |
| 460 | GNSS_AIDING_DATA_SV_DIRECTION_BIT = (1<<3), // direction |
| 461 | GNSS_AIDING_DATA_SV_STEER_BIT = (1<<4), // steer |
| 462 | GNSS_AIDING_DATA_SV_ALMANAC_CORR_BIT = (1<<5), // almanac correction |
| 463 | GNSS_AIDING_DATA_SV_BLACKLIST_BIT = (1<<6), // blacklist SVs |
| 464 | GNSS_AIDING_DATA_SV_SA_DATA_BIT = (1<<7), // sensitivity assistance data |
| 465 | GNSS_AIDING_DATA_SV_NO_EXIST_BIT = (1<<8), // SV does not exist |
| 466 | GNSS_AIDING_DATA_SV_IONOSPHERE_BIT = (1<<9), // ionosphere correction |
| 467 | GNSS_AIDING_DATA_SV_TIME_BIT = (1<<10),// reset satellite time |
Mike Cailean | 7dfa87b | 2018-02-06 16:36:27 -0800 | [diff] [blame] | 468 | GNSS_AIDING_DATA_SV_MB_DATA = (1 << 11),// delete multiband data |
Katz Yamada | 0fc49e8 | 2018-02-28 11:22:58 -0800 | [diff] [blame] | 469 | } GnssAidingDataSvBits; |
| 470 | |
| 471 | typedef uint32_t GnssAidingDataSvTypeMask; |
| 472 | typedef enum { |
| 473 | GNSS_AIDING_DATA_SV_TYPE_GPS_BIT = (1<<0), |
| 474 | GNSS_AIDING_DATA_SV_TYPE_GLONASS_BIT = (1<<1), |
| 475 | GNSS_AIDING_DATA_SV_TYPE_QZSS_BIT = (1<<2), |
| 476 | GNSS_AIDING_DATA_SV_TYPE_BEIDOU_BIT = (1<<3), |
| 477 | GNSS_AIDING_DATA_SV_TYPE_GALILEO_BIT = (1<<4), |
| 478 | } GnssAidingDataSvTypeBits; |
| 479 | |
Bhavna Sharma | ee8213f | 2018-05-25 14:34:08 -0700 | [diff] [blame] | 480 | /** GNSS Signal Type and RF Band */ |
| 481 | typedef uint32_t GnssSignalTypeMask; |
| 482 | typedef enum { |
| 483 | /** GPS L1CA Signal */ |
| 484 | GNSS_SIGNAL_GPS_L1CA = (1<<0), |
| 485 | /** GPS L1C Signal */ |
| 486 | GNSS_SIGNAL_GPS_L1C = (1<<1), |
| 487 | /** GPS L2 RF Band */ |
| 488 | GNSS_SIGNAL_GPS_L2 = (1<<2), |
| 489 | /** GPS L5 RF Band */ |
| 490 | GNSS_SIGNAL_GPS_L5 = (1<<3), |
| 491 | /** GLONASS G1 (L1OF) RF Band */ |
| 492 | GNSS_SIGNAL_GLONASS_G1 = (1<<4), |
| 493 | /** GLONASS G2 (L2OF) RF Band */ |
| 494 | GNSS_SIGNAL_GLONASS_G2 = (1<<5), |
| 495 | /** GALILEO E1 RF Band */ |
| 496 | GNSS_SIGNAL_GALILEO_E1 = (1<<6), |
| 497 | /** GALILEO E5A RF Band */ |
| 498 | GNSS_SIGNAL_GALILEO_E5A = (1<<7), |
| 499 | /** GALILEO E5B RF Band */ |
| 500 | GNSS_SIGNAL_GALILIEO_E5B = (1<<8), |
| 501 | /** BEIDOU B1 RF Band */ |
| 502 | GNSS_SIGNAL_BEIDOU_B1 = (1<<9), |
| 503 | /** BEIDOU B2 RF Band */ |
| 504 | GNSS_SIGNAL_BEIDOU_B2 = (1<<10), |
| 505 | /** QZSS L1CA RF Band */ |
| 506 | GNSS_SIGNAL_QZSS_L1CA = (1<<11), |
| 507 | /** QZSS L1S RF Band */ |
| 508 | GNSS_SIGNAL_QZSS_L1S = (1<<12), |
| 509 | /** QZSS L2 RF Band */ |
| 510 | GNSS_SIGNAL_QZSS_L2 = (1<<13), |
| 511 | /** QZSS L5 RF Band */ |
| 512 | GNSS_SIGNAL_QZSS_L5 = (1<<14), |
| 513 | /** SBAS L1 RF Band */ |
| 514 | GNSS_SIGNAL_SBAS_L1 = (1<<15) |
| 515 | } GnssSignalTypeBits; |
| 516 | |
Katz Yamada | 0fc49e8 | 2018-02-28 11:22:58 -0800 | [diff] [blame] | 517 | typedef enum |
| 518 | { |
| 519 | GNSS_LOC_SV_SYSTEM_GPS = 1, |
| 520 | /**< GPS satellite. */ |
| 521 | GNSS_LOC_SV_SYSTEM_GALILEO = 2, |
| 522 | /**< GALILEO satellite. */ |
| 523 | GNSS_LOC_SV_SYSTEM_SBAS = 3, |
| 524 | /**< SBAS satellite. */ |
| 525 | GNSS_LOC_SV_SYSTEM_COMPASS = 4, |
| 526 | /**< COMPASS satellite. */ |
| 527 | GNSS_LOC_SV_SYSTEM_GLONASS = 5, |
| 528 | /**< GLONASS satellite. */ |
| 529 | GNSS_LOC_SV_SYSTEM_BDS = 6, |
| 530 | /**< BDS satellite. */ |
| 531 | GNSS_LOC_SV_SYSTEM_QZSS = 7 |
| 532 | /**< QZSS satellite. */ |
| 533 | } Gnss_LocSvSystemEnumType; |
| 534 | |
| 535 | typedef uint32_t GnssSystemTimeStructTypeFlags; |
| 536 | typedef enum { |
| 537 | GNSS_SYSTEM_TIME_WEEK_VALID = (1 << 0), |
| 538 | GNSS_SYSTEM_TIME_WEEK_MS_VALID = (1 << 1), |
| 539 | GNSS_SYSTEM_CLK_TIME_BIAS_VALID = (1 << 2), |
| 540 | GNSS_SYSTEM_CLK_TIME_BIAS_UNC_VALID = (1 << 3), |
| 541 | GNSS_SYSTEM_REF_FCOUNT_VALID = (1 << 4), |
| 542 | GNSS_SYSTEM_NUM_CLOCK_RESETS_VALID = (1 << 5) |
| 543 | } GnssSystemTimeTypeBits; |
| 544 | |
| 545 | typedef uint32_t GnssGloTimeStructTypeFlags; |
| 546 | typedef enum { |
| 547 | GNSS_CLO_DAYS_VALID = (1 << 0), |
| 548 | GNSS_GLOS_MSEC_VALID = (1 << 1), |
| 549 | GNSS_GLO_CLK_TIME_BIAS_VALID = (1 << 2), |
| 550 | GNSS_GLO_CLK_TIME_BIAS_UNC_VALID = (1 << 3), |
| 551 | GNSS_GLO_REF_FCOUNT_VALID = (1 << 4), |
| 552 | GNSS_GLO_NUM_CLOCK_RESETS_VALID = (1 << 5), |
| 553 | GNSS_GLO_FOUR_YEAR_VALID = (1 << 6) |
| 554 | } GnssGloTimeTypeBits; |
| 555 | |
| 556 | typedef struct { |
| 557 | GnssAidingDataSvMask svMask; // bitwise OR of GnssAidingDataSvBits |
| 558 | GnssAidingDataSvTypeMask svTypeMask; // bitwise OR of GnssAidingDataSvTypeBits |
| 559 | } GnssAidingDataSv; |
| 560 | |
| 561 | typedef uint32_t GnssAidingDataCommonMask; |
| 562 | typedef enum { |
| 563 | GNSS_AIDING_DATA_COMMON_POSITION_BIT = (1<<0), // position estimate |
| 564 | GNSS_AIDING_DATA_COMMON_TIME_BIT = (1<<1), // reset all clock values |
| 565 | GNSS_AIDING_DATA_COMMON_UTC_BIT = (1<<2), // UTC estimate |
| 566 | GNSS_AIDING_DATA_COMMON_RTI_BIT = (1<<3), // RTI |
| 567 | GNSS_AIDING_DATA_COMMON_FREQ_BIAS_EST_BIT = (1<<4), // frequency bias estimate |
| 568 | GNSS_AIDING_DATA_COMMON_CELLDB_BIT = (1<<5), // all celldb info |
| 569 | } GnssAidingDataCommonBits; |
| 570 | |
| 571 | typedef struct { |
| 572 | GnssAidingDataCommonMask mask; // bitwise OR of GnssAidingDataCommonBits |
| 573 | } GnssAidingDataCommon; |
| 574 | |
| 575 | typedef struct { |
| 576 | bool deleteAll; // if true, delete all aiding data and ignore other params |
| 577 | GnssAidingDataSv sv; // SV specific aiding data |
| 578 | GnssAidingDataCommon common; // common aiding data |
| 579 | } GnssAidingData; |
| 580 | |
| 581 | typedef struct { |
| 582 | size_t size; // set to sizeof(Location) |
| 583 | LocationFlagsMask flags; // bitwise OR of LocationFlagsBits to mark which params are valid |
| 584 | uint64_t timestamp; // UTC timestamp for location fix, milliseconds since January 1, 1970 |
| 585 | double latitude; // in degrees |
| 586 | double longitude; // in degrees |
| 587 | double altitude; // in meters above the WGS 84 reference ellipsoid |
| 588 | float speed; // in meters per second |
| 589 | float bearing; // in degrees; range [0, 360) |
| 590 | float accuracy; // in meters |
| 591 | float verticalAccuracy; // in meters |
| 592 | float speedAccuracy; // in meters/second |
| 593 | float bearingAccuracy; // in degrees (0 to 359.999) |
| 594 | LocationTechnologyMask techMask; |
haohuang | 17015dd | 2018-04-16 15:12:49 +0800 | [diff] [blame] | 595 | LocationSpoofMask spoofMask; |
Katz Yamada | 0fc49e8 | 2018-02-28 11:22:58 -0800 | [diff] [blame] | 596 | } Location; |
| 597 | |
Saurabh Srivastava | 66c682f | 2018-05-20 23:06:12 +0530 | [diff] [blame] | 598 | struct LocationOptions { |
Katz Yamada | 0fc49e8 | 2018-02-28 11:22:58 -0800 | [diff] [blame] | 599 | size_t size; // set to sizeof(LocationOptions) |
| 600 | uint32_t minInterval; // in milliseconds |
| 601 | uint32_t minDistance; // in meters. if minDistance > 0, gnssSvCallback/gnssNmeaCallback/ |
| 602 | // gnssMeasurementsCallback may not be called |
| 603 | GnssSuplMode mode; // Standalone/MS-Based/MS-Assisted |
Katz Yamada | 0fc49e8 | 2018-02-28 11:22:58 -0800 | [diff] [blame] | 604 | |
Saurabh Srivastava | 66c682f | 2018-05-20 23:06:12 +0530 | [diff] [blame] | 605 | inline LocationOptions() : |
| 606 | size(0), minInterval(0), minDistance(0), mode(GNSS_SUPL_MODE_STANDALONE) {} |
| 607 | }; |
| 608 | |
| 609 | typedef enum { |
| 610 | GNSS_POWER_MODE_INVALID = 0, |
| 611 | GNSS_POWER_MODE_M1, /* Improved Accuracy Mode */ |
| 612 | GNSS_POWER_MODE_M2, /* Normal Mode */ |
| 613 | GNSS_POWER_MODE_M3, /* Background Mode */ |
| 614 | GNSS_POWER_MODE_M4, /* Background Mode */ |
| 615 | GNSS_POWER_MODE_M5 /* Background Mode */ |
| 616 | } GnssPowerMode; |
| 617 | |
| 618 | struct TrackingOptions : LocationOptions { |
| 619 | GnssPowerMode powerMode; /* Power Mode to be used for time based tracking |
| 620 | sessions */ |
| 621 | uint32_t tbm; /* Time interval between measurements specified in millis. |
| 622 | Applicable to background power modes */ |
| 623 | |
| 624 | inline TrackingOptions() : |
| 625 | LocationOptions(), powerMode(GNSS_POWER_MODE_INVALID), tbm(0) {} |
| 626 | inline TrackingOptions(size_t s, GnssPowerMode m, uint32_t t) : |
| 627 | LocationOptions(), powerMode(m), tbm(t) { LocationOptions::size = s; } |
| 628 | inline TrackingOptions(const LocationOptions& options) : |
| 629 | LocationOptions(options), powerMode(GNSS_POWER_MODE_INVALID), tbm(0) {} |
| 630 | inline void setLocationOptions(const LocationOptions& options) { |
| 631 | minInterval = options.minInterval; |
| 632 | minDistance = options.minDistance; |
| 633 | mode = options.mode; |
| 634 | } |
Harikrishnan Hariharan | 59269e1 | 2018-07-01 00:43:09 +0530 | [diff] [blame^] | 635 | inline LocationOptions getLocationOptions() { |
| 636 | LocationOptions locOption; |
| 637 | locOption.size = sizeof(locOption); |
| 638 | locOption.minDistance = minDistance; |
| 639 | locOption.minInterval = minInterval; |
| 640 | locOption.mode = mode; |
| 641 | return locOption; |
| 642 | } |
Saurabh Srivastava | 66c682f | 2018-05-20 23:06:12 +0530 | [diff] [blame] | 643 | }; |
| 644 | |
| 645 | struct BatchingOptions : LocationOptions { |
Katz Yamada | 0fc49e8 | 2018-02-28 11:22:58 -0800 | [diff] [blame] | 646 | BatchingMode batchingMode; |
Saurabh Srivastava | 66c682f | 2018-05-20 23:06:12 +0530 | [diff] [blame] | 647 | |
| 648 | inline BatchingOptions() : |
| 649 | LocationOptions(), batchingMode(BATCHING_MODE_ROUTINE) {} |
| 650 | inline BatchingOptions(size_t s, BatchingMode m) : |
| 651 | LocationOptions(), batchingMode(m) { LocationOptions::size = s; } |
| 652 | inline BatchingOptions(const LocationOptions& options) : |
| 653 | LocationOptions(options), batchingMode(BATCHING_MODE_ROUTINE) {} |
| 654 | inline void setLocationOptions(const LocationOptions& options) { |
| 655 | minInterval = options.minInterval; |
| 656 | minDistance = options.minDistance; |
| 657 | mode = options.mode; |
| 658 | } |
| 659 | }; |
Katz Yamada | 0fc49e8 | 2018-02-28 11:22:58 -0800 | [diff] [blame] | 660 | |
| 661 | typedef struct { |
| 662 | size_t size; |
| 663 | BatchingStatus batchingStatus; |
| 664 | } BatchingStatusInfo; |
| 665 | |
| 666 | typedef struct { |
| 667 | size_t size; // set to sizeof(GeofenceOption) |
| 668 | GeofenceBreachTypeMask breachTypeMask; // bitwise OR of GeofenceBreachTypeBits |
| 669 | uint32_t responsiveness; // in milliseconds |
| 670 | uint32_t dwellTime; // in seconds |
| 671 | } GeofenceOption; |
| 672 | |
| 673 | typedef struct { |
| 674 | size_t size; // set to sizeof(GeofenceInfo) |
| 675 | double latitude; // in degrees |
| 676 | double longitude; // in degrees |
| 677 | double radius; // in meters |
| 678 | } GeofenceInfo; |
| 679 | |
| 680 | typedef struct { |
| 681 | size_t size; // set to sizeof(GeofenceBreachNotification) |
| 682 | size_t count; // number of ids in array |
| 683 | uint32_t* ids; // array of ids that have breached |
| 684 | Location location; // location associated with breach |
| 685 | GeofenceBreachType type; // type of breach |
| 686 | uint64_t timestamp; // timestamp of breach |
| 687 | } GeofenceBreachNotification; |
| 688 | |
| 689 | typedef struct { |
| 690 | size_t size; // set to sizeof(GeofenceBreachNotification) |
| 691 | GeofenceStatusAvailable available; // GEOFENCE_STATUS_AVAILABILE_NO/_YES |
| 692 | LocationTechnologyType techType; // GNSS |
| 693 | } GeofenceStatusNotification; |
| 694 | |
| 695 | typedef struct { |
| 696 | uint64_t gpsSvUsedIdsMask; |
| 697 | uint64_t gloSvUsedIdsMask; |
| 698 | uint64_t galSvUsedIdsMask; |
| 699 | uint64_t bdsSvUsedIdsMask; |
| 700 | uint64_t qzssSvUsedIdsMask; |
| 701 | } GnssLocationSvUsedInPosition; |
| 702 | |
Bhavna Sharma | ee8213f | 2018-05-25 14:34:08 -0700 | [diff] [blame] | 703 | typedef struct { |
| 704 | /** GnssSignalType mask */ |
| 705 | GnssSignalTypeMask gnssSignalType; |
| 706 | /** Specifies GNSS Constellation Type */ |
| 707 | Gnss_LocSvSystemEnumType gnssConstellation; |
| 708 | /** GNSS SV ID. |
| 709 | For GPS: 1 to 32 |
| 710 | For GLONASS: 65 to 96. When slot-number to SV ID mapping is unknown, set as 255. |
| 711 | For SBAS: 120 to 151 |
| 712 | For QZSS-L1CA:193 to 197 |
| 713 | For BDS: 201 to 237 |
| 714 | For GAL: 301 to 336 */ |
| 715 | uint16_t gnssSvId; |
| 716 | } GnssMeasUsageInfo; |
| 717 | |
Katz Yamada | 0fc49e8 | 2018-02-28 11:22:58 -0800 | [diff] [blame] | 718 | /** @struct |
| 719 | Body Frame parameters |
| 720 | */ |
| 721 | typedef struct { |
| 722 | GnssLocationPosDataMask bodyFrameDataMask; // Contains Body frame LocPosDataMask bits |
| 723 | float longAccel; // Forward Acceleration in body frame (m/s2) |
| 724 | float latAccel; // Sideward Acceleration in body frame (m/s2) |
| 725 | float vertAccel; // Vertical Acceleration in body frame (m/s2) |
| 726 | float yawRate; // Heading Rate (Radians/second) |
| 727 | float pitch; // Body pitch (Radians) |
| 728 | } GnssLocationPositionDynamics; |
| 729 | |
| 730 | typedef struct { |
| 731 | /** Validity mask for below fields */ |
| 732 | GnssSystemTimeStructTypeFlags validityMask; |
| 733 | /** Extended week number at reference tick. |
| 734 | Unit: Week. |
| 735 | Set to 65535 if week number is unknown. |
| 736 | For GPS: |
| 737 | Calculated from midnight, Jan. 6, 1980. |
| 738 | OTA decoded 10 bit GPS week is extended to map between: |
| 739 | [NV6264 to (NV6264 + 1023)]. |
| 740 | NV6264: Minimum GPS week number configuration. |
| 741 | Default value of NV6264: 1738 |
| 742 | For BDS: |
| 743 | Calculated from 00:00:00 on January 1, 2006 of Coordinated Universal Time (UTC). |
| 744 | For GAL: |
| 745 | Calculated from 00:00 UT on Sunday August 22, 1999 (midnight between August 21 and August 22). |
| 746 | */ |
| 747 | uint16_t systemWeek; |
| 748 | /** Time in to the current week at reference tick. |
| 749 | Unit: Millisecond. Range: 0 to 604799999. |
| 750 | Check for systemClkTimeUncMs before use */ |
| 751 | uint32_t systemMsec; |
| 752 | /** System clock time bias (sub-millisecond) |
| 753 | Units: Millisecond |
| 754 | Note: System time (TOW Millisecond) = systemMsec - systemClkTimeBias. |
| 755 | Check for systemClkTimeUncMs before use. */ |
| 756 | float systemClkTimeBias; |
| 757 | /** Single sided maximum time bias uncertainty |
| 758 | Units: Millisecond */ |
| 759 | float systemClkTimeUncMs; |
| 760 | /** FCount (free running HW timer) value. Don't use for relative time purpose |
| 761 | due to possible discontinuities. |
| 762 | Unit: Millisecond */ |
| 763 | uint32_t refFCount; |
| 764 | /** Number of clock resets/discontinuities detected, affecting the local hardware counter value. */ |
| 765 | uint32_t numClockResets; |
| 766 | } GnssSystemTimeStructType; |
| 767 | |
| 768 | typedef struct { |
| 769 | /** GLONASS day number in four years. Refer to GLONASS ICD. |
| 770 | Applicable only for GLONASS and shall be ignored for other constellations. |
| 771 | If unknown shall be set to 65535 */ |
| 772 | uint16_t gloDays; |
| 773 | /** Validity mask for below fields */ |
| 774 | GnssGloTimeStructTypeFlags validityMask; |
| 775 | /** GLONASS time of day in Millisecond. Refer to GLONASS ICD. |
| 776 | Units: Millisecond |
| 777 | Check for gloClkTimeUncMs before use */ |
| 778 | uint32_t gloMsec; |
| 779 | /** GLONASS clock time bias (sub-millisecond) |
| 780 | Units: Millisecond |
| 781 | Note: GLO time (TOD Millisecond) = gloMsec - gloClkTimeBias. |
| 782 | Check for gloClkTimeUncMs before use. */ |
| 783 | float gloClkTimeBias; |
| 784 | /** Single sided maximum time bias uncertainty |
| 785 | Units: Millisecond */ |
| 786 | float gloClkTimeUncMs; |
| 787 | /** FCount (free running HW timer) value. Don't use for relative time purpose |
| 788 | due to possible discontinuities. |
| 789 | Unit: Millisecond */ |
| 790 | uint32_t refFCount; |
| 791 | /** Number of clock resets/discontinuities detected, affecting the local hardware counter value. */ |
| 792 | uint32_t numClockResets; |
| 793 | /** GLONASS four year number from 1996. Refer to GLONASS ICD. |
| 794 | Applicable only for GLONASS and shall be ignored for other constellations. |
| 795 | If unknown shall be set to 255 */ |
| 796 | uint8_t gloFourYear; |
| 797 | } GnssGloTimeStructType; |
| 798 | |
| 799 | typedef union { |
| 800 | GnssSystemTimeStructType gpsSystemTime; |
| 801 | GnssSystemTimeStructType galSystemTime; |
| 802 | GnssSystemTimeStructType bdsSystemTime; |
| 803 | GnssSystemTimeStructType qzssSystemTime; |
Katz Yamada | 8f2e900 | 2018-03-13 09:30:43 -0700 | [diff] [blame] | 804 | GnssGloTimeStructType gloSystemTime; |
Katz Yamada | 0fc49e8 | 2018-02-28 11:22:58 -0800 | [diff] [blame] | 805 | } SystemTimeStructUnion; |
| 806 | /** Time applicability of PVT report */ |
| 807 | typedef struct { |
| 808 | /** Specifies GNSS system time reported. Mandatory field */ |
| 809 | Gnss_LocSvSystemEnumType gnssSystemTimeSrc; |
| 810 | /** Reporting of GPS system time is recommended. |
| 811 | If GPS time is unknown & other satellite system time is known, |
| 812 | it should be reported. |
| 813 | Mandatory field |
| 814 | */ |
| 815 | SystemTimeStructUnion u; |
| 816 | } GnssSystemTime; |
| 817 | |
| 818 | typedef struct { |
| 819 | size_t size; // set to sizeof(GnssLocationInfo) |
| 820 | GnssLocationInfoFlagMask flags; // bitwise OR of GnssLocationInfoBits for param validity |
| 821 | float altitudeMeanSeaLevel; // altitude wrt mean sea level |
| 822 | float pdop; // position dilusion of precision |
| 823 | float hdop; // horizontal dilusion of precision |
| 824 | float vdop; // vertical dilusion of precision |
| 825 | float gdop; // geometric dilution of precision |
| 826 | float tdop; // time dilution of precision |
| 827 | float magneticDeviation; // magnetic deviation |
| 828 | LocationReliability horReliability; // horizontal reliability |
| 829 | LocationReliability verReliability; // vertical reliability |
| 830 | float horUncEllipseSemiMajor; // horizontal elliptical accuracy semi-major axis |
| 831 | float horUncEllipseSemiMinor; // horizontal elliptical accuracy semi-minor axis |
| 832 | float horUncEllipseOrientAzimuth; // horizontal elliptical accuracy azimuth |
Bhavna Sharma | ee8213f | 2018-05-25 14:34:08 -0700 | [diff] [blame] | 833 | float northStdDeviation; // North standard deviation Unit: Meters |
| 834 | float eastStdDeviation; // East standard deviation. Unit: Meters |
Katz Yamada | 0fc49e8 | 2018-02-28 11:22:58 -0800 | [diff] [blame] | 835 | float northVelocity; // North Velocity.Unit: Meters/sec |
Bhavna Sharma | ee8213f | 2018-05-25 14:34:08 -0700 | [diff] [blame] | 836 | float eastVelocity; // East Velocity Unit Meters/sec |
| 837 | float upVelocity; // Up Velocity. Unit Meters/sec |
Katz Yamada | 0fc49e8 | 2018-02-28 11:22:58 -0800 | [diff] [blame] | 838 | float northVelocityStdDeviation; |
| 839 | float eastVelocityStdDeviation; |
| 840 | float upVelocityStdDeviation; |
| 841 | GnssLocationSvUsedInPosition svUsedInPosition;// Gnss sv used in position data |
| 842 | GnssLocationNavSolutionMask navSolutionMask; // Nav solution mask to indicate sbas corrections |
| 843 | GnssLocationPosTechMask posTechMask; // Position technology used in computing this fix |
| 844 | GnssLocationPositionDynamics bodyFrameData; // Body Frame Dynamics: 4wayAcceleration and |
| 845 | // pitch set with validity |
| 846 | GnssSystemTime gnssSystemTime; // GNSS System Time |
Bhavna Sharma | ee8213f | 2018-05-25 14:34:08 -0700 | [diff] [blame] | 847 | uint8_t numOfMeasReceived; // Number of measurements received for use in fix. |
| 848 | GnssMeasUsageInfo measUsageInfo[GNSS_SV_MAX]; // GNSS Measurement Usage info |
| 849 | uint8_t leapSeconds; // leap second |
| 850 | float timeUncMs; // Time uncertainty in milliseconds |
Katz Yamada | 0fc49e8 | 2018-02-28 11:22:58 -0800 | [diff] [blame] | 851 | Location location; |
| 852 | } GnssLocationInfoNotification; |
| 853 | |
| 854 | typedef struct { |
| 855 | size_t size; // set to sizeof(GnssNiNotification) |
| 856 | GnssNiType type; // type of NI (Voice, SUPL, Control Plane) |
| 857 | GnssNiOptionsMask options; // bitwise OR of GnssNiOptionsBits |
| 858 | uint32_t timeout; // time (seconds) to wait for user input |
| 859 | GnssNiResponse timeoutResponse; // the response that should be sent when timeout expires |
| 860 | char requestor[GNSS_NI_REQUESTOR_MAX]; // the requestor that is making the request |
| 861 | GnssNiEncodingType requestorEncoding; // the encoding type for requestor |
| 862 | char message[GNSS_NI_MESSAGE_ID_MAX]; // the message to show user |
| 863 | GnssNiEncodingType messageEncoding; // the encoding type for message |
| 864 | char extras[GNSS_NI_MESSAGE_ID_MAX]; |
| 865 | } GnssNiNotification; |
| 866 | |
| 867 | typedef struct { |
| 868 | size_t size; // set to sizeof(GnssSv) |
| 869 | uint16_t svId; // Unique Identifier |
| 870 | GnssSvType type; // type of SV (GPS, SBAS, GLONASS, QZSS, BEIDOU, GALILEO) |
| 871 | float cN0Dbhz; // signal strength |
| 872 | float elevation; // elevation of SV (in degrees) |
| 873 | float azimuth; // azimuth of SV (in degrees) |
| 874 | GnssSvOptionsMask gnssSvOptionsMask; // Bitwise OR of GnssSvOptionsBits |
Mike Cailean | 7dfa87b | 2018-02-06 16:36:27 -0800 | [diff] [blame] | 875 | float carrierFrequencyHz; // carrier frequency of the signal tracked |
Katz Yamada | 0fc49e8 | 2018-02-28 11:22:58 -0800 | [diff] [blame] | 876 | } GnssSv; |
| 877 | |
Saurabh Srivastava | eaf7e54 | 2018-05-20 19:29:46 +0530 | [diff] [blame] | 878 | struct GnssConfigSetAssistanceServer { |
Katz Yamada | 0fc49e8 | 2018-02-28 11:22:58 -0800 | [diff] [blame] | 879 | size_t size; // set to sizeof(GnssConfigSetAssistanceServer) |
| 880 | GnssAssistanceType type; // SUPL or C2K |
| 881 | const char* hostName; // null terminated string |
| 882 | uint32_t port; // port of server |
Saurabh Srivastava | eaf7e54 | 2018-05-20 19:29:46 +0530 | [diff] [blame] | 883 | |
| 884 | inline bool equals(const GnssConfigSetAssistanceServer& config) { |
| 885 | if (config.type == type && config.port == port && |
| 886 | ((NULL == config.hostName && NULL == hostName) || |
| 887 | (NULL != config.hostName && NULL != hostName && |
| 888 | 0 == strcmp(config.hostName, hostName)))) { |
| 889 | return true; |
| 890 | } |
| 891 | return false; |
| 892 | } |
| 893 | }; |
Katz Yamada | 0fc49e8 | 2018-02-28 11:22:58 -0800 | [diff] [blame] | 894 | |
| 895 | typedef struct { |
| 896 | size_t size; // set to sizeof(GnssMeasurementsData) |
| 897 | GnssMeasurementsDataFlagsMask flags; // bitwise OR of GnssMeasurementsDataFlagsBits |
| 898 | int16_t svId; |
| 899 | GnssSvType svType; |
| 900 | double timeOffsetNs; |
| 901 | GnssMeasurementsStateMask stateMask; // bitwise OR of GnssMeasurementsStateBits |
| 902 | int64_t receivedSvTimeNs; |
| 903 | int64_t receivedSvTimeUncertaintyNs; |
| 904 | double carrierToNoiseDbHz; |
| 905 | double pseudorangeRateMps; |
| 906 | double pseudorangeRateUncertaintyMps; |
| 907 | GnssMeasurementsAdrStateMask adrStateMask; // bitwise OR of GnssMeasurementsAdrStateBits |
| 908 | double adrMeters; |
| 909 | double adrUncertaintyMeters; |
| 910 | float carrierFrequencyHz; |
| 911 | int64_t carrierCycles; |
| 912 | double carrierPhase; |
| 913 | double carrierPhaseUncertainty; |
| 914 | GnssMeasurementsMultipathIndicator multipathIndicator; |
| 915 | double signalToNoiseRatioDb; |
| 916 | double agcLevelDb; |
| 917 | } GnssMeasurementsData; |
| 918 | |
| 919 | typedef struct { |
| 920 | size_t size; // set to sizeof(GnssMeasurementsClock) |
| 921 | GnssMeasurementsClockFlagsMask flags; // bitwise OR of GnssMeasurementsClockFlagsBits |
| 922 | int16_t leapSecond; |
| 923 | int64_t timeNs; |
| 924 | double timeUncertaintyNs; |
| 925 | int64_t fullBiasNs; |
| 926 | double biasNs; |
| 927 | double biasUncertaintyNs; |
| 928 | double driftNsps; |
| 929 | double driftUncertaintyNsps; |
| 930 | uint32_t hwClockDiscontinuityCount; |
| 931 | } GnssMeasurementsClock; |
| 932 | |
| 933 | typedef struct { |
| 934 | size_t size; // set to sizeof(GnssSvNotification) |
| 935 | size_t count; // number of SVs in the GnssSv array |
| 936 | GnssSv gnssSvs[GNSS_SV_MAX]; // information on a number of SVs |
| 937 | } GnssSvNotification; |
| 938 | |
| 939 | typedef struct { |
| 940 | size_t size; // set to sizeof(GnssNmeaNotification) |
| 941 | uint64_t timestamp; // timestamp |
| 942 | const char* nmea; // nmea text |
| 943 | size_t length; // length of the nmea text |
| 944 | } GnssNmeaNotification; |
| 945 | |
| 946 | typedef struct { |
| 947 | size_t size; // set to sizeof(GnssMeasurementsNotification) |
| 948 | size_t count; // number of items in GnssMeasurements array |
| 949 | GnssMeasurementsData measurements[GNSS_MEASUREMENTS_MAX]; |
| 950 | GnssMeasurementsClock clock; // clock |
| 951 | } GnssMeasurementsNotification; |
| 952 | |
Saurabh Srivastava | eaf7e54 | 2018-05-20 19:29:46 +0530 | [diff] [blame] | 953 | typedef uint32_t GnssSvId; |
| 954 | |
| 955 | struct GnssSvIdSource{ |
| 956 | size_t size; // set to sizeof(GnssSvIdSource) |
| 957 | GnssSvType constellation; // constellation for the sv to blacklist |
| 958 | GnssSvId svId; // sv id to blacklist |
| 959 | }; |
| 960 | inline bool operator ==(GnssSvIdSource const& left, GnssSvIdSource const& right) { |
| 961 | return left.size == right.size && |
| 962 | left.constellation == right.constellation && left.svId == right.svId; |
| 963 | } |
| 964 | |
| 965 | #define GNSS_SV_CONFIG_ALL_BITS_ENABLED_MASK ((uint64_t)0xFFFFFFFFFFFFFFFF) |
Katz Yamada | 0fc49e8 | 2018-02-28 11:22:58 -0800 | [diff] [blame] | 966 | typedef struct { |
Saurabh Srivastava | eaf7e54 | 2018-05-20 19:29:46 +0530 | [diff] [blame] | 967 | size_t size; // set to sizeof(GnssSvIdConfig) |
| 968 | |
| 969 | // GLONASS - SV 65 maps to bit 0 |
| 970 | #define GNSS_SV_CONFIG_GLO_INITIAL_SV_ID 65 |
| 971 | uint64_t gloBlacklistSvMask; |
| 972 | |
| 973 | // BEIDOU - SV 201 maps to bit 0 |
| 974 | #define GNSS_SV_CONFIG_BDS_INITIAL_SV_ID 201 |
| 975 | uint64_t bdsBlacklistSvMask; |
| 976 | |
| 977 | // QZSS - SV 193 maps to bit 0 |
| 978 | #define GNSS_SV_CONFIG_QZSS_INITIAL_SV_ID 193 |
| 979 | uint64_t qzssBlacklistSvMask; |
| 980 | |
| 981 | // GAL - SV 301 maps to bit 0 |
| 982 | #define GNSS_SV_CONFIG_GAL_INITIAL_SV_ID 301 |
| 983 | uint64_t galBlacklistSvMask; |
| 984 | } GnssSvIdConfig; |
| 985 | |
| 986 | struct GnssConfig{ |
Katz Yamada | 0fc49e8 | 2018-02-28 11:22:58 -0800 | [diff] [blame] | 987 | size_t size; // set to sizeof(GnssConfig) |
| 988 | GnssConfigFlagsMask flags; // bitwise OR of GnssConfigFlagsBits to mark which params are valid |
| 989 | GnssConfigGpsLock gpsLock; |
| 990 | GnssConfigSuplVersion suplVersion; |
| 991 | GnssConfigSetAssistanceServer assistanceServer; |
| 992 | GnssConfigLppProfile lppProfile; |
| 993 | GnssConfigLppeControlPlaneMask lppeControlPlaneMask; |
| 994 | GnssConfigLppeUserPlaneMask lppeUserPlaneMask; |
| 995 | GnssConfigAGlonassPositionProtocolMask aGlonassPositionProtocolMask; |
| 996 | GnssConfigEmergencyPdnForEmergencySupl emergencyPdnForEmergencySupl; |
| 997 | GnssConfigSuplEmergencyServices suplEmergencyServices; |
| 998 | GnssConfigSuplModeMask suplModeMask; //bitwise OR of GnssConfigSuplModeBits |
Saurabh Srivastava | eaf7e54 | 2018-05-20 19:29:46 +0530 | [diff] [blame] | 999 | std::vector<GnssSvIdSource> blacklistedSvIds; |
| 1000 | |
| 1001 | inline bool equals(const GnssConfig& config) { |
| 1002 | if (flags == config.flags && |
| 1003 | gpsLock == config.gpsLock && |
| 1004 | suplVersion == config.suplVersion && |
| 1005 | assistanceServer.equals(config.assistanceServer) && |
| 1006 | lppProfile == config.lppProfile && |
| 1007 | lppeControlPlaneMask == config.lppeControlPlaneMask && |
| 1008 | lppeUserPlaneMask == config.lppeUserPlaneMask && |
| 1009 | aGlonassPositionProtocolMask == config.aGlonassPositionProtocolMask && |
| 1010 | emergencyPdnForEmergencySupl == config.emergencyPdnForEmergencySupl && |
| 1011 | suplEmergencyServices == config.suplEmergencyServices && |
| 1012 | suplModeMask == config.suplModeMask && |
| 1013 | blacklistedSvIds == config.blacklistedSvIds) { |
| 1014 | return true; |
| 1015 | } |
| 1016 | return false; |
| 1017 | } |
| 1018 | }; |
Katz Yamada | 0fc49e8 | 2018-02-28 11:22:58 -0800 | [diff] [blame] | 1019 | |
| 1020 | typedef struct { |
| 1021 | size_t size; // set to sizeof |
| 1022 | bool mValid; |
| 1023 | Location mLocation; |
| 1024 | double verticalAccuracyMeters; |
| 1025 | double speedAccuracyMetersPerSecond; |
| 1026 | double bearingAccuracyDegrees; |
| 1027 | timespec mUtcReported; |
| 1028 | } GnssDebugLocation; |
| 1029 | |
| 1030 | typedef struct { |
| 1031 | size_t size; // set to sizeof |
| 1032 | bool mValid; |
| 1033 | int64_t timeEstimate; |
| 1034 | float timeUncertaintyNs; |
| 1035 | float frequencyUncertaintyNsPerSec; |
| 1036 | } GnssDebugTime; |
| 1037 | |
| 1038 | typedef struct { |
| 1039 | size_t size; // set to sizeof |
| 1040 | uint32_t svid; |
| 1041 | GnssSvType constellation; |
| 1042 | GnssEphemerisType mEphemerisType; |
| 1043 | GnssEphemerisSource mEphemerisSource; |
| 1044 | GnssEphemerisHealth mEphemerisHealth; |
| 1045 | float ephemerisAgeSeconds; |
| 1046 | bool serverPredictionIsAvailable; |
| 1047 | float serverPredictionAgeSeconds; |
| 1048 | } GnssDebugSatelliteInfo; |
| 1049 | |
| 1050 | typedef struct { |
| 1051 | size_t size; // set to sizeof |
| 1052 | GnssDebugLocation mLocation; |
| 1053 | GnssDebugTime mTime; |
| 1054 | std::vector<GnssDebugSatelliteInfo> mSatelliteInfo; |
| 1055 | } GnssDebugReport; |
| 1056 | |
| 1057 | /* Provides the capabilities of the system |
| 1058 | capabilities callback is called once soon after createInstance is called */ |
| 1059 | typedef std::function<void( |
| 1060 | LocationCapabilitiesMask capabilitiesMask // bitwise OR of LocationCapabilitiesBits |
| 1061 | )> capabilitiesCallback; |
| 1062 | |
| 1063 | /* Used by tracking, batching, and miscellanous APIs |
| 1064 | responseCallback is called for every Tracking, Batching API, and Miscellanous API */ |
| 1065 | typedef std::function<void( |
| 1066 | LocationError err, // if not SUCCESS, then id is not valid |
| 1067 | uint32_t id // id to be associated to the request |
| 1068 | )> responseCallback; |
| 1069 | |
| 1070 | /* Used by APIs that gets more than one LocationError in it's response |
| 1071 | collectiveResponseCallback is called for every geofence API call. |
| 1072 | ids array and LocationError array are only valid until collectiveResponseCallback returns. */ |
| 1073 | typedef std::function<void( |
| 1074 | size_t count, // number of locations in arrays |
| 1075 | LocationError* errs, // array of LocationError associated to the request |
| 1076 | uint32_t* ids // array of ids to be associated to the request |
| 1077 | )> collectiveResponseCallback; |
| 1078 | |
| 1079 | /* Used for startTracking API, optional can be NULL |
| 1080 | trackingCallback is called when delivering a location in a tracking session |
| 1081 | broadcasted to all clients, no matter if a session has started by client */ |
| 1082 | typedef std::function<void( |
| 1083 | Location location |
| 1084 | )> trackingCallback; |
| 1085 | |
| 1086 | /* Used for startBatching API, optional can be NULL |
| 1087 | batchingCallback is called when delivering locations in a batching session. |
| 1088 | broadcasted to all clients, no matter if a session has started by client */ |
| 1089 | typedef std::function<void( |
| 1090 | size_t count, // number of locations in array |
| 1091 | Location* location, // array of locations |
| 1092 | BatchingOptions batchingOptions // Batching options |
| 1093 | )> batchingCallback; |
| 1094 | |
| 1095 | typedef std::function<void( |
| 1096 | BatchingStatusInfo batchingStatus, // batch status |
| 1097 | std::list<uint32_t> & listOfCompletedTrips |
| 1098 | )> batchingStatusCallback; |
| 1099 | |
| 1100 | /* Gives GNSS Location information, optional can be NULL |
| 1101 | gnssLocationInfoCallback is called only during a tracking session |
| 1102 | broadcasted to all clients, no matter if a session has started by client */ |
| 1103 | typedef std::function<void( |
| 1104 | GnssLocationInfoNotification gnssLocationInfoNotification |
| 1105 | )> gnssLocationInfoCallback; |
| 1106 | |
| 1107 | /* Used for addGeofences API, optional can be NULL |
| 1108 | geofenceBreachCallback is called when any number of geofences have a state change */ |
| 1109 | typedef std::function<void( |
| 1110 | GeofenceBreachNotification geofenceBreachNotification |
| 1111 | )> geofenceBreachCallback; |
| 1112 | |
| 1113 | /* Used for addGeofences API, optional can be NULL |
| 1114 | geofenceStatusCallback is called when any number of geofences have a status change */ |
| 1115 | typedef std::function<void( |
| 1116 | GeofenceStatusNotification geofenceStatusNotification |
| 1117 | )> geofenceStatusCallback; |
| 1118 | |
| 1119 | /* Network Initiated request, optional can be NULL |
| 1120 | This callback should be responded to by calling gnssNiResponse */ |
| 1121 | typedef std::function<void( |
| 1122 | uint32_t id, // id that should be used to respond by calling gnssNiResponse |
| 1123 | GnssNiNotification gnssNiNotification |
| 1124 | )> gnssNiCallback; |
| 1125 | |
| 1126 | /* Gives GNSS SV information, optional can be NULL |
| 1127 | gnssSvCallback is called only during a tracking session |
| 1128 | broadcasted to all clients, no matter if a session has started by client */ |
| 1129 | typedef std::function<void( |
| 1130 | GnssSvNotification gnssSvNotification |
| 1131 | )> gnssSvCallback; |
| 1132 | |
| 1133 | /* Gives GNSS NMEA data, optional can be NULL |
| 1134 | gnssNmeaCallback is called only during a tracking session |
| 1135 | broadcasted to all clients, no matter if a session has started by client */ |
| 1136 | typedef std::function<void( |
| 1137 | GnssNmeaNotification gnssNmeaNotification |
| 1138 | )> gnssNmeaCallback; |
| 1139 | |
| 1140 | /* Gives GNSS Measurements information, optional can be NULL |
| 1141 | gnssMeasurementsCallback is called only during a tracking session |
| 1142 | broadcasted to all clients, no matter if a session has started by client */ |
| 1143 | typedef std::function<void( |
| 1144 | GnssMeasurementsNotification gnssMeasurementsNotification |
| 1145 | )> gnssMeasurementsCallback; |
| 1146 | |
Saurabh Srivastava | eaf7e54 | 2018-05-20 19:29:46 +0530 | [diff] [blame] | 1147 | /* Provides the current GNSS configuration to the client */ |
| 1148 | typedef std::function<void( |
| 1149 | GnssConfig& config |
| 1150 | )> gnssConfigCallback; |
| 1151 | |
Katz Yamada | 0fc49e8 | 2018-02-28 11:22:58 -0800 | [diff] [blame] | 1152 | typedef struct { |
| 1153 | size_t size; // set to sizeof(LocationCallbacks) |
| 1154 | capabilitiesCallback capabilitiesCb; // mandatory |
| 1155 | responseCallback responseCb; // mandatory |
| 1156 | collectiveResponseCallback collectiveResponseCb; // mandatory |
| 1157 | trackingCallback trackingCb; // optional |
| 1158 | batchingCallback batchingCb; // optional |
| 1159 | geofenceBreachCallback geofenceBreachCb; // optional |
| 1160 | geofenceStatusCallback geofenceStatusCb; // optional |
| 1161 | gnssLocationInfoCallback gnssLocationInfoCb; // optional |
| 1162 | gnssNiCallback gnssNiCb; // optional |
| 1163 | gnssSvCallback gnssSvCb; // optional |
| 1164 | gnssNmeaCallback gnssNmeaCb; // optional |
| 1165 | gnssMeasurementsCallback gnssMeasurementsCb; // optional |
| 1166 | batchingStatusCallback batchingStatusCb; // optional |
| 1167 | } LocationCallbacks; |
| 1168 | |
| 1169 | #endif /* LOCATIONDATATYPES_H */ |