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