/* Copyright (c) 2013-2020 The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * Neither the name of The Linux Foundation nor the names of its * contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef GPS_EXTENDED_C_H #define GPS_EXTENDED_C_H #include #include #include #include #include #include struct timespec32_t { uint32_t tv_sec; /* seconds */ uint32_t tv_nsec; /* and nanoseconds */ }; /** * @file * @brief C++ declarations for GPS types */ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /** Location has valid source information. */ #define LOCATION_HAS_SOURCE_INFO 0x0020 /** LocGpsLocation has valid "is indoor?" flag */ #define LOC_GPS_LOCATION_HAS_IS_INDOOR 0x0040 /** LocGpsLocation has valid floor number */ #define LOC_GPS_LOCATION_HAS_FLOOR_NUMBER 0x0080 /** LocGpsLocation has valid map URL*/ #define LOC_GPS_LOCATION_HAS_MAP_URL 0x0100 /** LocGpsLocation has valid map index */ #define LOC_GPS_LOCATION_HAS_MAP_INDEX 0x0200 #define GNSS_INVALID_JAMMER_IND 0x7FFFFFFF /** Sizes for indoor fields */ #define GPS_LOCATION_MAP_URL_SIZE 400 #define GPS_LOCATION_MAP_INDEX_SIZE 16 /** Position source is ULP */ #define ULP_LOCATION_IS_FROM_HYBRID 0x0001 /** Position source is GNSS only */ #define ULP_LOCATION_IS_FROM_GNSS 0x0002 /** Position is from a Geofence Breach Event */ #define ULP_LOCATION_IS_FROM_GEOFENCE 0X0004 /** Position is from Hardware FLP */ #define ULP_LOCATION_IS_FROM_HW_FLP 0x0008 /** Position is from NLP */ #define ULP_LOCATION_IS_FROM_NLP 0x0010 /** Position is from external DR solution*/ #define ULP_LOCATION_IS_FROM_EXT_DR 0X0020 /** Raw GNSS position fixes */ #define ULP_LOCATION_IS_FROM_GNSS_RAW 0X0040 typedef uint32_t LocSvInfoSource; /** SVinfo source is GNSS/DR */ #define ULP_SVINFO_IS_FROM_GNSS ((LocSvInfoSource)0x0001) /** Raw SVinfo from GNSS */ #define ULP_SVINFO_IS_FROM_DR ((LocSvInfoSource)0x0002) #define ULP_MIN_INTERVAL_INVALID 0xffffffff #define ULP_MAX_NMEA_STRING_SIZE 201 /*Emergency SUPL*/ #define LOC_GPS_NI_TYPE_EMERGENCY_SUPL 4 #define LOC_AGPS_CERTIFICATE_MAX_LENGTH 2000 #define LOC_AGPS_CERTIFICATE_MAX_SLOTS 10 /* TBM Threshold for tracking in background power mode : in millis */ #define TRACKING_TBM_THRESHOLD_MILLIS 480000 /** Maximum number of satellites in an ephemeris report. */ #define GNSS_EPHEMERIS_LIST_MAX_SIZE_V02 32 typedef uint32_t LocPosTechMask; #define LOC_POS_TECH_MASK_DEFAULT ((LocPosTechMask)0x00000000) #define LOC_POS_TECH_MASK_SATELLITE ((LocPosTechMask)0x00000001) #define LOC_POS_TECH_MASK_CELLID ((LocPosTechMask)0x00000002) #define LOC_POS_TECH_MASK_WIFI ((LocPosTechMask)0x00000004) #define LOC_POS_TECH_MASK_SENSORS ((LocPosTechMask)0x00000008) #define LOC_POS_TECH_MASK_REFERENCE_LOCATION ((LocPosTechMask)0x00000010) #define LOC_POS_TECH_MASK_INJECTED_COARSE_POSITION ((LocPosTechMask)0x00000020) #define LOC_POS_TECH_MASK_AFLT ((LocPosTechMask)0x00000040) #define LOC_POS_TECH_MASK_HYBRID ((LocPosTechMask)0x00000080) #define LOC_POS_TECH_MASK_PPE ((LocPosTechMask)0x00000100) enum loc_registration_mask_status { LOC_REGISTRATION_MASK_ENABLED, LOC_REGISTRATION_MASK_DISABLED, LOC_REGISTRATION_MASK_SET }; typedef enum { LOC_SUPPORTED_FEATURE_ODCPI_2_V02 = 0, /**< Support ODCPI version 2 feature */ LOC_SUPPORTED_FEATURE_WIFI_AP_DATA_INJECT_2_V02, /**< Support Wifi AP data inject version 2 feature */ LOC_SUPPORTED_FEATURE_DEBUG_NMEA_V02, /**< Support debug NMEA feature */ LOC_SUPPORTED_FEATURE_GNSS_ONLY_POSITION_REPORT, /**< Support GNSS Only position reports */ LOC_SUPPORTED_FEATURE_FDCL, /**< Support FDCL */ LOC_SUPPORTED_FEATURE_CONSTELLATION_ENABLEMENT_V02, /**< Support constellation enablement */ LOC_SUPPORTED_FEATURE_AGPM_V02, /**< Support AGPM feature */ LOC_SUPPORTED_FEATURE_XTRA_INTEGRITY, /**< Support XTRA integrity */ LOC_SUPPORTED_FEATURE_FDCL_2, /**< Support FDCL V2 */ LOC_SUPPORTED_FEATURE_LOCATION_PRIVACY, /**< Support location privacy */ LOC_SUPPORTED_FEATURE_NAVIC, /**< Support NAVIC constellation */ LOC_SUPPORTED_FEATURE_MEASUREMENTS_CORRECTION, /**< Support measurements correction */ LOC_SUPPORTED_FEATURE_ROBUST_LOCATION, /**< Support Robust Location feature */ LOC_SUPPORTED_FEATURE_EDGNSS /**< Support precise location dgnss */ } loc_supported_feature_enum; typedef struct { /** set to sizeof(UlpLocation) */ uint32_t size; LocGpsLocation gpsLocation; /* Provider indicator for HYBRID or GPS */ uint16_t position_source; LocPosTechMask tech_mask; bool unpropagatedPosition; } UlpLocation; typedef struct { /** set to sizeof(UlpNmea) */ uint32_t size; char nmea_str[ULP_MAX_NMEA_STRING_SIZE]; unsigned int len; } UlpNmea; /** AGPS type */ typedef int8_t AGpsExtType; #define LOC_AGPS_TYPE_INVALID -1 #define LOC_AGPS_TYPE_ANY 0 #define LOC_AGPS_TYPE_SUPL 1 #define LOC_AGPS_TYPE_C2K 2 #define LOC_AGPS_TYPE_WWAN_ANY 3 #define LOC_AGPS_TYPE_WIFI 4 #define LOC_AGPS_TYPE_SUPL_ES 5 /** SSID length */ #define SSID_BUF_SIZE (32+1) typedef int16_t AGpsBearerType; #define AGPS_APN_BEARER_INVALID 0 #define AGPS_APN_BEARER_IPV4 1 #define AGPS_APN_BEARER_IPV6 2 #define AGPS_APN_BEARER_IPV4V6 3 typedef uint32_t LocApnTypeMask; /**< Denotes APN type for Default/Internet traffic */ #define LOC_APN_TYPE_MASK_DEFAULT ((LocApnTypeMask)0x00000001) /**< Denotes APN type for IP Multimedia Subsystem */ #define LOC_APN_TYPE_MASK_IMS ((LocApnTypeMask)0x00000002) /**< Denotes APN type for Multimedia Messaging Service */ #define LOC_APN_TYPE_MASK_MMS ((LocApnTypeMask)0x00000004) /**< Denotes APN type for Dial Up Network */ #define LOC_APN_TYPE_MASK_DUN ((LocApnTypeMask)0x00000008) /**< Denotes APN type for Secure User Plane Location */ #define LOC_APN_TYPE_MASK_SUPL ((LocApnTypeMask)0x00000010) /**< Denotes APN type for High Priority Mobile Data */ #define LOC_APN_TYPE_MASK_HIPRI ((LocApnTypeMask)0x00000020) /**< Denotes APN type for over the air administration */ #define LOC_APN_TYPE_MASK_FOTA ((LocApnTypeMask)0x00000040) /**< Denotes APN type for Carrier Branded Services */ #define LOC_APN_TYPE_MASK_CBS ((LocApnTypeMask)0x00000080) /**< Denotes APN type for Initial Attach */ #define LOC_APN_TYPE_MASK_IA ((LocApnTypeMask)0x00000100) /**< Denotes APN type for emergency */ #define LOC_APN_TYPE_MASK_EMERGENCY ((LocApnTypeMask)0x00000200) typedef uint32_t AGpsTypeMask; #define AGPS_ATL_TYPE_SUPL ((AGpsTypeMask)0x00000001) #define AGPS_ATL_TYPE_SUPL_ES ((AGpsTypeMask)0x00000002) #define AGPS_ATL_TYPE_WWAN ((AGpsTypeMask)0x00000004) typedef struct { void* statusV4Cb; AGpsTypeMask atlType; } AgpsCbInfo; typedef struct { void* visibilityControlCb; void* isInEmergencySession; } NfwCbInfo; /** GPS extended callback structure. */ typedef struct { /** set to sizeof(LocGpsCallbacks) */ uint32_t size; loc_gps_set_capabilities set_capabilities_cb; loc_gps_acquire_wakelock acquire_wakelock_cb; loc_gps_release_wakelock release_wakelock_cb; loc_gps_create_thread create_thread_cb; loc_gps_request_utc_time request_utc_time_cb; } GpsExtCallbacks; /** Callback to report the xtra server url to the client. * The client should use this url when downloading xtra unless overwritten * in the gps.conf file */ typedef void (* report_xtra_server)(const char*, const char*, const char*); /** Callback structure for the XTRA interface. */ typedef struct { loc_gps_xtra_download_request download_request_cb; loc_gps_create_thread create_thread_cb; report_xtra_server report_xtra_server_cb; } GpsXtraExtCallbacks; /** Represents the status of AGPS. */ typedef struct { /** set to sizeof(AGpsExtStatus) */ uint32_t size; AGpsExtType type; LocAGpsStatusValue status; uint32_t ipv4_addr; struct sockaddr_storage addr; char ssid[SSID_BUF_SIZE]; char password[SSID_BUF_SIZE]; } AGpsExtStatus; /** Callback with AGPS status information. * Can only be called from a thread created by create_thread_cb. */ typedef void (* agps_status_extended)(AGpsExtStatus* status); /** Callback structure for the AGPS interface. */ typedef struct { agps_status_extended status_cb; loc_gps_create_thread create_thread_cb; } AGpsExtCallbacks; typedef void (*loc_ni_notify_callback)(LocGpsNiNotification *notification, bool esEnalbed); /** GPS NI callback structure. */ typedef struct { /** * Sends the notification request from HAL to GPSLocationProvider. */ loc_ni_notify_callback notify_cb; } GpsNiExtCallbacks; typedef enum loc_server_type { LOC_AGPS_CDMA_PDE_SERVER, LOC_AGPS_CUSTOM_PDE_SERVER, LOC_AGPS_MPC_SERVER, LOC_AGPS_SUPL_SERVER, LOC_AGPS_MO_SUPL_SERVER } LocServerType; typedef enum loc_position_mode_type { LOC_POSITION_MODE_INVALID = -1, LOC_POSITION_MODE_STANDALONE = 0, LOC_POSITION_MODE_MS_BASED, LOC_POSITION_MODE_MS_ASSISTED, LOC_POSITION_MODE_RESERVED_1, LOC_POSITION_MODE_RESERVED_2, LOC_POSITION_MODE_RESERVED_3, LOC_POSITION_MODE_RESERVED_4, LOC_POSITION_MODE_RESERVED_5 } LocPositionMode; /** * @brief Minimum allowed value for fix interval. * * This value is a sanity limit in GPS framework. The hardware has own internal * limits that may not match this value * * @sa GPS_DEFAULT_FIX_INTERVAL_MS */ #define GPS_MIN_POSSIBLE_FIX_INTERVAL_MS 100 /** * @brief Default value for fix interval. * * This value is used by default whenever appropriate. * * @sa GPS_MIN_POSSIBLE_FIX_INTERVAL_MS */ #define GPS_DEFAULT_FIX_INTERVAL_MS 1000 /** Flags to indicate which values are valid in a GpsLocationExtended. */ typedef uint64_t GpsLocationExtendedFlags; /** GpsLocationExtended has valid pdop, hdop, vdop. */ #define GPS_LOCATION_EXTENDED_HAS_DOP 0x0001 /** GpsLocationExtended has valid altitude mean sea level. */ #define GPS_LOCATION_EXTENDED_HAS_ALTITUDE_MEAN_SEA_LEVEL 0x0002 /** UlpLocation has valid magnetic deviation. */ #define GPS_LOCATION_EXTENDED_HAS_MAG_DEV 0x0004 /** UlpLocation has valid mode indicator. */ #define GPS_LOCATION_EXTENDED_HAS_MODE_IND 0x0008 /** GpsLocationExtended has valid vertical uncertainty */ #define GPS_LOCATION_EXTENDED_HAS_VERT_UNC 0x0010 /** GpsLocationExtended has valid speed uncertainty */ #define GPS_LOCATION_EXTENDED_HAS_SPEED_UNC 0x0020 /** GpsLocationExtended has valid heading uncertainty */ #define GPS_LOCATION_EXTENDED_HAS_BEARING_UNC 0x0040 /** GpsLocationExtended has valid horizontal reliability */ #define GPS_LOCATION_EXTENDED_HAS_HOR_RELIABILITY 0x0080 /** GpsLocationExtended has valid vertical reliability */ #define GPS_LOCATION_EXTENDED_HAS_VERT_RELIABILITY 0x0100 /** GpsLocationExtended has valid Horizontal Elliptical Uncertainty (Semi-Major Axis) */ #define GPS_LOCATION_EXTENDED_HAS_HOR_ELIP_UNC_MAJOR 0x0200 /** GpsLocationExtended has valid Horizontal Elliptical Uncertainty (Semi-Minor Axis) */ #define GPS_LOCATION_EXTENDED_HAS_HOR_ELIP_UNC_MINOR 0x0400 /** GpsLocationExtended has valid Elliptical Horizontal Uncertainty Azimuth */ #define GPS_LOCATION_EXTENDED_HAS_HOR_ELIP_UNC_AZIMUTH 0x0800 /** GpsLocationExtended has valid gnss sv used in position data */ #define GPS_LOCATION_EXTENDED_HAS_GNSS_SV_USED_DATA 0x1000 /** GpsLocationExtended has valid navSolutionMask */ #define GPS_LOCATION_EXTENDED_HAS_NAV_SOLUTION_MASK 0x2000 /** GpsLocationExtended has valid LocPosTechMask */ #define GPS_LOCATION_EXTENDED_HAS_POS_TECH_MASK 0x4000 /** GpsLocationExtended has valid LocSvInfoSource */ #define GPS_LOCATION_EXTENDED_HAS_SV_SOURCE_INFO 0x8000 /** GpsLocationExtended has valid position dynamics data */ #define GPS_LOCATION_EXTENDED_HAS_POS_DYNAMICS_DATA 0x10000 /** GpsLocationExtended has GPS Time */ #define GPS_LOCATION_EXTENDED_HAS_GPS_TIME 0x20000 /** GpsLocationExtended has Extended Dilution of Precision */ #define GPS_LOCATION_EXTENDED_HAS_EXT_DOP 0x40000 /** GpsLocationExtended has North standard deviation */ #define GPS_LOCATION_EXTENDED_HAS_NORTH_STD_DEV 0x80000 /** GpsLocationExtended has East standard deviation*/ #define GPS_LOCATION_EXTENDED_HAS_EAST_STD_DEV 0x100000 /** GpsLocationExtended has North Velocity */ #define GPS_LOCATION_EXTENDED_HAS_NORTH_VEL 0x200000 /** GpsLocationExtended has East Velocity */ #define GPS_LOCATION_EXTENDED_HAS_EAST_VEL 0x400000 /** GpsLocationExtended has up Velocity */ #define GPS_LOCATION_EXTENDED_HAS_UP_VEL 0x800000 /** GpsLocationExtended has North Velocity Uncertainty */ #define GPS_LOCATION_EXTENDED_HAS_NORTH_VEL_UNC 0x1000000 /** GpsLocationExtended has East Velocity Uncertainty */ #define GPS_LOCATION_EXTENDED_HAS_EAST_VEL_UNC 0x2000000 /** GpsLocationExtended has up Velocity Uncertainty */ #define GPS_LOCATION_EXTENDED_HAS_UP_VEL_UNC 0x4000000 /** GpsLocationExtended has Clock Bias */ #define GPS_LOCATION_EXTENDED_HAS_CLOCK_BIAS 0x8000000 /** GpsLocationExtended has Clock Bias std deviation*/ #define GPS_LOCATION_EXTENDED_HAS_CLOCK_BIAS_STD_DEV 0x10000000 /** GpsLocationExtended has Clock drift*/ #define GPS_LOCATION_EXTENDED_HAS_CLOCK_DRIFT 0x20000000 /** GpsLocationExtended has Clock drift std deviation**/ #define GPS_LOCATION_EXTENDED_HAS_CLOCK_DRIFT_STD_DEV 0x40000000 /** GpsLocationExtended has leap seconds **/ #define GPS_LOCATION_EXTENDED_HAS_LEAP_SECONDS 0x80000000 /** GpsLocationExtended has time uncertainty **/ #define GPS_LOCATION_EXTENDED_HAS_TIME_UNC 0x100000000 /** GpsLocationExtended has heading rate **/ #define GPS_LOCATION_EXTENDED_HAS_HEADING_RATE 0x200000000 /** GpsLocationExtended has multiband signals **/ #define GPS_LOCATION_EXTENDED_HAS_MULTIBAND 0x400000000 /** GpsLocationExtended has sensor calibration confidence */ #define GPS_LOCATION_EXTENDED_HAS_CALIBRATION_CONFIDENCE 0x800000000 /** GpsLocationExtended has sensor calibration status */ #define GPS_LOCATION_EXTENDED_HAS_CALIBRATION_STATUS 0x1000000000 /** GpsLocationExtended has the engine type that produced this * position, the bit mask will only be set when there are two * or more position engines running in the system */ #define GPS_LOCATION_EXTENDED_HAS_OUTPUT_ENG_TYPE 0x2000000000 /** GpsLocationExtended has the engine mask that indicates the * set of engines contribute to the fix. */ #define GPS_LOCATION_EXTENDED_HAS_OUTPUT_ENG_MASK 0x4000000000 /** GpsLocationExtended has dgnss correction source */ #define GPS_LOCATION_EXTENDED_HAS_DGNSS_CORRECTION_SOURCE_TYPE 0x8000000000 /** GpsLocationExtended has dgnss correction source ID */ #define GPS_LOCATION_EXTENDED_HAS_DGNSS_CORRECTION_SOURCE_ID 0x10000000000 /** GpsLocationExtended has dgnss constellation usage */ #define GPS_LOCATION_EXTENDED_HAS_DGNSS_CONSTELLATION_USAGE 0x20000000000 /** GpsLocationExtended has dgnss ref station Id */ #define GPS_LOCATION_EXTENDED_HAS_DGNSS_REF_STATION_ID 0x40000000000 /** GpsLocationExtended has dgnss data age */ #define GPS_LOCATION_EXTENDED_HAS_DGNSS_DATA_AGE 0x80000000000 /** GpsLocationExtended has the conformityIndex computed from * robust location feature. */ #define GPS_LOCATION_EXTENDED_HAS_CONFORMITY_INDEX 0x100000000000 /** GpsLocationExtended has the llaVRPased. */ #define GPS_LOCATION_EXTENDED_HAS_LLA_VRP_BASED 0x200000000000 /** GpsLocationExtended has the velocityVRPased. */ #define GPS_LOCATION_EXTENDED_HAS_ENU_VELOCITY_LLA_VRP_BASED 0x400000000000 #define GPS_LOCATION_EXTENDED_HAS_UPPER_TRIANGLE_FULL_COV_MATRIX 0x800000000000 #define GPS_LOCATION_EXTENDED_HAS_DR_SOLUTION_STATUS_MASK 0x1000000000000 typedef uint32_t LocNavSolutionMask; /* Bitmask to specify whether SBAS ionospheric correction is used */ #define LOC_NAV_MASK_SBAS_CORRECTION_IONO ((LocNavSolutionMask)0x0001) /* Bitmask to specify whether SBAS fast correction is used */ #define LOC_NAV_MASK_SBAS_CORRECTION_FAST ((LocNavSolutionMask)0x0002) /**< Bitmask to specify whether SBAS long-tem correction is used */ #define LOC_NAV_MASK_SBAS_CORRECTION_LONG ((LocNavSolutionMask)0x0004) /**< Bitmask to specify whether SBAS integrity information is used */ #define LOC_NAV_MASK_SBAS_INTEGRITY ((LocNavSolutionMask)0x0008) /**< Bitmask to specify whether Position Report is DGNSS corrected */ #define LOC_NAV_MASK_DGNSS_CORRECTION ((LocNavSolutionMask)0x0010) /**< Bitmask to specify whether Position Report is RTK corrected */ #define LOC_NAV_MASK_RTK_CORRECTION ((LocNavSolutionMask)0x0020) /**< Bitmask to specify whether Position Report is PPP corrected */ #define LOC_NAV_MASK_PPP_CORRECTION ((LocNavSolutionMask)0x0040) /**< Bitmask to specify whether Position Report is RTK fixed corrected */ #define LOC_NAV_MASK_RTK_FIXED_CORRECTION ((LocNavSolutionMask)0x0080) /**< Bitmask specifying whether only SBAS corrected SVs are used for the fix */ #define LOC_NAV_MASK_ONLY_SBAS_CORRECTED_SV_USED ((LocNavSolutionMask)0x0100) typedef uint32_t LocPosDataMask; /* Bitmask to specify whether Navigation data has Forward Acceleration */ #define LOC_NAV_DATA_HAS_LONG_ACCEL ((LocPosDataMask)0x0001) /* Bitmask to specify whether Navigation data has Sideward Acceleration */ #define LOC_NAV_DATA_HAS_LAT_ACCEL ((LocPosDataMask)0x0002) /* Bitmask to specify whether Navigation data has Vertical Acceleration */ #define LOC_NAV_DATA_HAS_VERT_ACCEL ((LocPosDataMask)0x0004) /* Bitmask to specify whether Navigation data has Heading Rate */ #define LOC_NAV_DATA_HAS_YAW_RATE ((LocPosDataMask)0x0008) /* Bitmask to specify whether Navigation data has Body pitch */ #define LOC_NAV_DATA_HAS_PITCH ((LocPosDataMask)0x0010) /* Bitmask to specify whether Navigation data has Forward Acceleration Unc */ #define LOC_NAV_DATA_HAS_LONG_ACCEL_UNC ((LocPosDataMask)0x0020) /* Bitmask to specify whether Navigation data has Sideward Acceleration Unc*/ #define LOC_NAV_DATA_HAS_LAT_ACCEL_UNC ((LocPosDataMask)0x0040) /* Bitmask to specify whether Navigation data has Vertical Acceleration Unc*/ #define LOC_NAV_DATA_HAS_VERT_ACCEL_UNC ((LocPosDataMask)0x0080) /* Bitmask to specify whether Navigation data has Heading Rate Unc*/ #define LOC_NAV_DATA_HAS_YAW_RATE_UNC ((LocPosDataMask)0x0100) /* Bitmask to specify whether Navigation data has Body pitch Unc*/ #define LOC_NAV_DATA_HAS_PITCH_UNC ((LocPosDataMask)0x0200) typedef uint32_t GnssAdditionalSystemInfoMask; /* Bitmask to specify whether Tauc is valid */ #define GNSS_ADDITIONAL_SYSTEMINFO_HAS_TAUC ((GnssAdditionalSystemInfoMask)0x0001) /* Bitmask to specify whether leapSec is valid */ #define GNSS_ADDITIONAL_SYSTEMINFO_HAS_LEAP_SEC ((GnssAdditionalSystemInfoMask)0x0002) /** GPS PRN Range */ #define GPS_SV_PRN_MIN 1 #define GPS_SV_PRN_MAX 32 #define GLO_SV_PRN_MIN 65 #define GLO_SV_PRN_MAX 96 #define SBAS_SV_PRN_MIN 120 #define SBAS_SV_PRN_MAX 191 #define QZSS_SV_PRN_MIN 193 #define QZSS_SV_PRN_MAX 197 #define BDS_SV_PRN_MIN 201 #define BDS_SV_PRN_MAX 263 #define GAL_SV_PRN_MIN 301 #define GAL_SV_PRN_MAX 336 #define NAVIC_SV_PRN_MIN 401 #define NAVIC_SV_PRN_MAX 414 /* Checking svIdOneBase can be set to the corresponding bit in mask */ #define svFitsMask(mask, svIdOneBase) \ ((svIdOneBase) >= 1 && (svIdOneBase) <= (sizeof(mask) << 3)) /* Setting svIdOneBase specific bit in the mask if the bit offset fits */ #define setSvMask(mask, svIdOneBase) \ if (svFitsMask(mask, svIdOneBase)) mask |= (1ULL << ((svIdOneBase) - 1)) #define isValInRangeInclusive(val, min, max) ((val) >= (min) && (val) <= (max)) typedef enum { LOC_RELIABILITY_NOT_SET = 0, LOC_RELIABILITY_VERY_LOW = 1, LOC_RELIABILITY_LOW = 2, LOC_RELIABILITY_MEDIUM = 3, LOC_RELIABILITY_HIGH = 4 }LocReliability; typedef enum { LOC_IN_EMERGENCY_UNKNOWN = 0, LOC_IN_EMERGENCY_SET = 1, LOC_IN_EMERGENCY_NOT_SET = 2 }LocInEmergency; typedef struct { struct timespec32_t apTimeStamp; /*boottime received from pps-ktimer*/ float apTimeStampUncertaintyMs; /* timestamp uncertainty in milli seconds */ }Gnss_ApTimeStampStructType; typedef struct { uint64_t gps_sv_used_ids_mask; uint64_t glo_sv_used_ids_mask; uint64_t gal_sv_used_ids_mask; uint64_t bds_sv_used_ids_mask; uint64_t qzss_sv_used_ids_mask; uint64_t navic_sv_used_ids_mask; } GnssSvUsedInPosition; typedef struct { uint64_t gps_l1ca_sv_used_ids_mask; // GPS L1CA uint64_t gps_l1c_sv_used_ids_mask; // GPS L1C uint64_t gps_l2_sv_used_ids_mask; // GPS L2 uint64_t gps_l5_sv_used_ids_mask; // GPS L5 uint64_t glo_g1_sv_used_ids_mask; // GLO G1 uint64_t glo_g2_sv_used_ids_mask; // GLO G2 uint64_t gal_e1_sv_used_ids_mask; // GAL E1 uint64_t gal_e5a_sv_used_ids_mask; // GAL E5A uint64_t gal_e5b_sv_used_ids_mask; // GAL E5B uint64_t bds_b1i_sv_used_ids_mask; // BDS B1I uint64_t bds_b1c_sv_used_ids_mask; // BDS B1C uint64_t bds_b2i_sv_used_ids_mask; // BDS B2I uint64_t bds_b2ai_sv_used_ids_mask; // BDS B2AI uint64_t qzss_l1ca_sv_used_ids_mask; // QZSS L1CA uint64_t qzss_l1s_sv_used_ids_mask; // QZSS L1S uint64_t qzss_l2_sv_used_ids_mask; // QZSS L2 uint64_t qzss_l5_sv_used_ids_mask; // QZSS L5 uint64_t sbas_l1_sv_used_ids_mask; // SBAS L1 uint64_t bds_b2aq_sv_used_ids_mask; // BDS B2AQ } GnssSvMbUsedInPosition; /* Body Frame parameters */ typedef struct { /** Contains Body frame LocPosDataMask bits. */ uint32_t bodyFrameDatamask; /* Forward Acceleration in body frame (m/s2)*/ float longAccel; /** Uncertainty of Forward Acceleration in body frame */ float longAccelUnc; /* Sideward Acceleration in body frame (m/s2)*/ float latAccel; /** Uncertainty of Side-ward Acceleration in body frame */ float latAccelUnc; /* Vertical Acceleration in body frame (m/s2)*/ float vertAccel; /** Uncertainty of Vertical Acceleration in body frame */ float vertAccelUnc; /* Heading Rate (Radians/second) */ float yawRate; /** Uncertainty of Heading Rate */ float yawRateUnc; /* Body pitch (Radians) */ float pitch; /** Uncertainty of Body pitch */ float pitchRadUnc; }LocPositionDynamics; typedef struct { /** Position dilution of precision. Range: 1 (highest accuracy) to 50 (lowest accuracy) */ float PDOP; /** Horizontal dilution of precision. Range: 1 (highest accuracy) to 50 (lowest accuracy) */ float HDOP; /** Vertical dilution of precision. Range: 1 (highest accuracy) to 50 (lowest accuracy) */ float VDOP; /** geometric dilution of precision. Range: 1 (highest accuracy) to 50 (lowest accuracy) */ float GDOP; /** time dilution of precision. Range: 1 (highest accuracy) to 50 (lowest accuracy) */ float TDOP; }LocExtDOP; /* GPS Time structure */ typedef struct { /**< Current GPS week as calculated from midnight, Jan. 6, 1980. \n - Units: Weeks */ uint16_t gpsWeek; /**< Amount of time into the current GPS week. \n - Units: Milliseconds */ uint32_t gpsTimeOfWeekMs; }GPSTimeStruct; typedef uint8_t CarrierPhaseAmbiguityType; #define CARRIER_PHASE_AMBIGUITY_RESOLUTION_NONE ((CarrierPhaseAmbiguityType)0) #define CARRIER_PHASE_AMBIGUITY_RESOLUTION_FLOAT ((CarrierPhaseAmbiguityType)1) #define CARRIER_PHASE_AMBIGUITY_RESOLUTION_FIXED ((CarrierPhaseAmbiguityType)2) typedef enum { LOC_DGNSS_CORR_SOURCE_TYPE_INVALID = 0, /**< Invalid DGNSS correction source type \n */ LOC_DGNSS_CORR_SOURCE_TYPE_RTCM = 1, /**< DGNSS correction source type RTCM \n */ LOC_DGNSS_CORR_SOURCE_TYPE_3GPP = 2, /**< DGNSS correction source type 3GPP \n */ }LocDgnssCorrectionSourceType; typedef uint16_t GnssMeasUsageStatusBitMask; /** Used in fix */ #define GNSS_MEAS_USED_IN_PVT ((GnssMeasUsageStatusBitMask)0x00000001ul) /** Measurement is Bad */ #define GNSS_MEAS_USAGE_STATUS_BAD_MEAS ((GnssMeasUsageStatusBitMask)0x00000002ul) /** Measurement has too low C/N */ #define GNSS_MEAS_USAGE_STATUS_CNO_TOO_LOW ((GnssMeasUsageStatusBitMask)0x00000004ul) /** Measurement has too low elevation */ #define GNSS_MEAS_USAGE_STATUS_ELEVATION_TOO_LOW ((GnssMeasUsageStatusBitMask)0x00000008ul) /** No ephemeris available for this measurement */ #define GNSS_MEAS_USAGE_STATUS_NO_EPHEMERIS ((GnssMeasUsageStatusBitMask)0x00000010ul) /** No corrections available for the measurement */ #define GNSS_MEAS_USAGE_STATUS_NO_CORRECTIONS ((GnssMeasUsageStatusBitMask)0x00000020ul) /** Corrections has timed out for the measurement */ #define GNSS_MEAS_USAGE_STATUS_CORRECTION_TIMEOUT ((GnssMeasUsageStatusBitMask)0x00000040ul) /** Measurement is unhealthy */ #define GNSS_MEAS_USAGE_STATUS_UNHEALTHY ((GnssMeasUsageStatusBitMask)0x00000080ul) /** Configuration is disabled for this measurement */ #define GNSS_MEAS_USAGE_STATUS_CONFIG_DISABLED ((GnssMeasUsageStatusBitMask)0x00000100ul) /** Measurement not used for other reasons */ #define GNSS_MEAS_USAGE_STATUS_OTHER ((GnssMeasUsageStatusBitMask)0x00000200ul) /** Flags to indicate valid fields in epMeasUsageInfo */ typedef uint16_t GnssMeasUsageInfoValidityMask; #define GNSS_PSEUDO_RANGE_RESIDUAL_VALID ((GnssMeasUsageInfoValidityMask)0x00000001ul) #define GNSS_DOPPLER_RESIDUAL_VALID ((GnssMeasUsageInfoValidityMask)0x00000002ul) #define GNSS_CARRIER_PHASE_RESIDUAL_VALID ((GnssMeasUsageInfoValidityMask)0x00000004ul) #define GNSS_CARRIER_PHASE_AMBIGUITY_TYPE_VALID ((GnssMeasUsageInfoValidityMask)0x00000008ul) typedef uint16_t GnssSvPolyStatusMask; #define GNSS_SV_POLY_SRC_ALM_CORR_V02 ((GnssSvPolyStatusMask)0x01) #define GNSS_SV_POLY_GLO_STR4_V02 ((GnssSvPolyStatusMask)0x02) #define GNSS_SV_POLY_DELETE_V02 ((GnssSvPolyStatusMask)0x04) #define GNSS_SV_POLY_SRC_GAL_FNAV_OR_INAV_V02 ((GnssSvPolyStatusMask)0x08) typedef uint16_t GnssSvPolyStatusMaskValidity; #define GNSS_SV_POLY_SRC_ALM_CORR_VALID_V02 ((GnssSvPolyStatusMaskValidity)0x01) #define GNSS_SV_POLY_GLO_STR4_VALID_V02 ((GnssSvPolyStatusMaskValidity)0x02) #define GNSS_SV_POLY_DELETE_VALID_V02 ((GnssSvPolyStatusMaskValidity)0x04) #define GNSS_SV_POLY_SRC_GAL_FNAV_OR_INAV_VALID_V02 ((GnssSvPolyStatusMaskValidity)0x08) typedef struct { /** Specifies GNSS signal type Mandatory Field*/ GnssSignalTypeMask gnssSignalType; /** Specifies GNSS Constellation Type Mandatory Field*/ Gnss_LocSvSystemEnumType gnssConstellation; /** Unique SV Identifier. * SV Range for supported constellation is specified as below: * - For GPS: 1 to 32 * - For GLONASS: 65 to 96 * - For SBAS: 120 to 158 and 183 to 191 * - For QZSS: 193 to 197 * - For BDS: 201 to 263 * - For GAL: 301 to 336 * - For NAVIC: 401 to 414 */ uint16_t gnssSvId; /** GLONASS frequency number + 7. Valid only for a GLONASS system and is to be ignored for all other systems. Range: 1 to 14 */ uint8_t gloFrequency; /** Carrier phase ambiguity type. */ CarrierPhaseAmbiguityType carrierPhaseAmbiguityType; /** Validity mask */ GnssMeasUsageStatusBitMask measUsageStatusMask; /** Specifies measurement usage status Mandatory Field*/ GnssMeasUsageInfoValidityMask validityMask; /** Computed pseudorange residual. Unit: Meters */ float pseudorangeResidual; /** Computed doppler residual. Unit: Meters/sec*/ float dopplerResidual; /** Computed carrier phase residual. Unit: Cycles*/ float carrierPhaseResidual; /** Carrier phase ambiguity value. Unit: Cycles*/ float carrierPhasAmbiguity; } GpsMeasUsageInfo; #define COV_MATRIX_SIZE 12 /** Represents gps location extended. */ typedef struct { /** set to sizeof(GpsLocationExtended) */ uint32_t size; /** Contains GpsLocationExtendedFlags bits. */ uint64_t flags; /** Contains the Altitude wrt mean sea level */ float altitudeMeanSeaLevel; /** Contains Position Dilusion of Precision. */ float pdop; /** Contains Horizontal Dilusion of Precision. */ float hdop; /** Contains Vertical Dilusion of Precision. */ float vdop; /** Contains Magnetic Deviation. */ float magneticDeviation; /** vertical uncertainty in meters */ float vert_unc; /** speed uncertainty in m/s */ float speed_unc; /** heading uncertainty in degrees (0 to 359.999) */ float bearing_unc; /** horizontal reliability. */ LocReliability horizontal_reliability; /** vertical reliability. */ LocReliability vertical_reliability; /* Horizontal Elliptical Uncertainty (Semi-Major Axis) */ float horUncEllipseSemiMajor; /* Horizontal Elliptical Uncertainty (Semi-Minor Axis) */ float horUncEllipseSemiMinor; /* Elliptical Horizontal Uncertainty Azimuth */ float horUncEllipseOrientAzimuth; Gnss_ApTimeStampStructType timeStamp; /** Gnss sv used in position data */ GnssSvUsedInPosition gnss_sv_used_ids; /** Gnss sv used in position data for multiband */ GnssSvMbUsedInPosition gnss_mb_sv_used_ids; /** Nav solution mask to indicate sbas corrections */ LocNavSolutionMask navSolutionMask; /** Position technology used in computing this fix */ LocPosTechMask tech_mask; /** SV Info source used in computing this fix */ LocSvInfoSource sv_source; /** Body Frame Dynamics: 4wayAcceleration and pitch set with validity */ GnssLocationPositionDynamics bodyFrameData; /** GPS Time */ GPSTimeStruct gpsTime; GnssSystemTime gnssSystemTime; /** Dilution of precision associated with this position*/ LocExtDOP extDOP; /** North standard deviation. Unit: Meters */ float northStdDeviation; /** East standard deviation. Unit: Meters */ float eastStdDeviation; /** North Velocity. Unit: Meters/sec */ float northVelocity; /** East Velocity. Unit: Meters/sec */ float eastVelocity; /** Up Velocity. Unit: Meters/sec */ float upVelocity; /** North Velocity standard deviation. Unit: Meters/sec */ float northVelocityStdDeviation; /** East Velocity standard deviation. Unit: Meters/sec */ float eastVelocityStdDeviation; /** Up Velocity standard deviation Unit: Meters/sec */ float upVelocityStdDeviation; /** Estimated clock bias. Unit: Nano seconds */ float clockbiasMeter; /** Estimated clock bias std deviation. Unit: Nano seconds */ float clockBiasStdDeviationMeter; /** Estimated clock drift. Unit: Meters/sec */ float clockDrift; /** Estimated clock drift std deviation. Unit: Meters/sec */ float clockDriftStdDeviation; /** Number of valid reference stations. Range:[0-4] */ uint8_t numValidRefStations; /** Reference station(s) number */ uint16_t referenceStation[4]; /** Number of measurements received for use in fix. Shall be used as maximum index in-to svUsageInfo[]. Set to 0, if svUsageInfo reporting is not supported. Range: 0-EP_GNSS_MAX_MEAS */ uint8_t numOfMeasReceived; /** Measurement Usage Information */ GpsMeasUsageInfo measUsageInfo[GNSS_SV_MAX]; /** Leap Seconds */ uint8_t leapSeconds; /** Time uncertainty in milliseconds */ float timeUncMs; /** Heading Rate is in NED frame. Range: 0 to 359.999. 946 Unit: Degrees per Seconds */ float headingRateDeg; /** Sensor calibration confidence percent. Range: 0 - 100 */ uint8_t calibrationConfidence; DrCalibrationStatusMask calibrationStatus; /** location engine type. When the fix. when the type is set to LOC_ENGINE_SRC_FUSED, the fix is the propagated/aggregated reports from all engines running on the system (e.g.: DR/SPE/PPE). To check which location engine contributes to the fused output, check for locOutputEngMask. */ LocOutputEngineType locOutputEngType; /** when loc output eng type is set to fused, this field indicates the set of engines contribute to the fix. */ PositioningEngineMask locOutputEngMask; /** DGNSS Correction Source for position report: RTCM, 3GPP * etc. */ LocDgnssCorrectionSourceType dgnssCorrectionSourceType; /** If DGNSS is used, the SourceID is a 32bit number identifying * the DGNSS source ID */ uint32_t dgnssCorrectionSourceID; /** If DGNSS is used, which constellation was DGNSS used for to * produce the pos report. */ GnssConstellationTypeMask dgnssConstellationUsage; /** If DGNSS is used, DGNSS Reference station ID used for * position report */ uint16_t dgnssRefStationId; /** If DGNSS is used, DGNSS data age in milli-seconds */ uint32_t dgnssDataAgeMsec; /** When robust location is enabled, this field * will how well the various input data considered for * navigation solution conform to expectations. * Range: 0 (least conforming) to 1 (most conforming) */ float conformityIndex; GnssLocationPositionDynamicsExt bodyFrameDataExt; /** VRR-based latitude/longitude/altitude */ LLAInfo llaVRPBased; /** VRR-based east, north, and up velocity */ float enuVelocityVRPBased[3]; /** Upper triangle elements of full matrix of position and velocity estimate in ECEF The full covariance matrix of PPE position (x, y, z in ECEF, in the unit of meters) estimate is a 3x3 matrix | px,x px,y px,z | | py,x py,y py,z | | pz,x pz,y pz,z | The full covariance matrix of PPE velocity (vx,vy, vz in ECEF, in the unit of m/s) estimate is a 3x3 matrix | pvx,vx pvx,vy pvx,vz | | pvy,vx pvy,vy pvy,vz | | pvz,vx pvz,vy pvz,vz | upperTriangleFullCovMatrix = { px,x, px,y, px,z, py,y, py,z, pz,z, pvx,vx, pvx,vy, pvx,vz, pvy,vy, pvy,vz, pvz,vz} Uint: px,x, px,y, px,z, py,y, py,z, pz,z is in meter pvx,vx, pvx,vy, pvx,vz, pvy,vy, pvy,vz, pvz,vz is in meters/seconds */ float upperTriangleFullCovMatrix[COV_MATRIX_SIZE]; DrSolutionStatusMask drSolutionStatusMask; } GpsLocationExtended; enum loc_sess_status { LOC_SESS_SUCCESS, LOC_SESS_INTERMEDIATE, LOC_SESS_FAILURE }; // struct that contains complete position info from engine typedef struct { UlpLocation location; GpsLocationExtended locationExtended; enum loc_sess_status sessionStatus; } EngineLocationInfo; // Nmea sentence types mask typedef uint32_t NmeaSentenceTypesMask; #define LOC_NMEA_MASK_GGA_V02 ((NmeaSentenceTypesMask)0x00000001) /**< Enable GGA type */ #define LOC_NMEA_MASK_RMC_V02 ((NmeaSentenceTypesMask)0x00000002) /**< Enable RMC type */ #define LOC_NMEA_MASK_GSV_V02 ((NmeaSentenceTypesMask)0x00000004) /**< Enable GSV type */ #define LOC_NMEA_MASK_GSA_V02 ((NmeaSentenceTypesMask)0x00000008) /**< Enable GSA type */ #define LOC_NMEA_MASK_VTG_V02 ((NmeaSentenceTypesMask)0x00000010) /**< Enable VTG type */ #define LOC_NMEA_MASK_PQXFI_V02 ((NmeaSentenceTypesMask)0x00000020) /**< Enable PQXFI type */ #define LOC_NMEA_MASK_PSTIS_V02 ((NmeaSentenceTypesMask)0x00000040) /**< Enable PSTIS type */ #define LOC_NMEA_MASK_GLGSV_V02 ((NmeaSentenceTypesMask)0x00000080) /**< Enable GLGSV type */ #define LOC_NMEA_MASK_GNGSA_V02 ((NmeaSentenceTypesMask)0x00000100) /**< Enable GNGSA type */ #define LOC_NMEA_MASK_GNGNS_V02 ((NmeaSentenceTypesMask)0x00000200) /**< Enable GNGNS type */ #define LOC_NMEA_MASK_GARMC_V02 ((NmeaSentenceTypesMask)0x00000400) /**< Enable GARMC type */ #define LOC_NMEA_MASK_GAGSV_V02 ((NmeaSentenceTypesMask)0x00000800) /**< Enable GAGSV type */ #define LOC_NMEA_MASK_GAGSA_V02 ((NmeaSentenceTypesMask)0x00001000) /**< Enable GAGSA type */ #define LOC_NMEA_MASK_GAVTG_V02 ((NmeaSentenceTypesMask)0x00002000) /**< Enable GAVTG type */ #define LOC_NMEA_MASK_GAGGA_V02 ((NmeaSentenceTypesMask)0x00004000) /**< Enable GAGGA type */ #define LOC_NMEA_MASK_PQGSA_V02 ((NmeaSentenceTypesMask)0x00008000) /**< Enable PQGSA type */ #define LOC_NMEA_MASK_PQGSV_V02 ((NmeaSentenceTypesMask)0x00010000) /**< Enable PQGSV type */ #define LOC_NMEA_MASK_DEBUG_V02 ((NmeaSentenceTypesMask)0x00020000) /**< Enable DEBUG type */ #define LOC_NMEA_MASK_GPDTM_V02 ((NmeaSentenceTypesMask)0x00040000) /**< Enable GPDTM type */ #define LOC_NMEA_MASK_GNGGA_V02 ((NmeaSentenceTypesMask)0x00080000) /**< Enable GNGGA type */ #define LOC_NMEA_MASK_GNRMC_V02 ((NmeaSentenceTypesMask)0x00100000) /**< Enable GNRMC type */ #define LOC_NMEA_MASK_GNVTG_V02 ((NmeaSentenceTypesMask)0x00200000) /**< Enable GNVTG type */ #define LOC_NMEA_MASK_GAGNS_V02 ((NmeaSentenceTypesMask)0x00400000) /**< Enable GAGNS type */ #define LOC_NMEA_MASK_GBGGA_V02 ((NmeaSentenceTypesMask)0x00800000) /**< Enable GBGGA type */ #define LOC_NMEA_MASK_GBGSA_V02 ((NmeaSentenceTypesMask)0x01000000) /**< Enable GBGSA type */ #define LOC_NMEA_MASK_GBGSV_V02 ((NmeaSentenceTypesMask)0x02000000) /**< Enable GBGSV type */ #define LOC_NMEA_MASK_GBRMC_V02 ((NmeaSentenceTypesMask)0x04000000) /**< Enable GBRMC type */ #define LOC_NMEA_MASK_GBVTG_V02 ((NmeaSentenceTypesMask)0x08000000) /**< Enable GBVTG type */ #define LOC_NMEA_MASK_GQGSV_V02 ((NmeaSentenceTypesMask)0x10000000) /**< Enable GQGSV type */ #define LOC_NMEA_MASK_GIGSV_V02 ((NmeaSentenceTypesMask)0x20000000) /**< Enable GIGSV type */ #define LOC_NMEA_MASK_GNDTM_V02 ((NmeaSentenceTypesMask)0x40000000) /**< Enable GNDTM type */ // all bitmasks of general supported NMEA sentenses - debug is not part of this #define LOC_NMEA_ALL_GENERAL_SUPPORTED_MASK (LOC_NMEA_MASK_GGA_V02 | LOC_NMEA_MASK_RMC_V02 | \ LOC_NMEA_MASK_GSV_V02 | LOC_NMEA_MASK_GSA_V02 | LOC_NMEA_MASK_VTG_V02 | \ LOC_NMEA_MASK_PQXFI_V02 | LOC_NMEA_MASK_PSTIS_V02 | LOC_NMEA_MASK_GLGSV_V02 | \ LOC_NMEA_MASK_GNGSA_V02 | LOC_NMEA_MASK_GNGNS_V02 | LOC_NMEA_MASK_GARMC_V02 | \ LOC_NMEA_MASK_GAGSV_V02 | LOC_NMEA_MASK_GAGSA_V02 | LOC_NMEA_MASK_GAVTG_V02 | \ LOC_NMEA_MASK_GAGGA_V02 | LOC_NMEA_MASK_PQGSA_V02 | LOC_NMEA_MASK_PQGSV_V02 | \ LOC_NMEA_MASK_GPDTM_V02 | LOC_NMEA_MASK_GNGGA_V02 | LOC_NMEA_MASK_GNRMC_V02 | \ LOC_NMEA_MASK_GNVTG_V02 | LOC_NMEA_MASK_GAGNS_V02 | LOC_NMEA_MASK_GBGGA_V02 | \ LOC_NMEA_MASK_GBGSA_V02 | LOC_NMEA_MASK_GBGSV_V02 | LOC_NMEA_MASK_GBRMC_V02 | \ LOC_NMEA_MASK_GBVTG_V02 | LOC_NMEA_MASK_GQGSV_V02 | LOC_NMEA_MASK_GIGSV_V02 | \ LOC_NMEA_MASK_GNDTM_V02) typedef enum { LOC_ENG_IF_REQUEST_SENDER_ID_QUIPC = 0, LOC_ENG_IF_REQUEST_SENDER_ID_MSAPM, LOC_ENG_IF_REQUEST_SENDER_ID_MSAPU, LOC_ENG_IF_REQUEST_SENDER_ID_GPSONE_DAEMON, LOC_ENG_IF_REQUEST_SENDER_ID_MODEM, LOC_ENG_IF_REQUEST_SENDER_ID_UNKNOWN } loc_if_req_sender_id_e_type; #define smaller_of(a, b) (((a) > (b)) ? (b) : (a)) #define MAX_APN_LEN 100 // This will be overridden by the individual adapters // if necessary. #define DEFAULT_IMPL(rtv) \ { \ LOC_LOGD("%s: default implementation invoked", __func__); \ return rtv; \ } enum loc_api_adapter_err { LOC_API_ADAPTER_ERR_SUCCESS = 0, LOC_API_ADAPTER_ERR_GENERAL_FAILURE = 1, LOC_API_ADAPTER_ERR_UNSUPPORTED = 2, LOC_API_ADAPTER_ERR_INVALID_HANDLE = 4, LOC_API_ADAPTER_ERR_INVALID_PARAMETER = 5, LOC_API_ADAPTER_ERR_ENGINE_BUSY = 6, LOC_API_ADAPTER_ERR_PHONE_OFFLINE = 7, LOC_API_ADAPTER_ERR_TIMEOUT = 8, LOC_API_ADAPTER_ERR_SERVICE_NOT_PRESENT = 9, LOC_API_ADAPTER_ERR_INTERNAL = 10, /* equating engine down to phone offline, as they are the same errror */ LOC_API_ADAPTER_ERR_ENGINE_DOWN = LOC_API_ADAPTER_ERR_PHONE_OFFLINE, LOC_API_ADAPTER_ERR_FAILURE = 101, LOC_API_ADAPTER_ERR_UNKNOWN }; enum loc_api_adapter_event_index { LOC_API_ADAPTER_REPORT_POSITION = 0, // Position report comes in loc_parsed_position_s_type LOC_API_ADAPTER_REPORT_SATELLITE, // Satellite in view report LOC_API_ADAPTER_REPORT_NMEA_1HZ, // NMEA report at 1HZ rate LOC_API_ADAPTER_REPORT_NMEA_POSITION, // NMEA report at position report rate LOC_API_ADAPTER_REQUEST_NI_NOTIFY_VERIFY, // NI notification/verification request LOC_API_ADAPTER_REQUEST_ASSISTANCE_DATA, // Assistance data, eg: time, predicted orbits request LOC_API_ADAPTER_REQUEST_LOCATION_SERVER, // Request for location server LOC_API_ADAPTER_REPORT_IOCTL, // Callback report for loc_ioctl LOC_API_ADAPTER_REPORT_STATUS, // Misc status report: eg, engine state LOC_API_ADAPTER_REQUEST_WIFI, // LOC_API_ADAPTER_SENSOR_STATUS, // LOC_API_ADAPTER_REQUEST_TIME_SYNC, // LOC_API_ADAPTER_REPORT_SPI, // LOC_API_ADAPTER_REPORT_NI_GEOFENCE, // LOC_API_ADAPTER_GEOFENCE_GEN_ALERT, // LOC_API_ADAPTER_REPORT_GENFENCE_BREACH, // LOC_API_ADAPTER_PEDOMETER_CTRL, // LOC_API_ADAPTER_MOTION_CTRL, // LOC_API_ADAPTER_REQUEST_WIFI_AP_DATA, // Wifi ap data LOC_API_ADAPTER_BATCH_FULL, // Batching on full LOC_API_ADAPTER_BATCHED_POSITION_REPORT, // Batching on fix LOC_API_ADAPTER_BATCHED_GENFENCE_BREACH_REPORT, // LOC_API_ADAPTER_GNSS_MEASUREMENT_REPORT, // GNSS Measurement Report LOC_API_ADAPTER_GNSS_SV_POLYNOMIAL_REPORT, // GNSS SV Polynomial Report LOC_API_ADAPTER_GDT_UPLOAD_BEGIN_REQ, // GDT upload start request LOC_API_ADAPTER_GDT_UPLOAD_END_REQ, // GDT upload end request LOC_API_ADAPTER_GNSS_MEASUREMENT, // GNSS Measurement report LOC_API_ADAPTER_REQUEST_TIMEZONE, // Timezone injection request LOC_API_ADAPTER_REPORT_GENFENCE_DWELL_REPORT, // Geofence dwell report LOC_API_ADAPTER_REQUEST_SRN_DATA, // request srn data from AP LOC_API_ADAPTER_REQUEST_POSITION_INJECTION, // Position injection request LOC_API_ADAPTER_BATCH_STATUS, // batch status LOC_API_ADAPTER_FDCL_SERVICE_REQ, // FDCL service request LOC_API_ADAPTER_REPORT_UNPROPAGATED_POSITION, // Unpropagated Position report LOC_API_ADAPTER_BS_OBS_DATA_SERVICE_REQ, // BS observation data request LOC_API_ADAPTER_GNSS_SV_EPHEMERIS_REPORT, // GNSS SV Ephemeris Report LOC_API_ADAPTER_LOC_SYSTEM_INFO, // Location system info event LOC_API_ADAPTER_GNSS_NHZ_MEASUREMENT_REPORT, // GNSS SV nHz measurement report LOC_API_ADAPTER_EVENT_REPORT_INFO, // Event report info LOC_API_ADAPTER_EVENT_MAX }; #define LOC_API_ADAPTER_BIT_PARSED_POSITION_REPORT (1< GnssSvTypeConfigCallback; /* * Represents the status of AGNSS augmented to support IPv4. */ struct AGnssExtStatusIpV4 { AGpsExtType type; LocApnTypeMask apnTypeMask; LocAGpsStatusValue status; /* * 32-bit IPv4 address. */ uint32_t ipV4Addr; }; /* * Represents the status of AGNSS augmented to support IPv6. */ struct AGnssExtStatusIpV6 { AGpsExtType type; LocApnTypeMask apnTypeMask; LocAGpsStatusValue status; /* * 128-bit IPv6 address. */ uint8_t ipV6Addr[16]; }; /* * Represents the the Nfw Notification structure */ #define GNSS_MAX_NFW_APP_STRING_LEN 64 #define GNSS_MAX_NFW_STRING_LEN 20 typedef enum { GNSS_NFW_CTRL_PLANE = 0, GNSS_NFW_SUPL = 1, GNSS_NFW_IMS = 10, GNSS_NFW_SIM = 11, GNSS_NFW_OTHER_PROTOCOL_STACK = 100 } GnssNfwProtocolStack; typedef enum { GNSS_NFW_CARRIER = 0, GNSS_NFW_OEM = 10, GNSS_NFW_MODEM_CHIPSET_VENDOR = 11, GNSS_NFW_GNSS_CHIPSET_VENDOR = 12, GNSS_NFW_OTHER_CHIPSET_VENDOR = 13, GNSS_NFW_AUTOMOBILE_CLIENT = 20, GNSS_NFW_OTHER_REQUESTOR = 100 } GnssNfwRequestor; typedef enum { GNSS_NFW_REJECTED = 0, GNSS_NFW_ACCEPTED_NO_LOCATION_PROVIDED = 1, GNSS_NFW_ACCEPTED_LOCATION_PROVIDED = 2, } GnssNfwResponseType; typedef struct { char proxyAppPackageName[GNSS_MAX_NFW_APP_STRING_LEN]; GnssNfwProtocolStack protocolStack; char otherProtocolStackName[GNSS_MAX_NFW_STRING_LEN]; GnssNfwRequestor requestor; char requestorId[GNSS_MAX_NFW_STRING_LEN]; GnssNfwResponseType responseType; bool inEmergencyMode; bool isCachedLocation; } GnssNfwNotification; typedef uint16_t GnssMeasurementCorrectionsCapabilitiesMask; typedef enum { GNSS_MEAS_CORR_LOS_SATS = 1 << 0, GNSS_MEAS_CORR_EXCESS_PATH_LENGTH = 1 << 1, GNSS_MEAS_CORR_REFLECTING_PLANE = 1 << 2, } GnssMeasurementCorrectionsCapabilities; /* Represents GNSS NMEA Report Rate Configuration */ typedef enum { GNSS_NMEA_REPORT_RATE_UNKNOWN = 0, GNSS_NMEA_REPORT_RATE_1HZ = 1, GNSS_NMEA_REPORT_RATE_NHZ = 2 } GnssNMEARptRate; /* ODCPI Request Info */ enum OdcpiRequestType { ODCPI_REQUEST_TYPE_START, ODCPI_REQUEST_TYPE_STOP }; struct OdcpiRequestInfo { uint32_t size; OdcpiRequestType type; uint32_t tbfMillis; bool isEmergencyMode; }; /* Callback to send ODCPI request to framework */ typedef std::function OdcpiRequestCallback; /* ODCPI callback priorities*/ enum OdcpiPrioritytype { ODCPI_HANDLER_PRIORITY_LOW, ODCPI_HANDLER_PRIORITY_HIGH }; /* * Callback with AGNSS(IpV4) status information. * * @param status Will be of type AGnssExtStatusIpV4. */ typedef void (*AgnssStatusIpV4Cb)(AGnssExtStatusIpV4 status); /* * Callback with AGNSS(IpV6) status information. * * @param status Will be of type AGnssExtStatusIpV6. */ typedef void (*AgnssStatusIpV6Cb)(AGnssExtStatusIpV6 status); /* * Callback with NFW information. */ typedef void(*NfwStatusCb)(GnssNfwNotification notification); typedef bool(*IsInEmergencySession)(void); enum AntennaInfoStatus { ANTENNA_INFO_SUCCESS = 0, ANTENNA_INFO_ERROR_ALREADY_INIT = 1, ANTENNA_INFO_ERROR_GENERIC = 2 }; /* * Callback with Measurement corrections information. */ typedef void(*measCorrSetCapabilitiesCb)(GnssMeasurementCorrectionsCapabilitiesMask capabilities); /* * Callback with AGNSS(IpV6) status information. * * @param status Will be of type AGnssExtStatusIpV6. */ typedef void (*AgnssStatusIpV6Cb)(AGnssExtStatusIpV6 status); /* * Callback with Antenna information. */ typedef void(*antennaInfoCb)(std::vector gnssAntennaInformations); /* Constructs for interaction with loc_net_iface library */ typedef void (*LocAgpsOpenResultCb)(bool isSuccess, AGpsExtType agpsType, const char* apn, AGpsBearerType bearerType, void* userDataPtr); typedef void (*LocAgpsCloseResultCb)(bool isSuccess, AGpsExtType agpsType, void* userDataPtr); enum PowerStateType { POWER_STATE_UNKNOWN = 0, POWER_STATE_SUSPEND = 1, POWER_STATE_RESUME = 2, POWER_STATE_SHUTDOWN = 3 }; /* Shared resources of LocIpc */ #define LOC_IPC_HAL "/dev/socket/location/socket_hal" #define LOC_IPC_XTRA "/dev/socket/location/xtra/socket_xtra" #define SOCKET_DIR_LOCATION "/dev/socket/location/" #define SOCKET_DIR_EHUB "/dev/socket/location/ehub/" #define SOCKET_TO_LOCATION_HAL_DAEMON "/dev/socket/loc_client/hal_daemon" #define SOCKET_LOC_CLIENT_DIR "/dev/socket/loc_client/" #define EAP_LOC_CLIENT_DIR "/data/vendor/location/extap_locclient/" #define LOC_CLIENT_NAME_PREFIX "toclient" // Please note that the socket name for all location hal daemon client need // to start with LOC_CLIENT_NAME_PREFIX so that upon hal daemon restarts, // every client can get the notification that hal daemon has restarted. #define LOC_INTAPI_NAME_PREFIX LOC_CLIENT_NAME_PREFIX "_intapi" typedef uint64_t NetworkHandle; #define NETWORK_HANDLE_UNKNOWN ~0 #define MAX_NETWORK_HANDLES 10 #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* GPS_EXTENDED_C_H */