diff --git a/core/LocAdapterBase.cpp b/core/LocAdapterBase.cpp index 5531fa2d..c11b93d8 100644 --- a/core/LocAdapterBase.cpp +++ b/core/LocAdapterBase.cpp @@ -130,7 +130,7 @@ bool LocAdapterBase:: DEFAULT_IMPL(false) bool LocAdapterBase:: - requestATL(int /*connHandle*/, LocAGpsType /*agps_type*/) + requestATL(int /*connHandle*/, LocAGpsType /*agps_type*/, LocApnTypeMask /*mask*/) DEFAULT_IMPL(false) bool LocAdapterBase:: @@ -138,7 +138,7 @@ bool LocAdapterBase:: DEFAULT_IMPL(false) bool LocAdapterBase:: - requestSuplES(int /*connHandle*/) + requestSuplES(int /*connHandle*/, LocApnTypeMask /*mask*/) DEFAULT_IMPL(false) bool LocAdapterBase:: diff --git a/core/LocAdapterBase.h b/core/LocAdapterBase.h index 64537fea..263855a7 100644 --- a/core/LocAdapterBase.h +++ b/core/LocAdapterBase.h @@ -144,9 +144,9 @@ public: virtual bool requestXtraData(); virtual bool requestTime(); virtual bool requestLocation(); - virtual bool requestATL(int connHandle, LocAGpsType agps_type); + virtual bool requestATL(int connHandle, LocAGpsType agps_type, LocApnTypeMask mask); virtual bool releaseATL(int connHandle); - virtual bool requestSuplES(int connHandle); + virtual bool requestSuplES(int connHandle, LocApnTypeMask mask); virtual bool reportDataCallOpened(); virtual bool reportDataCallClosed(); virtual bool requestNiNotifyEvent(const GnssNiNotification ¬ify, const void* data); diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp index 5ec3ce62..45a0ec48 100644 --- a/core/LocApiBase.cpp +++ b/core/LocApiBase.cpp @@ -374,10 +374,10 @@ void LocApiBase::requestLocation() TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestLocation()); } -void LocApiBase::requestATL(int connHandle, LocAGpsType agps_type) +void LocApiBase::requestATL(int connHandle, LocAGpsType agps_type, LocApnTypeMask mask) { // loop through adapters, and deliver to the first handling adapter. - TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestATL(connHandle, agps_type)); + TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestATL(connHandle, agps_type, mask)); } void LocApiBase::releaseATL(int connHandle) @@ -386,10 +386,10 @@ void LocApiBase::releaseATL(int connHandle) TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->releaseATL(connHandle)); } -void LocApiBase::requestSuplES(int connHandle) +void LocApiBase::requestSuplES(int connHandle, LocApnTypeMask mask) { // loop through adapters, and deliver to the first handling adapter. - TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestSuplES(connHandle)); + TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestSuplES(connHandle, mask)); } void LocApiBase::reportDataCallOpened() @@ -455,7 +455,7 @@ DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS) void LocApiBase:: atlOpenStatus(int /*handle*/, int /*is_succ*/, char* /*apn*/, uint32_t /*apnLen*/, - AGpsBearerType /*bear*/, LocAGpsType /*agpsType*/) + AGpsBearerType /*bear*/, LocAGpsType /*agpsType*/, LocApnTypeMask /*mask*/) DEFAULT_IMPL() void LocApiBase:: diff --git a/core/LocApiBase.h b/core/LocApiBase.h index f0b1f592..f9fdf4d6 100644 --- a/core/LocApiBase.h +++ b/core/LocApiBase.h @@ -147,9 +147,9 @@ public: void requestXtraData(); void requestTime(); void requestLocation(); - void requestATL(int connHandle, LocAGpsType agps_type); + void requestATL(int connHandle, LocAGpsType agps_type, LocApnTypeMask mask); void releaseATL(int connHandle); - void requestSuplES(int connHandle); + void requestSuplES(int connHandle, LocApnTypeMask mask); void reportDataCallOpened(); void reportDataCallClosed(); void requestNiNotify(GnssNiNotification ¬ify, const void* data); @@ -181,7 +181,7 @@ public: virtual void atlOpenStatus(int handle, int is_succ, char* apn, uint32_t apnLen, - AGpsBearerType bear, LocAGpsType agpsType); + AGpsBearerType bear, LocAGpsType agpsType, LocApnTypeMask mask); virtual void atlCloseStatus(int handle, int is_succ); virtual void diff --git a/gnss/Agps.cpp b/gnss/Agps.cpp index d6a75aba..6fe306e8 100644 --- a/gnss/Agps.cpp +++ b/gnss/Agps.cpp @@ -26,13 +26,14 @@ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - +#define LOG_NDEBUG 0 #define LOG_TAG "LocSvc_Agps" #include #include #include #include +#include /* -------------------------------------------------------------------- * AGPS State Machine Methods @@ -361,13 +362,13 @@ void AgpsStateMachine::notifyEventToSubscriber( case AGPS_EVENT_GRANTED: mAgpsManager->mAtlOpenStatusCb( subscriberToNotify->mConnHandle, 1, getAPN(), getAPNLen(), - getBearer(), mAgpsType); + getBearer(), mAgpsType, LOC_APN_TYPE_MASK_SUPL); break; case AGPS_EVENT_DENIED: mAgpsManager->mAtlOpenStatusCb( subscriberToNotify->mConnHandle, 0, getAPN(), getAPNLen(), - getBearer(), mAgpsType); + getBearer(), mAgpsType, LOC_APN_TYPE_MASK_SUPL); break; case AGPS_EVENT_UNSUBSCRIBE: @@ -572,7 +573,7 @@ void DSStateMachine :: retryCallback() mAgpsManager->mSendMsgToAdapterQueueFn( new AgpsMsgRequestATL( mAgpsManager, subscriber->mConnHandle, - LOC_AGPS_TYPE_SUPL_ES)); + LOC_AGPS_TYPE_SUPL_ES, subscriber->mApnTypeMask)); } /* Overridden method @@ -662,7 +663,8 @@ void DSStateMachine::notifyEventToSubscriber( case AGPS_EVENT_GRANTED: mAgpsManager->mAtlOpenStatusCb( subscriberToNotify->mConnHandle, 1, NULL, 0, - AGPS_APN_BEARER_INVALID, LOC_AGPS_TYPE_SUPL_ES); + AGPS_APN_BEARER_INVALID, LOC_AGPS_TYPE_SUPL_ES, + LOC_APN_TYPE_MASK_EMERGENCY); break; case AGPS_EVENT_DENIED: @@ -672,7 +674,7 @@ void DSStateMachine::notifyEventToSubscriber( mAgpsManager->mSendMsgToAdapterQueueFn( new AgpsMsgRequestATL( mAgpsManager, subscriberToNotify->mConnHandle, - LOC_AGPS_TYPE_SUPL)); + LOC_AGPS_TYPE_SUPL, subscriberToNotify->mApnTypeMask)); break; case AGPS_EVENT_UNSUBSCRIBE: @@ -767,10 +769,10 @@ AgpsStateMachine* AgpsManager::getAgpsStateMachine(AGpsExtType agpsType) { return NULL; } -void AgpsManager::requestATL(int connHandle, AGpsExtType agpsType){ +void AgpsManager::requestATL(int connHandle, AGpsExtType agpsType, LocApnTypeMask mask){ - LOC_LOGD("AgpsManager::requestATL(): connHandle %d, agpsType %d", - connHandle, agpsType); + LOC_LOGD("AgpsManager::requestATL(): connHandle %d, agpsType %d apnTypeMask %" PRIu64, + connHandle, agpsType, mask); AgpsStateMachine* sm = getAgpsStateMachine(agpsType); @@ -778,12 +780,12 @@ void AgpsManager::requestATL(int connHandle, AGpsExtType agpsType){ LOC_LOGE("No AGPS State Machine for agpsType: %d", agpsType); mAtlOpenStatusCb( - connHandle, 0, NULL, 0, AGPS_APN_BEARER_INVALID, agpsType); + connHandle, 0, NULL, 0, AGPS_APN_BEARER_INVALID, agpsType, mask); return; } /* Invoke AGPS SM processing */ - AgpsSubscriber subscriber(connHandle, false, false); + AgpsSubscriber subscriber(connHandle, false, false, mask); sm->setCurrentSubscriber(&subscriber); /* If DS State Machine, wait for close complete */ diff --git a/gnss/Agps.h b/gnss/Agps.h index f9a54f84..e388cfe5 100644 --- a/gnss/Agps.h +++ b/gnss/Agps.h @@ -41,9 +41,10 @@ * Passed in by Adapter to AgpsManager */ typedef std::function AgpsAtlOpenStatusCb; + AGpsBearerType bearerType, AGpsExtType agpsType, + LocApnTypeMask mask)> AgpsAtlOpenStatusCb; -typedef std::function AgpsAtlCloseStatusCb; +typedef std::function AgpsAtlCloseStatusCb; /* DS Client control APIs * Passed in by Adapter to AgpsManager */ @@ -109,12 +110,15 @@ public: * inactive state. */ bool mWaitForCloseComplete; bool mIsInactive; + LocApnTypeMask mApnTypeMask; inline AgpsSubscriber( - int connHandle, bool waitForCloseComplete, bool isInactive) : + int connHandle, bool waitForCloseComplete, bool isInactive, + LocApnTypeMask apnTypeMask) : mConnHandle(connHandle), mWaitForCloseComplete(waitForCloseComplete), - mIsInactive(isInactive) {} + mIsInactive(isInactive), + mApnTypeMask(apnTypeMask) {} inline virtual ~AgpsSubscriber() {} inline virtual bool equals(const AgpsSubscriber *s) const @@ -122,7 +126,7 @@ public: inline virtual AgpsSubscriber* clone() { return new AgpsSubscriber( - mConnHandle, mWaitForCloseComplete, mIsInactive); } + mConnHandle, mWaitForCloseComplete, mIsInactive, mApnTypeMask); } }; /* AGPS STATE MACHINE */ @@ -306,7 +310,7 @@ public: void createAgpsStateMachines(); /* Process incoming ATL requests */ - void requestATL(int connHandle, AGpsExtType agpsType); + void requestATL(int connHandle, AGpsExtType agpsType, LocApnTypeMask mask); void releaseATL(int connHandle); /* Process incoming DS Client data call events */ @@ -354,11 +358,12 @@ struct AgpsMsgRequestATL: public LocMsg { AgpsManager* mAgpsManager; int mConnHandle; AGpsExtType mAgpsType; + LocApnTypeMask mApnTypeMask; inline AgpsMsgRequestATL(AgpsManager* agpsManager, int connHandle, - AGpsExtType agpsType) : - LocMsg(), mAgpsManager(agpsManager), mConnHandle(connHandle), mAgpsType( - agpsType) { + AGpsExtType agpsType, LocApnTypeMask mask) : + LocMsg(), mAgpsManager(agpsManager), mConnHandle(connHandle), + mAgpsType(agpsType), mApnTypeMask(mask) { LOC_LOGV("AgpsMsgRequestATL"); } @@ -366,7 +371,7 @@ struct AgpsMsgRequestATL: public LocMsg { inline virtual void proc() const { LOC_LOGV("AgpsMsgRequestATL::proc()"); - mAgpsManager->requestATL(mConnHandle, mAgpsType); + mAgpsManager->requestATL(mConnHandle, mAgpsType, mApnTypeMask); } }; diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp index 263a6338..ab2dac56 100644 --- a/gnss/GnssAdapter.cpp +++ b/gnss/GnssAdapter.cpp @@ -26,6 +26,7 @@ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ +#define LOG_NDEBUG 0 #define LOG_TAG "LocSvc_GnssAdapter" #include @@ -93,10 +94,10 @@ GnssAdapter::GnssAdapter() : /* Set ATL open/close callbacks */ AgpsAtlOpenStatusCb atlOpenStatusCb = [this](int handle, int isSuccess, char* apn, uint32_t apnLen, - AGpsBearerType bearerType, AGpsExtType agpsType) { + AGpsBearerType bearerType, AGpsExtType agpsType, LocApnTypeMask mask) { mLocApi->atlOpenStatus( - handle, isSuccess, apn, apnLen, bearerType, agpsType); + handle, isSuccess, apn, apnLen, bearerType, agpsType, mask); }; AgpsAtlCloseStatusCb atlCloseStatusCb = [this](int handle, int isSuccess) { @@ -2870,12 +2871,12 @@ void GnssAdapter::initAgpsCommand(const AgpsCbInfo& cbInfo){ * Triggers the AGPS state machine to setup AGPS call for below WWAN types: * eQMI_LOC_WWAN_TYPE_INTERNET_V02 * eQMI_LOC_WWAN_TYPE_AGNSS_V02 */ -bool GnssAdapter::requestATL(int connHandle, LocAGpsType agpsType){ +bool GnssAdapter::requestATL(int connHandle, LocAGpsType agpsType, LocApnTypeMask mask){ LOC_LOGI("GnssAdapter::requestATL"); sendMsg( new AgpsMsgRequestATL( - &mAgpsManager, connHandle, (AGpsExtType)agpsType)); + &mAgpsManager, connHandle, (AGpsExtType)agpsType, mask)); return true; } @@ -2885,12 +2886,12 @@ bool GnssAdapter::requestATL(int connHandle, LocAGpsType agpsType){ * eQMI_LOC_SERVER_REQUEST_OPEN_V02 * Triggers the AGPS state machine to setup AGPS call for below WWAN types: * eQMI_LOC_WWAN_TYPE_AGNSS_EMERGENCY_V02 */ -bool GnssAdapter::requestSuplES(int connHandle){ +bool GnssAdapter::requestSuplES(int connHandle, LocApnTypeMask mask){ LOC_LOGI("GnssAdapter::requestSuplES"); sendMsg( new AgpsMsgRequestATL( - &mAgpsManager, connHandle, LOC_AGPS_TYPE_SUPL_ES)); + &mAgpsManager, connHandle, LOC_AGPS_TYPE_SUPL_ES, mask)); return true; } diff --git a/gnss/GnssAdapter.h b/gnss/GnssAdapter.h index 80d67618..c9491f06 100644 --- a/gnss/GnssAdapter.h +++ b/gnss/GnssAdapter.h @@ -252,9 +252,9 @@ public: virtual void reportSvMeasurementEvent(GnssSvMeasurementSet &svMeasurementSet); virtual void reportSvPolynomialEvent(GnssSvPolynomial &svPolynomial); - virtual bool requestATL(int connHandle, LocAGpsType agps_type); + virtual bool requestATL(int connHandle, LocAGpsType agps_type, LocApnTypeMask mask); virtual bool releaseATL(int connHandle); - virtual bool requestSuplES(int connHandle); + virtual bool requestSuplES(int connHandle, LocApnTypeMask mask); virtual bool reportDataCallOpened(); virtual bool reportDataCallClosed(); virtual bool reportZppBestAvailableFix(LocGpsLocation &zppLoc, diff --git a/utils/gps_extended_c.h b/utils/gps_extended_c.h index 21eb5d55..60286683 100644 --- a/utils/gps_extended_c.h +++ b/utils/gps_extended_c.h @@ -158,6 +158,18 @@ typedef int16_t AGpsBearerType; #define AGPS_APN_BEARER_IPV6 2 #define AGPS_APN_BEARER_IPV4V6 3 +typedef uint64_t LocApnTypeMask; +#define LOC_APN_TYPE_MASK_DEFAULT ((LocApnTypeMask)0x0000000000000001ull) /**< Denotes APN type for Default/Internet traffic */ +#define LOC_APN_TYPE_MASK_IMS ((LocApnTypeMask)0x0000000000000002ull) /**< Denotes APN type for IP Multimedia Subsystem */ +#define LOC_APN_TYPE_MASK_MMS ((LocApnTypeMask)0x0000000000000004ull) /**< Denotes APN type for Multimedia Messaging Service */ +#define LOC_APN_TYPE_MASK_DUN ((LocApnTypeMask)0x0000000000000008ull) /**< Denotes APN type for Dial Up Network */ +#define LOC_APN_TYPE_MASK_SUPL ((LocApnTypeMask)0x0000000000000010ull) /**< Denotes APN type for Secure User Plane Location */ +#define LOC_APN_TYPE_MASK_HIPRI ((LocApnTypeMask)0x0000000000000020ull) /**< Denotes APN type for High Priority Mobile Data */ +#define LOC_APN_TYPE_MASK_FOTA ((LocApnTypeMask)0x0000000000000040ull) /**< Denotes APN type for over the air administration */ +#define LOC_APN_TYPE_MASK_CBS ((LocApnTypeMask)0x0000000000000080ull) /**< Denotes APN type for Carrier Branded Services */ +#define LOC_APN_TYPE_MASK_IA ((LocApnTypeMask)0x0000000000000100ull) /**< Denotes APN type for Initial Attach */ +#define LOC_APN_TYPE_MASK_EMERGENCY ((LocApnTypeMask)0x0000000000000200ull) /**< Denotes APN type for emergency */ + typedef enum { AGPS_CB_PRIORITY_LOW = 1, AGPS_CB_PRIORITY_MED = 2,