Merge "SUPL connection enhancements" into location.lnx.4.0

This commit is contained in:
Linux Build Service Account 2018-06-11 21:55:21 -07:00 committed by Gerrit - the friendly Code Review server
commit f7981a3c11
10 changed files with 95 additions and 573 deletions

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2011-2014, 2016-2017The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2014, 2016-2018 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
@ -130,25 +130,14 @@ bool LocAdapterBase::
DEFAULT_IMPL(false)
bool LocAdapterBase::
requestATL(int /*connHandle*/, LocAGpsType /*agps_type*/, LocApnTypeMask /*mask*/)
requestATL(int /*connHandle*/, LocAGpsType /*agps_type*/,
LocApnTypeMask /*apn_type_mask*/)
DEFAULT_IMPL(false)
bool LocAdapterBase::
releaseATL(int /*connHandle*/)
DEFAULT_IMPL(false)
bool LocAdapterBase::
requestSuplES(int /*connHandle*/, LocApnTypeMask /*mask*/)
DEFAULT_IMPL(false)
bool LocAdapterBase::
reportDataCallOpened()
DEFAULT_IMPL(false)
bool LocAdapterBase::
reportDataCallClosed()
DEFAULT_IMPL(false)
bool LocAdapterBase::
requestNiNotifyEvent(const GnssNiNotification &/*notify*/, const void* /*data*/)
DEFAULT_IMPL(false)

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2011-2014, 2016-2017 The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2014, 2016-2018 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,11 +133,9 @@ public:
virtual bool requestXtraData();
virtual bool requestTime();
virtual bool requestLocation();
virtual bool requestATL(int connHandle, LocAGpsType agps_type, LocApnTypeMask mask);
virtual bool requestATL(int connHandle, LocAGpsType agps_type,
LocApnTypeMask apn_type_mask);
virtual bool releaseATL(int connHandle);
virtual bool requestSuplES(int connHandle, LocApnTypeMask mask);
virtual bool reportDataCallOpened();
virtual bool reportDataCallClosed();
virtual bool requestNiNotifyEvent(const GnssNiNotification &notify, const void* data);
inline virtual bool isInSession() { return false; }
ContextBase* getContext() const { return mContext; }

View file

@ -378,10 +378,12 @@ void LocApiBase::requestLocation()
TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestLocation());
}
void LocApiBase::requestATL(int connHandle, LocAGpsType agps_type, LocApnTypeMask mask)
void LocApiBase::requestATL(int connHandle, LocAGpsType agps_type,
LocApnTypeMask apn_type_mask)
{
// loop through adapters, and deliver to the first handling adapter.
TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->requestATL(connHandle, agps_type, mask));
TO_1ST_HANDLING_LOCADAPTERS(
mLocAdapters[i]->requestATL(connHandle, agps_type, apn_type_mask));
}
void LocApiBase::releaseATL(int connHandle)
@ -390,24 +392,6 @@ void LocApiBase::releaseATL(int connHandle)
TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->releaseATL(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, mask));
}
void LocApiBase::reportDataCallOpened()
{
// loop through adapters, and deliver to the first handling adapter.
TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportDataCallOpened());
}
void LocApiBase::reportDataCallClosed()
{
// loop through adapters, and deliver to the first handling adapter.
TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->reportDataCallClosed());
}
void LocApiBase::requestNiNotify(GnssNiNotification &notify, const void* data)
{
// loop through adapters, and deliver to the first handling adapter.
@ -485,7 +469,8 @@ DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
void LocApiBase::
atlOpenStatus(int /*handle*/, int /*is_succ*/, char* /*apn*/, uint32_t /*apnLen*/,
AGpsBearerType /*bear*/, LocAGpsType /*agpsType*/, LocApnTypeMask /*mask*/)
AGpsBearerType /*bear*/, LocAGpsType /*agpsType*/,
LocApnTypeMask /*mask*/)
DEFAULT_IMPL()
void LocApiBase::
@ -583,26 +568,6 @@ void LocApiBase::
getBestAvailableZppFix()
DEFAULT_IMPL()
int LocApiBase::
initDataServiceClient(bool /*isDueToSsr*/)
DEFAULT_IMPL(-1)
int LocApiBase::
openAndStartDataCall()
DEFAULT_IMPL(-1)
void LocApiBase::
stopDataCall()
DEFAULT_IMPL()
void LocApiBase::
closeDataCall()
DEFAULT_IMPL()
void LocApiBase::
releaseDataServiceClient()
DEFAULT_IMPL()
LocationError LocApiBase::
setGpsLockSync(GnssConfigGpsLock /*lock*/)
DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2011-2014, 2016-2017 The Linux Foundation. All rights reserved.
/* Copyright (c) 2011-2014, 2016-2018 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
@ -147,11 +147,8 @@ public:
void requestXtraData();
void requestTime();
void requestLocation();
void requestATL(int connHandle, LocAGpsType agps_type, LocApnTypeMask mask);
void requestATL(int connHandle, LocAGpsType agps_type, LocApnTypeMask apn_type_mask);
void releaseATL(int connHandle);
void requestSuplES(int connHandle, LocApnTypeMask mask);
void reportDataCallOpened();
void reportDataCallClosed();
void requestNiNotify(GnssNiNotification &notify, const void* data);
void reportGnssMeasurementData(GnssMeasurementsNotification& measurements, int msInWeek);
void reportWwanZppFix(LocGpsLocation &zppLoc);
@ -186,7 +183,8 @@ public:
virtual void
atlOpenStatus(int handle, int is_succ, char* apn, uint32_t apnLen,
AGpsBearerType bear, LocAGpsType agpsType, LocApnTypeMask mask);
AGpsBearerType bear, LocAGpsType agpsType,
LocApnTypeMask mask);
virtual void
atlCloseStatus(int handle, int is_succ);
virtual void
@ -237,11 +235,6 @@ public:
virtual void getWwanZppFix();
virtual void getBestAvailableZppFix();
virtual int initDataServiceClient(bool isDueToSsr);
virtual int openAndStartDataCall();
virtual void stopDataCall();
virtual void closeDataCall();
virtual void releaseDataServiceClient();
virtual void installAGpsCert(const LocDerEncodedCertificate* pData,
size_t length,
uint32_t slotBitMask);

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2018, 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
@ -78,16 +78,8 @@ void AgpsStateMachine::processAgpsEventSubscribe(){
/* Add subscriber to list
* No notifications until we get RSRC_GRANTED */
addSubscriber(mCurrentSubscriber);
/* Send data request
* The if condition below is added so that if the data call setup
* fails for DS State Machine, we want to retry in released state.
* for Agps State Machine, sendRsrcRequest() will always return
* success. */
if (requestOrReleaseDataConn(true) == 0) {
// If data request successful, move to pending state
transitionState(AGPS_STATE_PENDING);
}
requestOrReleaseDataConn(true);
transitionState(AGPS_STATE_PENDING);
break;
case AGPS_STATE_PENDING:
@ -294,24 +286,25 @@ void AgpsStateMachine::processAgpsEventDenied(){
* bool request :
* true = Request data connection
* false = Release data connection */
int AgpsStateMachine::requestOrReleaseDataConn(bool request){
void AgpsStateMachine::requestOrReleaseDataConn(bool request){
AGnssExtStatusIpV4 nifRequest;
memset(&nifRequest, 0, sizeof(nifRequest));
nifRequest.type = mAgpsType;
nifRequest.apnTypeMask = mApnTypeMask;
if (request) {
LOC_LOGD("AGPS Data Conn Request");
LOC_LOGD("AGPS Data Conn Request mAgpsType=%d mApnTypeMask=0x%X",
mAgpsType, mApnTypeMask);
nifRequest.status = LOC_GPS_REQUEST_AGPS_DATA_CONN;
}
else{
LOC_LOGD("AGPS Data Conn Release");
LOC_LOGD("AGPS Data Conn Release mAgpsType=%d mApnTypeMask=0x%X",
mAgpsType, mApnTypeMask);
nifRequest.status = LOC_GPS_RELEASE_AGPS_DATA_CONN;
}
mAgpsManager->mFrameworkStatusV4Cb(nifRequest);
return 0;
}
void AgpsStateMachine::notifyAllSubscribers(
@ -362,13 +355,13 @@ void AgpsStateMachine::notifyEventToSubscriber(
case AGPS_EVENT_GRANTED:
mAgpsManager->mAtlOpenStatusCb(
subscriberToNotify->mConnHandle, 1, getAPN(), getAPNLen(),
getBearer(), mAgpsType, LOC_APN_TYPE_MASK_SUPL);
getBearer(), mAgpsType, mApnTypeMask);
break;
case AGPS_EVENT_DENIED:
mAgpsManager->mAtlOpenStatusCb(
subscriberToNotify->mConnHandle, 0, getAPN(), getAPNLen(),
getBearer(), mAgpsType, LOC_APN_TYPE_MASK_SUPL);
getBearer(), mAgpsType, mApnTypeMask);
break;
case AGPS_EVENT_UNSUBSCRIBE:
@ -513,189 +506,6 @@ void AgpsStateMachine::dropAllSubscribers(){
}
}
/* --------------------------------------------------------------------
* DS State Machine Methods
* -------------------------------------------------------------------*/
const int DSStateMachine::MAX_START_DATA_CALL_RETRIES = 4;
const int DSStateMachine::DATA_CALL_RETRY_DELAY_MSEC = 500;
/* Overridden method
* DS SM needs to handle one scenario differently */
void DSStateMachine::processAgpsEvent(AgpsEvent event) {
LOC_LOGD("DSStateMachine::processAgpsEvent() %d", event);
/* DS Client call setup APIs don't return failure/closure separately.
* Hence we receive RELEASED event in both cases.
* If we are in pending, we should consider RELEASED as DENIED */
if (event == AGPS_EVENT_RELEASED && mState == AGPS_STATE_PENDING) {
LOC_LOGD("Translating RELEASED to DENIED event");
event = AGPS_EVENT_DENIED;
}
/* Redirect process to base class */
AgpsStateMachine::processAgpsEvent(event);
}
/* Timer Callback
* For the retry timer started in case of DS Client call setup failure */
void delay_callback(void *callbackData, int result)
{
LOC_LOGD("delay_callback(): cbData %p", callbackData);
(void)result;
if (callbackData == NULL) {
LOC_LOGE("delay_callback(): NULL argument received !");
return;
}
DSStateMachine* dsStateMachine = (DSStateMachine *)callbackData;
dsStateMachine->retryCallback();
}
/* Invoked from Timer Callback
* For the retry timer started in case of DS Client call setup failure */
void DSStateMachine :: retryCallback()
{
LOC_LOGD("DSStateMachine::retryCallback()");
/* Request SUPL ES
* There must be at least one active subscriber in list */
AgpsSubscriber* subscriber = getFirstSubscriber(false);
if (subscriber == NULL) {
LOC_LOGE("No active subscriber for DS Client call setup");
return;
}
/* Send message to retry */
mAgpsManager->mSendMsgToAdapterQueueFn(
new AgpsMsgRequestATL(
mAgpsManager, subscriber->mConnHandle,
LOC_AGPS_TYPE_SUPL_ES, subscriber->mApnTypeMask));
}
/* Overridden method
* Request or Release data connection
* bool request :
* true = Request data connection
* false = Release data connection */
int DSStateMachine::requestOrReleaseDataConn(bool request){
LOC_LOGD("DSStateMachine::requestOrReleaseDataConn(): "
"request %d", request);
/* Release data connection required ? */
if (!request && mAgpsManager->mDSClientStopDataCallFn) {
mAgpsManager->mDSClientStopDataCallFn();
LOC_LOGD("DS Client release data call request sent !");
return 0;
}
/* Setup data connection request
* There must be at least one active subscriber in list */
AgpsSubscriber* subscriber = getFirstSubscriber(false);
if (subscriber == NULL) {
LOC_LOGE("No active subscriber for DS Client call setup");
return -1;
}
/* DS Client Fn registered ? */
if (!mAgpsManager->mDSClientOpenAndStartDataCallFn) {
LOC_LOGE("DS Client start fn not registered, fallback to SUPL ATL");
notifyEventToSubscriber(AGPS_EVENT_DENIED, subscriber, false);
return -1;
}
/* Setup the call */
int ret = mAgpsManager->mDSClientOpenAndStartDataCallFn();
/* Check if data call start failed */
switch (ret) {
case LOC_API_ADAPTER_ERR_ENGINE_BUSY:
LOC_LOGE("DS Client open call failed, err: %d", ret);
mRetries++;
if (mRetries > MAX_START_DATA_CALL_RETRIES) {
LOC_LOGE("DS Client call retries exhausted, "
"falling back to normal SUPL ATL");
notifyEventToSubscriber(AGPS_EVENT_DENIED, subscriber, false);
}
/* Retry DS Client call setup after some delay */
else if(loc_timer_start(
DATA_CALL_RETRY_DELAY_MSEC, delay_callback, this)) {
LOC_LOGE("Error: Could not start delay thread\n");
return -1;
}
break;
case LOC_API_ADAPTER_ERR_UNSUPPORTED:
LOC_LOGE("No emergency profile found. Fall back to normal SUPL ATL");
notifyEventToSubscriber(AGPS_EVENT_DENIED, subscriber, false);
break;
case LOC_API_ADAPTER_ERR_SUCCESS:
LOC_LOGD("Request to start data call sent");
break;
default:
LOC_LOGE("Unrecognized return value: %d", ret);
}
return ret;
}
void DSStateMachine::notifyEventToSubscriber(
AgpsEvent event, AgpsSubscriber* subscriberToNotify,
bool deleteSubscriberPostNotify) {
LOC_LOGD("DSStateMachine::notifyEventToSubscriber(): "
"SM %p, Event %d Subscriber %p Delete %d",
this, event, subscriberToNotify, deleteSubscriberPostNotify);
switch (event) {
case AGPS_EVENT_GRANTED:
mAgpsManager->mAtlOpenStatusCb(
subscriberToNotify->mConnHandle, 1, NULL, 0,
AGPS_APN_BEARER_INVALID, LOC_AGPS_TYPE_SUPL_ES,
LOC_APN_TYPE_MASK_EMERGENCY);
break;
case AGPS_EVENT_DENIED:
/* Now try with regular SUPL
* We need to send request via message queue */
mRetries = 0;
mAgpsManager->mSendMsgToAdapterQueueFn(
new AgpsMsgRequestATL(
mAgpsManager, subscriberToNotify->mConnHandle,
LOC_AGPS_TYPE_SUPL, subscriberToNotify->mApnTypeMask));
break;
case AGPS_EVENT_UNSUBSCRIBE:
mAgpsManager->mAtlCloseStatusCb(subscriberToNotify->mConnHandle, 1);
break;
case AGPS_EVENT_RELEASED:
mAgpsManager->mDSClientCloseDataCallFn();
mAgpsManager->mAtlCloseStatusCb(subscriberToNotify->mConnHandle, 1);
break;
default:
LOC_LOGE("Invalid event %d", event);
}
/* Search this subscriber in list and delete */
if (deleteSubscriberPostNotify) {
deleteSubscriber(subscriberToNotify);
}
}
/* --------------------------------------------------------------------
* Loc AGPS Manager Methods
* -------------------------------------------------------------------*/
@ -719,22 +529,6 @@ void AgpsManager::createAgpsStateMachines() {
mAgnssNif = new AgpsStateMachine(this, LOC_AGPS_TYPE_SUPL);
LOC_LOGD("AGNSS NIF: %p", mAgnssNif);
}
if (NULL == mDsNif &&
loc_core::ContextBase::mGps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL) {
if(!mDSClientInitFn){
LOC_LOGE("DS Client Init Fn not registered !");
return;
}
if (mDSClientInitFn(false) != 0) {
LOC_LOGE("Failed to init data service client");
return;
}
mDsNif = new DSStateMachine(this);
LOC_LOGD("DS NIF: %p", mDsNif);
}
}
}
@ -746,21 +540,11 @@ AgpsStateMachine* AgpsManager::getAgpsStateMachine(AGpsExtType agpsType) {
case LOC_AGPS_TYPE_INVALID:
case LOC_AGPS_TYPE_SUPL:
case LOC_AGPS_TYPE_SUPL_ES:
if (mAgnssNif == NULL) {
LOC_LOGE("NULL AGNSS NIF !");
}
return mAgnssNif;
case LOC_AGPS_TYPE_SUPL_ES:
if (loc_core::ContextBase::mGps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL) {
if (mDsNif == NULL) {
createAgpsStateMachines();
}
return mDsNif;
} else {
return mAgnssNif;
}
default:
return mInternetNif;
}
@ -769,30 +553,28 @@ AgpsStateMachine* AgpsManager::getAgpsStateMachine(AGpsExtType agpsType) {
return NULL;
}
void AgpsManager::requestATL(int connHandle, AGpsExtType agpsType, LocApnTypeMask mask){
void AgpsManager::requestATL(int connHandle, AGpsExtType agpsType,
LocApnTypeMask apnTypeMask){
LOC_LOGD("AgpsManager::requestATL(): connHandle %d, agpsType %d apnTypeMask %" PRIu64,
connHandle, agpsType, mask);
LOC_LOGD("AgpsManager::requestATL(): connHandle %d, agpsType 0x%X apnTypeMask: 0x%X",
connHandle, agpsType, apnTypeMask);
AgpsStateMachine* sm = getAgpsStateMachine(agpsType);
if (sm == NULL) {
LOC_LOGE("No AGPS State Machine for agpsType: %d", agpsType);
LOC_LOGE("No AGPS State Machine for agpsType: %d apnTypeMask: 0x%X",
agpsType, apnTypeMask);
mAtlOpenStatusCb(
connHandle, 0, NULL, 0, AGPS_APN_BEARER_INVALID, agpsType, mask);
connHandle, 0, NULL, 0, AGPS_APN_BEARER_INVALID, agpsType, apnTypeMask);
return;
}
sm->setType(agpsType);
sm->setApnTypeMask(apnTypeMask);
/* Invoke AGPS SM processing */
AgpsSubscriber subscriber(connHandle, false, false, mask);
AgpsSubscriber subscriber(connHandle, false, false, apnTypeMask);
sm->setCurrentSubscriber(&subscriber);
/* If DS State Machine, wait for close complete */
if (agpsType == LOC_AGPS_TYPE_SUPL_ES) {
subscriber.mWaitForCloseComplete = true;
}
/* Send subscriber event */
sm->processAgpsEvent(AGPS_EVENT_SUBSCRIBE);
}
@ -814,11 +596,6 @@ void AgpsManager::releaseATL(int connHandle){
(subscriber = mInternetNif->getSubscriber(connHandle)) != NULL) {
sm = mInternetNif;
}
else if (mDsNif &&
(subscriber = mDsNif->getSubscriber(connHandle)) != NULL) {
sm = mDsNif;
}
if (sm == NULL) {
LOC_LOGE("Subscriber with connHandle %d not found in any SM",
connHandle);
@ -831,24 +608,6 @@ void AgpsManager::releaseATL(int connHandle){
sm->processAgpsEvent(AGPS_EVENT_UNSUBSCRIBE);
}
void AgpsManager::reportDataCallOpened(){
LOC_LOGD("AgpsManager::reportDataCallOpened");
if (mDsNif) {
mDsNif->processAgpsEvent(AGPS_EVENT_GRANTED);
}
}
void AgpsManager::reportDataCallClosed(){
LOC_LOGD("AgpsManager::reportDataCallClosed");
if (mDsNif) {
mDsNif->processAgpsEvent(AGPS_EVENT_RELEASED);
}
}
void AgpsManager::reportAtlOpenSuccess(
AGpsExtType agpsType, char* apnName, int apnLen,
AGpsBearerType bearerType){
@ -897,18 +656,4 @@ void AgpsManager::handleModemSSR(){
if (mInternetNif) {
mInternetNif->dropAllSubscribers();
}
if (mDsNif) {
mDsNif->dropAllSubscribers();
}
// reinitialize DS client in SSR mode
if (loc_core::ContextBase::mGps_conf.
USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL) {
mDSClientStopDataCallFn();
mDSClientCloseDataCallFn();
mDSClientReleaseFn();
mDSClientInitFn(true);
}
}

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2012-2017, The Linux Foundation. All rights reserved.
/* Copyright (c) 2012-2018, 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
@ -42,18 +42,10 @@
typedef std::function<void(
int handle, int isSuccess, char* apn, uint32_t apnLen,
AGpsBearerType bearerType, AGpsExtType agpsType,
LocApnTypeMask mask)> AgpsAtlOpenStatusCb;
LocApnTypeMask mask)> AgpsAtlOpenStatusCb;
typedef std::function<void(int handle, int isSuccess)> AgpsAtlCloseStatusCb;
/* DS Client control APIs
* Passed in by Adapter to AgpsManager */
typedef std::function<int(bool isDueToSSR)> AgpsDSClientInitFn;
typedef std::function<int()> AgpsDSClientOpenAndStartDataCallFn;
typedef std::function<void()> AgpsDSClientStopDataCallFn;
typedef std::function<void()> AgpsDSClientCloseDataCallFn;
typedef std::function<void()> AgpsDSClientReleaseFn;
/* Post message to adapter's message queue */
typedef std::function<void(LocMsg* msg)> SendMsgToAdapterMsgQueueFn;
@ -93,8 +85,6 @@ typedef enum {
class AgpsSubscriber;
class AgpsManager;
class AgpsStateMachine;
class DSStateMachine;
/* SUBSCRIBER
* Each Subscriber instance corresponds to one AGPS request,
@ -154,6 +144,7 @@ private:
LOC_AGPS_TYPE_WWAN_ANY 3
LOC_AGPS_TYPE_SUPL_ES 5 */
AGpsExtType mAgpsType;
LocApnTypeMask mApnTypeMask;
/* APN and IP Type info for AGPS Call */
char* mAPN;
@ -175,7 +166,11 @@ public:
inline char* getAPN() const { return (char*)mAPN; }
inline uint32_t getAPNLen() const { return mAPNLen; }
inline void setBearer(AGpsBearerType bearer) { mBearer = bearer; }
inline LocApnTypeMask getApnTypeMask() const { return mApnTypeMask; }
inline void setApnTypeMask(LocApnTypeMask apnTypeMask)
{ mApnTypeMask = apnTypeMask; }
inline AGpsBearerType getBearer() const { return mBearer; }
inline void setType(AGpsExtType type) { mAgpsType = type; }
inline AGpsExtType getType() const { return mAgpsType; }
inline void setCurrentSubscriber(AgpsSubscriber* subscriber)
{ mCurrentSubscriber = subscriber; }
@ -204,7 +199,7 @@ private:
/* Send call setup request to framework
* sendRsrcRequest(LOC_GPS_REQUEST_AGPS_DATA_CONN)
* sendRsrcRequest(LOC_GPS_RELEASE_AGPS_DATA_CONN) */
virtual int requestOrReleaseDataConn(bool request);
void requestOrReleaseDataConn(bool request);
/* Individual event processing methods */
void processAgpsEventSubscribe();
@ -232,74 +227,23 @@ private:
void transitionState(AgpsState newState);
};
/* DS STATE MACHINE */
class DSStateMachine : public AgpsStateMachine {
private:
static const int MAX_START_DATA_CALL_RETRIES;
static const int DATA_CALL_RETRY_DELAY_MSEC;
int mRetries;
public:
/* CONSTRUCTOR */
DSStateMachine(AgpsManager* agpsManager):
AgpsStateMachine(agpsManager, LOC_AGPS_TYPE_SUPL_ES), mRetries(0) {}
/* Overridden method
* DS SM needs to handle one event differently */
void processAgpsEvent(AgpsEvent event);
/* Retry callback, used in case call failure */
void retryCallback();
private:
/* Overridden method, different functionality for DS SM
* Send call setup request to framework
* sendRsrcRequest(LOC_GPS_REQUEST_AGPS_DATA_CONN)
* sendRsrcRequest(LOC_GPS_RELEASE_AGPS_DATA_CONN) */
int requestOrReleaseDataConn(bool request);
/* Overridden method, different functionality for DS SM */
void notifyEventToSubscriber(
AgpsEvent event, AgpsSubscriber* subscriber,
bool deleteSubscriberPostNotify);
};
/* LOC AGPS MANAGER */
class AgpsManager {
friend class AgpsStateMachine;
friend class DSStateMachine;
public:
/* CONSTRUCTOR */
AgpsManager():
mFrameworkStatusV4Cb(NULL),
mAtlOpenStatusCb(), mAtlCloseStatusCb(),
mDSClientInitFn(), mDSClientOpenAndStartDataCallFn(),
mDSClientStopDataCallFn(), mDSClientCloseDataCallFn(), mDSClientReleaseFn(),
mSendMsgToAdapterQueueFn(),
mAgnssNif(NULL), mInternetNif(NULL), mDsNif(NULL) {}
mAgnssNif(NULL), mInternetNif(NULL)/*, mDsNif(NULL)*/ {}
/* Register callbacks */
inline void registerATLCallbacks(AgpsAtlOpenStatusCb atlOpenStatusCb,
AgpsAtlCloseStatusCb atlCloseStatusCb,
AgpsDSClientInitFn dsClientInitFn,
AgpsDSClientOpenAndStartDataCallFn dsClientOpenAndStartDataCallFn,
AgpsDSClientStopDataCallFn dsClientStopDataCallFn,
AgpsDSClientCloseDataCallFn dsClientCloseDataCallFn,
AgpsDSClientReleaseFn dsClientReleaseFn,
SendMsgToAdapterMsgQueueFn sendMsgToAdapterQueueFn) {
AgpsAtlCloseStatusCb atlCloseStatusCb) {
mAtlOpenStatusCb = atlOpenStatusCb;
mAtlCloseStatusCb = atlCloseStatusCb;
mDSClientInitFn = dsClientInitFn;
mDSClientOpenAndStartDataCallFn = dsClientOpenAndStartDataCallFn;
mDSClientStopDataCallFn = dsClientStopDataCallFn;
mDSClientCloseDataCallFn = dsClientCloseDataCallFn;
mDSClientReleaseFn = dsClientReleaseFn;
mSendMsgToAdapterQueueFn = sendMsgToAdapterQueueFn;
}
inline void registerFrameworkStatusCallback(AgnssStatusIpV4Cb frameworkStatusV4Cb) {
@ -310,13 +254,8 @@ public:
void createAgpsStateMachines();
/* Process incoming ATL requests */
void requestATL(int connHandle, AGpsExtType agpsType, LocApnTypeMask mask);
void requestATL(int connHandle, AGpsExtType agpsType, LocApnTypeMask apnTypeMask);
void releaseATL(int connHandle);
/* Process incoming DS Client data call events */
void reportDataCallOpened();
void reportDataCallClosed();
/* Process incoming framework data call events */
void reportAtlOpenSuccess(AGpsExtType agpsType, char* apnName, int apnLen,
AGpsBearerType bearerType);
@ -331,19 +270,8 @@ protected:
AgpsAtlOpenStatusCb mAtlOpenStatusCb;
AgpsAtlCloseStatusCb mAtlCloseStatusCb;
AgpsDSClientInitFn mDSClientInitFn;
AgpsDSClientOpenAndStartDataCallFn mDSClientOpenAndStartDataCallFn;
AgpsDSClientStopDataCallFn mDSClientStopDataCallFn;
AgpsDSClientCloseDataCallFn mDSClientCloseDataCallFn;
AgpsDSClientReleaseFn mDSClientReleaseFn;
SendMsgToAdapterMsgQueueFn mSendMsgToAdapterQueueFn;
AgpsStateMachine* mAgnssNif;
AgpsStateMachine* mInternetNif;
AgpsStateMachine* mDsNif;
private:
/* Fetch state machine for handling request ATL call */
AgpsStateMachine* getAgpsStateMachine(AGpsExtType agpsType);
@ -361,9 +289,9 @@ struct AgpsMsgRequestATL: public LocMsg {
LocApnTypeMask mApnTypeMask;
inline AgpsMsgRequestATL(AgpsManager* agpsManager, int connHandle,
AGpsExtType agpsType, LocApnTypeMask mask) :
AGpsExtType agpsType, LocApnTypeMask apnTypeMask) :
LocMsg(), mAgpsManager(agpsManager), mConnHandle(connHandle),
mAgpsType(agpsType), mApnTypeMask(mask) {
mAgpsType(agpsType), mApnTypeMask(apnTypeMask){
LOC_LOGV("AgpsMsgRequestATL");
}

View file

@ -109,47 +109,7 @@ GnssAdapter::GnssAdapter() :
mLocApi->atlCloseStatus(handle, isSuccess);
};
/* Register DS Client APIs */
AgpsDSClientInitFn dsClientInitFn =
[this](bool isDueToSSR) {
return mLocApi->initDataServiceClient(isDueToSSR);
};
AgpsDSClientOpenAndStartDataCallFn dsClientOpenAndStartDataCallFn =
[this] {
return mLocApi->openAndStartDataCall();
};
AgpsDSClientStopDataCallFn dsClientStopDataCallFn =
[this] {
mLocApi->stopDataCall();
};
AgpsDSClientCloseDataCallFn dsClientCloseDataCallFn =
[this] {
mLocApi->closeDataCall();
};
AgpsDSClientReleaseFn dsClientReleaseFn =
[this] {
mLocApi->releaseDataServiceClient();
};
/* Send Msg function */
SendMsgToAdapterMsgQueueFn sendMsgFn =
[this](LocMsg* msg) {
sendMsg(msg);
};
mAgpsManager.registerATLCallbacks(atlOpenStatusCb, atlCloseStatusCb,
dsClientInitFn, dsClientOpenAndStartDataCallFn, dsClientStopDataCallFn,
dsClientCloseDataCallFn, dsClientReleaseFn, sendMsgFn);
mAgpsManager.registerATLCallbacks(atlOpenStatusCb, atlCloseStatusCb);
readConfigCommand();
initDefaultAgpsCommand();
@ -3365,28 +3325,17 @@ void GnssAdapter::initAgpsCommand(const AgpsCbInfo& cbInfo){
* eQMI_LOC_SERVER_REQUEST_OPEN_V02
* 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, LocApnTypeMask mask){
LOC_LOGI("GnssAdapter::requestATL");
sendMsg( new AgpsMsgRequestATL(
&mAgpsManager, connHandle, (AGpsExtType)agpsType, mask));
return true;
}
/* GnssAdapter::requestSuplES
* Method triggered in QMI thread as part of handling below message:
* eQMI_LOC_SERVER_REQUEST_OPEN_V02
* Triggers the AGPS state machine to setup AGPS call for below WWAN types:
* eQMI_LOC_WWAN_TYPE_AGNSS_V02
* eQMI_LOC_WWAN_TYPE_AGNSS_EMERGENCY_V02 */
bool GnssAdapter::requestSuplES(int connHandle, LocApnTypeMask mask){
bool GnssAdapter::requestATL(int connHandle, LocAGpsType agpsType,
LocApnTypeMask apnTypeMask){
LOC_LOGI("GnssAdapter::requestSuplES");
LOC_LOGI("GnssAdapter::requestATL handle=%d agpsType=0x%X apnTypeMask=0x%X",
connHandle, agpsType, apnTypeMask);
sendMsg( new AgpsMsgRequestATL(
&mAgpsManager, connHandle, LOC_AGPS_TYPE_SUPL_ES, mask));
&mAgpsManager, connHandle, (AGpsExtType)agpsType,
apnTypeMask));
return true;
}
@ -3423,64 +3372,6 @@ bool GnssAdapter::releaseATL(int connHandle){
return true;
}
/* GnssAdapter::reportDataCallOpened
* DS Client data call opened successfully.
* Send message to AGPS Manager to handle. */
bool GnssAdapter::reportDataCallOpened(){
LOC_LOGI("GnssAdapter::reportDataCallOpened");
struct AgpsMsgSuplEsOpened: public LocMsg {
AgpsManager* mAgpsManager;
inline AgpsMsgSuplEsOpened(AgpsManager* agpsManager) :
LocMsg(), mAgpsManager(agpsManager) {
LOC_LOGV("AgpsMsgSuplEsOpened");
}
inline virtual void proc() const {
LOC_LOGV("AgpsMsgSuplEsOpened::proc()");
mAgpsManager->reportDataCallOpened();
}
};
sendMsg( new AgpsMsgSuplEsOpened(&mAgpsManager));
return true;
}
/* GnssAdapter::reportDataCallClosed
* DS Client data call closed.
* Send message to AGPS Manager to handle. */
bool GnssAdapter::reportDataCallClosed(){
LOC_LOGI("GnssAdapter::reportDataCallClosed");
struct AgpsMsgSuplEsClosed: public LocMsg {
AgpsManager* mAgpsManager;
inline AgpsMsgSuplEsClosed(AgpsManager* agpsManager) :
LocMsg(), mAgpsManager(agpsManager) {
LOC_LOGV("AgpsMsgSuplEsClosed");
}
inline virtual void proc() const {
LOC_LOGV("AgpsMsgSuplEsClosed::proc()");
mAgpsManager->reportDataCallClosed();
}
};
sendMsg( new AgpsMsgSuplEsClosed(&mAgpsManager));
return true;
}
void GnssAdapter::dataConnOpenCommand(
AGpsExtType agpsType,
const char* apnName, int apnLen, AGpsBearerType bearerType){

View file

@ -283,11 +283,8 @@ public:
virtual void reportGnssSvIdConfigEvent(const GnssSvIdConfig& config);
virtual void reportGnssSvTypeConfigEvent(const GnssSvTypeConfig& config);
virtual bool requestATL(int connHandle, LocAGpsType agps_type, LocApnTypeMask mask);
virtual bool requestATL(int connHandle, LocAGpsType agps_type, LocApnTypeMask apn_type_mask);
virtual bool releaseATL(int connHandle);
virtual bool requestSuplES(int connHandle, LocApnTypeMask mask);
virtual bool reportDataCallOpened();
virtual bool reportDataCallClosed();
virtual bool requestOdcpiEvent(OdcpiRequestInfo& request);
/* ======== UTILITIES ================================================================= */

View file

@ -1,4 +1,4 @@
/* Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2018 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
@ -160,17 +160,27 @@ 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 uint32_t LocApnTypeMask;
/**< Denotes APN type for Default/Internet traffic */
#define LOC_APN_TYPE_MASK_DEFAULT ((LocApnTypeMask)0x00000001)
/**< Denotes APN type for IP Multimedia Subsystem */
#define LOC_APN_TYPE_MASK_IMS ((LocApnTypeMask)0x00000002)
/**< Denotes APN type for Multimedia Messaging Service */
#define LOC_APN_TYPE_MASK_MMS ((LocApnTypeMask)0x00000004)
/**< Denotes APN type for Dial Up Network */
#define LOC_APN_TYPE_MASK_DUN ((LocApnTypeMask)0x00000008)
/**< Denotes APN type for Secure User Plane Location */
#define LOC_APN_TYPE_MASK_SUPL ((LocApnTypeMask)0x00000010)
/**< Denotes APN type for High Priority Mobile Data */
#define LOC_APN_TYPE_MASK_HIPRI ((LocApnTypeMask)0x00000020)
/**< Denotes APN type for over the air administration */
#define LOC_APN_TYPE_MASK_FOTA ((LocApnTypeMask)0x00000040)
/**< Denotes APN type for Carrier Branded Services */
#define LOC_APN_TYPE_MASK_CBS ((LocApnTypeMask)0x00000080)
/**< Denotes APN type for Initial Attach */
#define LOC_APN_TYPE_MASK_IA ((LocApnTypeMask)0x00000100)
/**< Denotes APN type for emergency */
#define LOC_APN_TYPE_MASK_EMERGENCY ((LocApnTypeMask)0x00000200)
typedef enum {
AGPS_CB_PRIORITY_LOW = 1,
@ -1490,24 +1500,26 @@ typedef std::function<void(
* Represents the status of AGNSS augmented to support IPv4.
*/
struct AGnssExtStatusIpV4 {
AGpsExtType type;
LocAGpsStatusValue status;
AGpsExtType type;
LocApnTypeMask apnTypeMask;
LocAGpsStatusValue status;
/*
* 32-bit IPv4 address.
*/
uint32_t ipV4Addr;
uint32_t ipV4Addr;
};
/*
* Represents the status of AGNSS augmented to support IPv6.
*/
struct AGnssExtStatusIpV6 {
AGpsExtType type;
LocAGpsStatusValue status;
AGpsExtType type;
LocApnTypeMask apnTypeMask;
LocAGpsStatusValue status;
/*
* 128-bit IPv6 address.
*/
uint8_t ipV6Addr[16];
uint8_t ipV6Addr[16];
};
/* ODCPI Request Info */

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2010 The Android Open Source Project
* Copyright (C) 2010, 2018 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -156,8 +156,12 @@ typedef uint16_t LocGpsAidingData;
/** AGPS type */
typedef uint16_t LocAGpsType;
#define LOC_AGPS_TYPE_ANY 0
#define LOC_AGPS_TYPE_SUPL 1
#define LOC_AGPS_TYPE_C2K 2
#define LOC_AGPS_TYPE_WWAN_ANY 3
#define LOC_AGPS_TYPE_WIFI 4
#define LOC_AGPS_TYPE_SUPL_ES 5
typedef uint16_t LocAGpsSetIDType;
#define LOC_AGPS_SETID_TYPE_NONE 0