From f9a26b2a68082f8de9c8167632d27be095a8fabf Mon Sep 17 00:00:00 2001 From: Dante Russo Date: Wed, 2 Apr 2014 14:23:39 -0700 Subject: [PATCH] Inject location only on CPI disabled Includes inject API from GPS HAL and FLP HAL CRs-fixed: 640452 Change-Id: Ied947e2862fb9ecca0142f9608cdcc889cac8a2b --- core/LocAdapterBase.h | 1 + core/LocAdapterProxyBase.h | 5 ++- loc_api/libloc_api_50001/LocEngAdapter.cpp | 40 +++++++++++----------- loc_api/libloc_api_50001/LocEngAdapter.h | 4 +-- loc_api/libloc_api_50001/loc.cpp | 4 +-- loc_api/libloc_api_50001/loc_eng.cpp | 4 +-- 6 files changed, 31 insertions(+), 27 deletions(-) diff --git a/core/LocAdapterBase.h b/core/LocAdapterBase.h index 02b09877..9348a89c 100644 --- a/core/LocAdapterBase.h +++ b/core/LocAdapterBase.h @@ -101,6 +101,7 @@ public: const void* data); inline virtual bool isInSession() { return false; } virtual void shutdown(); + ContextBase* getContext() const { return mContext; } }; } // namespace loc_core diff --git a/core/LocAdapterProxyBase.h b/core/LocAdapterProxyBase.h index adc868c6..25af10be 100644 --- a/core/LocAdapterProxyBase.h +++ b/core/LocAdapterProxyBase.h @@ -46,6 +46,9 @@ protected: inline virtual ~LocAdapterProxyBase() { delete mLocAdapterBase; } + ContextBase* getContext() const { + return mLocAdapterBase->getContext(); + } public: inline virtual void handleEngineUpEvent() {}; inline virtual void handleEngineDownEvent() {}; @@ -53,4 +56,4 @@ public: } // namespace loc_core -#endif //LOC_ADAPTER_PROXY_BASE_H \ No newline at end of file +#endif //LOC_ADAPTER_PROXY_BASE_H diff --git a/loc_api/libloc_api_50001/LocEngAdapter.cpp b/loc_api/libloc_api_50001/LocEngAdapter.cpp index db9f26c2..1e6e4e1b 100644 --- a/loc_api/libloc_api_50001/LocEngAdapter.cpp +++ b/loc_api/libloc_api_50001/LocEngAdapter.cpp @@ -69,8 +69,8 @@ LocEngAdapter::LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask, :context), mOwner(owner), mInternalAdapter(new LocInternalAdapter(this)), mUlp(new UlpProxyBase()), mNavigating(false), - mSupportsAgpsExtendedCapabilities(false), - mSupportsCPIExtendedCapabilities(false), mPowerVote(0) + mSupportsAgpsRequests(false), + mSupportsPositionInjection(false), mPowerVote(0) { memset(&mFixCriteria, 0, sizeof(mFixCriteria)); mFixCriteria.mode = LOC_POSITION_MODE_INVALID; @@ -249,84 +249,84 @@ bool LocEngAdapter::reportXtraServer(const char* url1, const char* url3, const int maxlength) { - if (mSupportsAgpsExtendedCapabilities) { + if (mSupportsAgpsRequests) { sendMsg(new LocEngReportXtraServer(mOwner, url1, url2, url3, maxlength)); } - return mSupportsAgpsExtendedCapabilities; + return mSupportsAgpsRequests; } inline bool LocEngAdapter::requestATL(int connHandle, AGpsType agps_type) { - if (mSupportsAgpsExtendedCapabilities) { + if (mSupportsAgpsRequests) { sendMsg(new LocEngRequestATL(mOwner, connHandle, agps_type)); } - return mSupportsAgpsExtendedCapabilities; + return mSupportsAgpsRequests; } inline bool LocEngAdapter::releaseATL(int connHandle) { - if (mSupportsAgpsExtendedCapabilities) { + if (mSupportsAgpsRequests) { sendMsg(new LocEngReleaseATL(mOwner, connHandle)); } - return mSupportsAgpsExtendedCapabilities; + return mSupportsAgpsRequests; } inline bool LocEngAdapter::requestXtraData() { - if (mSupportsAgpsExtendedCapabilities) { + if (mSupportsAgpsRequests) { sendMsg(new LocEngRequestXtra(mOwner)); } - return mSupportsAgpsExtendedCapabilities; + return mSupportsAgpsRequests; } inline bool LocEngAdapter::requestTime() { - if (mSupportsAgpsExtendedCapabilities) { + if (mSupportsAgpsRequests) { sendMsg(new LocEngRequestTime(mOwner)); } - return mSupportsAgpsExtendedCapabilities; + return mSupportsAgpsRequests; } inline bool LocEngAdapter::requestNiNotify(GpsNiNotification ¬if, const void* data) { - if (mSupportsAgpsExtendedCapabilities) { + if (mSupportsAgpsRequests) { notif.size = sizeof(notif); notif.timeout = LOC_NI_NO_RESPONSE_TIME; sendMsg(new LocEngRequestNi(mOwner, notif, data)); } - return mSupportsAgpsExtendedCapabilities; + return mSupportsAgpsRequests; } inline bool LocEngAdapter::requestSuplES(int connHandle) { - if (mSupportsAgpsExtendedCapabilities) + if (mSupportsAgpsRequests) sendMsg(new LocEngRequestSuplEs(mOwner, connHandle)); - return mSupportsAgpsExtendedCapabilities; + return mSupportsAgpsRequests; } inline bool LocEngAdapter::reportDataCallOpened() { - if(mSupportsAgpsExtendedCapabilities) + if(mSupportsAgpsRequests) sendMsg(new LocEngSuplEsOpened(mOwner)); - return mSupportsAgpsExtendedCapabilities; + return mSupportsAgpsRequests; } inline bool LocEngAdapter::reportDataCallClosed() { - if(mSupportsAgpsExtendedCapabilities) + if(mSupportsAgpsRequests) sendMsg(new LocEngSuplEsClosed(mOwner)); - return mSupportsAgpsExtendedCapabilities; + return mSupportsAgpsRequests; } inline diff --git a/loc_api/libloc_api_50001/LocEngAdapter.h b/loc_api/libloc_api_50001/LocEngAdapter.h index 10b81fb1..27fb0fa1 100644 --- a/loc_api/libloc_api_50001/LocEngAdapter.h +++ b/loc_api/libloc_api_50001/LocEngAdapter.h @@ -83,8 +83,8 @@ class LocEngAdapter : public LocAdapterBase { static const unsigned int POWER_VOTE_VALUE = 0x10; public: - bool mSupportsAgpsExtendedCapabilities; - bool mSupportsCPIExtendedCapabilities; + bool mSupportsAgpsRequests; + bool mSupportsPositionInjection; LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask, void* owner, ContextBase* context, diff --git a/loc_api/libloc_api_50001/loc.cpp b/loc_api/libloc_api_50001/loc.cpp index 910c30c9..97a610ca 100644 --- a/loc_api/libloc_api_50001/loc.cpp +++ b/loc_api/libloc_api_50001/loc.cpp @@ -287,8 +287,8 @@ 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->mSupportsAgpsExtendedCapabilities = !loc_afw_data.adapter->hasAgpsExtendedCapabilities(); - loc_afw_data.adapter->mSupportsCPIExtendedCapabilities = !loc_afw_data.adapter->hasCPIExtendedCapabilities(); + loc_afw_data.adapter->mSupportsAgpsRequests = !loc_afw_data.adapter->hasAgpsExtendedCapabilities(); + loc_afw_data.adapter->mSupportsPositionInjection = !loc_afw_data.adapter->hasCPIExtendedCapabilities(); if(retVal) { LOC_LOGE("loc_eng_init() fail!"); diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp index bddb30db..24ad998c 100644 --- a/loc_api/libloc_api_50001/loc_eng.cpp +++ b/loc_api/libloc_api_50001/loc_eng.cpp @@ -1898,7 +1898,7 @@ 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; - if(!adapter->mSupportsCPIExtendedCapabilities) + if(adapter->mSupportsPositionInjection) { adapter->sendMsg(new LocEngInjectLocation(adapter, latitude, longitude, accuracy)); @@ -2114,7 +2114,7 @@ void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data, AGpsExtCallbacks* call AGPS_TYPE_SUPL, false); - if (adapter->mSupportsAgpsExtendedCapabilities) { + if (adapter->mSupportsAgpsRequests) { loc_eng_data.adapter->sendMsg(new LocEngDataClientInit(&loc_eng_data)); loc_eng_dmn_conn_loc_api_server_launch(callbacks->create_thread_cb,