Changes for liblbs_core
Added new module liblbs_core to make LocApiV02 independent of pre-built binaries. This patch provies the necessary changes to support the new module CRs-fixed: 538124 Change-Id: I716cf169de9dae164a141651af971793099a927d
This commit is contained in:
parent
7b0be28423
commit
4dbc22bd57
7 changed files with 29 additions and 23 deletions
|
@ -38,7 +38,7 @@ LOCAL_COPY_HEADERS:= \
|
|||
LocAdapterBase.h \
|
||||
ContextBase.h \
|
||||
LocDualContext.h \
|
||||
IzatProxyBase.h \
|
||||
LBSProxyBase.h \
|
||||
UlpProxyBase.h \
|
||||
gps_extended_c.h \
|
||||
gps_extended.h \
|
||||
|
|
|
@ -40,21 +40,22 @@
|
|||
|
||||
namespace loc_core {
|
||||
|
||||
|
||||
IzatProxyBase* ContextBase::getIzatProxy(const char* libName)
|
||||
LBSProxyBase* ContextBase::getLBSProxy(const char* libName)
|
||||
{
|
||||
IzatProxyBase* proxy = NULL;
|
||||
LBSProxyBase* proxy = NULL;
|
||||
LOC_LOGD("%s:%d]: getLBSProxy libname: %s\n", __func__, __LINE__, libName);
|
||||
void* lib = dlopen(libName, RTLD_NOW);
|
||||
|
||||
if ((void*)NULL != lib) {
|
||||
getIzatProxy_t* getter = (getIzatProxy_t*)dlsym(lib, "getIzatProxy");
|
||||
getLBSProxy_t* getter = (getLBSProxy_t*)dlsym(lib, "getLBSProxy");
|
||||
if (NULL != getter) {
|
||||
proxy = (*getter)();
|
||||
}
|
||||
}
|
||||
if (NULL == proxy) {
|
||||
proxy = new IzatProxyBase();
|
||||
proxy = new LBSProxyBase();
|
||||
}
|
||||
LOC_LOGD("%s:%d]: Exiting\n", __func__, __LINE__);
|
||||
return proxy;
|
||||
}
|
||||
|
||||
|
@ -64,7 +65,7 @@ LocApiBase* ContextBase::createLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask)
|
|||
|
||||
// first if can not be MPQ
|
||||
if (TARGET_MPQ != get_target()) {
|
||||
if (NULL == (locApi = mIzatProxy->getLocApi(mMsgTask, exMask))) {
|
||||
if (NULL == (locApi = mLBSProxy->getLocApi(mMsgTask, exMask))) {
|
||||
// only RPC is the option now
|
||||
void* handle = dlopen("libloc_api-rpc-qc.so", RTLD_NOW);
|
||||
if (NULL != handle) {
|
||||
|
@ -88,7 +89,7 @@ LocApiBase* ContextBase::createLocApi(LOC_API_ADAPTER_EVENT_MASK_T exMask)
|
|||
ContextBase::ContextBase(const MsgTask* msgTask,
|
||||
LOC_API_ADAPTER_EVENT_MASK_T exMask,
|
||||
const char* libName) :
|
||||
mIzatProxy(getIzatProxy(libName)),
|
||||
mLBSProxy(getLBSProxy(libName)),
|
||||
mMsgTask(msgTask),
|
||||
mLocApi(createLocApi(exMask))
|
||||
{
|
||||
|
|
|
@ -33,17 +33,17 @@
|
|||
#include <ctype.h>
|
||||
#include <MsgTask.h>
|
||||
#include <LocApiBase.h>
|
||||
#include <IzatProxyBase.h>
|
||||
#include <LBSProxyBase.h>
|
||||
|
||||
namespace loc_core {
|
||||
|
||||
class LocAdapterBase;
|
||||
|
||||
class ContextBase {
|
||||
static IzatProxyBase* getIzatProxy(const char* libName);
|
||||
static LBSProxyBase* getLBSProxy(const char* libName);
|
||||
LocApiBase* createLocApi(LOC_API_ADAPTER_EVENT_MASK_T excludedMask);
|
||||
protected:
|
||||
const IzatProxyBase* mIzatProxy;
|
||||
const LBSProxyBase* mLBSProxy;
|
||||
const MsgTask* mMsgTask;
|
||||
LocApiBase* mLocApi;
|
||||
|
||||
|
@ -51,14 +51,14 @@ public:
|
|||
ContextBase(const MsgTask* msgTask,
|
||||
LOC_API_ADAPTER_EVENT_MASK_T exMask,
|
||||
const char* libName);
|
||||
inline virtual ~ContextBase() { delete mLocApi; delete mIzatProxy; }
|
||||
inline virtual ~ContextBase() { delete mLocApi; delete mLBSProxy; }
|
||||
|
||||
inline const MsgTask* getMsgTask() { return mMsgTask; }
|
||||
inline LocApiBase* getLocApi() { return mLocApi; }
|
||||
inline bool hasAgpsExt() { return mIzatProxy->hasAgpsExt(); }
|
||||
inline bool hasAgpsExt() { return mLBSProxy->hasAgpsExt(); }
|
||||
inline void requestUlp(LocAdapterBase* adapter,
|
||||
unsigned long capabilities) {
|
||||
mIzatProxy->requestUlp(adapter, capabilities);
|
||||
mLBSProxy->requestUlp(adapter, capabilities);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
*/
|
||||
#ifndef IZAT_PROXY_BASE_H
|
||||
#define IZAT_PROXY_BASE_H
|
||||
|
||||
#include <gps_extended.h>
|
||||
#include <MsgTask.h>
|
||||
|
||||
|
@ -37,7 +36,7 @@ namespace loc_core {
|
|||
class LocApiBase;
|
||||
class LocAdapterBase;
|
||||
|
||||
class IzatProxyBase {
|
||||
class LBSProxyBase {
|
||||
friend class ContextBase;
|
||||
inline virtual LocApiBase*
|
||||
getLocApi(const MsgTask* msgTask,
|
||||
|
@ -45,15 +44,15 @@ class IzatProxyBase {
|
|||
return NULL;
|
||||
}
|
||||
protected:
|
||||
inline IzatProxyBase() {}
|
||||
inline LBSProxyBase() {}
|
||||
public:
|
||||
inline virtual ~IzatProxyBase() {}
|
||||
inline virtual ~LBSProxyBase() {}
|
||||
inline virtual void requestUlp(LocAdapterBase* adapter,
|
||||
unsigned long capabilities) const {}
|
||||
inline virtual bool hasAgpsExt() const { return false; }
|
||||
};
|
||||
|
||||
typedef IzatProxyBase* (getIzatProxy_t)();
|
||||
typedef LBSProxyBase* (getLBSProxy_t)();
|
||||
|
||||
} // namespace loc_core
|
||||
|
|
@ -296,6 +296,11 @@ void LocApiBase::requestNiNotify(GpsNiNotification ¬ify, const void* data)
|
|||
TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestNiNotify(notify, data));
|
||||
}
|
||||
|
||||
void* LocApiBase :: getSibling()
|
||||
DEFAULT_IMPL(NULL)
|
||||
void* LocApiBase :: getSibling2()
|
||||
DEFAULT_IMPL(NULL)
|
||||
|
||||
enum loc_api_adapter_err LocApiBase::
|
||||
open(LOC_API_ADAPTER_EVENT_MASK_T mask)
|
||||
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#include <ctype.h>
|
||||
#include <gps_extended.h>
|
||||
#include <MsgTask.h>
|
||||
|
||||
#include <log_util.h>
|
||||
namespace loc_core {
|
||||
|
||||
int hexcode(char *hexstring, int string_size,
|
||||
|
@ -77,8 +77,6 @@ protected:
|
|||
bool isInSession();
|
||||
|
||||
public:
|
||||
inline virtual void* getSibling() { return NULL; }
|
||||
|
||||
void addAdapter(LocAdapterBase* adapter);
|
||||
void removeAdapter(LocAdapterBase* adapter);
|
||||
|
||||
|
@ -111,6 +109,9 @@ public:
|
|||
// downward calls
|
||||
// All below functions are to be defined by adapter specific modules:
|
||||
// RPC, QMI, etc. The default implementation is empty.
|
||||
|
||||
virtual void* getSibling();
|
||||
virtual void* getSibling2();
|
||||
virtual enum loc_api_adapter_err
|
||||
startFix(const LocPosMode& posMode);
|
||||
virtual enum loc_api_adapter_err
|
||||
|
|
|
@ -58,7 +58,7 @@ ContextBase* LocDualContext::mBgContext = NULL;
|
|||
|
||||
// the name must be shorter than 15 chars
|
||||
const char* LocDualContext::mLocationHalName = "Loc_hal_worker";
|
||||
const char* LocDualContext::mIzatLibName = "libizat_core.so";
|
||||
const char* LocDualContext::mIzatLibName = "liblbs_core.so";
|
||||
|
||||
const MsgTask* LocDualContext::getMsgTask(MsgTask::tCreate tCreator,
|
||||
const char* name)
|
||||
|
|
Loading…
Reference in a new issue