summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhaohuang <haohuang@codeaurora.org>2019-08-15 22:09:11 +0800
committerhaohuang <haohuang@codeaurora.org>2019-08-20 21:38:51 +0800
commit39e34de194c0b1d4dc23e5eed05a63ad3b791393 (patch)
tree45f85ecba60d48f723b9ad7d3da7546bbe077324
parente549c9be3b4719dfa2aa5fbc64684c2b358e4213 (diff)
downloadgps-39e34de194c0b1d4dc23e5eed05a63ad3b791393.tar.gz
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
-rw-r--r--android/1.0/AGnss.cpp2
-rw-r--r--android/1.1/AGnss.cpp2
-rw-r--r--android/2.0/AGnss.cpp2
-rw-r--r--gnss/Agps.cpp16
-rw-r--r--gnss/Agps.h15
-rw-r--r--gnss/GnssAdapter.cpp24
-rw-r--r--gnss/GnssAdapter.h1
-rw-r--r--utils/gps_extended_c.h11
8 files changed, 35 insertions, 38 deletions
diff --git a/android/1.0/AGnss.cpp b/android/1.0/AGnss.cpp
index faaf75e..79f665c 100644
--- a/android/1.0/AGnss.cpp
+++ b/android/1.0/AGnss.cpp
@@ -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();
diff --git a/android/1.1/AGnss.cpp b/android/1.1/AGnss.cpp
index fe50c9a..d8f9706 100644
--- a/android/1.1/AGnss.cpp
+++ b/android/1.1/AGnss.cpp
@@ -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();
diff --git a/android/2.0/AGnss.cpp b/android/2.0/AGnss.cpp
index 7bd015e..a48f1a0 100644
--- a/android/2.0/AGnss.cpp
+++ b/android/2.0/AGnss.cpp
@@ -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();
diff --git a/gnss/Agps.cpp b/gnss/Agps.cpp
index 7931d0c..9255f88 100644
--- a/gnss/Agps.cpp
+++ b/gnss/Agps.cpp
@@ -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;
}
diff --git a/gnss/Agps.h b/gnss/Agps.h
index 829cbd5..d559377 100644
--- a/gnss/Agps.h
+++ b/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;
diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp
index 47e5527..f813c58 100644
--- a/gnss/GnssAdapter.cpp
+++ b/gnss/GnssAdapter.cpp
@@ -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();
-
- /* Register for AGPS event mask */
- updateEvtMask(LOC_API_ADAPTER_BIT_LOCATION_SERVER_REQUEST,
- LOC_REGISTRATION_MASK_ENABLED);
- }
+ 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){
diff --git a/gnss/GnssAdapter.h b/gnss/GnssAdapter.h
index b84c365..410a4b7 100644
--- a/gnss/GnssAdapter.h
+++ b/gnss/GnssAdapter.h
@@ -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 =========================================================================== */
diff --git a/utils/gps_extended_c.h b/utils/gps_extended_c.h
index e49b088..2036032 100644
--- a/utils/gps_extended_c.h
+++ b/utils/gps_extended_c.h
@@ -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 {