Merge "Added optional MO SUPL SLP"

This commit is contained in:
Linux Build Service Account 2018-06-29 01:39:07 -07:00 committed by Gerrit - the friendly Code Review server
commit 021821ce54
8 changed files with 54 additions and 20 deletions

View file

@ -72,6 +72,8 @@ const loc_param_s_type ContextBase::mGps_conf_table[] =
{"SUPL_HOST", &mGps_conf.SUPL_HOST, NULL, 's'},
{"SUPL_PORT", &mGps_conf.SUPL_PORT, NULL, 'n'},
{"MODEM_TYPE", &mGps_conf.MODEM_TYPE, NULL, 'n' },
{"MO_SUPL_HOST", &mGps_conf.MO_SUPL_HOST, NULL, 's' },
{"MO_SUPL_PORT", &mGps_conf.MO_SUPL_PORT, NULL, 'n' },
};
const loc_param_s_type ContextBase::mSap_conf_table[] =

View file

@ -68,6 +68,8 @@ typedef struct loc_gps_cfg_s
char SUPL_HOST[MAX_SUPL_SERVER_URL_LENGTH];
uint32_t SUPL_PORT;
uint32_t MODEM_TYPE;
char MO_SUPL_HOST[MAX_SUPL_SERVER_URL_LENGTH];
uint32_t MO_SUPL_PORT;
} loc_gps_cfg_s_type;
/* NOTE: the implementaiton of the parser casts number

View file

@ -495,7 +495,7 @@ void LocApiBase::
DEFAULT_IMPL()
LocationError LocApiBase::
setServerSync(const char* /*url*/, int /*len*/)
setServerSync(const char* /*url*/, int /*len*/, LocServerType /*type*/)
DEFAULT_IMPL(LOCATION_ERROR_SUCCESS)
LocationError LocApiBase::

View file

@ -191,10 +191,9 @@ public:
virtual void
setPositionMode(const LocPosMode& posMode);
virtual LocationError
setServerSync(const char* url, int len);
setServerSync(const char* url, int len, LocServerType type);
virtual LocationError
setServerSync(unsigned int ip, int port,
LocServerType type);
setServerSync(unsigned int ip, int port, LocServerType type);
virtual void
informNiResponse(GnssNiResponse userResponse, const void* passThroughData);
virtual LocationError setSUPLVersionSync(GnssConfigSuplVersion version);

View file

@ -76,6 +76,10 @@ CAPABILITIES=0x37
# SUPL_HOST=supl.host.com or IP
# SUPL_PORT=1234
# FOR MO SUPL SUPPORT, set the following
# MO_SUPL_HOST=supl.host.com or IP
# MO_SUPL_PORT=1234
# FOR C2K PDE SUPPORT, set the following
# C2K_HOST=c2k.pde.com or IP
# C2K_PORT=1234
@ -138,6 +142,8 @@ LPPE_UP_TECHNOLOGY = 0
# SUPL_VER
# SUPL_HOST
# SUPL_PORT
# MO_SUPL_HOST
# MO_SUPL_PORT
# C2K_HOST
# C2K_PORT
# LPP_PROFILE

View file

@ -605,7 +605,7 @@ GnssAdapter::readConfigCommand()
}
void
GnssAdapter::setSuplHostServer(const char* server, int port)
GnssAdapter::setSuplHostServer(const char* server, int port, LocServerType type)
{
if (ContextBase::mGps_conf.AGPS_CONFIG_INJECT) {
char serverUrl[MAX_URL_LEN] = {};
@ -619,10 +619,14 @@ GnssAdapter::setSuplHostServer(const char* server, int port)
} else if (port > 0) {
length = snprintf(serverUrl, sizeof(serverUrl), "%s:%u", server, port);
}
if (length >= 0 && strncasecmp(getServerUrl().c_str(),
serverUrl, sizeof(serverUrl)) != 0) {
setServerUrl(serverUrl);
if (LOC_AGPS_SUPL_SERVER != type && LOC_AGPS_MO_SUPL_SERVER != type) {
LOC_LOGe("Invalid type=%d", type);
} else {
string& url = (LOC_AGPS_SUPL_SERVER == type) ? getServerUrl() : getMoServerUrl();
if (length > 0 && strncasecmp(url.c_str(), serverUrl, sizeof(serverUrl)) != 0) {
url.assign(serverUrl);
LOC_LOGv("serverUrl=%s length=%d type=%d", serverUrl, length, type);
}
}
}
}
@ -652,8 +656,13 @@ GnssAdapter::setConfigCommand()
mAdapter.mNmeaMask= mask;
std::string oldServerUrl = mAdapter.getServerUrl();
std::string oldMoServerUrl = mAdapter.getMoServerUrl();
mAdapter.setSuplHostServer(ContextBase::mGps_conf.SUPL_HOST,
ContextBase::mGps_conf.SUPL_PORT);
ContextBase::mGps_conf.SUPL_PORT,
LOC_AGPS_SUPL_SERVER);
mAdapter.setSuplHostServer(ContextBase::mGps_conf.MO_SUPL_HOST,
ContextBase::mGps_conf.MO_SUPL_PORT,
LOC_AGPS_MO_SUPL_SERVER);
// inject the configurations into modem
GnssAdapter& adapter = mAdapter;
@ -661,10 +670,12 @@ GnssAdapter::setConfigCommand()
loc_sap_cfg_s_type sapConf = ContextBase::mSap_conf;
mApi.sendMsg(new LocApiMsg(
[&adapter, gpsConf, sapConf, oldServerUrl] () {
[&adapter, gpsConf, sapConf, oldServerUrl, oldMoServerUrl] () {
std::string serverUrl = adapter.getServerUrl();
std::string moServerUrl = adapter.getMoServerUrl();
int serverUrlLen = serverUrl.length();
int moServerUrlLen = moServerUrl.length();
if (gpsConf.AGPS_CONFIG_INJECT) {
adapter.mLocApi->setSUPLVersionSync(
@ -677,10 +688,21 @@ GnssAdapter::setConfigCommand()
if ((serverUrlLen !=0) && (oldServerUrl.compare(serverUrl) != 0)) {
LocationError locErr =
adapter.mLocApi->setServerSync(serverUrl.c_str(), serverUrlLen);
adapter.mLocApi->setServerSync(serverUrl.c_str(), serverUrlLen,
LOC_AGPS_SUPL_SERVER);
if (locErr != LOCATION_ERROR_SUCCESS) {
LOC_LOGE("%s]:Error while setting SUPL_HOST server:%s",
__func__, serverUrl.c_str());
LOC_LOGe("Error while setting SUPL_HOST server:%s",
serverUrl.c_str());
}
}
if ((moServerUrlLen != 0) && (oldMoServerUrl.compare(moServerUrl) != 0)) {
LocationError locErr =
adapter.mLocApi->setServerSync(moServerUrl.c_str(),
moServerUrlLen,
LOC_AGPS_MO_SUPL_SERVER);
if (locErr != LOCATION_ERROR_SUCCESS) {
LOC_LOGe("Error while setting MO SUPL_HOST server:%s",
moServerUrl.c_str());
}
}
@ -832,8 +854,9 @@ GnssAdapter::gnssUpdateConfigCommand(GnssConfig config)
index++;
if (GNSS_ASSISTANCE_TYPE_SUPL == mConfig.assistanceServer.type) {
mAdapter.setSuplHostServer(mConfig.assistanceServer.hostName,
mConfig.assistanceServer.port);
} else if (GNSS_ASSISTANCE_TYPE_C2K != mConfig.assistanceServer.type) {
mConfig.assistanceServer.port,
LOC_AGPS_SUPL_SERVER);
} else {
LOC_LOGE("%s]: Not a valid gnss assistance type %u",
__func__, mConfig.assistanceServer.type);
errs.at(index) = LOCATION_ERROR_INVALID_PARAMETER;
@ -947,7 +970,7 @@ GnssAdapter::gnssUpdateConfigCommand(GnssConfig config)
GNSS_ASSISTANCE_TYPE_SUPL) {
if ((serverUrlLen != 0) && (oldServerUrl.compare(serverUrl) !=0)) {
err = adapter.mLocApi->setServerSync(
serverUrl.c_str(), serverUrlLen);
serverUrl.c_str(), serverUrlLen, LOC_AGPS_SUPL_SERVER);
errsList[index] = err;
}
} else if (gnssConfigNeedEngineUpdate.assistanceServer.type ==

View file

@ -122,6 +122,7 @@ class GnssAdapter : public LocAdapterBase {
/* === SystemStatus ===================================================================== */
SystemStatus* mSystemStatus;
std::string mServerUrl;
std::string mMoServerUrl;
XtraSystemStatusObserver mXtraObserver;
/*==== CONVERSION ===================================================================*/
@ -160,7 +161,7 @@ public:
LocationCallbacks getClientCallbacks(LocationAPI* client);
LocationCapabilitiesMask getCapabilities();
void broadcastCapabilities(LocationCapabilitiesMask);
void setSuplHostServer(const char* server, int port);
void setSuplHostServer(const char* server, int port, LocServerType type);
/* ==== TRACKING ======================================================================= */
/* ======== COMMANDS ====(Called from Client Thread)==================================== */
@ -310,7 +311,7 @@ public:
/*==== SYSTEM STATUS ================================================================*/
inline SystemStatus* getSystemStatus(void) { return mSystemStatus; }
std::string& getServerUrl(void) { return mServerUrl; }
void setServerUrl(const char* server) { mServerUrl.assign(server); }
std::string& getMoServerUrl(void) { return mMoServerUrl; }
/*==== CONVERSION ===================================================================*/
static uint32_t convertGpsLock(const GnssConfigGpsLock gpsLock);

View file

@ -258,7 +258,8 @@ typedef enum loc_server_type {
LOC_AGPS_CDMA_PDE_SERVER,
LOC_AGPS_CUSTOM_PDE_SERVER,
LOC_AGPS_MPC_SERVER,
LOC_AGPS_SUPL_SERVER
LOC_AGPS_SUPL_SERVER,
LOC_AGPS_MO_SUPL_SERVER
} LocServerType;
typedef enum loc_position_mode_type {