Cache the SUPL server and port on each update

CRs-Fixed: 2286256

Change-Id: I7adb584ff6f81c6a7f50f5ec4e9a4a094414e297
This commit is contained in:
Bhavna Sharma 2018-07-18 12:00:54 -07:00
parent 04f0a9a45d
commit 2a005b5816

View file

@ -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);
}
}