diff options
author | qctecmdr <qctecmdr@localhost> | 2020-11-04 12:42:54 -0800 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2020-11-04 12:42:54 -0800 |
commit | 31bed120f103c8a099f8b14799a6ac634f5c6537 (patch) | |
tree | bb687ee6e7846b5bebd403a98d8df3af0a5be11c | |
parent | 181d177eed3eca1fbd1f49b712996eeec032629c (diff) | |
parent | 8a9f02f570f9790b2f03afda861cf4ba3e64c143 (diff) |
Merge "GPS HAL: support runtime DR engine supsend resume"
-rw-r--r-- | core/EngineHubProxyBase.h | 7 | ||||
-rw-r--r-- | gnss/GnssAdapter.cpp | 51 | ||||
-rw-r--r-- | gnss/GnssAdapter.h | 3 | ||||
-rw-r--r-- | gnss/location_gnss.cpp | 10 | ||||
-rw-r--r-- | location/ILocationAPI.h | 38 | ||||
-rw-r--r-- | location/LocationAPI.cpp | 15 | ||||
-rw-r--r-- | location/LocationAPI.h | 38 | ||||
-rw-r--r-- | location/LocationDataTypes.h | 10 | ||||
-rw-r--r-- | location/location_interface.h | 2 |
9 files changed, 172 insertions, 2 deletions
diff --git a/core/EngineHubProxyBase.h b/core/EngineHubProxyBase.h index f7fe4d2..399297b 100644 --- a/core/EngineHubProxyBase.h +++ b/core/EngineHubProxyBase.h @@ -112,6 +112,13 @@ public: (void) dreConfig; return false; } + + inline virtual bool configEngineRunState( + PositioningEngineMask engType, LocEngineRunState engState) { + (void) engType; + (void) engState; + return false; + } }; typedef std::function<void(int count, EngineLocationInfo* locationArr)> diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp index 3f0acd0..04b5172 100644 --- a/gnss/GnssAdapter.cpp +++ b/gnss/GnssAdapter.cpp @@ -117,6 +117,7 @@ GnssAdapter::GnssAdapter() : mServerUrl(":"), mXtraObserver(mSystemStatus->getOsObserver(), mMsgTask), mBlockCPIInfo{}, + mDreIntEnabled(false), mLocSystemInfo{}, mGnssMbSvIdUsedInPosition{}, mGnssMbSvIdUsedInPosAvail(false), @@ -5720,7 +5721,7 @@ GnssAdapter::configLeverArmCommand(const LeverArmConfigInfo& configInfo) { mSessionId(sessionId), mConfigInfo(configInfo) {} inline virtual void proc() const { - // save the lever ARM config info for translate position from GNSS antenna based + // save the lever ARM config info for translating position from GNSS antenna based // to VRP based if (mConfigInfo.leverArmValidMask & LEVER_ARM_TYPE_GNSS_TO_VRP_BIT) { mAdapter.mLocConfigInfo.leverArmConfigInfo.leverArmValidMask |= @@ -5868,6 +5869,47 @@ uint32_t GnssAdapter::configDeadReckoningEngineParamsCommand( return sessionId; } +uint32_t GnssAdapter::configEngineRunStateCommand( + PositioningEngineMask engType, LocEngineRunState engState) { + + // generated session id will be none-zero + uint32_t sessionId = generateSessionId(); + LOC_LOGe("session id %u, eng type 0x%x, eng state %d, dre enabled %d", + sessionId, engType, engState, mDreIntEnabled); + + struct MsgConfigEngineRunState : public LocMsg { + GnssAdapter& mAdapter; + uint32_t mSessionId; + PositioningEngineMask mEngType; + LocEngineRunState mEngState; + + inline MsgConfigEngineRunState(GnssAdapter& adapter, + uint32_t sessionId, + PositioningEngineMask engType, + LocEngineRunState engState) : + LocMsg(), + mAdapter(adapter), + mSessionId(sessionId), + mEngType(engType), + mEngState(engState) {} + inline virtual void proc() const { + LocationError err = LOCATION_ERROR_NOT_SUPPORTED; + // Currently, only DR engine supports pause/resume request + if ((mEngType == DEAD_RECKONING_ENGINE) && + (mAdapter.mDreIntEnabled == true)) { + if (true == mAdapter.mEngHubProxy->configEngineRunState(mEngType, mEngState)) { + err = LOCATION_ERROR_SUCCESS; + } + } + mAdapter.reportResponse(err, mSessionId); + } + }; + + sendMsg(new MsgConfigEngineRunState(*this, sessionId, engType, engState)); + + return sessionId; +} + void GnssAdapter::reportGnssConfigEvent(uint32_t sessionId, const GnssConfig& gnssConfig) { struct MsgReportGnssConfig : public LocMsg { @@ -5942,7 +5984,12 @@ GnssAdapter::initEngHubProxy() { strlen(PROCESS_NAME_ENGINE_SERVICE)) == 0) && (processInfoList[i].proc_status == ENABLED)) { pluginDaemonEnabled = true; - break; + // check if this is DRE-INT engine + if ((processInfoList[i].args[1]!= nullptr) && + (strncmp(processInfoList[i].args[1], "DRE-INT", sizeof("DRE-INT")) == 0)) { + mDreIntEnabled = true; + break; + } } } diff --git a/gnss/GnssAdapter.h b/gnss/GnssAdapter.h index 9601b38..ff8cc6d 100644 --- a/gnss/GnssAdapter.h +++ b/gnss/GnssAdapter.h @@ -254,6 +254,7 @@ class GnssAdapter : public LocAdapterBase { BlockCPIInfo mBlockCPIInfo; std::queue<GnssLatencyInfo> mGnssLatencyInfoQueue; GnssReportLoggerUtil mLogger; + bool mDreIntEnabled; /* === Misc callback from QMI LOC API ============================================== */ GnssEnergyConsumedCallback mGnssEnergyConsumedCb; @@ -424,6 +425,8 @@ public: uint32_t configRobustLocationCommand(bool enable, bool enableForE911); uint32_t configMinGpsWeekCommand(uint16_t minGpsWeek); uint32_t configDeadReckoningEngineParamsCommand(const DeadReckoningEngineConfig& dreConfig); + uint32_t configEngineRunStateCommand(PositioningEngineMask engType, + LocEngineRunState engState); /* ========= ODCPI ===================================================================== */ /* ======== COMMANDS ====(Called from Client Thread)==================================== */ diff --git a/gnss/location_gnss.cpp b/gnss/location_gnss.cpp index d29840a..6c3c226 100644 --- a/gnss/location_gnss.cpp +++ b/gnss/location_gnss.cpp @@ -87,6 +87,7 @@ static uint32_t configMinGpsWeek(uint16_t minGpsWeek); static uint32_t configDeadReckoningEngineParams(const DeadReckoningEngineConfig& dreConfig); static uint32_t gnssUpdateSecondaryBandConfig(const GnssSvTypeConfig& secondaryBandConfig); static uint32_t gnssGetSecondaryBandConfig(); +static uint32_t configEngineRunState(PositioningEngineMask engType, LocEngineRunState engState); static const GnssInterface gGnssInterface = { sizeof(GnssInterface), @@ -133,6 +134,7 @@ static const GnssInterface gGnssInterface = { configDeadReckoningEngineParams, gnssUpdateSecondaryBandConfig, gnssGetSecondaryBandConfig, + configEngineRunState, }; #ifndef DEBUG_X86 @@ -467,3 +469,11 @@ static uint32_t gnssGetSecondaryBandConfig(){ return 0; } } + +static uint32_t configEngineRunState(PositioningEngineMask engType, LocEngineRunState engState) { + if (NULL != gGnssAdapter) { + return gGnssAdapter->configEngineRunStateCommand(engType, engState); + } else { + return 0; + } +} diff --git a/location/ILocationAPI.h b/location/ILocationAPI.h index 96076e9..074ef5f 100644 --- a/location/ILocationAPI.h +++ b/location/ILocationAPI.h @@ -363,6 +363,44 @@ public: LOCATION_ERROR_INVALID_PARAMETER if any parameters are invalid */ virtual uint32_t configDeadReckoningEngineParams(const DeadReckoningEngineConfig& dreConfig)=0; + + /** @brief + This API is used to instruct the specified engine to be in + the pause/resume state. <br/> + + When the engine is placed in paused state, the engine will + stop. If there is an on-going session, engine will no longer + produce fixes. In the paused state, calling API to delete + aiding data from the paused engine may not have effect. + Request to delete Aiding data shall be issued after + engine resume. <br/> + + Currently, only DRE engine will support pause/resume + request. responseCb() will return not supported when request + is made to pause/resume none-DRE engine. <br/> + + Request to pause/resume DRE engine can be made with or + without an on-going session. With Qualcomm DR engine, on + resume, GNSS position & heading re-acquisition is needed for + DR to engage. If DRE engine is already in the requested + state, the request will be no-op. <br/> + + @param + engType: the engine that is instructed to change its run + state. <br/> + + engState: the new engine run state that the engine is + instructed to be in. <br/> + + @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 configEngineRunState(PositioningEngineMask engType, + LocEngineRunState engState) = 0; }; #endif /* ILOCATIONAPI_H */ diff --git a/location/LocationAPI.cpp b/location/LocationAPI.cpp index 284a625..001327c 100644 --- a/location/LocationAPI.cpp +++ b/location/LocationAPI.cpp @@ -872,3 +872,18 @@ uint32_t LocationControlAPI::configDeadReckoningEngineParams( pthread_mutex_unlock(&gDataMutex); return id; } + +uint32_t LocationControlAPI::configEngineRunState( + PositioningEngineMask engType, LocEngineRunState engState) { + uint32_t id = 0; + pthread_mutex_lock(&gDataMutex); + + if (gData.gnssInterface != NULL) { + id = gData.gnssInterface->configEngineRunState(engType, engState); + } 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 21a3a1f..b21e02a 100644 --- a/location/LocationAPI.h +++ b/location/LocationAPI.h @@ -442,6 +442,44 @@ public: */ virtual uint32_t configDeadReckoningEngineParams( const DeadReckoningEngineConfig& dreConfig) override; + + /** @brief + This API is used to instruct the specified engine to be in + the pause/resume state. <br/> + + When the engine is placed in paused state, the engine will + stop. If there is an on-going session, engine will no longer + produce fixes. In the paused state, calling API to delete + aiding data from the paused engine may not have effect. + Request to delete Aiding data shall be issued after + engine resume. <br/> + + Currently, only DRE engine will support pause/resume + request. responseCb() will return not supported when request + is made to pause/resume none-DRE engine. <br/> + + Request to pause/resume DRE engine can be made with or + without an on-going session. With Qualcomm DR engine, on + resume, GNSS position & heading re-acquisition is needed for + DR to engage. If DRE engine is already in the requested + state, the request will be no-op. <br/> + + @param + engType: the engine that is instructed to change its run + state. <br/> + + engState: the new engine run state that the engine is + instructed to be in. <br/> + + @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 configEngineRunState(PositioningEngineMask engType, + LocEngineRunState engState) override; }; #endif /* LOCATIONAPI_H */ diff --git a/location/LocationDataTypes.h b/location/LocationDataTypes.h index b2a6a8f..a30d729 100644 --- a/location/LocationDataTypes.h +++ b/location/LocationDataTypes.h @@ -679,6 +679,16 @@ typedef enum { (STANDARD_POSITIONING_ENGINE|DEAD_RECKONING_ENGINE| \ PRECISE_POSITIONING_ENGINE|VP_POSITIONING_ENGINE) +/** Specify the position engine running state. <br/> */ +enum LocEngineRunState { + /** Request the position engine to be put into resume state. + * <br/> */ + LOC_ENGINE_RUN_STATE_PAUSE = 1, + /** Request the position engine to be put into resume state. + * <br/> */ + LOC_ENGINE_RUN_STATE_RESUME = 2, +}; + typedef uint64_t GnssDataMask; typedef enum { // Jammer Indicator is available diff --git a/location/location_interface.h b/location/location_interface.h index cbbdf4d..0d343c2 100644 --- a/location/location_interface.h +++ b/location/location_interface.h @@ -95,6 +95,8 @@ struct GnssInterface { uint32_t (*configDeadReckoningEngineParams)(const DeadReckoningEngineConfig& dreConfig); uint32_t (*gnssUpdateSecondaryBandConfig)(const GnssSvTypeConfig& secondaryBandConfig); uint32_t (*gnssGetSecondaryBandConfig)(); + uint32_t (*configEngineRunState)(PositioningEngineMask engType, + LocEngineRunState engState); }; struct FlpInterface { |