Changes to conditionally check and inject coarse position

Changes to GPS HAL to determine if wiper available before it does
CPI injection.

Change-Id: Ic481c020bf51ae55b001ab28a0b1caaa5de47cdd
This commit is contained in:
Hema Iyer Sankaranarayanan 2013-11-14 10:25:17 -08:00 committed by Gerrit - the friendly Code Review server
parent 3e5e65938d
commit b5ed3d8505
6 changed files with 13 additions and 4 deletions

View file

@ -57,6 +57,7 @@ public:
inline LocApiBase* getLocApi() { return mLocApi; } inline LocApiBase* getLocApi() { return mLocApi; }
inline LocApiProxyBase* getLocApiProxy() { return mLocApiProxy; } inline LocApiProxyBase* getLocApiProxy() { return mLocApiProxy; }
inline bool hasAgpsExt() { return mLBSProxy->hasAgpsExt(); } inline bool hasAgpsExt() { return mLBSProxy->hasAgpsExt(); }
inline bool hasCPIExt() { return mLBSProxy->hasCPIExt(); }
inline void requestUlp(LocAdapterBase* adapter, inline void requestUlp(LocAdapterBase* adapter,
unsigned long capabilities) { unsigned long capabilities) {
mLBSProxy->requestUlp(adapter, capabilities); mLBSProxy->requestUlp(adapter, capabilities);

View file

@ -50,6 +50,7 @@ public:
inline virtual void requestUlp(LocAdapterBase* adapter, inline virtual void requestUlp(LocAdapterBase* adapter,
unsigned long capabilities) const {} unsigned long capabilities) const {}
inline virtual bool hasAgpsExt() const { return false; } inline virtual bool hasAgpsExt() const { return false; }
inline virtual bool hasCPIExt() const { return false; }
}; };
typedef LBSProxyBase* (getLBSProxy_t)(); typedef LBSProxyBase* (getLBSProxy_t)();

View file

@ -78,7 +78,7 @@ LocEngAdapter::LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask,
:context), :context),
mOwner(owner), mInternalAdapter(new LocInternalAdapter(this)), mOwner(owner), mInternalAdapter(new LocInternalAdapter(this)),
mUlp(new UlpProxyBase()), mNavigating(false), mUlp(new UlpProxyBase()), mNavigating(false),
mAgpsEnabled(false) mAgpsEnabled(false), mCPIEnabled(false)
{ {
memset(&mFixCriteria, 0, sizeof(mFixCriteria)); memset(&mFixCriteria, 0, sizeof(mFixCriteria));
mFixCriteria.mode = LOC_POSITION_MODE_INVALID; mFixCriteria.mode = LOC_POSITION_MODE_INVALID;
@ -291,3 +291,4 @@ void LocEngAdapter::handleEngineUpEvent()
{ {
sendMsg(new LocEngUp(mOwner)); sendMsg(new LocEngUp(mOwner));
} }

View file

@ -76,6 +76,7 @@ class LocEngAdapter : public LocAdapterBase {
public: public:
bool mAgpsEnabled; bool mAgpsEnabled;
bool mCPIEnabled;
LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask, LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask,
void* owner,ContextBase* context, void* owner,ContextBase* context,
@ -90,6 +91,7 @@ public:
inline UlpProxyBase* getUlpProxy() { return mUlp; } inline UlpProxyBase* getUlpProxy() { return mUlp; }
inline void* getOwner() { return mOwner; } inline void* getOwner() { return mOwner; }
inline bool hasAgpsExt() { return mContext->hasAgpsExt(); } inline bool hasAgpsExt() { return mContext->hasAgpsExt(); }
inline bool hasCPIExt() { return mContext->hasCPIExt(); }
inline const MsgTask* getMsgTask() { return mMsgTask; } inline const MsgTask* getMsgTask() { return mMsgTask; }
inline enum loc_api_adapter_err inline enum loc_api_adapter_err

View file

@ -277,7 +277,7 @@ static int loc_init(GpsCallbacks* callbacks)
retVal = loc_eng_init(loc_afw_data, &clientCallbacks, event, NULL); retVal = loc_eng_init(loc_afw_data, &clientCallbacks, event, NULL);
loc_afw_data.adapter->requestUlp(gps_conf.CAPABILITIES); loc_afw_data.adapter->requestUlp(gps_conf.CAPABILITIES);
loc_afw_data.adapter->mAgpsEnabled = !loc_afw_data.adapter->hasAgpsExt(); loc_afw_data.adapter->mAgpsEnabled = !loc_afw_data.adapter->hasAgpsExt();
loc_afw_data.adapter->mCPIEnabled = !loc_afw_data.adapter->hasCPIExt();
EXIT_LOG(%d, retVal); EXIT_LOG(%d, retVal);
return retVal; return retVal;
@ -463,6 +463,7 @@ static int loc_inject_location(double latitude, double longitude, float accuracy
{ {
static bool initialized = false; static bool initialized = false;
static bool enable_cpi = true; static bool enable_cpi = true;
accuracy = 1000;
ENTRY_LOG(); ENTRY_LOG();
if(!initialized) if(!initialized)

View file

@ -1845,8 +1845,11 @@ int loc_eng_inject_location(loc_eng_data_s_type &loc_eng_data, double latitude,
ENTRY_LOG_CALLFLOW(); ENTRY_LOG_CALLFLOW();
INIT_CHECK(loc_eng_data.adapter, return -1); INIT_CHECK(loc_eng_data.adapter, return -1);
LocEngAdapter* adapter = loc_eng_data.adapter; LocEngAdapter* adapter = loc_eng_data.adapter;
adapter->sendMsg(new LocEngInjectLocation(adapter, latitude, longitude, if(!adapter->mCPIEnabled)
accuracy)); {
adapter->sendMsg(new LocEngInjectLocation(adapter, latitude, longitude,
accuracy));
}
EXIT_LOG(%d, 0); EXIT_LOG(%d, 0);
return 0; return 0;