FR 57252: GPS hal changes to allow configuration for LE target

(1) runtime enable/disable TUNC
(2) runtime enable/disable PACE
(3) runtime enable/disable constellations
(4) delete all aiding data
(5) config lever arm

Change-Id: I6cffd08e4c6fa45ff8d62bfef2da1156f3b61956
CRs-fixed: 2497326
This commit is contained in:
Wei Chen 2019-08-16 14:59:23 -07:00
parent 3b3bcb1113
commit 6c35439ef2
12 changed files with 780 additions and 42 deletions

View file

@ -101,6 +101,11 @@ public:
(void) additionalSystemInfo; (void) additionalSystemInfo;
return false; return false;
} }
inline virtual bool configLeverArm(const LeverArmConfigInfo& configInfo) {
(void) configInfo;
return false;
}
}; };
typedef std::function<void(int count, EngineLocationInfo* locationArr)> typedef std::function<void(int count, EngineLocationInfo* locationArr)>

View file

@ -756,24 +756,27 @@ DEFAULT_IMPL()
void LocApiBase::getBlacklistSv() void LocApiBase::getBlacklistSv()
DEFAULT_IMPL() DEFAULT_IMPL()
void LocApiBase::setConstellationControl(const GnssSvTypeConfig& /*config*/) void LocApiBase::setConstellationControl(const GnssSvTypeConfig& /*config*/,
LocApiResponse* /*adapterResponse*/)
DEFAULT_IMPL() DEFAULT_IMPL()
void LocApiBase::getConstellationControl() void LocApiBase::getConstellationControl()
DEFAULT_IMPL() DEFAULT_IMPL()
void LocApiBase::resetConstellationControl() void LocApiBase::resetConstellationControl(LocApiResponse* /*adapterResponse*/)
DEFAULT_IMPL() DEFAULT_IMPL()
LocationError LocApiBase:: void LocApiBase::
setConstrainedTuncMode(bool /*enabled*/, setConstrainedTuncMode(bool /*enabled*/,
float /*tuncConstraint*/, float /*tuncConstraint*/,
uint32_t /*energyBudget*/) uint32_t /*energyBudget*/,
DEFAULT_IMPL(LOCATION_ERROR_SUCCESS) LocApiResponse* /*adapterResponse*/)
DEFAULT_IMPL()
LocationError LocApiBase:: void LocApiBase::
setPositionAssistedClockEstimatorMode(bool /*enabled*/) setPositionAssistedClockEstimatorMode(bool /*enabled*/,
DEFAULT_IMPL(LOCATION_ERROR_SUCCESS) LocApiResponse* /*adapterResponse*/)
DEFAULT_IMPL()
LocationError LocApiBase::getGnssEnergyConsumed() LocationError LocApiBase::getGnssEnergyConsumed()
DEFAULT_IMPL(LOCATION_ERROR_SUCCESS) DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)

View file

@ -260,12 +260,17 @@ public:
virtual LocationError setBlacklistSvSync(const GnssSvIdConfig& config); virtual LocationError setBlacklistSvSync(const GnssSvIdConfig& config);
virtual void setBlacklistSv(const GnssSvIdConfig& config); virtual void setBlacklistSv(const GnssSvIdConfig& config);
virtual void getBlacklistSv(); virtual void getBlacklistSv();
virtual void setConstellationControl(const GnssSvTypeConfig& config); virtual void setConstellationControl(const GnssSvTypeConfig& config,
LocApiResponse *adapterResponse=nullptr);
virtual void getConstellationControl(); virtual void getConstellationControl();
virtual void resetConstellationControl(); virtual void resetConstellationControl(LocApiResponse *adapterResponse=nullptr);
virtual LocationError setConstrainedTuncMode(bool enabled, float tuncConstraint,
uint32_t energyBudget); virtual void setConstrainedTuncMode(bool enabled,
virtual LocationError setPositionAssistedClockEstimatorMode(bool enabled); float tuncConstraint,
uint32_t energyBudget,
LocApiResponse* adapterResponse=nullptr);
virtual void setPositionAssistedClockEstimatorMode(bool enabled,
LocApiResponse* adapterResponse=nullptr);
virtual LocationError getGnssEnergyConsumed(); virtual LocationError getGnssEnergyConsumed();
virtual void addGeofence(uint32_t clientId, const GeofenceOption& options, virtual void addGeofence(uint32_t clientId, const GeofenceOption& options,

View file

@ -80,6 +80,7 @@ GnssAdapter::GnssAdapter() :
mGnssSvIdConfig(), mGnssSvIdConfig(),
mGnssSvTypeConfig(), mGnssSvTypeConfig(),
mGnssSvTypeConfigCb(nullptr), mGnssSvTypeConfigCb(nullptr),
mLocConfigInfo{},
mNiData(), mNiData(),
mAgpsManager(), mAgpsManager(),
mOdcpiRequestCb(nullptr), mOdcpiRequestCb(nullptr),
@ -826,12 +827,32 @@ GnssAdapter::setConfig()
mLocApi->setXtraVersionCheckSync(gpsConf.XTRA_VERSION_CHECK); mLocApi->setXtraVersionCheckSync(gpsConf.XTRA_VERSION_CHECK);
// load tunc configuration from config file on first boot-up,
// e.g.: adapter.mLocConfigInfo.tuncConfigInfo.isValid is false
if (mLocConfigInfo.tuncConfigInfo.isValid == false) {
mLocConfigInfo.tuncConfigInfo.isValid = true;
mLocConfigInfo.tuncConfigInfo.enable =
(gpsConf.CONSTRAINED_TIME_UNCERTAINTY_ENABLED == 1);
mLocConfigInfo.tuncConfigInfo.tuncThresholdMs =
(float)gpsConf.CONSTRAINED_TIME_UNCERTAINTY_THRESHOLD;
mLocConfigInfo.tuncConfigInfo.energyBudget =
gpsConf.CONSTRAINED_TIME_UNCERTAINTY_ENERGY_BUDGET;
}
mLocApi->setConstrainedTuncMode( mLocApi->setConstrainedTuncMode(
gpsConf.CONSTRAINED_TIME_UNCERTAINTY_ENABLED == 1, mLocConfigInfo.tuncConfigInfo.enable,
(float)gpsConf.CONSTRAINED_TIME_UNCERTAINTY_THRESHOLD, mLocConfigInfo.tuncConfigInfo.tuncThresholdMs,
gpsConf.CONSTRAINED_TIME_UNCERTAINTY_ENERGY_BUDGET); mLocConfigInfo.tuncConfigInfo.energyBudget);
// load pace configuration from config file on first boot-up,
// e.g.: adapter.mLocConfigInfo.paceConfigInfo.isValid is false
if (mLocConfigInfo.paceConfigInfo.isValid == false) {
mLocConfigInfo.paceConfigInfo.isValid = true;
mLocConfigInfo.paceConfigInfo.enable =
(gpsConf.POSITION_ASSISTED_CLOCK_ESTIMATOR_ENABLED==1);
}
mLocApi->setPositionAssistedClockEstimatorMode( mLocApi->setPositionAssistedClockEstimatorMode(
gpsConf.POSITION_ASSISTED_CLOCK_ESTIMATOR_ENABLED == 1); mLocConfigInfo.paceConfigInfo.enable);
if (sapConf.GYRO_BIAS_RANDOM_WALK_VALID || if (sapConf.GYRO_BIAS_RANDOM_WALK_VALID ||
sapConf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID || sapConf.ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID ||
@ -3371,9 +3392,10 @@ GnssAdapter::reportPosition(const UlpLocation& ulpLocation,
} }
} }
// if engine hub is running and the fix is from sensor, e.g.: DRE, // if PACE is enabled and engine hub is running and the fix is from sensor,
// inject DRE fix to modem // e.g.: DRE, inject DRE fix to modem
if ((1 == ContextBase::mGps_conf.POSITION_ASSISTED_CLOCK_ESTIMATOR_ENABLED) && if ((true == mLocConfigInfo.paceConfigInfo.isValid &&
true == mLocConfigInfo.paceConfigInfo.enable) &&
(true == initEngHubProxy()) && (LOC_POS_TECH_MASK_SENSORS & techMask)) { (true == initEngHubProxy()) && (LOC_POS_TECH_MASK_SENSORS & techMask)) {
mLocApi->injectPosition(locationInfo, false); mLocApi->injectPosition(locationInfo, false);
} }
@ -5056,6 +5078,263 @@ GnssAdapter::nfwControlCommand(bool enable) {
} }
} }
// Set tunc constrained mode, use 0 session id to indicate
// that no callback is needed. Session id 0 is used for calls that
// are not invoked from the integration api, e.g.: initial configuration
// from the configure file
void
GnssAdapter::setConstrainedTunc(bool enable, float tuncConstraint,
uint32_t energyBudget, uint32_t sessionId) {
mLocConfigInfo.tuncConfigInfo.isValid = true;
mLocConfigInfo.tuncConfigInfo.enable = enable;
mLocConfigInfo.tuncConfigInfo.tuncThresholdMs = tuncConstraint;
mLocConfigInfo.tuncConfigInfo.energyBudget = energyBudget;
LocApiResponse* locApiResponse = nullptr;
if (sessionId != 0) {
locApiResponse =
new LocApiResponse(*getContext(),
[this, sessionId] (LocationError err) {
reportResponse(err, sessionId);});
if (!locApiResponse) {
LOC_LOGe("memory alloc failed");
}
}
mLocApi->setConstrainedTuncMode(
enable, tuncConstraint, energyBudget, locApiResponse);
}
uint32_t
GnssAdapter::setConstrainedTuncCommand (bool enable, float tuncConstraint,
uint32_t energyBudget) {
// generated session id will be none-zero
uint32_t sessionId = generateSessionId();
LOC_LOGd("session id %u", sessionId);
struct MsgEnableTUNC : public LocMsg {
GnssAdapter& mAdapter;
uint32_t mSessionId;
bool mEnable;
float mTuncConstraint;
uint32_t mEnergyBudget;
inline MsgEnableTUNC(GnssAdapter& adapter,
uint32_t sessionId,
bool enable,
float tuncConstraint,
uint32_t energyBudget) :
LocMsg(),
mAdapter(adapter),
mSessionId(sessionId),
mEnable(enable),
mTuncConstraint(tuncConstraint),
mEnergyBudget(energyBudget) {}
inline virtual void proc() const {
mAdapter.setConstrainedTunc(mEnable, mTuncConstraint,
mEnergyBudget, mSessionId);
}
};
sendMsg(new MsgEnableTUNC(*this, sessionId, enable,
tuncConstraint, energyBudget));
return sessionId;
}
// Set position assisted clock estimator, use 0 session id to indicate
// that no callback is needed. Session id 0 is used for calls that are
// not invoked from the integration api, e.g.: initial configuration
// from the configure file.
void
GnssAdapter::setPositionAssistedClockEstimator(bool enable,
uint32_t sessionId) {
mLocConfigInfo.paceConfigInfo.isValid = true;
mLocConfigInfo.paceConfigInfo.enable = enable;
LocApiResponse* locApiResponse = nullptr;
if (sessionId != 0) {
locApiResponse =
new LocApiResponse(*getContext(),
[this, sessionId] (LocationError err) {
reportResponse(err, sessionId);});
if (!locApiResponse) {
LOC_LOGe("memory alloc failed");
}
}
mLocApi->setPositionAssistedClockEstimatorMode(enable, locApiResponse);
}
uint32_t
GnssAdapter::setPositionAssistedClockEstimatorCommand(bool enable) {
// generated session id will be none-zero
uint32_t sessionId = generateSessionId();
LOC_LOGd("session id %u", sessionId);
struct MsgEnablePACE : public LocMsg {
GnssAdapter& mAdapter;
uint32_t mSessionId;
bool mEnable;
inline MsgEnablePACE(GnssAdapter& adapter,
uint32_t sessionId, bool enable) :
LocMsg(),
mAdapter(adapter),
mSessionId(sessionId),
mEnable(enable){}
inline virtual void proc() const {
mAdapter.setPositionAssistedClockEstimator(mEnable, mSessionId);
}
};
sendMsg(new MsgEnablePACE(*this, sessionId, enable));
return sessionId;
}
void
GnssAdapter::updateSvConfig(uint32_t sessionId,
const GnssSvTypeConfig& svTypeConfig,
const GnssSvIdConfig& svIdConfig) {
// check whether if any constellation is removed from the new config
GnssSvTypesMask enabledRemoved = mGnssSvTypeConfig.enabledSvTypesMask &
(mGnssSvTypeConfig.enabledSvTypesMask ^ svTypeConfig.enabledSvTypesMask);
// Send reset if any constellation is removed from the enabled list
if (enabledRemoved != 0) {
mLocApi->resetConstellationControl();
}
mGnssSvTypeConfig = svTypeConfig;
mGnssSvIdConfig = svIdConfig;
// Send blacklist info
mLocApi->setBlacklistSv(mGnssSvIdConfig);
// Send only enabled constellation config
GnssSvTypeConfig svTypeConfigCopy = {sizeof(GnssSvTypeConfig), 0, 0};
svTypeConfigCopy.enabledSvTypesMask = mGnssSvTypeConfig.enabledSvTypesMask;
LocApiResponse* locApiResponse = new LocApiResponse(*getContext(),
[this, sessionId] (LocationError err) {
reportResponse(err, sessionId);});
if (!locApiResponse) {
LOC_LOGe("memory alloc failed");
}
mLocApi->setConstellationControl(svTypeConfigCopy, locApiResponse);
}
uint32_t GnssAdapter::gnssUpdateSvConfigCommand(
const GnssSvTypeConfig& svTypeConfig,
const GnssSvIdConfig& svIdConfig) {
// generated session id will be none-zero
uint32_t sessionId = generateSessionId();
LOC_LOGd("session id %u", sessionId);
struct MsgUpdateSvConfig : public LocMsg {
GnssAdapter& mAdapter;
uint32_t mSessionId;
GnssSvTypeConfig mSvTypeConfig;
GnssSvIdConfig mSvIdConfig;
inline MsgUpdateSvConfig(GnssAdapter& adapter,
uint32_t sessionId,
const GnssSvTypeConfig& svTypeConfig,
const GnssSvIdConfig& svIdConfig) :
LocMsg(),
mAdapter(adapter),
mSessionId(sessionId),
mSvTypeConfig(svTypeConfig),
mSvIdConfig(svIdConfig) {}
inline virtual void proc() const {
mAdapter.updateSvConfig(mSessionId, mSvTypeConfig, mSvIdConfig);
}
};
if (sessionId != 0) {
sendMsg(new MsgUpdateSvConfig(*this, sessionId,
svTypeConfig, svIdConfig));
}
return sessionId;
}
void
GnssAdapter::resetSvConfig(uint32_t sessionId) {
LocApiResponse* locApiResponse = nullptr;
if (sessionId != 0) {
locApiResponse =
new LocApiResponse(*getContext(),
[this, sessionId] (LocationError err) {
reportResponse(err, sessionId);});
if (!locApiResponse) {
LOC_LOGe("memory alloc failed");
}
}
mLocApi->resetConstellationControl(locApiResponse);
}
uint32_t GnssAdapter::gnssResetSvConfigCommand() {
// generated session id will be none-zero
uint32_t sessionId = generateSessionId();
LOC_LOGd("session id %u", sessionId);
struct MsgResetSvConfig : public LocMsg {
GnssAdapter& mAdapter;
uint32_t mSessionId;
inline MsgResetSvConfig(GnssAdapter& adapter,
uint32_t sessionId) :
LocMsg(),
mAdapter(adapter),
mSessionId(sessionId) {}
inline virtual void proc() const {
mAdapter.resetSvConfig(mSessionId);
}
};
sendMsg(new MsgResetSvConfig(*this, sessionId));
return sessionId;
}
void
GnssAdapter::configLeverArm(uint32_t sessionId,
const LeverArmConfigInfo& configInfo) {
LocationError err = LOCATION_ERROR_NOT_SUPPORTED;
if (true == mEngHubProxy->configLeverArm(configInfo)) {
err = LOCATION_ERROR_SUCCESS;
}
reportResponse(err, sessionId);
}
uint32_t
GnssAdapter::configLeverArmCommand(const LeverArmConfigInfo& configInfo) {
// generated session id will be none-zero
uint32_t sessionId = generateSessionId();
LOC_LOGd("session id %u", sessionId);
struct MsgConfigLeverArm : public LocMsg {
GnssAdapter& mAdapter;
uint32_t mSessionId;
LeverArmConfigInfo mConfigInfo;
inline MsgConfigLeverArm(GnssAdapter& adapter,
uint32_t sessionId,
const LeverArmConfigInfo& configInfo) :
LocMsg(),
mAdapter(adapter),
mSessionId(sessionId),
mConfigInfo(configInfo) {}
inline virtual void proc() const {
mAdapter.configLeverArm(mSessionId, mConfigInfo);
}
};
sendMsg(new MsgConfigLeverArm(*this, sessionId, configInfo));
return sessionId;
}
/* ==== Eng Hub Proxy ================================================================= */ /* ==== Eng Hub Proxy ================================================================= */
/* ======== UTILITIES ================================================================= */ /* ======== UTILITIES ================================================================= */
void void

View file

@ -122,6 +122,23 @@ typedef struct {
double latLonDiffThreshold; double latLonDiffThreshold;
} BlockCPIInfo; } BlockCPIInfo;
typedef struct {
bool isValid;
bool enable;
float tuncThresholdMs; // need to be specified if enable is true
uint32_t energyBudget; // need to be specified if enable is true
} TuncConfigInfo;
typedef struct {
bool isValid;
bool enable;
} PaceConfigInfo;
typedef struct {
TuncConfigInfo tuncConfigInfo;
PaceConfigInfo paceConfigInfo;
} LocIntegrationConfigInfo;
using namespace loc_core; using namespace loc_core;
namespace loc_core { namespace loc_core {
@ -158,6 +175,7 @@ class GnssAdapter : public LocAdapterBase {
GnssSvTypeConfig mGnssSvTypeConfig; GnssSvTypeConfig mGnssSvTypeConfig;
GnssSvTypeConfigCallback mGnssSvTypeConfigCb; GnssSvTypeConfigCallback mGnssSvTypeConfigCb;
bool mSupportNfwControl; bool mSupportNfwControl;
LocIntegrationConfigInfo mLocConfigInfo;
/* ==== NI ============================================================================= */ /* ==== NI ============================================================================= */
NiData mNiData; NiData mNiData;
@ -270,6 +288,14 @@ public:
const TrackingOptions& updatedOptions, const TrackingOptions& oldOptions); const TrackingOptions& updatedOptions, const TrackingOptions& oldOptions);
bool checkAndSetSPEToRunforNHz(TrackingOptions & out); bool checkAndSetSPEToRunforNHz(TrackingOptions & out);
void setConstrainedTunc(bool enable, float tuncConstraint,
uint32_t energyBudget, uint32_t sessionId);
void setPositionAssistedClockEstimator(bool enable, uint32_t sessionId);
void updateSvConfig(uint32_t sessionId, const GnssSvTypeConfig& svTypeConfig,
const GnssSvIdConfig& svIdConfig);
void resetSvConfig(uint32_t sessionId);
void configLeverArm(uint32_t sessionId, const LeverArmConfigInfo& configInfo);
/* ==== NI ============================================================================= */ /* ==== NI ============================================================================= */
/* ======== COMMANDS ====(Called from Client Thread)==================================== */ /* ======== COMMANDS ====(Called from Client Thread)==================================== */
void gnssNiResponseCommand(LocationAPI* client, uint32_t id, GnssNiResponse response); void gnssNiResponseCommand(LocationAPI* client, uint32_t id, GnssNiResponse response);
@ -329,6 +355,13 @@ public:
void dataConnFailedCommand(AGpsExtType agpsType); void dataConnFailedCommand(AGpsExtType agpsType);
void getGnssEnergyConsumedCommand(GnssEnergyConsumedCallback energyConsumedCb); void getGnssEnergyConsumedCommand(GnssEnergyConsumedCallback energyConsumedCb);
void nfwControlCommand(bool enable); void nfwControlCommand(bool enable);
uint32_t setConstrainedTuncCommand (bool enable, float tuncConstraint,
uint32_t energyBudget);
uint32_t setPositionAssistedClockEstimatorCommand (bool enable);
uint32_t gnssUpdateSvConfigCommand(const GnssSvTypeConfig& svTypeConfig,
const GnssSvIdConfig& svIdConfig);
uint32_t gnssResetSvConfigCommand();
uint32_t configLeverArmCommand(const LeverArmConfigInfo& configInfo);
/* ========= ODCPI ===================================================================== */ /* ========= ODCPI ===================================================================== */
/* ======== COMMANDS ====(Called from Client Thread)==================================== */ /* ======== COMMANDS ====(Called from Client Thread)==================================== */

View file

@ -80,6 +80,13 @@ static void blockCPI(double latitude, double longitude, float accuracy,
int blockDurationMsec, double latLonDiffThreshold); int blockDurationMsec, double latLonDiffThreshold);
static void updateBatteryStatus(bool charging); static void updateBatteryStatus(bool charging);
static void updateSystemPowerState(PowerStateType systemPowerState); static void updateSystemPowerState(PowerStateType systemPowerState);
static uint32_t setConstrainedTunc (bool enable, float tuncConstraint,
uint32_t energyBudget);
static uint32_t setPositionAssistedClockEstimator(bool enable);
static uint32_t gnssUpdateSvConfig(const GnssSvTypeConfig& svTypeConfig,
const GnssSvIdConfig& svIdConfig);
static uint32_t gnssResetSvConfig();
static uint32_t configLeverArm(const LeverArmConfigInfo& configInfo);
static const GnssInterface gGnssInterface = { static const GnssInterface gGnssInterface = {
sizeof(GnssInterface), sizeof(GnssInterface),
@ -119,7 +126,12 @@ static const GnssInterface gGnssInterface = {
getPowerStateChanges, getPowerStateChanges,
injectLocationExt, injectLocationExt,
updateBatteryStatus, updateBatteryStatus,
updateSystemPowerState updateSystemPowerState,
setConstrainedTunc,
setPositionAssistedClockEstimator,
gnssUpdateSvConfig,
gnssResetSvConfig,
configLeverArm,
}; };
#ifndef DEBUG_X86 #ifndef DEBUG_X86
@ -398,3 +410,46 @@ static void updateSystemPowerState(PowerStateType systemPowerState) {
gGnssAdapter->updateSystemPowerStateCommand(systemPowerState); gGnssAdapter->updateSystemPowerStateCommand(systemPowerState);
} }
} }
static uint32_t setConstrainedTunc (bool enable, float tuncConstraint, uint32_t energyBudget) {
if (NULL != gGnssAdapter) {
return gGnssAdapter->setConstrainedTuncCommand(enable, tuncConstraint, energyBudget);
} else {
return 0;
}
}
static uint32_t setPositionAssistedClockEstimator(bool enable) {
if (NULL != gGnssAdapter) {
return gGnssAdapter->setPositionAssistedClockEstimatorCommand(enable);
} else {
return 0;
}
}
static uint32_t gnssUpdateSvConfig(
const GnssSvTypeConfig& svTypeConfig,
const GnssSvIdConfig& svIdConfig) {
if (NULL != gGnssAdapter) {
return gGnssAdapter->gnssUpdateSvConfigCommand(
svTypeConfig, svIdConfig);
} else {
return 0;
}
}
static uint32_t gnssResetSvConfig() {
if (NULL != gGnssAdapter) {
return gGnssAdapter->gnssResetSvConfigCommand();
} else {
return 0;
}
}
static uint32_t configLeverArm(const LeverArmConfigInfo& configInfo){
if (NULL != gGnssAdapter) {
return gGnssAdapter->configLeverArmCommand(configInfo);
} else {
return 0;
}
}

View file

@ -189,6 +189,119 @@ public:
LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
LOCATION_ERROR_NOT_SUPPORTED if build is not userdebug */ LOCATION_ERROR_NOT_SUPPORTED if build is not userdebug */
virtual uint32_t gnssDeleteAidingData(GnssAidingData& data) = 0; 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 */ #endif /* ILOCATIONAPI_H */

View file

@ -723,3 +723,79 @@ LocationControlAPI::gnssDeleteAidingData(GnssAidingData& data)
pthread_mutex_unlock(&gDataMutex); pthread_mutex_unlock(&gDataMutex);
return id; 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;
}

View file

@ -261,6 +261,119 @@ public:
LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid
LOCATION_ERROR_NOT_SUPPORTED if build is not userdebug */ LOCATION_ERROR_NOT_SUPPORTED if build is not userdebug */
virtual uint32_t gnssDeleteAidingData(GnssAidingData& data) override; 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 */ #endif /* LOCATIONAPI_H */

View file

@ -658,6 +658,8 @@ typedef enum {
DEAD_RECKONING_ENGINE = (1 << 1), DEAD_RECKONING_ENGINE = (1 << 1),
PRECISE_POSITIONING_ENGINE = (1 << 2) PRECISE_POSITIONING_ENGINE = (1 << 2)
} PositioningEngineBits; } PositioningEngineBits;
#define POSITION_ENGINE_MASK_ALL \
(STANDARD_POSITIONING_ENGINE|DEAD_RECKONING_ENGINE|PRECISE_POSITIONING_ENGINE)
typedef uint64_t GnssDataMask; typedef uint64_t GnssDataMask;
typedef enum { typedef enum {
@ -1186,6 +1188,13 @@ typedef struct {
// GAL - SV 301 maps to bit 0 // GAL - SV 301 maps to bit 0
#define GNSS_SV_CONFIG_GAL_INITIAL_SV_ID 301 #define GNSS_SV_CONFIG_GAL_INITIAL_SV_ID 301
uint64_t galBlacklistSvMask; 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; } GnssSvIdConfig;
struct GnssConfig{ struct GnssConfig{
@ -1313,6 +1322,66 @@ struct LocationSystemInfo {
LeapSecondSystemInfo leapSecondSysInfo; 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 /* Provides the capabilities of the system
capabilities callback is called once soon after createInstance is called */ capabilities callback is called once soon after createInstance is called */
typedef std::function<void( typedef std::function<void(

View file

@ -89,6 +89,12 @@ struct GnssInterface {
void (*injectLocationExt)(const GnssLocationInfoNotification &locationInfo); void (*injectLocationExt)(const GnssLocationInfoNotification &locationInfo);
void (*updateBatteryStatus)(bool charging); void (*updateBatteryStatus)(bool charging);
void (*updateSystemPowerState)(PowerStateType systemPowerState); 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 { struct BatchingInterface {

View file

@ -2089,26 +2089,6 @@ typedef struct
Gnss_Srn_MacAddr_Type macAddrType; /* SRN AP MAC Address type */ Gnss_Srn_MacAddr_Type macAddrType; /* SRN AP MAC Address type */
} GnssSrnDataReq; } GnssSrnDataReq;
/* 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;
/* Provides the current GNSS SV Type configuration to the client. /* Provides the current GNSS SV Type configuration to the client.
* This is fetched via direct call to GNSS Adapter bypassing * This is fetched via direct call to GNSS Adapter bypassing
* Location API */ * Location API */
@ -2242,6 +2222,7 @@ enum PowerStateType {
#define EAP_LOC_CLIENT_DIR "/data/vendor/location/extap_locclient/" #define EAP_LOC_CLIENT_DIR "/data/vendor/location/extap_locclient/"
#define LOC_CLIENT_NAME_PREFIX "toclient" #define LOC_CLIENT_NAME_PREFIX "toclient"
#define LOC_INTAPI_NAME_PREFIX "toIntapiClient"
typedef uint64_t NetworkHandle; typedef uint64_t NetworkHandle;
#define NETWORK_HANDLE_UNKNOWN ~0 #define NETWORK_HANDLE_UNKNOWN ~0