Merge "Reinitialize dataservice client post SSR"

This commit is contained in:
Linux Build Service Account 2016-11-04 18:35:33 -07:00 committed by Gerrit - the friendly Code Review server
commit da6012a581
4 changed files with 54 additions and 5 deletions

View file

@ -554,7 +554,7 @@ enum loc_api_adapter_err LocApiBase::
} }
int LocApiBase:: int LocApiBase::
initDataServiceClient() initDataServiceClient(bool isDueToSsr)
DEFAULT_IMPL(-1) DEFAULT_IMPL(-1)
int LocApiBase:: int LocApiBase::
@ -569,6 +569,10 @@ void LocApiBase::
closeDataCall() closeDataCall()
DEFAULT_IMPL() DEFAULT_IMPL()
void LocApiBase::
releaseDataServiceClient()
DEFAULT_IMPL()
int LocApiBase:: int LocApiBase::
setGpsLock(LOC_GPS_LOCK_MASK lock) setGpsLock(LOC_GPS_LOCK_MASK lock)
DEFAULT_IMPL(-1) DEFAULT_IMPL(-1)

View file

@ -215,10 +215,11 @@ public:
getBestAvailableZppFix(GpsLocation & zppLoc); getBestAvailableZppFix(GpsLocation & zppLoc);
virtual enum loc_api_adapter_err virtual enum loc_api_adapter_err
getBestAvailableZppFix(GpsLocation & zppLoc, LocPosTechMask & tech_mask); getBestAvailableZppFix(GpsLocation & zppLoc, LocPosTechMask & tech_mask);
virtual int initDataServiceClient(); virtual int initDataServiceClient(bool isDueToSsr);
virtual int openAndStartDataCall(); virtual int openAndStartDataCall();
virtual void stopDataCall(); virtual void stopDataCall();
virtual void closeDataCall(); virtual void closeDataCall();
virtual void releaseDataServiceClient();
virtual void installAGpsCert(const DerEncodedCertificate* pData, virtual void installAGpsCert(const DerEncodedCertificate* pData,
size_t length, size_t length,
uint32_t slotBitMask); uint32_t slotBitMask);

View file

@ -261,9 +261,9 @@ public:
{ {
return mLocApi->setLPPeProtocol(lppeCP, lppeUP); return mLocApi->setLPPeProtocol(lppeCP, lppeUP);
} }
inline virtual int initDataServiceClient() inline virtual int initDataServiceClient(bool isDueToSsr)
{ {
return mLocApi->initDataServiceClient(); return mLocApi->initDataServiceClient(isDueToSsr);
} }
inline virtual int openAndStartDataCall() inline virtual int openAndStartDataCall()
{ {
@ -277,6 +277,10 @@ public:
{ {
mLocApi->closeDataCall(); mLocApi->closeDataCall();
} }
inline virtual void releaseDataServiceClient()
{
mLocApi->releaseDataServiceClient();
}
inline enum loc_api_adapter_err inline enum loc_api_adapter_err
getZpp(GpsLocation &zppLoc, LocPosTechMask &tech_mask) getZpp(GpsLocation &zppLoc, LocPosTechMask &tech_mask)
{ {

View file

@ -186,6 +186,7 @@ static void loc_default_parameters(void)
// 2nd half of init(), singled out for // 2nd half of init(), singled out for
// modem restart to use. // modem restart to use.
static int loc_eng_reinit(loc_eng_data_s_type &loc_eng_data); static int loc_eng_reinit(loc_eng_data_s_type &loc_eng_data);
static void loc_eng_dsclient_release(loc_eng_data_s_type &loc_eng_data);
static void loc_eng_agps_reinit(loc_eng_data_s_type &loc_eng_data); static void loc_eng_agps_reinit(loc_eng_data_s_type &loc_eng_data);
static int loc_eng_set_server(loc_eng_data_s_type &loc_eng_data, static int loc_eng_set_server(loc_eng_data_s_type &loc_eng_data,
@ -2360,6 +2361,39 @@ static void loc_eng_agps_reinit(loc_eng_data_s_type &loc_eng_data)
} }
EXIT_LOG(%s, VOID_RET); EXIT_LOG(%s, VOID_RET);
} }
/*===========================================================================
FUNCTION loc_eng_dsclient_release
DESCRIPTION
Stop/Close/Release DS client when modem SSR happens.
DEPENDENCIES
NONE
RETURN VALUE
0
SIDE EFFECTS
N/A
===========================================================================*/
static void loc_eng_dsclient_release(loc_eng_data_s_type &loc_eng_data)
{
ENTRY_LOG();
int result = 1;
LocEngAdapter* adapter = loc_eng_data.adapter;
if (NULL != adapter && gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL)
{
// stop and close the ds client
adapter->stopDataCall();
adapter->closeDataCall();
adapter->releaseDataServiceClient();
}
EXIT_LOG(%s, VOID_RET);
}
/*=========================================================================== /*===========================================================================
FUNCTION loc_eng_agps_init FUNCTION loc_eng_agps_init
@ -2430,7 +2464,7 @@ static void createAgnssNifs(loc_eng_data_s_type& locEng) {
} }
if (NULL == locEng.ds_nif && if (NULL == locEng.ds_nif &&
gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL && gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL &&
0 == adapter->initDataServiceClient()) { 0 == adapter->initDataServiceClient(false)) {
locEng.ds_nif = new DSStateMachine(servicerTypeExt, locEng.ds_nif = new DSStateMachine(servicerTypeExt,
(void *)dataCallCb, (void *)dataCallCb,
locEng.adapter); locEng.adapter);
@ -2964,6 +2998,12 @@ void loc_eng_handle_engine_up(loc_eng_data_s_type &loc_eng_data)
if (loc_eng_data.internet_nif) if (loc_eng_data.internet_nif)
loc_eng_data.internet_nif->dropAllSubscribers(); loc_eng_data.internet_nif->dropAllSubscribers();
// reinitialize DS client in SSR mode
loc_eng_dsclient_release(loc_eng_data);
if (loc_eng_data.adapter->mSupportsAgpsRequests &&
gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL) {
loc_eng_data.adapter->initDataServiceClient(true);
}
loc_eng_agps_reinit(loc_eng_data); loc_eng_agps_reinit(loc_eng_data);
} }