summaryrefslogtreecommitdiff
path: root/location
diff options
context:
space:
mode:
authorqctecmdr <qctecmdr@localhost>2019-11-26 15:38:28 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2019-11-26 15:38:28 -0800
commita43430218337739c0c1143dc55474d1036d50558 (patch)
tree4220c98cb3efb29875bdc54d326bb0adc6e54b95 /location
parent6b13ac10f1f298e5e60d1239516cf7cda37a69dd (diff)
parent6c35439ef28c99928ae26360bdc4952f97d8d66e (diff)
downloadgps-a43430218337739c0c1143dc55474d1036d50558.tar.gz
Merge "FR 57252: GPS hal changes to allow configuration for LE target"
Diffstat (limited to 'location')
-rw-r--r--location/ILocationAPI.h113
-rw-r--r--location/LocationAPI.cpp76
-rw-r--r--location/LocationAPI.h113
-rw-r--r--location/LocationDataTypes.h69
-rw-r--r--location/location_interface.h6
5 files changed, 377 insertions, 0 deletions
diff --git a/location/ILocationAPI.h b/location/ILocationAPI.h
index 3df6f79..87aa99b 100644
--- a/location/ILocationAPI.h
+++ b/location/ILocationAPI.h
@@ -189,6 +189,119 @@ public:
LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
LOCATION_ERROR_NOT_SUPPORTED if build is not userdebug */
virtual uint32_t gnssDeleteAidingData(GnssAidingData& data) = 0;
+
+ /** @brief
+ Reset the constellation settings to modem default.
+
+ @param
+ None
+
+ @return
+ A session id that will be returned in responseCallback to
+ match command with response. This effect is global for all
+ clients of LocationAPI responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
+ */
+ virtual uint32_t resetConstellationConfig() = 0;
+
+ /** @brief
+ Configure the constellation to be used by the GNSS engine on
+ modem.
+
+ @param
+ constellationConfig: specify the constellation configuration
+ used by GNSS engine.
+
+ @return
+ A session id that will be returned in responseCallback to
+ match command with response. This effect is global for all
+ clients of LocationAPI responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
+ */
+ virtual uint32_t configConstellations(
+ const GnssSvTypeConfig& svTypeConfig,
+ const GnssSvIdConfig& svIdConfig) = 0;
+
+ /** @brief
+ Enable or disable the constrained time uncertainty feature.
+
+ @param
+ enable: true to enable the constrained time uncertainty
+ feature and false to disable the constrainted time
+ uncertainty feature.
+
+ @param
+ tuncThreshold: this specifies the time uncertainty threshold
+ that gps engine need to maintain, in units of milli-seconds.
+ Default is 0.0 meaning that modem default value of time
+ uncertainty threshold will be used. This parameter is
+ ignored when requesting to disable this feature.
+
+ @param
+ energyBudget: this specifies the power budget that gps
+ engine is allowed to spend to maintain the time uncertainty.
+ Default is 0 meaning that GPS engine is not constained by
+ power budget and can spend as much power as needed. The
+ parameter need to be specified in units of 0.1 milli watt
+ second. This parameter is ignored requesting to disable this
+ feature.
+
+ @return
+ A session id that will be returned in responseCallback to
+ match command with response. This effect is global for all
+ clients of LocationAPI responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters
+ are invalid
+ */
+ virtual uint32_t configConstrainedTimeUncertainty(
+ bool enable, float tuncThreshold = 0.0,
+ uint32_t energyBudget = 0) = 0;
+
+ /** @brief
+ Enable or disable position assisted clock estimator feature.
+
+ @param
+ enable: true to enable position assisted clock estimator and
+ false to disable the position assisted clock estimator
+ feature.
+
+ @return
+ A session id that will be returned in responseCallback to
+ match command with response. This effect is global for all
+ clients of LocationAPI responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
+ */
+ virtual uint32_t configPositionAssistedClockEstimator(bool enable) = 0;
+
+ /** @brief
+ Sets the lever arm parameters for the vehicle.
+
+ @param
+ configInfo: lever arm configuration info regarding below two
+ types of lever arm info:
+ a: GNSS Antenna w.r.t the origin at the IMU e.g.: inertial
+ measurement unit.
+ b: lever arm parameters regarding the OPF (output frame)
+ w.r.t the origin (at the GPS Antenna). Vehicle manufacturers
+ prefer the position output to be tied to a specific point in
+ the vehicle rather than where the antenna is placed
+ (midpoint of the rear axle is typical).
+
+ Caller can choose types of lever arm info to configure via the
+ leverMarkTypeMask.
+
+ @return
+ A session id that will be returned in responseCallback to
+ match command with response. This effect is global for all
+ clients of LocationAPI responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
+ */
+ virtual uint32_t configLeverArm(const LeverArmConfigInfo& configInfo) = 0;
};
#endif /* ILOCATIONAPI_H */
diff --git a/location/LocationAPI.cpp b/location/LocationAPI.cpp
index 4348c27..7c125b8 100644
--- a/location/LocationAPI.cpp
+++ b/location/LocationAPI.cpp
@@ -723,3 +723,79 @@ LocationControlAPI::gnssDeleteAidingData(GnssAidingData& data)
pthread_mutex_unlock(&gDataMutex);
return id;
}
+
+uint32_t LocationControlAPI::resetConstellationConfig() {
+ uint32_t id = 0;
+ pthread_mutex_lock(&gDataMutex);
+
+ if (gData.gnssInterface != NULL) {
+ id = gData.gnssInterface->gnssResetSvConfig();
+ } else {
+ LOC_LOGe("No gnss interface available for Location Control API");
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+ return id;
+}
+
+uint32_t LocationControlAPI::configConstellations(
+ const GnssSvTypeConfig& svTypeConfig,
+ const GnssSvIdConfig& svIdConfig) {
+ uint32_t id = 0;
+ pthread_mutex_lock(&gDataMutex);
+
+ if (gData.gnssInterface != NULL) {
+ id = gData.gnssInterface->gnssUpdateSvConfig(
+ svTypeConfig, svIdConfig);
+ } else {
+ LOC_LOGe("No gnss interface available for Location Control API");
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+ return id;
+}
+
+uint32_t LocationControlAPI::configConstrainedTimeUncertainty(
+ bool enable, float tuncThreshold, uint32_t energyBudget) {
+ uint32_t id = 0;
+ pthread_mutex_lock(&gDataMutex);
+
+ if (gData.gnssInterface != NULL) {
+ id = gData.gnssInterface->setConstrainedTunc(enable,
+ tuncThreshold,
+ energyBudget);
+ } else {
+ LOC_LOGe("No gnss interface available for Location Control API");
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+ return id;
+}
+
+uint32_t LocationControlAPI::configPositionAssistedClockEstimator(bool enable) {
+ uint32_t id = 0;
+ pthread_mutex_lock(&gDataMutex);
+
+ if (gData.gnssInterface != NULL) {
+ id = gData.gnssInterface->setPositionAssistedClockEstimator(enable);
+ } else {
+ LOC_LOGe("No gnss interface available for Location Control API");
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+ return id;
+}
+
+uint32_t LocationControlAPI::configLeverArm(const LeverArmConfigInfo& configInfo) {
+ uint32_t id = 0;
+ pthread_mutex_lock(&gDataMutex);
+
+ if (gData.gnssInterface != NULL) {
+ id = gData.gnssInterface->configLeverArm(configInfo);
+ } else {
+ LOC_LOGe("No gnss interface available for Location Control API");
+ }
+
+ pthread_mutex_unlock(&gDataMutex);
+ return id;
+}
diff --git a/location/LocationAPI.h b/location/LocationAPI.h
index 6f5987c..f70fc2f 100644
--- a/location/LocationAPI.h
+++ b/location/LocationAPI.h
@@ -261,6 +261,119 @@ public:
LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
LOCATION_ERROR_NOT_SUPPORTED if build is not userdebug */
virtual uint32_t gnssDeleteAidingData(GnssAidingData& data) override;
+
+ /** @brief
+ Reset the constellation settings to modem default.
+
+ @param
+ None
+
+ @return
+ A session id that will be returned in responseCallback to
+ match command with response. This effect is global for all
+ clients of LocationAPI responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
+ */
+ virtual uint32_t resetConstellationConfig() override;
+
+ /** @brief
+ Configure the constellation to be used by the GNSS engine on
+ modem.
+
+ @param
+ constellationConfig: specify the constellation configuration
+ used by GNSS engine.
+
+ @return
+ A session id that will be returned in responseCallback to
+ match command with response. This effect is global for all
+ clients of LocationAPI responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
+ */
+ virtual uint32_t configConstellations(
+ const GnssSvTypeConfig& svTypeConfig,
+ const GnssSvIdConfig& svIdConfig) override;
+
+ /** @brief
+ Enable or disable the constrained time uncertainty feature.
+
+ @param
+ enable: true to enable the constrained time uncertainty
+ feature and false to disable the constrainted time
+ uncertainty feature.
+
+ @param
+ tuncThreshold: this specifies the time uncertainty threshold
+ that gps engine need to maintain, in units of milli-seconds.
+ Default is 0.0 meaning that modem default value of time
+ uncertainty threshold will be used. This parameter is
+ ignored when requesting to disable this feature.
+
+ @param
+ energyBudget: this specifies the power budget that gps
+ engine is allowed to spend to maintain the time uncertainty.
+ Default is 0 meaning that GPS engine is not constained by
+ power budget and can spend as much power as needed. The
+ parameter need to be specified in units of 0.1 milli watt
+ second. This parameter is ignored requesting to disable this
+ feature.
+
+ @return
+ A session id that will be returned in responseCallback to
+ match command with response. This effect is global for all
+ clients of LocationAPI responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters
+ are invalid
+ */
+ virtual uint32_t configConstrainedTimeUncertainty(
+ bool enable, float tuncThreshold = 0.0,
+ uint32_t energyBudget = 0) override;
+
+ /** @brief
+ Enable or disable position assisted clock estimator feature.
+
+ @param
+ enable: true to enable position assisted clock estimator and
+ false to disable the position assisted clock estimator
+ feature.
+
+ @return
+ A session id that will be returned in responseCallback to
+ match command with response. This effect is global for all
+ clients of LocationAPI responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
+ */
+ virtual uint32_t configPositionAssistedClockEstimator(bool enable) override;
+
+ /** @brief
+ Sets the lever arm parameters for the vehicle.
+
+ @param
+ configInfo: lever arm configuration info regarding below two
+ types of lever arm info:
+ a: GNSS Antenna w.r.t the origin at the IMU e.g.: inertial
+ measurement unit.
+ b: lever arm parameters regarding the OPF (output frame)
+ w.r.t the origin (at the GPS Antenna). Vehicle manufacturers
+ prefer the position output to be tied to a specific point in
+ the vehicle rather than where the antenna is placed
+ (midpoint of the rear axle is typical).
+
+ Caller can choose types of lever arm info to configure via the
+ leverMarkTypeMask.
+
+ @return
+ A session id that will be returned in responseCallback to
+ match command with response. This effect is global for all
+ clients of LocationAPI responseCallback returns:
+ LOCATION_ERROR_SUCCESS if successful
+ LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
+ */
+ virtual uint32_t configLeverArm(const LeverArmConfigInfo& configInfo) override;
};
#endif /* LOCATIONAPI_H */
diff --git a/location/LocationDataTypes.h b/location/LocationDataTypes.h
index 2fb35bf..65b5e13 100644
--- a/location/LocationDataTypes.h
+++ b/location/LocationDataTypes.h
@@ -659,6 +659,8 @@ typedef enum {
DEAD_RECKONING_ENGINE = (1 << 1),
PRECISE_POSITIONING_ENGINE = (1 << 2)
} PositioningEngineBits;
+#define POSITION_ENGINE_MASK_ALL \
+ (STANDARD_POSITIONING_ENGINE|DEAD_RECKONING_ENGINE|PRECISE_POSITIONING_ENGINE)
typedef uint64_t GnssDataMask;
typedef enum {
@@ -1187,6 +1189,13 @@ typedef struct {
// GAL - SV 301 maps to bit 0
#define GNSS_SV_CONFIG_GAL_INITIAL_SV_ID 301
uint64_t galBlacklistSvMask;
+
+ // SBAS - SV 120 to 158, maps to 0 to 38
+ // SV 183 to 191, maps to 39 to 47
+#define GNSS_SV_CONFIG_SBAS_INITIAL_SV_ID 120
+#define GNSS_SV_CONFIG_SBAS_INITIAL_SV_LENGTH 39
+#define GNSS_SV_CONFIG_SBAS_INITIAL2_SV_ID 183
+ uint64_t sbasBlacklistSvMask;
} GnssSvIdConfig;
struct GnssConfig{
@@ -1314,6 +1323,66 @@ struct LocationSystemInfo {
LeapSecondSystemInfo leapSecondSysInfo;
};
+/* Mask indicating enabled or disabled constellations */
+typedef uint64_t GnssSvTypesMask;
+typedef enum {
+ GNSS_SV_TYPES_MASK_GLO_BIT = (1<<0),
+ GNSS_SV_TYPES_MASK_BDS_BIT = (1<<1),
+ GNSS_SV_TYPES_MASK_QZSS_BIT = (1<<2),
+ GNSS_SV_TYPES_MASK_GAL_BIT = (1<<3),
+ GNSS_SV_TYPES_MASK_NAVIC_BIT = (1<<4),
+} GnssSvTypesMaskBits;
+
+/* This SV Type config is injected directly to GNSS Adapter
+ * bypassing Location API */
+typedef struct {
+ uint32_t size; // set to sizeof(GnssSvTypeConfig)
+ // Enabled Constellations
+ GnssSvTypesMask enabledSvTypesMask;
+ // Disabled Constellations
+ GnssSvTypesMask blacklistedSvTypesMask;
+} GnssSvTypeConfig;
+
+// Specify parameters related to lever arm
+struct LeverArmParams {
+ // Offset along the vehicle forward axis
+ float forwardOffsetMeters;
+ // Offset along the vehicle starboard axis
+ float sidewaysOffsetMeters;
+ // Offset along the vehicle up axis
+ float upOffsetMeters;
+};
+
+typedef uint32_t LeverArmTypeMask;
+
+enum LeverArmTypeBits {
+ // Lever arm regarding the VRP (Vehicle Reference Point) w.r.t
+ // the origin (at the GPS Antenna)
+ LEVER_ARM_TYPE_GNSS_TO_VRP_BIT = (1<<0),
+ // Lever arm regarding GNSS Antenna w.r.t the origin at the IMU
+ // e.g.: inertial measurement unit for DR (dead reckoning
+ // engine)
+ LEVER_ARM_TYPE_DR_IMU_TO_GNSS_BIT = (1<<1),
+ // Lever arm regarding GNSS Antenna w.r.t the origin at the
+ // IMU (inertial measurement unit) for VEPP (vision enhanced
+ // precise positioning engine)
+ LEVER_ARM_TYPE_VEPP_IMU_TO_GNSS_BIT = (1<<2)
+};
+
+struct LeverArmConfigInfo {
+ // Valid mask for the types of lever arm parameters provided
+ LeverArmTypeMask leverArmValidMask;
+ // Lever arm regarding the VRP (Vehicle Reference Point) w.r.t the origin
+ // (at the GPS Antenna)
+ LeverArmParams gnssToVRP;
+ // Lever arm parameters regarding GNSS Antenna w.r.t the origin at the IMU
+ // (inertial measurement unit) for DR (dead reckoning engine)
+ LeverArmParams drImuToGnss;
+ // Lever arm regarding GNSS Antenna w.r.t the origin at the IMU
+ // (inertial measurement unit) for VEPP (vision enhanced precise position engine)
+ LeverArmParams veppImuToGnss;
+};
+
/* Provides the capabilities of the system
capabilities callback is called once soon after createInstance is called */
typedef std::function<void(
diff --git a/location/location_interface.h b/location/location_interface.h
index d08dfb3..6edb911 100644
--- a/location/location_interface.h
+++ b/location/location_interface.h
@@ -89,6 +89,12 @@ struct GnssInterface {
void (*injectLocationExt)(const GnssLocationInfoNotification &locationInfo);
void (*updateBatteryStatus)(bool charging);
void (*updateSystemPowerState)(PowerStateType systemPowerState);
+ uint32_t (*setConstrainedTunc) (bool enable, float tuncConstraint, uint32_t energyBudget);
+ uint32_t (*setPositionAssistedClockEstimator) (bool enable);
+ uint32_t (*gnssUpdateSvConfig)(const GnssSvTypeConfig& svTypeConfig,
+ const GnssSvIdConfig& svIdConfig);
+ uint32_t (*gnssResetSvConfig)();
+ uint32_t (*configLeverArm)(const LeverArmConfigInfo& configInfo);
};
struct BatchingInterface {