summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorTushar Janefalkar <tusharj@codeaurora.org>2014-02-24 11:13:57 -0800
committerTushar Janefalkar <tusharj@codeaurora.org>2014-05-05 12:10:59 -0700
commit9e585cb7bfbbf602555fe7b8e737ff64083ac7f4 (patch)
treebca328fb9a645897c8399932268655454323baf4 /core
parent3c8b3ff4fd3a444117d9e2067f131d6611e9e57d (diff)
downloadgps-9e585cb7bfbbf602555fe7b8e737ff64083ac7f4.tar.gz
Inject feature config
This change injects feature config through using the first available context CRs-fixed: 616544 Change-Id: Idea5bd8acfff729589c071f20bec18679c89ab25
Diffstat (limited to 'core')
-rw-r--r--core/ContextBase.cpp8
-rw-r--r--core/ContextBase.h1
-rw-r--r--core/LBSProxyBase.h5
-rw-r--r--core/LocApiBase.cpp18
-rw-r--r--core/LocApiBase.h16
-rw-r--r--core/LocDualContext.cpp38
-rw-r--r--core/LocDualContext.h7
7 files changed, 71 insertions, 22 deletions
diff --git a/core/ContextBase.cpp b/core/ContextBase.cpp
index 1bd138e..e5a5014 100644
--- a/core/ContextBase.cpp
+++ b/core/ContextBase.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -65,13 +65,13 @@ LocApiBase* ContextBase::createLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask)
// first if can not be MPQ
if (TARGET_MPQ != loc_get_target()) {
- if (NULL == (locApi = mLBSProxy->getLocApi(mMsgTask, exMask))) {
+ if (NULL == (locApi = mLBSProxy->getLocApi(mMsgTask, exMask, this))) {
// only RPC is the option now
void* handle = dlopen("libloc_api-rpc-qc.so", RTLD_NOW);
if (NULL != handle) {
getLocApi_t* getter = (getLocApi_t*)dlsym(handle, "getLocApi");
if (NULL != getter) {
- locApi = (*getter)(mMsgTask, exMask);
+ locApi = (*getter)(mMsgTask, exMask, this);
}
}
}
@@ -80,7 +80,7 @@ LocApiBase* ContextBase::createLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask)
// locApi could still be NULL at this time
// we would then create a dummy one
if (NULL == locApi) {
- locApi = new LocApiBase(mMsgTask, exMask);
+ locApi = new LocApiBase(mMsgTask, exMask, this);
}
return locApi;
diff --git a/core/ContextBase.h b/core/ContextBase.h
index d713587..2adbedd 100644
--- a/core/ContextBase.h
+++ b/core/ContextBase.h
@@ -62,6 +62,7 @@ public:
unsigned long capabilities) {
mLBSProxy->requestUlp(adapter, capabilities);
}
+ inline void sendMsg(const LocMsg *msg) { getMsgTask()->sendMsg(msg); }
};
} // namespace loc_core
diff --git a/core/LBSProxyBase.h b/core/LBSProxyBase.h
index 99872ee..0b7dbdf 100644
--- a/core/LBSProxyBase.h
+++ b/core/LBSProxyBase.h
@@ -35,12 +35,14 @@ namespace loc_core {
class LocApiBase;
class LocAdapterBase;
+class ContextBase;
class LBSProxyBase {
friend class ContextBase;
inline virtual LocApiBase*
getLocApi(const MsgTask* msgTask,
- LOC_API_ADAPTER_EVENT_MASK_T exMask) const {
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase* context) const {
return NULL;
}
protected:
@@ -51,6 +53,7 @@ public:
unsigned long capabilities) const {}
inline virtual bool hasAgpsExtendedCapabilities() const { return false; }
inline virtual bool hasCPIExtendedCapabilities() const { return false; }
+ virtual void injectFeatureConfig(ContextBase* context) const {}
};
typedef LBSProxyBase* (getLBSProxy_t)();
diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp
index 65d2c8d..90f3653 100644
--- a/core/LocApiBase.cpp
+++ b/core/LocApiBase.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -33,6 +33,7 @@
#include <LocApiBase.h>
#include <LocAdapterBase.h>
#include <log_util.h>
+#include <LocDualContext.h>
namespace loc_core {
@@ -125,8 +126,9 @@ struct LocOpenMsg : public LocMsg {
};
LocApiBase::LocApiBase(const MsgTask* msgTask,
- LOC_API_ADAPTER_EVENT_MASK_T excludedMask) :
- mMsgTask(msgTask), mExcludedMask(excludedMask), mMask(0)
+ LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
+ ContextBase* context) :
+ mExcludedMask(excludedMask), mMsgTask(msgTask), mMask(0), mContext(context)
{
memset(mLocAdapters, 0, sizeof(mLocAdapters));
}
@@ -206,6 +208,8 @@ void LocApiBase::handleEngineUpEvent()
// This will take care of renegotiating the loc handle
mMsgTask->sendMsg(new LocSsrMsg(this));
+ LocDualContext::injectFeatureConfig(mContext);
+
// loop through adapters, and deliver to all adapters.
TO_ALL_LOCADAPTERS(mLocAdapters[i]->handleEngineUpEvent());
}
@@ -443,11 +447,15 @@ enum loc_api_adapter_err LocApiBase::
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
enum loc_api_adapter_err LocApiBase::
- getZppFix(GpsLocation & zppLoc)
+ getWwanZppFix(GpsLocation & zppLoc)
+DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
+
+enum loc_api_adapter_err LocApiBase::
+ getBestAvailableZppFix(GpsLocation & zppLoc)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
enum loc_api_adapter_err LocApiBase::
- getZppFix(GpsLocation & zppLoc, LocPosTechMask & tech_mask)
+ getBestAvailableZppFix(GpsLocation & zppLoc, LocPosTechMask & tech_mask)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
int LocApiBase::
diff --git a/core/LocApiBase.h b/core/LocApiBase.h
index 1603e6b..bef0379 100644
--- a/core/LocApiBase.h
+++ b/core/LocApiBase.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -36,6 +36,7 @@
#include <log_util.h>
namespace loc_core {
+class ContextBase;
int hexcode(char *hexstring, int string_size,
const char *data, int data_size);
@@ -70,6 +71,7 @@ class LocApiBase {
friend struct LocOpenMsg;
friend class ContextBase;
const MsgTask* mMsgTask;
+ ContextBase *mContext;
LocAdapterBase* mLocAdapters[MAX_ADAPTERS];
protected:
@@ -80,7 +82,8 @@ protected:
LOC_API_ADAPTER_EVENT_MASK_T getEvtMask();
LOC_API_ADAPTER_EVENT_MASK_T mMask;
LocApiBase(const MsgTask* msgTask,
- LOC_API_ADAPTER_EVENT_MASK_T excludedMask);
+ LOC_API_ADAPTER_EVENT_MASK_T excludedMask,
+ ContextBase* context = NULL);
inline virtual ~LocApiBase() { close(); }
bool isInSession();
const LOC_API_ADAPTER_EVENT_MASK_T mExcludedMask;
@@ -189,9 +192,11 @@ public:
virtual enum loc_api_adapter_err
setAGLONASSProtocol(unsigned long aGlonassProtocol);
virtual enum loc_api_adapter_err
- getZppFix(GpsLocation & zppLoc);
+ getWwanZppFix(GpsLocation & zppLoc);
virtual enum loc_api_adapter_err
- getZppFix(GpsLocation & zppLoc, LocPosTechMask & tech_mask);
+ getBestAvailableZppFix(GpsLocation & zppLoc);
+ virtual enum loc_api_adapter_err
+ getBestAvailableZppFix(GpsLocation & zppLoc, LocPosTechMask & tech_mask);
virtual int initDataServiceClient();
virtual int openAndStartDataCall();
virtual void stopDataCall();
@@ -215,7 +220,8 @@ public:
};
typedef LocApiBase* (getLocApi_t)(const MsgTask* msgTask,
- LOC_API_ADAPTER_EVENT_MASK_T exMask);
+ LOC_API_ADAPTER_EVENT_MASK_T exMask,
+ ContextBase *context);
} // namespace loc_core
diff --git a/core/LocDualContext.cpp b/core/LocDualContext.cpp
index fa4c4d6..ab15110 100644
--- a/core/LocDualContext.cpp
+++ b/core/LocDualContext.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -55,10 +55,10 @@ LocDualContext::mBgExclMask =
const MsgTask* LocDualContext::mMsgTask = NULL;
ContextBase* LocDualContext::mFgContext = NULL;
ContextBase* LocDualContext::mBgContext = NULL;
-
+ContextBase* LocDualContext::mInjectContext = NULL;
// the name must be shorter than 15 chars
const char* LocDualContext::mLocationHalName = "Loc_hal_worker";
-const char* LocDualContext::mIzatLibName = "liblbs_core.so";
+const char* LocDualContext::mLBSLibName = "liblbs_core.so";
const MsgTask* LocDualContext::getMsgTask(MsgTask::tCreate tCreator,
const char* name)
@@ -88,6 +88,10 @@ ContextBase* LocDualContext::getLocFgContext(MsgTask::tCreate tCreator,
mFgContext = new LocDualContext(msgTask,
mFgExclMask);
}
+ if(NULL == mInjectContext) {
+ mInjectContext = mFgContext;
+ injectFeatureConfig(mInjectContext);
+ }
return mFgContext;
}
@@ -99,6 +103,11 @@ ContextBase* LocDualContext::getLocFgContext(MsgTask::tAssociate tAssociate,
mFgContext = new LocDualContext(msgTask,
mFgExclMask);
}
+ if(NULL == mInjectContext) {
+ LOC_LOGD("%s:%d]: mInjectContext is FgContext", __func__, __LINE__);
+ mInjectContext = mFgContext;
+ injectFeatureConfig(mInjectContext);
+ }
return mFgContext;
}
@@ -111,6 +120,11 @@ ContextBase* LocDualContext::getLocBgContext(MsgTask::tCreate tCreator,
mBgContext = new LocDualContext(msgTask,
mBgExclMask);
}
+ if(NULL == mInjectContext) {
+ LOC_LOGD("%s:%d]: mInjectContext is BgContext", __func__, __LINE__);
+ mInjectContext = mBgContext;
+ injectFeatureConfig(mInjectContext);
+ }
return mBgContext;
}
@@ -122,12 +136,28 @@ ContextBase* LocDualContext::getLocBgContext(MsgTask::tAssociate tAssociate,
mBgContext = new LocDualContext(msgTask,
mBgExclMask);
}
+ if(NULL == mInjectContext) {
+ LOC_LOGD("%s:%d]: mInjectContext is BgContext", __func__, __LINE__);
+ mInjectContext = mBgContext;
+ injectFeatureConfig(mInjectContext);
+ }
return mBgContext;
}
+void LocDualContext :: injectFeatureConfig(ContextBase *curContext)
+{
+ LOC_LOGD("%s:%d]: Enter", __func__, __LINE__);
+ if(curContext == mInjectContext) {
+ LOC_LOGD("%s:%d]: Calling LBSProxy (%p) to inject feature config",
+ __func__, __LINE__, ((LocDualContext *)mInjectContext)->mLBSProxy);
+ ((LocDualContext *)mInjectContext)->mLBSProxy->injectFeatureConfig(curContext);
+ }
+ LOC_LOGD("%s:%d]: Exit", __func__, __LINE__);
+}
+
LocDualContext::LocDualContext(const MsgTask* msgTask,
LOC_API_ADAPTER_EVENT_MASK_T exMask) :
- ContextBase(msgTask, exMask, mIzatLibName)
+ ContextBase(msgTask, exMask, mLBSLibName)
{
}
diff --git a/core/LocDualContext.h b/core/LocDualContext.h
index e761e76..cdc4df3 100644
--- a/core/LocDualContext.h
+++ b/core/LocDualContext.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2013, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -40,7 +40,7 @@ class LocDualContext : public ContextBase {
static const MsgTask* mMsgTask;
static ContextBase* mFgContext;
static ContextBase* mBgContext;
-
+ static ContextBase* mInjectContext;
static const MsgTask* getMsgTask(MsgTask::tCreate tCreator,
const char* name);
static const MsgTask* getMsgTask(MsgTask::tAssociate tAssociate,
@@ -52,7 +52,7 @@ protected:
inline virtual ~LocDualContext() {}
public:
- static const char* mIzatLibName;
+ static const char* mLBSLibName;
static const LOC_API_ADAPTER_EVENT_MASK_T mFgExclMask;
static const LOC_API_ADAPTER_EVENT_MASK_T mBgExclMask;
static const char* mLocationHalName;
@@ -65,6 +65,7 @@ public:
const char* name);
static ContextBase* getLocBgContext(MsgTask::tAssociate tAssociate,
const char* name);
+ static void injectFeatureConfig(ContextBase *context);
};
}