Inject feature config
This change injects feature config through using the first available context CRs-fixed: 616544 Change-Id: Idea5bd8acfff729589c071f20bec18679c89ab25
This commit is contained in:
parent
3c8b3ff4fd
commit
9e585cb7bf
12 changed files with 82 additions and 32 deletions
|
@ -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;
|
||||
|
|
|
@ -62,6 +62,7 @@ public:
|
|||
unsigned long capabilities) {
|
||||
mLBSProxy->requestUlp(adapter, capabilities);
|
||||
}
|
||||
inline void sendMsg(const LocMsg *msg) { getMsgTask()->sendMsg(msg); }
|
||||
};
|
||||
|
||||
} // namespace loc_core
|
||||
|
|
|
@ -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)();
|
||||
|
|
|
@ -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::
|
||||
getZppFix(GpsLocation & zppLoc, LocPosTechMask & tech_mask)
|
||||
getBestAvailableZppFix(GpsLocation & zppLoc)
|
||||
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
|
||||
|
||||
enum loc_api_adapter_err LocApiBase::
|
||||
getBestAvailableZppFix(GpsLocation & zppLoc, LocPosTechMask & tech_mask)
|
||||
DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
|
||||
|
||||
int LocApiBase::
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
@ -133,6 +133,7 @@ public:
|
|||
};
|
||||
|
||||
extern "C" LocApiBase* getLocApi(const MsgTask* msgTask,
|
||||
LOC_API_ADAPTER_EVENT_MASK_T exMask);
|
||||
LOC_API_ADAPTER_EVENT_MASK_T exMask,
|
||||
ContextBase *context);
|
||||
|
||||
#endif //LOC_API_RPC_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
|
||||
|
@ -134,8 +134,9 @@ const rpc_loc_event_mask_type LocApiRpc::locBits[] =
|
|||
|
||||
// constructor
|
||||
LocApiRpc::LocApiRpc(const MsgTask* msgTask,
|
||||
LOC_API_ADAPTER_EVENT_MASK_T exMask) :
|
||||
LocApiBase(msgTask, exMask),
|
||||
LOC_API_ADAPTER_EVENT_MASK_T exMask,
|
||||
ContextBase* context) :
|
||||
LocApiBase(msgTask, exMask, context),
|
||||
client_handle(RPC_LOC_CLIENT_HANDLE_INVALID),
|
||||
dataEnableLastSet(-1)
|
||||
{
|
||||
|
@ -1388,8 +1389,9 @@ GpsNiEncodingType LocApiRpc::convertNiEncodingType(int loc_encoding)
|
|||
}
|
||||
|
||||
LocApiBase* getLocApi(const MsgTask* msgTask,
|
||||
LOC_API_ADAPTER_EVENT_MASK_T exMask) {
|
||||
return new LocApiRpc(msgTask, exMask);
|
||||
LOC_API_ADAPTER_EVENT_MASK_T exMask,
|
||||
ContextBase *context) {
|
||||
return new LocApiRpc(msgTask, exMask, context);
|
||||
}
|
||||
|
||||
/*Values for lock
|
||||
|
|
|
@ -254,7 +254,7 @@ public:
|
|||
inline enum loc_api_adapter_err
|
||||
getZpp(GpsLocation &zppLoc, LocPosTechMask &tech_mask)
|
||||
{
|
||||
return mLocApi->getZppFix(zppLoc, tech_mask);
|
||||
return mLocApi->getBestAvailableZppFix(zppLoc, tech_mask);
|
||||
}
|
||||
|
||||
virtual void handleEngineDownEvent();
|
||||
|
|
|
@ -115,7 +115,6 @@ static loc_param_s_type loc_parameter_table[] =
|
|||
{"SENSOR_CONTROL_MODE", &sap_conf.SENSOR_CONTROL_MODE, NULL, 'n'},
|
||||
{"SENSOR_USAGE", &sap_conf.SENSOR_USAGE, NULL, 'n'},
|
||||
{"SENSOR_ALGORITHM_CONFIG_MASK", &sap_conf.SENSOR_ALGORITHM_CONFIG_MASK, NULL, 'n'},
|
||||
{"QUIPC_ENABLED", &gps_conf.QUIPC_ENABLED, NULL, 'n'},
|
||||
{"LPP_PROFILE", &gps_conf.LPP_PROFILE, NULL, 'n'},
|
||||
{"A_GLONASS_POS_PROTOCOL_SELECT", &gps_conf.A_GLONASS_POS_PROTOCOL_SELECT, NULL, 'n'},
|
||||
{"SENSOR_PROVIDER", &sap_conf.SENSOR_PROVIDER, NULL, 'n'},
|
||||
|
|
|
@ -143,7 +143,6 @@ typedef struct loc_gps_cfg_s
|
|||
unsigned long ACCURACY_THRES;
|
||||
unsigned long SUPL_VER;
|
||||
unsigned long CAPABILITIES;
|
||||
unsigned long QUIPC_ENABLED;
|
||||
unsigned long LPP_PROFILE;
|
||||
uint8_t NMEA_PROVIDER;
|
||||
unsigned long A_GLONASS_POS_PROTOCOL_SELECT;
|
||||
|
|
Loading…
Reference in a new issue