Merge "Set SUPL_HOST to modem on GnssAdapter init."

This commit is contained in:
Linux Build Service Account 2017-09-22 18:37:26 -07:00 committed by Gerrit - the friendly Code Review server
commit 1f8b3587f2
4 changed files with 40 additions and 25 deletions

View file

@ -65,6 +65,8 @@ const loc_param_s_type ContextBase::mGps_conf_table[] =
{"USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL", &mGps_conf.USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL, NULL, 'n'},
{"AGPS_CONFIG_INJECT", &mGps_conf.AGPS_CONFIG_INJECT, NULL, 'n'},
{"EXTERNAL_DR_ENABLED", &mGps_conf.EXTERNAL_DR_ENABLED, NULL, 'n'},
{"SUPL_HOST", &mGps_conf.SUPL_HOST, NULL, 's'},
{"SUPL_PORT", &mGps_conf.SUPL_PORT, NULL, 'n'},
};
const loc_param_s_type ContextBase::mSap_conf_table[] =
@ -98,6 +100,8 @@ void ContextBase::readConfig()
mGps_conf.SUPL_VER = 0x10000;
mGps_conf.SUPL_MODE = 0x1;
mGps_conf.SUPL_ES = 0;
mGps_conf.SUPL_HOST[0] = 0;
mGps_conf.SUPL_PORT = 0;
mGps_conf.CAPABILITIES = 0x7;
/* LTE Positioning Profile configuration is disable by default*/
mGps_conf.LPP_PROFILE = 0;

View file

@ -36,7 +36,8 @@
#include <LBSProxyBase.h>
#include <loc_cfg.h>
#define MAX_XTRA_SERVER_URL_LENGTH 256
#define MAX_XTRA_SERVER_URL_LENGTH (256)
#define MAX_SUPL_SERVER_URL_LENGTH (256)
/* GPS.conf support */
/* NOTE: the implementaiton of the parser casts number
@ -64,6 +65,8 @@ typedef struct loc_gps_cfg_s
uint32_t LPPE_CP_TECHNOLOGY;
uint32_t LPPE_UP_TECHNOLOGY;
uint32_t EXTERNAL_DR_ENABLED;
char SUPL_HOST[MAX_SUPL_SERVER_URL_LENGTH];
uint32_t SUPL_PORT;
} loc_gps_cfg_s_type;
/* NOTE: the implementaiton of the parser casts number

View file

@ -522,6 +522,33 @@ GnssAdapter::readConfigCommand()
}
}
LocationError
GnssAdapter::setSuplHostServer(const char* server, int port)
{
LocationError locErr = LOCATION_ERROR_SUCCESS;
if (ContextBase::mGps_conf.AGPS_CONFIG_INJECT) {
char serverUrl[MAX_URL_LEN] = {};
int32_t length = 0;
const char noHost[] = "NONE";
if ((NULL == server) || (server[0] == 0) || (port == 0) ||
(strncasecmp(noHost, server, sizeof(noHost)) == 0)) {
locErr = LOCATION_ERROR_INVALID_PARAMETER;
} else {
length = snprintf(serverUrl, sizeof(serverUrl), "%s:%u", server, port);
if (length > 0 && strncasecmp(getServerUrl().c_str(),
serverUrl, sizeof(serverUrl)) != 0) {
setServerUrl(serverUrl);
locErr = mLocApi->setServer(serverUrl, length);
if (locErr != LOCATION_ERROR_SUCCESS) {
LOC_LOGE("%s]:Error while setting SUPL_HOST server:%s",
__func__, serverUrl);
}
}
}
}
return locErr;
}
void
GnssAdapter::setConfigCommand()
{
@ -541,6 +568,8 @@ GnssAdapter::setConfigCommand()
mApi.setLPPConfig(mAdapter.convertLppProfile(ContextBase::mGps_conf.LPP_PROFILE));
mApi.setAGLONASSProtocol(ContextBase::mGps_conf.A_GLONASS_POS_PROTOCOL_SELECT);
}
mAdapter.setSuplHostServer(ContextBase::mGps_conf.SUPL_HOST,
ContextBase::mGps_conf.SUPL_PORT);
mApi.setSensorControlConfig(ContextBase::mSap_conf.SENSOR_USAGE,
ContextBase::mSap_conf.SENSOR_PROVIDER);
mApi.setLPPeProtocolCp(
@ -674,30 +703,8 @@ GnssAdapter::gnssUpdateConfigCommand(GnssConfig config)
}
if (mConfig.flags & GNSS_CONFIG_FLAGS_SET_ASSISTANCE_DATA_VALID_BIT) {
if (GNSS_ASSISTANCE_TYPE_SUPL == mConfig.assistanceServer.type) {
if (ContextBase::mGps_conf.AGPS_CONFIG_INJECT) {
char serverUrl[MAX_URL_LEN] = {};
int32_t length = 0;
const char noHost[] = "NONE";
if (NULL == mConfig.assistanceServer.hostName ||
strncasecmp(noHost,
mConfig.assistanceServer.hostName,
sizeof(noHost)) == 0) {
err = LOCATION_ERROR_INVALID_PARAMETER;
} else {
length = snprintf(serverUrl, sizeof(serverUrl), "%s:%u",
mConfig.assistanceServer.hostName,
mConfig.assistanceServer.port);
}
if (length > 0 && strncasecmp(mAdapter.getServerUrl().c_str(),
serverUrl, sizeof(serverUrl)) != 0) {
mAdapter.setServerUrl(serverUrl);
err = mApi.setServer(serverUrl, length);
}
} else {
err = LOCATION_ERROR_SUCCESS;
}
err = mAdapter.setSuplHostServer(mConfig.assistanceServer.hostName,
mConfig.assistanceServer.port);
} else if (GNSS_ASSISTANCE_TYPE_C2K == mConfig.assistanceServer.type) {
if (ContextBase::mGps_conf.AGPS_CONFIG_INJECT) {
struct in_addr addr;

View file

@ -151,6 +151,7 @@ public:
LocationCallbacks getClientCallbacks(LocationAPI* client);
LocationCapabilitiesMask getCapabilities();
void broadcastCapabilities(LocationCapabilitiesMask);
LocationError setSuplHostServer(const char* server, int port);
/* ==== TRACKING ======================================================================= */
/* ======== COMMANDS ====(Called from Client Thread)==================================== */