diff --git a/core/ContextBase.h b/core/ContextBase.h index b41dd780..85cbab7e 100644 --- a/core/ContextBase.h +++ b/core/ContextBase.h @@ -57,6 +57,7 @@ public: inline LocApiBase* getLocApi() { return mLocApi; } inline LocApiProxyBase* getLocApiProxy() { return mLocApiProxy; } inline bool hasAgpsExt() { return mLBSProxy->hasAgpsExt(); } + inline bool hasCPIExt() { return mLBSProxy->hasCPIExt(); } inline void requestUlp(LocAdapterBase* adapter, unsigned long capabilities) { mLBSProxy->requestUlp(adapter, capabilities); diff --git a/core/LBSProxyBase.h b/core/LBSProxyBase.h index e643d126..f0d1a329 100644 --- a/core/LBSProxyBase.h +++ b/core/LBSProxyBase.h @@ -50,6 +50,7 @@ public: inline virtual void requestUlp(LocAdapterBase* adapter, unsigned long capabilities) const {} inline virtual bool hasAgpsExt() const { return false; } + inline virtual bool hasCPIExt() const { return false; } }; typedef LBSProxyBase* (getLBSProxy_t)(); diff --git a/loc_api/libloc_api_50001/LocEngAdapter.cpp b/loc_api/libloc_api_50001/LocEngAdapter.cpp index 1aef99d3..55418d1d 100644 --- a/loc_api/libloc_api_50001/LocEngAdapter.cpp +++ b/loc_api/libloc_api_50001/LocEngAdapter.cpp @@ -78,7 +78,7 @@ LocEngAdapter::LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask, :context), mOwner(owner), mInternalAdapter(new LocInternalAdapter(this)), mUlp(new UlpProxyBase()), mNavigating(false), - mAgpsEnabled(false) + mAgpsEnabled(false), mCPIEnabled(false) { memset(&mFixCriteria, 0, sizeof(mFixCriteria)); mFixCriteria.mode = LOC_POSITION_MODE_INVALID; @@ -291,3 +291,4 @@ void LocEngAdapter::handleEngineUpEvent() { sendMsg(new LocEngUp(mOwner)); } + diff --git a/loc_api/libloc_api_50001/LocEngAdapter.h b/loc_api/libloc_api_50001/LocEngAdapter.h index a9a50e68..3a757dd3 100644 --- a/loc_api/libloc_api_50001/LocEngAdapter.h +++ b/loc_api/libloc_api_50001/LocEngAdapter.h @@ -76,6 +76,7 @@ class LocEngAdapter : public LocAdapterBase { public: bool mAgpsEnabled; + bool mCPIEnabled; LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask, void* owner,ContextBase* context, @@ -90,6 +91,7 @@ public: inline UlpProxyBase* getUlpProxy() { return mUlp; } inline void* getOwner() { return mOwner; } inline bool hasAgpsExt() { return mContext->hasAgpsExt(); } + inline bool hasCPIExt() { return mContext->hasCPIExt(); } inline const MsgTask* getMsgTask() { return mMsgTask; } inline enum loc_api_adapter_err diff --git a/loc_api/libloc_api_50001/loc.cpp b/loc_api/libloc_api_50001/loc.cpp index 7cedb577..0b032f0b 100644 --- a/loc_api/libloc_api_50001/loc.cpp +++ b/loc_api/libloc_api_50001/loc.cpp @@ -277,7 +277,7 @@ static int loc_init(GpsCallbacks* callbacks) retVal = loc_eng_init(loc_afw_data, &clientCallbacks, event, NULL); loc_afw_data.adapter->requestUlp(gps_conf.CAPABILITIES); loc_afw_data.adapter->mAgpsEnabled = !loc_afw_data.adapter->hasAgpsExt(); - + loc_afw_data.adapter->mCPIEnabled = !loc_afw_data.adapter->hasCPIExt(); EXIT_LOG(%d, retVal); return retVal; @@ -463,6 +463,7 @@ static int loc_inject_location(double latitude, double longitude, float accuracy { static bool initialized = false; static bool enable_cpi = true; + accuracy = 1000; ENTRY_LOG(); if(!initialized) diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp index 8079ada5..cf11c183 100644 --- a/loc_api/libloc_api_50001/loc_eng.cpp +++ b/loc_api/libloc_api_50001/loc_eng.cpp @@ -1845,8 +1845,11 @@ int loc_eng_inject_location(loc_eng_data_s_type &loc_eng_data, double latitude, ENTRY_LOG_CALLFLOW(); INIT_CHECK(loc_eng_data.adapter, return -1); LocEngAdapter* adapter = loc_eng_data.adapter; - adapter->sendMsg(new LocEngInjectLocation(adapter, latitude, longitude, - accuracy)); + if(!adapter->mCPIEnabled) + { + adapter->sendMsg(new LocEngInjectLocation(adapter, latitude, longitude, + accuracy)); + } EXIT_LOG(%d, 0); return 0;