From 1de8a18031532d0253d854d3e6923e02e2ba8405 Mon Sep 17 00:00:00 2001 From: Harikrishnan Hariharan Date: Tue, 18 Oct 2016 17:13:20 +0530 Subject: [PATCH] Reinitialize dataservice client post SSR On SSR invoke dsi_release() and dsi_init(Mode_SSR) to recover data call functionality post SSR. Change-Id: Ie784dad73ae8d6d91cf4cb87efe938af9015a7a2 CRs-Fixed: 1073101 --- core/LocApiBase.cpp | 6 +++- core/LocApiBase.h | 3 +- loc_api/libloc_api_50001/LocEngAdapter.h | 8 +++-- loc_api/libloc_api_50001/loc_eng.cpp | 42 +++++++++++++++++++++++- 4 files changed, 54 insertions(+), 5 deletions(-) diff --git a/core/LocApiBase.cpp b/core/LocApiBase.cpp index 3af79b2d..2857e785 100644 --- a/core/LocApiBase.cpp +++ b/core/LocApiBase.cpp @@ -549,7 +549,7 @@ enum loc_api_adapter_err LocApiBase:: } int LocApiBase:: - initDataServiceClient() + initDataServiceClient(bool isDueToSsr) DEFAULT_IMPL(-1) int LocApiBase:: @@ -564,6 +564,10 @@ void LocApiBase:: closeDataCall() DEFAULT_IMPL() +void LocApiBase:: + releaseDataServiceClient() +DEFAULT_IMPL() + int LocApiBase:: setGpsLock(LOC_GPS_LOCK_MASK lock) DEFAULT_IMPL(-1) diff --git a/core/LocApiBase.h b/core/LocApiBase.h index 4655332e..2d0cc8c6 100644 --- a/core/LocApiBase.h +++ b/core/LocApiBase.h @@ -215,10 +215,11 @@ public: getBestAvailableZppFix(GpsLocation & zppLoc); virtual enum loc_api_adapter_err getBestAvailableZppFix(GpsLocation & zppLoc, LocPosTechMask & tech_mask); - virtual int initDataServiceClient(); + virtual int initDataServiceClient(bool isDueToSsr); virtual int openAndStartDataCall(); virtual void stopDataCall(); virtual void closeDataCall(); + virtual void releaseDataServiceClient(); virtual void installAGpsCert(const DerEncodedCertificate* pData, size_t length, uint32_t slotBitMask); diff --git a/loc_api/libloc_api_50001/LocEngAdapter.h b/loc_api/libloc_api_50001/LocEngAdapter.h index 4afea495..713470a6 100644 --- a/loc_api/libloc_api_50001/LocEngAdapter.h +++ b/loc_api/libloc_api_50001/LocEngAdapter.h @@ -240,9 +240,9 @@ public: { 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() { @@ -256,6 +256,10 @@ public: { mLocApi->closeDataCall(); } + inline virtual void releaseDataServiceClient() + { + mLocApi->releaseDataServiceClient(); + } inline enum loc_api_adapter_err getZpp(GpsLocation &zppLoc, LocPosTechMask &tech_mask) { diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp index 318786dc..ccfc6e74 100644 --- a/loc_api/libloc_api_50001/loc_eng.cpp +++ b/loc_api/libloc_api_50001/loc_eng.cpp @@ -186,6 +186,7 @@ static void loc_default_parameters(void) // 2nd half of init(), singled out for // modem restart to use. 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 int loc_eng_set_server(loc_eng_data_s_type &loc_eng_data, @@ -2308,6 +2309,39 @@ static void loc_eng_agps_reinit(loc_eng_data_s_type &loc_eng_data) } 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 @@ -2378,7 +2412,7 @@ static void createAgnssNifs(loc_eng_data_s_type& locEng) { } if (NULL == locEng.ds_nif && gps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL && - 0 == adapter->initDataServiceClient()) { + 0 == adapter->initDataServiceClient(false)) { locEng.ds_nif = new DSStateMachine(servicerTypeExt, (void *)dataCallCb, locEng.adapter); @@ -2912,6 +2946,12 @@ void loc_eng_handle_engine_up(loc_eng_data_s_type &loc_eng_data) if (loc_eng_data.internet_nif) 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); }