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_HOST", &mGps_conf.SUPL_HOST, NULL, 's'},
{"SUPL_PORT", &mGps_conf.SUPL_PORT, NULL, 'n'}, {"SUPL_PORT", &mGps_conf.SUPL_PORT, NULL, 'n'},
{"MODEM_TYPE", &mGps_conf.MODEM_TYPE, 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[] = 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]; char SUPL_HOST[MAX_SUPL_SERVER_URL_LENGTH];
uint32_t SUPL_PORT; uint32_t SUPL_PORT;
uint32_t MODEM_TYPE; uint32_t MODEM_TYPE;
char MO_SUPL_HOST[MAX_SUPL_SERVER_URL_LENGTH];
uint32_t MO_SUPL_PORT;
} loc_gps_cfg_s_type; } loc_gps_cfg_s_type;
/* NOTE: the implementaiton of the parser casts number /* NOTE: the implementaiton of the parser casts number

View file

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

View file

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

View file

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

View file

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

View file

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