Merge "SUPL connection enhancements" into location.lnx.4.0
This commit is contained in:
commit
f7981a3c11
10 changed files with 95 additions and 573 deletions
|
@ -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
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -130,25 +130,14 @@ bool LocAdapterBase::
|
||||||
DEFAULT_IMPL(false)
|
DEFAULT_IMPL(false)
|
||||||
|
|
||||||
bool LocAdapterBase::
|
bool LocAdapterBase::
|
||||||
requestATL(int /*connHandle*/, LocAGpsType /*agps_type*/, LocApnTypeMask /*mask*/)
|
requestATL(int /*connHandle*/, LocAGpsType /*agps_type*/,
|
||||||
|
LocApnTypeMask /*apn_type_mask*/)
|
||||||
DEFAULT_IMPL(false)
|
DEFAULT_IMPL(false)
|
||||||
|
|
||||||
bool LocAdapterBase::
|
bool LocAdapterBase::
|
||||||
releaseATL(int /*connHandle*/)
|
releaseATL(int /*connHandle*/)
|
||||||
DEFAULT_IMPL(false)
|
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::
|
bool LocAdapterBase::
|
||||||
requestNiNotifyEvent(const GnssNiNotification &/*notify*/, const void* /*data*/)
|
requestNiNotifyEvent(const GnssNiNotification &/*notify*/, const void* /*data*/)
|
||||||
DEFAULT_IMPL(false)
|
DEFAULT_IMPL(false)
|
||||||
|
|
|
@ -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
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -133,11 +133,9 @@ public:
|
||||||
virtual bool requestXtraData();
|
virtual bool requestXtraData();
|
||||||
virtual bool requestTime();
|
virtual bool requestTime();
|
||||||
virtual bool requestLocation();
|
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 releaseATL(int connHandle);
|
||||||
virtual bool requestSuplES(int connHandle, LocApnTypeMask mask);
|
|
||||||
virtual bool reportDataCallOpened();
|
|
||||||
virtual bool reportDataCallClosed();
|
|
||||||
virtual bool requestNiNotifyEvent(const GnssNiNotification ¬ify, const void* data);
|
virtual bool requestNiNotifyEvent(const GnssNiNotification ¬ify, const void* data);
|
||||||
inline virtual bool isInSession() { return false; }
|
inline virtual bool isInSession() { return false; }
|
||||||
ContextBase* getContext() const { return mContext; }
|
ContextBase* getContext() const { return mContext; }
|
||||||
|
|
|
@ -378,10 +378,12 @@ void LocApiBase::requestLocation()
|
||||||
TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->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.
|
// 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)
|
void LocApiBase::releaseATL(int connHandle)
|
||||||
|
@ -390,24 +392,6 @@ void LocApiBase::releaseATL(int connHandle)
|
||||||
TO_1ST_HANDLING_LOCADAPTERS(mLocAdapters[i]->releaseATL(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 ¬ify, const void* data)
|
void LocApiBase::requestNiNotify(GnssNiNotification ¬ify, const void* data)
|
||||||
{
|
{
|
||||||
// loop through adapters, and deliver to the first handling adapter.
|
// loop through adapters, and deliver to the first handling adapter.
|
||||||
|
@ -485,7 +469,8 @@ DEFAULT_IMPL(LOC_API_ADAPTER_ERR_SUCCESS)
|
||||||
|
|
||||||
void LocApiBase::
|
void LocApiBase::
|
||||||
atlOpenStatus(int /*handle*/, int /*is_succ*/, char* /*apn*/, uint32_t /*apnLen*/,
|
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()
|
DEFAULT_IMPL()
|
||||||
|
|
||||||
void LocApiBase::
|
void LocApiBase::
|
||||||
|
@ -583,26 +568,6 @@ void LocApiBase::
|
||||||
getBestAvailableZppFix()
|
getBestAvailableZppFix()
|
||||||
DEFAULT_IMPL()
|
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::
|
LocationError LocApiBase::
|
||||||
setGpsLockSync(GnssConfigGpsLock /*lock*/)
|
setGpsLockSync(GnssConfigGpsLock /*lock*/)
|
||||||
DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
|
DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
|
||||||
|
|
|
@ -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
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -147,11 +147,8 @@ public:
|
||||||
void requestXtraData();
|
void requestXtraData();
|
||||||
void requestTime();
|
void requestTime();
|
||||||
void requestLocation();
|
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 releaseATL(int connHandle);
|
||||||
void requestSuplES(int connHandle, LocApnTypeMask mask);
|
|
||||||
void reportDataCallOpened();
|
|
||||||
void reportDataCallClosed();
|
|
||||||
void requestNiNotify(GnssNiNotification ¬ify, const void* data);
|
void requestNiNotify(GnssNiNotification ¬ify, const void* data);
|
||||||
void reportGnssMeasurementData(GnssMeasurementsNotification& measurements, int msInWeek);
|
void reportGnssMeasurementData(GnssMeasurementsNotification& measurements, int msInWeek);
|
||||||
void reportWwanZppFix(LocGpsLocation &zppLoc);
|
void reportWwanZppFix(LocGpsLocation &zppLoc);
|
||||||
|
@ -186,7 +183,8 @@ public:
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
atlOpenStatus(int handle, int is_succ, char* apn, uint32_t apnLen,
|
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
|
virtual void
|
||||||
atlCloseStatus(int handle, int is_succ);
|
atlCloseStatus(int handle, int is_succ);
|
||||||
virtual void
|
virtual void
|
||||||
|
@ -237,11 +235,6 @@ public:
|
||||||
|
|
||||||
virtual void getWwanZppFix();
|
virtual void getWwanZppFix();
|
||||||
virtual void getBestAvailableZppFix();
|
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,
|
virtual void installAGpsCert(const LocDerEncodedCertificate* pData,
|
||||||
size_t length,
|
size_t length,
|
||||||
uint32_t slotBitMask);
|
uint32_t slotBitMask);
|
||||||
|
|
299
gnss/Agps.cpp
299
gnss/Agps.cpp
|
@ -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
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -78,16 +78,8 @@ void AgpsStateMachine::processAgpsEventSubscribe(){
|
||||||
/* Add subscriber to list
|
/* Add subscriber to list
|
||||||
* No notifications until we get RSRC_GRANTED */
|
* No notifications until we get RSRC_GRANTED */
|
||||||
addSubscriber(mCurrentSubscriber);
|
addSubscriber(mCurrentSubscriber);
|
||||||
|
requestOrReleaseDataConn(true);
|
||||||
/* Send data request
|
transitionState(AGPS_STATE_PENDING);
|
||||||
* 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);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AGPS_STATE_PENDING:
|
case AGPS_STATE_PENDING:
|
||||||
|
@ -294,24 +286,25 @@ void AgpsStateMachine::processAgpsEventDenied(){
|
||||||
* bool request :
|
* bool request :
|
||||||
* true = Request data connection
|
* true = Request data connection
|
||||||
* false = Release data connection */
|
* false = Release data connection */
|
||||||
int AgpsStateMachine::requestOrReleaseDataConn(bool request){
|
void AgpsStateMachine::requestOrReleaseDataConn(bool request){
|
||||||
|
|
||||||
AGnssExtStatusIpV4 nifRequest;
|
AGnssExtStatusIpV4 nifRequest;
|
||||||
memset(&nifRequest, 0, sizeof(nifRequest));
|
memset(&nifRequest, 0, sizeof(nifRequest));
|
||||||
|
|
||||||
nifRequest.type = mAgpsType;
|
nifRequest.type = mAgpsType;
|
||||||
|
nifRequest.apnTypeMask = mApnTypeMask;
|
||||||
if (request) {
|
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;
|
nifRequest.status = LOC_GPS_REQUEST_AGPS_DATA_CONN;
|
||||||
}
|
}
|
||||||
else{
|
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;
|
nifRequest.status = LOC_GPS_RELEASE_AGPS_DATA_CONN;
|
||||||
}
|
}
|
||||||
|
|
||||||
mAgpsManager->mFrameworkStatusV4Cb(nifRequest);
|
mAgpsManager->mFrameworkStatusV4Cb(nifRequest);
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void AgpsStateMachine::notifyAllSubscribers(
|
void AgpsStateMachine::notifyAllSubscribers(
|
||||||
|
@ -362,13 +355,13 @@ void AgpsStateMachine::notifyEventToSubscriber(
|
||||||
case AGPS_EVENT_GRANTED:
|
case AGPS_EVENT_GRANTED:
|
||||||
mAgpsManager->mAtlOpenStatusCb(
|
mAgpsManager->mAtlOpenStatusCb(
|
||||||
subscriberToNotify->mConnHandle, 1, getAPN(), getAPNLen(),
|
subscriberToNotify->mConnHandle, 1, getAPN(), getAPNLen(),
|
||||||
getBearer(), mAgpsType, LOC_APN_TYPE_MASK_SUPL);
|
getBearer(), mAgpsType, mApnTypeMask);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AGPS_EVENT_DENIED:
|
case AGPS_EVENT_DENIED:
|
||||||
mAgpsManager->mAtlOpenStatusCb(
|
mAgpsManager->mAtlOpenStatusCb(
|
||||||
subscriberToNotify->mConnHandle, 0, getAPN(), getAPNLen(),
|
subscriberToNotify->mConnHandle, 0, getAPN(), getAPNLen(),
|
||||||
getBearer(), mAgpsType, LOC_APN_TYPE_MASK_SUPL);
|
getBearer(), mAgpsType, mApnTypeMask);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AGPS_EVENT_UNSUBSCRIBE:
|
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
|
* Loc AGPS Manager Methods
|
||||||
* -------------------------------------------------------------------*/
|
* -------------------------------------------------------------------*/
|
||||||
|
@ -719,22 +529,6 @@ void AgpsManager::createAgpsStateMachines() {
|
||||||
mAgnssNif = new AgpsStateMachine(this, LOC_AGPS_TYPE_SUPL);
|
mAgnssNif = new AgpsStateMachine(this, LOC_AGPS_TYPE_SUPL);
|
||||||
LOC_LOGD("AGNSS NIF: %p", mAgnssNif);
|
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_INVALID:
|
||||||
case LOC_AGPS_TYPE_SUPL:
|
case LOC_AGPS_TYPE_SUPL:
|
||||||
|
case LOC_AGPS_TYPE_SUPL_ES:
|
||||||
if (mAgnssNif == NULL) {
|
if (mAgnssNif == NULL) {
|
||||||
LOC_LOGE("NULL AGNSS NIF !");
|
LOC_LOGE("NULL AGNSS NIF !");
|
||||||
}
|
}
|
||||||
return mAgnssNif;
|
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:
|
default:
|
||||||
return mInternetNif;
|
return mInternetNif;
|
||||||
}
|
}
|
||||||
|
@ -769,30 +553,28 @@ AgpsStateMachine* AgpsManager::getAgpsStateMachine(AGpsExtType agpsType) {
|
||||||
return NULL;
|
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,
|
LOC_LOGD("AgpsManager::requestATL(): connHandle %d, agpsType 0x%X apnTypeMask: 0x%X",
|
||||||
connHandle, agpsType, mask);
|
connHandle, agpsType, apnTypeMask);
|
||||||
|
|
||||||
AgpsStateMachine* sm = getAgpsStateMachine(agpsType);
|
AgpsStateMachine* sm = getAgpsStateMachine(agpsType);
|
||||||
|
|
||||||
if (sm == NULL) {
|
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(
|
mAtlOpenStatusCb(
|
||||||
connHandle, 0, NULL, 0, AGPS_APN_BEARER_INVALID, agpsType, mask);
|
connHandle, 0, NULL, 0, AGPS_APN_BEARER_INVALID, agpsType, apnTypeMask);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
sm->setType(agpsType);
|
||||||
|
sm->setApnTypeMask(apnTypeMask);
|
||||||
|
|
||||||
/* Invoke AGPS SM processing */
|
/* Invoke AGPS SM processing */
|
||||||
AgpsSubscriber subscriber(connHandle, false, false, mask);
|
AgpsSubscriber subscriber(connHandle, false, false, apnTypeMask);
|
||||||
sm->setCurrentSubscriber(&subscriber);
|
sm->setCurrentSubscriber(&subscriber);
|
||||||
|
|
||||||
/* If DS State Machine, wait for close complete */
|
|
||||||
if (agpsType == LOC_AGPS_TYPE_SUPL_ES) {
|
|
||||||
subscriber.mWaitForCloseComplete = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Send subscriber event */
|
/* Send subscriber event */
|
||||||
sm->processAgpsEvent(AGPS_EVENT_SUBSCRIBE);
|
sm->processAgpsEvent(AGPS_EVENT_SUBSCRIBE);
|
||||||
}
|
}
|
||||||
|
@ -814,11 +596,6 @@ void AgpsManager::releaseATL(int connHandle){
|
||||||
(subscriber = mInternetNif->getSubscriber(connHandle)) != NULL) {
|
(subscriber = mInternetNif->getSubscriber(connHandle)) != NULL) {
|
||||||
sm = mInternetNif;
|
sm = mInternetNif;
|
||||||
}
|
}
|
||||||
else if (mDsNif &&
|
|
||||||
(subscriber = mDsNif->getSubscriber(connHandle)) != NULL) {
|
|
||||||
sm = mDsNif;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sm == NULL) {
|
if (sm == NULL) {
|
||||||
LOC_LOGE("Subscriber with connHandle %d not found in any SM",
|
LOC_LOGE("Subscriber with connHandle %d not found in any SM",
|
||||||
connHandle);
|
connHandle);
|
||||||
|
@ -831,24 +608,6 @@ void AgpsManager::releaseATL(int connHandle){
|
||||||
sm->processAgpsEvent(AGPS_EVENT_UNSUBSCRIBE);
|
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(
|
void AgpsManager::reportAtlOpenSuccess(
|
||||||
AGpsExtType agpsType, char* apnName, int apnLen,
|
AGpsExtType agpsType, char* apnName, int apnLen,
|
||||||
AGpsBearerType bearerType){
|
AGpsBearerType bearerType){
|
||||||
|
@ -897,18 +656,4 @@ void AgpsManager::handleModemSSR(){
|
||||||
if (mInternetNif) {
|
if (mInternetNif) {
|
||||||
mInternetNif->dropAllSubscribers();
|
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
98
gnss/Agps.h
98
gnss/Agps.h
|
@ -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
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
|
@ -42,18 +42,10 @@
|
||||||
typedef std::function<void(
|
typedef std::function<void(
|
||||||
int handle, int isSuccess, char* apn, uint32_t apnLen,
|
int handle, int isSuccess, char* apn, uint32_t apnLen,
|
||||||
AGpsBearerType bearerType, AGpsExtType agpsType,
|
AGpsBearerType bearerType, AGpsExtType agpsType,
|
||||||
LocApnTypeMask mask)> AgpsAtlOpenStatusCb;
|
LocApnTypeMask mask)> AgpsAtlOpenStatusCb;
|
||||||
|
|
||||||
typedef std::function<void(int handle, int isSuccess)> AgpsAtlCloseStatusCb;
|
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 */
|
/* Post message to adapter's message queue */
|
||||||
typedef std::function<void(LocMsg* msg)> SendMsgToAdapterMsgQueueFn;
|
typedef std::function<void(LocMsg* msg)> SendMsgToAdapterMsgQueueFn;
|
||||||
|
|
||||||
|
@ -93,8 +85,6 @@ typedef enum {
|
||||||
class AgpsSubscriber;
|
class AgpsSubscriber;
|
||||||
class AgpsManager;
|
class AgpsManager;
|
||||||
class AgpsStateMachine;
|
class AgpsStateMachine;
|
||||||
class DSStateMachine;
|
|
||||||
|
|
||||||
|
|
||||||
/* SUBSCRIBER
|
/* SUBSCRIBER
|
||||||
* Each Subscriber instance corresponds to one AGPS request,
|
* Each Subscriber instance corresponds to one AGPS request,
|
||||||
|
@ -154,6 +144,7 @@ private:
|
||||||
LOC_AGPS_TYPE_WWAN_ANY 3
|
LOC_AGPS_TYPE_WWAN_ANY 3
|
||||||
LOC_AGPS_TYPE_SUPL_ES 5 */
|
LOC_AGPS_TYPE_SUPL_ES 5 */
|
||||||
AGpsExtType mAgpsType;
|
AGpsExtType mAgpsType;
|
||||||
|
LocApnTypeMask mApnTypeMask;
|
||||||
|
|
||||||
/* APN and IP Type info for AGPS Call */
|
/* APN and IP Type info for AGPS Call */
|
||||||
char* mAPN;
|
char* mAPN;
|
||||||
|
@ -175,7 +166,11 @@ public:
|
||||||
inline char* getAPN() const { return (char*)mAPN; }
|
inline char* getAPN() const { return (char*)mAPN; }
|
||||||
inline uint32_t getAPNLen() const { return mAPNLen; }
|
inline uint32_t getAPNLen() const { return mAPNLen; }
|
||||||
inline void setBearer(AGpsBearerType bearer) { mBearer = bearer; }
|
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 AGpsBearerType getBearer() const { return mBearer; }
|
||||||
|
inline void setType(AGpsExtType type) { mAgpsType = type; }
|
||||||
inline AGpsExtType getType() const { return mAgpsType; }
|
inline AGpsExtType getType() const { return mAgpsType; }
|
||||||
inline void setCurrentSubscriber(AgpsSubscriber* subscriber)
|
inline void setCurrentSubscriber(AgpsSubscriber* subscriber)
|
||||||
{ mCurrentSubscriber = subscriber; }
|
{ mCurrentSubscriber = subscriber; }
|
||||||
|
@ -204,7 +199,7 @@ private:
|
||||||
/* Send call setup request to framework
|
/* Send call setup request to framework
|
||||||
* sendRsrcRequest(LOC_GPS_REQUEST_AGPS_DATA_CONN)
|
* sendRsrcRequest(LOC_GPS_REQUEST_AGPS_DATA_CONN)
|
||||||
* sendRsrcRequest(LOC_GPS_RELEASE_AGPS_DATA_CONN) */
|
* sendRsrcRequest(LOC_GPS_RELEASE_AGPS_DATA_CONN) */
|
||||||
virtual int requestOrReleaseDataConn(bool request);
|
void requestOrReleaseDataConn(bool request);
|
||||||
|
|
||||||
/* Individual event processing methods */
|
/* Individual event processing methods */
|
||||||
void processAgpsEventSubscribe();
|
void processAgpsEventSubscribe();
|
||||||
|
@ -232,74 +227,23 @@ private:
|
||||||
void transitionState(AgpsState newState);
|
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 */
|
/* LOC AGPS MANAGER */
|
||||||
class AgpsManager {
|
class AgpsManager {
|
||||||
|
|
||||||
friend class AgpsStateMachine;
|
friend class AgpsStateMachine;
|
||||||
friend class DSStateMachine;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/* CONSTRUCTOR */
|
/* CONSTRUCTOR */
|
||||||
AgpsManager():
|
AgpsManager():
|
||||||
mFrameworkStatusV4Cb(NULL),
|
mFrameworkStatusV4Cb(NULL),
|
||||||
mAtlOpenStatusCb(), mAtlCloseStatusCb(),
|
mAtlOpenStatusCb(), mAtlCloseStatusCb(),
|
||||||
mDSClientInitFn(), mDSClientOpenAndStartDataCallFn(),
|
mAgnssNif(NULL), mInternetNif(NULL)/*, mDsNif(NULL)*/ {}
|
||||||
mDSClientStopDataCallFn(), mDSClientCloseDataCallFn(), mDSClientReleaseFn(),
|
|
||||||
mSendMsgToAdapterQueueFn(),
|
|
||||||
mAgnssNif(NULL), mInternetNif(NULL), mDsNif(NULL) {}
|
|
||||||
|
|
||||||
/* Register callbacks */
|
/* Register callbacks */
|
||||||
inline void registerATLCallbacks(AgpsAtlOpenStatusCb atlOpenStatusCb,
|
inline void registerATLCallbacks(AgpsAtlOpenStatusCb atlOpenStatusCb,
|
||||||
AgpsAtlCloseStatusCb atlCloseStatusCb,
|
AgpsAtlCloseStatusCb atlCloseStatusCb) {
|
||||||
AgpsDSClientInitFn dsClientInitFn,
|
|
||||||
AgpsDSClientOpenAndStartDataCallFn dsClientOpenAndStartDataCallFn,
|
|
||||||
AgpsDSClientStopDataCallFn dsClientStopDataCallFn,
|
|
||||||
AgpsDSClientCloseDataCallFn dsClientCloseDataCallFn,
|
|
||||||
AgpsDSClientReleaseFn dsClientReleaseFn,
|
|
||||||
SendMsgToAdapterMsgQueueFn sendMsgToAdapterQueueFn) {
|
|
||||||
|
|
||||||
mAtlOpenStatusCb = atlOpenStatusCb;
|
mAtlOpenStatusCb = atlOpenStatusCb;
|
||||||
mAtlCloseStatusCb = atlCloseStatusCb;
|
mAtlCloseStatusCb = atlCloseStatusCb;
|
||||||
mDSClientInitFn = dsClientInitFn;
|
|
||||||
mDSClientOpenAndStartDataCallFn = dsClientOpenAndStartDataCallFn;
|
|
||||||
mDSClientStopDataCallFn = dsClientStopDataCallFn;
|
|
||||||
mDSClientCloseDataCallFn = dsClientCloseDataCallFn;
|
|
||||||
mDSClientReleaseFn = dsClientReleaseFn;
|
|
||||||
mSendMsgToAdapterQueueFn = sendMsgToAdapterQueueFn;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void registerFrameworkStatusCallback(AgnssStatusIpV4Cb frameworkStatusV4Cb) {
|
inline void registerFrameworkStatusCallback(AgnssStatusIpV4Cb frameworkStatusV4Cb) {
|
||||||
|
@ -310,13 +254,8 @@ public:
|
||||||
void createAgpsStateMachines();
|
void createAgpsStateMachines();
|
||||||
|
|
||||||
/* Process incoming ATL requests */
|
/* Process incoming ATL requests */
|
||||||
void requestATL(int connHandle, AGpsExtType agpsType, LocApnTypeMask mask);
|
void requestATL(int connHandle, AGpsExtType agpsType, LocApnTypeMask apnTypeMask);
|
||||||
void releaseATL(int connHandle);
|
void releaseATL(int connHandle);
|
||||||
|
|
||||||
/* Process incoming DS Client data call events */
|
|
||||||
void reportDataCallOpened();
|
|
||||||
void reportDataCallClosed();
|
|
||||||
|
|
||||||
/* Process incoming framework data call events */
|
/* Process incoming framework data call events */
|
||||||
void reportAtlOpenSuccess(AGpsExtType agpsType, char* apnName, int apnLen,
|
void reportAtlOpenSuccess(AGpsExtType agpsType, char* apnName, int apnLen,
|
||||||
AGpsBearerType bearerType);
|
AGpsBearerType bearerType);
|
||||||
|
@ -331,19 +270,8 @@ protected:
|
||||||
|
|
||||||
AgpsAtlOpenStatusCb mAtlOpenStatusCb;
|
AgpsAtlOpenStatusCb mAtlOpenStatusCb;
|
||||||
AgpsAtlCloseStatusCb mAtlCloseStatusCb;
|
AgpsAtlCloseStatusCb mAtlCloseStatusCb;
|
||||||
|
|
||||||
AgpsDSClientInitFn mDSClientInitFn;
|
|
||||||
AgpsDSClientOpenAndStartDataCallFn mDSClientOpenAndStartDataCallFn;
|
|
||||||
AgpsDSClientStopDataCallFn mDSClientStopDataCallFn;
|
|
||||||
AgpsDSClientCloseDataCallFn mDSClientCloseDataCallFn;
|
|
||||||
AgpsDSClientReleaseFn mDSClientReleaseFn;
|
|
||||||
|
|
||||||
SendMsgToAdapterMsgQueueFn mSendMsgToAdapterQueueFn;
|
|
||||||
|
|
||||||
AgpsStateMachine* mAgnssNif;
|
AgpsStateMachine* mAgnssNif;
|
||||||
AgpsStateMachine* mInternetNif;
|
AgpsStateMachine* mInternetNif;
|
||||||
AgpsStateMachine* mDsNif;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/* Fetch state machine for handling request ATL call */
|
/* Fetch state machine for handling request ATL call */
|
||||||
AgpsStateMachine* getAgpsStateMachine(AGpsExtType agpsType);
|
AgpsStateMachine* getAgpsStateMachine(AGpsExtType agpsType);
|
||||||
|
@ -361,9 +289,9 @@ struct AgpsMsgRequestATL: public LocMsg {
|
||||||
LocApnTypeMask mApnTypeMask;
|
LocApnTypeMask mApnTypeMask;
|
||||||
|
|
||||||
inline AgpsMsgRequestATL(AgpsManager* agpsManager, int connHandle,
|
inline AgpsMsgRequestATL(AgpsManager* agpsManager, int connHandle,
|
||||||
AGpsExtType agpsType, LocApnTypeMask mask) :
|
AGpsExtType agpsType, LocApnTypeMask apnTypeMask) :
|
||||||
LocMsg(), mAgpsManager(agpsManager), mConnHandle(connHandle),
|
LocMsg(), mAgpsManager(agpsManager), mConnHandle(connHandle),
|
||||||
mAgpsType(agpsType), mApnTypeMask(mask) {
|
mAgpsType(agpsType), mApnTypeMask(apnTypeMask){
|
||||||
|
|
||||||
LOC_LOGV("AgpsMsgRequestATL");
|
LOC_LOGV("AgpsMsgRequestATL");
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,47 +109,7 @@ GnssAdapter::GnssAdapter() :
|
||||||
|
|
||||||
mLocApi->atlCloseStatus(handle, isSuccess);
|
mLocApi->atlCloseStatus(handle, isSuccess);
|
||||||
};
|
};
|
||||||
|
mAgpsManager.registerATLCallbacks(atlOpenStatusCb, atlCloseStatusCb);
|
||||||
/* 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);
|
|
||||||
|
|
||||||
readConfigCommand();
|
readConfigCommand();
|
||||||
initDefaultAgpsCommand();
|
initDefaultAgpsCommand();
|
||||||
|
@ -3365,28 +3325,17 @@ void GnssAdapter::initAgpsCommand(const AgpsCbInfo& cbInfo){
|
||||||
* eQMI_LOC_SERVER_REQUEST_OPEN_V02
|
* eQMI_LOC_SERVER_REQUEST_OPEN_V02
|
||||||
* Triggers the AGPS state machine to setup AGPS call for below WWAN types:
|
* Triggers the AGPS state machine to setup AGPS call for below WWAN types:
|
||||||
* eQMI_LOC_WWAN_TYPE_INTERNET_V02
|
* eQMI_LOC_WWAN_TYPE_INTERNET_V02
|
||||||
* eQMI_LOC_WWAN_TYPE_AGNSS_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_EMERGENCY_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(
|
sendMsg( new AgpsMsgRequestATL(
|
||||||
&mAgpsManager, connHandle, LOC_AGPS_TYPE_SUPL_ES, mask));
|
&mAgpsManager, connHandle, (AGpsExtType)agpsType,
|
||||||
|
apnTypeMask));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -3423,64 +3372,6 @@ bool GnssAdapter::releaseATL(int connHandle){
|
||||||
return true;
|
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(
|
void GnssAdapter::dataConnOpenCommand(
|
||||||
AGpsExtType agpsType,
|
AGpsExtType agpsType,
|
||||||
const char* apnName, int apnLen, AGpsBearerType bearerType){
|
const char* apnName, int apnLen, AGpsBearerType bearerType){
|
||||||
|
|
|
@ -283,11 +283,8 @@ public:
|
||||||
virtual void reportGnssSvIdConfigEvent(const GnssSvIdConfig& config);
|
virtual void reportGnssSvIdConfigEvent(const GnssSvIdConfig& config);
|
||||||
virtual void reportGnssSvTypeConfigEvent(const GnssSvTypeConfig& 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 releaseATL(int connHandle);
|
||||||
virtual bool requestSuplES(int connHandle, LocApnTypeMask mask);
|
|
||||||
virtual bool reportDataCallOpened();
|
|
||||||
virtual bool reportDataCallClosed();
|
|
||||||
virtual bool requestOdcpiEvent(OdcpiRequestInfo& request);
|
virtual bool requestOdcpiEvent(OdcpiRequestInfo& request);
|
||||||
|
|
||||||
/* ======== UTILITIES ================================================================= */
|
/* ======== UTILITIES ================================================================= */
|
||||||
|
|
|
@ -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
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* 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_IPV6 2
|
||||||
#define AGPS_APN_BEARER_IPV4V6 3
|
#define AGPS_APN_BEARER_IPV4V6 3
|
||||||
|
|
||||||
typedef uint64_t LocApnTypeMask;
|
typedef uint32_t LocApnTypeMask;
|
||||||
#define LOC_APN_TYPE_MASK_DEFAULT ((LocApnTypeMask)0x0000000000000001ull) /**< Denotes APN type for Default/Internet traffic */
|
/**< 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_DEFAULT ((LocApnTypeMask)0x00000001)
|
||||||
#define LOC_APN_TYPE_MASK_MMS ((LocApnTypeMask)0x0000000000000004ull) /**< Denotes APN type for Multimedia Messaging Service */
|
/**< Denotes APN type for IP Multimedia Subsystem */
|
||||||
#define LOC_APN_TYPE_MASK_DUN ((LocApnTypeMask)0x0000000000000008ull) /**< Denotes APN type for Dial Up Network */
|
#define LOC_APN_TYPE_MASK_IMS ((LocApnTypeMask)0x00000002)
|
||||||
#define LOC_APN_TYPE_MASK_SUPL ((LocApnTypeMask)0x0000000000000010ull) /**< Denotes APN type for Secure User Plane Location */
|
/**< Denotes APN type for Multimedia Messaging Service */
|
||||||
#define LOC_APN_TYPE_MASK_HIPRI ((LocApnTypeMask)0x0000000000000020ull) /**< Denotes APN type for High Priority Mobile Data */
|
#define LOC_APN_TYPE_MASK_MMS ((LocApnTypeMask)0x00000004)
|
||||||
#define LOC_APN_TYPE_MASK_FOTA ((LocApnTypeMask)0x0000000000000040ull) /**< Denotes APN type for over the air administration */
|
/**< Denotes APN type for Dial Up Network */
|
||||||
#define LOC_APN_TYPE_MASK_CBS ((LocApnTypeMask)0x0000000000000080ull) /**< Denotes APN type for Carrier Branded Services */
|
#define LOC_APN_TYPE_MASK_DUN ((LocApnTypeMask)0x00000008)
|
||||||
#define LOC_APN_TYPE_MASK_IA ((LocApnTypeMask)0x0000000000000100ull) /**< Denotes APN type for Initial Attach */
|
/**< Denotes APN type for Secure User Plane Location */
|
||||||
#define LOC_APN_TYPE_MASK_EMERGENCY ((LocApnTypeMask)0x0000000000000200ull) /**< Denotes APN type for emergency */
|
#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 {
|
typedef enum {
|
||||||
AGPS_CB_PRIORITY_LOW = 1,
|
AGPS_CB_PRIORITY_LOW = 1,
|
||||||
|
@ -1490,24 +1500,26 @@ typedef std::function<void(
|
||||||
* Represents the status of AGNSS augmented to support IPv4.
|
* Represents the status of AGNSS augmented to support IPv4.
|
||||||
*/
|
*/
|
||||||
struct AGnssExtStatusIpV4 {
|
struct AGnssExtStatusIpV4 {
|
||||||
AGpsExtType type;
|
AGpsExtType type;
|
||||||
LocAGpsStatusValue status;
|
LocApnTypeMask apnTypeMask;
|
||||||
|
LocAGpsStatusValue status;
|
||||||
/*
|
/*
|
||||||
* 32-bit IPv4 address.
|
* 32-bit IPv4 address.
|
||||||
*/
|
*/
|
||||||
uint32_t ipV4Addr;
|
uint32_t ipV4Addr;
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Represents the status of AGNSS augmented to support IPv6.
|
* Represents the status of AGNSS augmented to support IPv6.
|
||||||
*/
|
*/
|
||||||
struct AGnssExtStatusIpV6 {
|
struct AGnssExtStatusIpV6 {
|
||||||
AGpsExtType type;
|
AGpsExtType type;
|
||||||
LocAGpsStatusValue status;
|
LocApnTypeMask apnTypeMask;
|
||||||
|
LocAGpsStatusValue status;
|
||||||
/*
|
/*
|
||||||
* 128-bit IPv6 address.
|
* 128-bit IPv6 address.
|
||||||
*/
|
*/
|
||||||
uint8_t ipV6Addr[16];
|
uint8_t ipV6Addr[16];
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ODCPI Request Info */
|
/* ODCPI Request Info */
|
||||||
|
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -156,8 +156,12 @@ typedef uint16_t LocGpsAidingData;
|
||||||
|
|
||||||
/** AGPS type */
|
/** AGPS type */
|
||||||
typedef uint16_t LocAGpsType;
|
typedef uint16_t LocAGpsType;
|
||||||
|
#define LOC_AGPS_TYPE_ANY 0
|
||||||
#define LOC_AGPS_TYPE_SUPL 1
|
#define LOC_AGPS_TYPE_SUPL 1
|
||||||
#define LOC_AGPS_TYPE_C2K 2
|
#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;
|
typedef uint16_t LocAGpsSetIDType;
|
||||||
#define LOC_AGPS_SETID_TYPE_NONE 0
|
#define LOC_AGPS_SETID_TYPE_NONE 0
|
||||||
|
|
Loading…
Reference in a new issue