summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorKevin Tang <zhikait@codeaurora.org>2013-07-20 14:16:32 -0700
committerSridhar Nelloru <nellos@codeaurora.org>2013-08-09 11:44:27 -0700
commit3535edcfb0def6f298eea21f51fc91103004c984 (patch)
tree00784aefaf9ecbd9cfbf2e086bc477381e05b5f3 /core
parent11adbb371f795fc676949a6fee5fe5e918443845 (diff)
downloadgps-3535edcfb0def6f298eea21f51fc91103004c984.tar.gz
corresponding to izat_core and LBSAdapter changes.
Removed makefile dependency to AndrodRuntime; Renamed library to be loaded from liblocation to libizat_core; Made some class private access to protected for the needs of inheritance; piggy bagged some optimizations. Change-Id: Id7e3127baa1833cbad7739f50808941c733b87f2 (cherry picked from commit c039ceaec84b25573d710b31831c9b06d4f3d1c6)
Diffstat (limited to 'core')
-rw-r--r--core/Android.mk3
-rw-r--r--core/ContextBase.cpp2
-rw-r--r--core/ContextBase.h3
-rw-r--r--core/LocAdapterBase.cpp8
-rw-r--r--core/LocApiBase.cpp10
-rw-r--r--core/LocApiBase.h14
-rw-r--r--core/LocDualContext.cpp37
-rw-r--r--core/LocDualContext.h6
8 files changed, 56 insertions, 27 deletions
diff --git a/core/Android.mk b/core/Android.mk
index f9074db..bb222b8 100644
--- a/core/Android.mk
+++ b/core/Android.mk
@@ -13,8 +13,7 @@ LOCAL_SHARED_LIBRARIES := \
libutils \
libcutils \
libgps.utils \
- libdl \
- libandroid_runtime
+ libdl
LOCAL_SRC_FILES += \
MsgTask.cpp \
diff --git a/core/ContextBase.cpp b/core/ContextBase.cpp
index 7922cc2..3ab364f 100644
--- a/core/ContextBase.cpp
+++ b/core/ContextBase.cpp
@@ -39,7 +39,7 @@
namespace loc_core {
-const char* ContextBase::mIzatLibName = "libloc_api_v02.so ";
+const char* ContextBase::mIzatLibName = "libizat_core.so";
// we initialized this handle to 1 because it can't possibly
// 1 if it ever gets assigned a value. NULL on the otherhand
// is possilbe.
diff --git a/core/ContextBase.h b/core/ContextBase.h
index b04def3..6ad9cad 100644
--- a/core/ContextBase.h
+++ b/core/ContextBase.h
@@ -45,12 +45,11 @@ protected:
const MsgTask* mMsgTask;
LocApiBase* mLocApi;
-protected:
+public:
ContextBase(const MsgTask* msgTask,
LOC_API_ADAPTER_EVENT_MASK_T exMask);
inline virtual ~ContextBase() { delete mLocApi; }
-public:
static void* getIzatLibHandle();
inline const MsgTask* getMsgTask() { return mMsgTask; }
inline LocApiBase* getLocApi() { return mLocApi; }
diff --git a/core/LocAdapterBase.cpp b/core/LocAdapterBase.cpp
index 27b9f61..48d179f 100644
--- a/core/LocAdapterBase.cpp
+++ b/core/LocAdapterBase.cpp
@@ -68,14 +68,6 @@ LocAdapterBase::LocAdapterBase(const LOC_API_ADAPTER_EVENT_MASK_T mask,
sendMsg(new LocOpenMsg(this, mLocApi));
}
-// This will be overridden by the individual adapters
-// if necessary.
-#define DEFAULT_IMPL(rtv) \
-{ \
- LOC_LOGW("%s: default implementation invoked", __func__); \
- return rtv; \
-}
-
void LocAdapterBase::
handleEngineDownEvent()
DEFAULT_IMPL()
diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp
index c6fef93..11d2ccb 100644
--- a/core/LocApiBase.cpp
+++ b/core/LocApiBase.cpp
@@ -328,16 +328,6 @@ void LocApiBase::requestNiNotify(GpsNiNotification &notify, const void* data)
TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestNiNotify(notify, data));
}
-
-// downward calls
-// All below functions are to be defined by adapter specific modules:
-// RPC, QMI, etc. The default implementation is empty.
-#define DEFAULT_IMPL(rtv) \
-{ \
- LOC_LOGW("%s: default implementation invoked", __func__); \
- return rtv; \
-}
-
enum loc_api_adapter_err LocApiBase::
open(LOC_API_ADAPTER_EVENT_MASK_T mask)
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
diff --git a/core/LocApiBase.h b/core/LocApiBase.h
index c027b3f..3676bff 100644
--- a/core/LocApiBase.h
+++ b/core/LocApiBase.h
@@ -37,6 +37,14 @@
#define smaller_of(a, b) (((a) > (b)) ? (b) : (a))
#define MAX_APN_LEN 100
+// This will be overridden by the individual adapters
+// if necessary.
+#define DEFAULT_IMPL(rtv) \
+{ \
+ LOC_LOGW("%s: default implementation invoked", __func__); \
+ return rtv; \
+}
+
namespace loc_core {
int hexcode(char *hexstring, int string_size,
@@ -122,20 +130,20 @@ class LocApiBase {
friend class ContextBase;
const LOC_API_ADAPTER_EVENT_MASK_T mExcludedMask;
const MsgTask* mMsgTask;
+
LocAdapterBase* mLocAdapters[MAX_ADAPTERS];
static LocApiBase* create(const MsgTask* msgTask,
LOC_API_ADAPTER_EVENT_MASK_T exMask,
void* libHandle);
+protected:
virtual enum loc_api_adapter_err
open(LOC_API_ADAPTER_EVENT_MASK_T mask);
virtual enum loc_api_adapter_err
close();
LOC_API_ADAPTER_EVENT_MASK_T getEvtMask();
-
-protected:
LOC_API_ADAPTER_EVENT_MASK_T mMask;
LocApiBase(const MsgTask* msgTask,
LOC_API_ADAPTER_EVENT_MASK_T excludedMask);
@@ -143,6 +151,8 @@ protected:
bool isInSession();
public:
+ inline virtual void* getSibling() { return NULL; }
+
void addAdapter(LocAdapterBase* adapter);
void removeAdapter(LocAdapterBase* adapter);
diff --git a/core/LocDualContext.cpp b/core/LocDualContext.cpp
index 2218621..a62a700 100644
--- a/core/LocDualContext.cpp
+++ b/core/LocDualContext.cpp
@@ -70,6 +70,15 @@ const MsgTask* LocDualContext::getMsgTask(MsgTask::tCreate tCreator,
return mMsgTask;
}
+const MsgTask* LocDualContext::getMsgTask(MsgTask::tAssociate tAssociate,
+ const char* name)
+{
+ if (NULL == mMsgTask) {
+ mMsgTask = new MsgTask(tAssociate, name);
+ }
+ return mMsgTask;
+}
+
ContextBase* LocDualContext::getLocFgContext(MsgTask::tCreate tCreator,
const char* name)
{
@@ -81,6 +90,18 @@ ContextBase* LocDualContext::getLocFgContext(MsgTask::tCreate tCreator,
return mFgContext;
}
+ContextBase* LocDualContext::getLocFgContext(MsgTask::tAssociate tAssociate,
+ const char* name)
+{
+ if (NULL == mFgContext) {
+ const MsgTask* msgTask = getMsgTask(tAssociate, name);
+ mFgContext = new LocDualContext(msgTask,
+ mFgExclMask);
+ }
+ return mFgContext;
+
+}
+
ContextBase* LocDualContext::getLocBgContext(MsgTask::tCreate tCreator,
const char* name)
{
@@ -92,6 +113,18 @@ ContextBase* LocDualContext::getLocBgContext(MsgTask::tCreate tCreator,
return mBgContext;
}
+ContextBase* LocDualContext::getLocBgContext(MsgTask::tAssociate tAssociate,
+ const char* name)
+{
+ if (NULL == mBgContext) {
+ const MsgTask* msgTask = getMsgTask(tAssociate, name);
+ mBgContext = new LocDualContext(msgTask,
+ mBgExclMask);
+ }
+ return mBgContext;
+}
+
+
bool LocDualContext::hasAgpsExt()
{
if (0xff == mHasAgpsExt) {
@@ -99,8 +132,8 @@ bool LocDualContext::hasAgpsExt()
void* handle = ContextBase::getIzatLibHandle();
if (NULL != handle) {
bool(*getter)() = (bool(*)())dlsym(handle, "hasAgpsExt");
- if (NULL != getter && (*getter)()) {
- mHasAgpsExt = 1;
+ if (NULL != getter) {
+ mHasAgpsExt = (*getter)();
}
}
}
diff --git a/core/LocDualContext.h b/core/LocDualContext.h
index 4e03bf4..488f5aa 100644
--- a/core/LocDualContext.h
+++ b/core/LocDualContext.h
@@ -44,6 +44,8 @@ class LocDualContext : public ContextBase {
static const MsgTask* getMsgTask(MsgTask::tCreate tCreator,
const char* name);
+ static const MsgTask* getMsgTask(MsgTask::tAssociate tAssociate,
+ const char* name);
protected:
LocDualContext(const MsgTask* msgTask,
@@ -57,8 +59,12 @@ public:
static ContextBase* getLocFgContext(MsgTask::tCreate tCreator,
const char* name);
+ static ContextBase* getLocFgContext(MsgTask::tAssociate tAssociate,
+ const char* name);
static ContextBase* getLocBgContext(MsgTask::tCreate tCreator,
const char* name);
+ static ContextBase* getLocBgContext(MsgTask::tAssociate tAssociate,
+ const char* name);
static bool hasAgpsExt();
};