AgpsManager supports two clients
AgpsManager supports two clients, QCOM AGPS Stack is to handle ATL type WWAN, AFW AGPS stack is used to handle ATL type SUPL and SUPL emergency. Change-Id: Id43c4919a1ae67d739e055c7fb5ba3abacc70b34 CRs-Fixed: 2509244
This commit is contained in:
parent
e549c9be3b
commit
39e34de194
8 changed files with 35 additions and 38 deletions
|
@ -105,7 +105,7 @@ Return<void> AGnss::setCallback(const sp<IAGnssCallback>& callback) {
|
|||
|
||||
AgpsCbInfo cbInfo = {};
|
||||
cbInfo.statusV4Cb = (void*)agnssStatusIpV4Cb;
|
||||
cbInfo.cbPriority = AGPS_CB_PRIORITY_LOW;
|
||||
cbInfo.atlType = AGPS_ATL_TYPE_SUPL | AGPS_ATL_TYPE_SUPL_ES;
|
||||
|
||||
mGnss->getGnssInterface()->agpsInit(cbInfo);
|
||||
return Void();
|
||||
|
|
|
@ -105,7 +105,7 @@ Return<void> AGnss::setCallback(const sp<IAGnssCallback>& callback) {
|
|||
|
||||
AgpsCbInfo cbInfo = {};
|
||||
cbInfo.statusV4Cb = (void*)agnssStatusIpV4Cb;
|
||||
cbInfo.cbPriority = AGPS_CB_PRIORITY_LOW;
|
||||
cbInfo.atlType = AGPS_ATL_TYPE_SUPL | AGPS_ATL_TYPE_SUPL_ES;
|
||||
|
||||
mGnss->getGnssInterface()->agpsInit(cbInfo);
|
||||
return Void();
|
||||
|
|
|
@ -107,7 +107,7 @@ Return<void> AGnss::setCallback(const sp<V2_0::IAGnssCallback>& callback) {
|
|||
|
||||
AgpsCbInfo cbInfo = {};
|
||||
cbInfo.statusV4Cb = (void*)agnssStatusIpV4Cb;
|
||||
cbInfo.cbPriority = AGPS_CB_PRIORITY_HIGH;
|
||||
cbInfo.atlType = AGPS_ATL_TYPE_SUPL | AGPS_ATL_TYPE_SUPL_ES;
|
||||
|
||||
mGnss->getGnssInterface()->agpsInit(cbInfo);
|
||||
return Void();
|
||||
|
|
|
@ -304,7 +304,7 @@ void AgpsStateMachine::requestOrReleaseDataConn(bool request){
|
|||
nifRequest.status = LOC_GPS_RELEASE_AGPS_DATA_CONN;
|
||||
}
|
||||
|
||||
mAgpsManager->mFrameworkStatusV4Cb(nifRequest);
|
||||
mFrameworkStatusV4Cb(nifRequest);
|
||||
}
|
||||
|
||||
void AgpsStateMachine::notifyAllSubscribers(
|
||||
|
@ -511,7 +511,7 @@ void AgpsStateMachine::dropAllSubscribers(){
|
|||
|
||||
/* CREATE AGPS STATE MACHINES
|
||||
* Must be invoked in Msg Handler context */
|
||||
void AgpsManager::createAgpsStateMachines() {
|
||||
void AgpsManager::createAgpsStateMachines(const AgpsCbInfo& cbInfo) {
|
||||
|
||||
LOC_LOGD("AgpsManager::createAgpsStateMachines");
|
||||
|
||||
|
@ -519,13 +519,16 @@ void AgpsManager::createAgpsStateMachines() {
|
|||
((loc_core::ContextBase::mGps_conf.CAPABILITIES & LOC_GPS_CAPABILITY_MSA) ||
|
||||
(loc_core::ContextBase::mGps_conf.CAPABILITIES & LOC_GPS_CAPABILITY_MSB));
|
||||
|
||||
if (NULL == mInternetNif) {
|
||||
if (NULL == mInternetNif && (cbInfo.atlType & AGPS_ATL_TYPE_WWAN)) {
|
||||
mInternetNif = new AgpsStateMachine(this, LOC_AGPS_TYPE_WWAN_ANY);
|
||||
mInternetNif->registerFrameworkStatusCallback((AgnssStatusIpV4Cb)cbInfo.statusV4Cb);
|
||||
LOC_LOGD("Internet NIF: %p", mInternetNif);
|
||||
}
|
||||
if (agpsCapable) {
|
||||
if (NULL == mAgnssNif) {
|
||||
if (NULL == mAgnssNif && (cbInfo.atlType & AGPS_ATL_TYPE_SUPL) &&
|
||||
(cbInfo.atlType & AGPS_ATL_TYPE_SUPL_ES)) {
|
||||
mAgnssNif = new AgpsStateMachine(this, LOC_AGPS_TYPE_SUPL);
|
||||
mAgnssNif->registerFrameworkStatusCallback((AgnssStatusIpV4Cb)cbInfo.statusV4Cb);
|
||||
LOC_LOGD("AGNSS NIF: %p", mAgnssNif);
|
||||
}
|
||||
}
|
||||
|
@ -544,6 +547,11 @@ AgpsStateMachine* AgpsManager::getAgpsStateMachine(AGpsExtType agpsType) {
|
|||
LOC_LOGE("NULL AGNSS NIF !");
|
||||
}
|
||||
return mAgnssNif;
|
||||
case LOC_AGPS_TYPE_WWAN_ANY:
|
||||
if (mInternetNif == NULL) {
|
||||
LOC_LOGE("NULL Internet NIF !");
|
||||
}
|
||||
return mInternetNif;
|
||||
default:
|
||||
return mInternetNif;
|
||||
}
|
||||
|
|
15
gnss/Agps.h
15
gnss/Agps.h
|
@ -137,6 +137,7 @@ protected:
|
|||
/* Current state for this state machine */
|
||||
AgpsState mState;
|
||||
|
||||
AgnssStatusIpV4Cb mFrameworkStatusV4Cb;
|
||||
private:
|
||||
/* AGPS Type for this state machine
|
||||
LOC_AGPS_TYPE_ANY 0
|
||||
|
@ -154,6 +155,7 @@ private:
|
|||
public:
|
||||
/* CONSTRUCTOR */
|
||||
AgpsStateMachine(AgpsManager* agpsManager, AGpsExtType agpsType):
|
||||
mFrameworkStatusV4Cb(NULL),
|
||||
mAgpsManager(agpsManager), mSubscriberList(),
|
||||
mCurrentSubscriber(NULL), mState(AGPS_STATE_RELEASED),
|
||||
mAgpsType(agpsType), mAPN(NULL), mAPNLen(0),
|
||||
|
@ -175,6 +177,10 @@ public:
|
|||
inline void setCurrentSubscriber(AgpsSubscriber* subscriber)
|
||||
{ mCurrentSubscriber = subscriber; }
|
||||
|
||||
inline void registerFrameworkStatusCallback(AgnssStatusIpV4Cb frameworkStatusV4Cb) {
|
||||
mFrameworkStatusV4Cb = frameworkStatusV4Cb;
|
||||
}
|
||||
|
||||
/* Fetch subscriber with specified handle */
|
||||
AgpsSubscriber* getSubscriber(int connHandle);
|
||||
|
||||
|
@ -234,7 +240,6 @@ class AgpsManager {
|
|||
public:
|
||||
/* CONSTRUCTOR */
|
||||
AgpsManager():
|
||||
mFrameworkStatusV4Cb(NULL),
|
||||
mAtlOpenStatusCb(), mAtlCloseStatusCb(),
|
||||
mAgnssNif(NULL), mInternetNif(NULL)/*, mDsNif(NULL)*/ {}
|
||||
|
||||
|
@ -246,12 +251,11 @@ public:
|
|||
mAtlCloseStatusCb = atlCloseStatusCb;
|
||||
}
|
||||
|
||||
inline void registerFrameworkStatusCallback(AgnssStatusIpV4Cb frameworkStatusV4Cb) {
|
||||
mFrameworkStatusV4Cb = frameworkStatusV4Cb;
|
||||
}
|
||||
/* Check if AGPS client is registered */
|
||||
inline bool isRegistered() { return nullptr != mAgnssNif || nullptr != mInternetNif; }
|
||||
|
||||
/* Create all AGPS state machines */
|
||||
void createAgpsStateMachines();
|
||||
void createAgpsStateMachines(const AgpsCbInfo& cbInfo);
|
||||
|
||||
/* Process incoming ATL requests */
|
||||
void requestATL(int connHandle, AGpsExtType agpsType, LocApnTypeMask apnTypeMask);
|
||||
|
@ -266,7 +270,6 @@ public:
|
|||
void handleModemSSR();
|
||||
|
||||
protected:
|
||||
AgnssStatusIpV4Cb mFrameworkStatusV4Cb;
|
||||
|
||||
AgpsAtlOpenStatusCb mAtlOpenStatusCb;
|
||||
AgpsAtlCloseStatusCb mAtlCloseStatusCb;
|
||||
|
|
|
@ -80,7 +80,6 @@ GnssAdapter::GnssAdapter() :
|
|||
mGnssSvTypeConfigCb(nullptr),
|
||||
mNiData(),
|
||||
mAgpsManager(),
|
||||
mAgpsCbInfo(),
|
||||
mOdcpiRequestCb(nullptr),
|
||||
mOdcpiRequestActive(false),
|
||||
mOdcpiTimer(this),
|
||||
|
@ -2078,10 +2077,9 @@ GnssAdapter::updateClientsEventMask()
|
|||
mask);
|
||||
}
|
||||
|
||||
if (mAgpsCbInfo.statusV4Cb != NULL) {
|
||||
if (mAgpsManager.isRegistered()) {
|
||||
mask |= LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST;
|
||||
}
|
||||
|
||||
// Add ODCPI handling
|
||||
if (nullptr != mOdcpiRequestCb) {
|
||||
mask |= LOC_API_ADAPTER_BIT_REQUEST_WIFI;
|
||||
|
@ -4111,27 +4109,17 @@ void GnssAdapter::initDefaultAgpsCommand() {
|
|||
/* INIT LOC AGPS MANAGER */
|
||||
|
||||
void GnssAdapter::initAgps(const AgpsCbInfo& cbInfo) {
|
||||
LOC_LOGD("%s]: mAgpsCbInfo.cbPriority - %d; cbInfo.cbPriority - %d",
|
||||
__func__, mAgpsCbInfo.cbPriority, cbInfo.cbPriority)
|
||||
LOC_LOGD("%s]:cbInfo.atlType - %d", __func__, cbInfo.atlType);
|
||||
|
||||
if (!((ContextBase::mGps_conf.CAPABILITIES & LOC_GPS_CAPABILITY_MSB) ||
|
||||
(ContextBase::mGps_conf.CAPABILITIES & LOC_GPS_CAPABILITY_MSA))) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (mAgpsCbInfo.cbPriority > cbInfo.cbPriority) {
|
||||
return;
|
||||
} else {
|
||||
mAgpsCbInfo = cbInfo;
|
||||
|
||||
mAgpsManager.registerFrameworkStatusCallback((AgnssStatusIpV4Cb)cbInfo.statusV4Cb);
|
||||
|
||||
mAgpsManager.createAgpsStateMachines();
|
||||
|
||||
mAgpsManager.createAgpsStateMachines(cbInfo);
|
||||
/* Register for AGPS event mask */
|
||||
updateEvtMask(LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST,
|
||||
LOC_REGISTRATION_MASK_ENABLED);
|
||||
}
|
||||
}
|
||||
|
||||
void GnssAdapter::initAgpsCommand(const AgpsCbInfo& cbInfo){
|
||||
|
|
|
@ -163,7 +163,6 @@ class GnssAdapter : public LocAdapterBase {
|
|||
/* ==== AGPS =========================================================================== */
|
||||
// This must be initialized via initAgps()
|
||||
AgpsManager mAgpsManager;
|
||||
AgpsCbInfo mAgpsCbInfo;
|
||||
void initAgps(const AgpsCbInfo& cbInfo);
|
||||
|
||||
/* ==== NFW =========================================================================== */
|
||||
|
|
|
@ -194,15 +194,14 @@ typedef uint32_t LocApnTypeMask;
|
|||
/**< Denotes APN type for emergency */
|
||||
#define LOC_APN_TYPE_MASK_EMERGENCY ((LocApnTypeMask)0x00000200)
|
||||
|
||||
typedef enum {
|
||||
AGPS_CB_PRIORITY_LOW = 1,
|
||||
AGPS_CB_PRIORITY_MED = 2,
|
||||
AGPS_CB_PRIORITY_HIGH = 3
|
||||
} AgpsCbPriority;
|
||||
typedef uint32_t AGpsTypeMask;
|
||||
#define AGPS_ATL_TYPE_SUPL ((AGpsTypeMask)0x00000001)
|
||||
#define AGPS_ATL_TYPE_SUPL_ES ((AGpsTypeMask)0x00000002)
|
||||
#define AGPS_ATL_TYPE_WWAN ((AGpsTypeMask)0x00000004)
|
||||
|
||||
typedef struct {
|
||||
void* statusV4Cb;
|
||||
AgpsCbPriority cbPriority;
|
||||
AGpsTypeMask atlType;
|
||||
} AgpsCbInfo;
|
||||
|
||||
typedef struct {
|
||||
|
|
Loading…
Reference in a new issue