From 2a005b5816fb4942403ece1cc968e90dc6172d2f Mon Sep 17 00:00:00 2001 From: Bhavna Sharma Date: Wed, 18 Jul 2018 12:00:54 -0700 Subject: [PATCH] Cache the SUPL server and port on each update CRs-Fixed: 2286256 Change-Id: I7adb584ff6f81c6a7f50f5ec4e9a4a094414e297 --- gnss/GnssAdapter.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/gnss/GnssAdapter.cpp b/gnss/GnssAdapter.cpp index de4934f4..75cb3216 100644 --- a/gnss/GnssAdapter.cpp +++ b/gnss/GnssAdapter.cpp @@ -627,6 +627,15 @@ GnssAdapter::setSuplHostServer(const char* server, int port, LocServerType type) string& url = (LOC_AGPS_SUPL_SERVER == type) ? getServerUrl() : getMoServerUrl(); if (length > 0 && strncasecmp(url.c_str(), serverUrl, sizeof(serverUrl)) != 0) { url.assign(serverUrl); + + if (LOC_AGPS_SUPL_SERVER == type) { + int nCharsToCopy = strlen(server) < MAX_SUPL_SERVER_URL_LENGTH ? + strlen(server) : (MAX_SUPL_SERVER_URL_LENGTH - 1); + strncpy(ContextBase::mGps_conf.SUPL_HOST, server, nCharsToCopy); + ContextBase::mGps_conf.SUPL_HOST[nCharsToCopy] = '\0'; + ContextBase::mGps_conf.SUPL_PORT = port; + } + LOC_LOGv("serverUrl=%s length=%d type=%d", serverUrl, length, type); } }