From 4e9741f5278a7f0f8a6315746c23a9cfa7793e5e Mon Sep 17 00:00:00 2001 From: Pandari Sabhapathi Date: Tue, 19 Aug 2014 18:44:33 -0700 Subject: [PATCH] Migrating XTRA from gpsonextra.net to cloud based izatcloud.net *Added logic to remove xtra1.gpsonextra.net from URLs received from modem. *Added logic to override modem URLs with those configured in gps.conf *Replaced all instances of xtra{1,2,3}.gpsonextra.net domain URLs in gps.conf with xtrapath{1,2,3}.izatcloud.net URLs. *Replaced all commented instances of xtra.bin in gps.conf with xtra2.bin. CRs-fixed: 643816 Change-Id: I803b26bce22f06910dcaa1ee057902b9381667bf --- etc/gps.conf | 6 ++--- loc_api/libloc_api_50001/loc_eng.cpp | 35 ++++++++++++++++++++++++---- loc_api/libloc_api_50001/loc_eng.h | 7 +++++- 3 files changed, 40 insertions(+), 8 deletions(-) diff --git a/etc/gps.conf b/etc/gps.conf index b79b3801..a172a8ab 100644 --- a/etc/gps.conf +++ b/etc/gps.conf @@ -1,8 +1,8 @@ #Uncommenting these urls would only enable #the power up auto injection and force injection(test case). -#XTRA_SERVER_1=http://xtra1.gpsonextra.net/xtra.bin -#XTRA_SERVER_2=http://xtra2.gpsonextra.net/xtra.bin -#XTRA_SERVER_3=http://xtra3.gpsonextra.net/xtra.bin +#XTRA_SERVER_1=http://xtrapath1.izatcloud.net/xtra2.bin +#XTRA_SERVER_2=http://xtrapath2.izatcloud.net/xtra2.bin +#XTRA_SERVER_3=http://xtrapath3.izatcloud.net/xtra2.bin # Error Estimate # _SET = 1 diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp index eb307719..c3e82f85 100644 --- a/loc_api/libloc_api_50001/loc_eng.cpp +++ b/loc_api/libloc_api_50001/loc_eng.cpp @@ -44,7 +44,7 @@ #include #include #include - +#include #include #ifdef _ANDROID @@ -94,6 +94,8 @@ #define SAP_CONF_FILE "/etc/sap.conf" #endif +#define XTRA1_GPSONEXTRA "xtra1.gpsonextra.net" + using namespace loc_core; boolean configAlreadyRead = false; @@ -128,6 +130,9 @@ static loc_param_s_type loc_parameter_table[] = {"QUIPC_ENABLED", &gps_conf.QUIPC_ENABLED, NULL, 'n'}, {"LPP_PROFILE", &gps_conf.LPP_PROFILE, NULL, 'n'}, {"A_GLONASS_POS_PROTOCOL_SELECT", &gps_conf.A_GLONASS_POS_PROTOCOL_SELECT, NULL, 'n'}, + {"XTRA_SERVER_1", &gps_conf.XTRA_SERVER_1, NULL, 's'}, + {"XTRA_SERVER_2", &gps_conf.XTRA_SERVER_2, NULL, 's'}, + {"XTRA_SERVER_3", &gps_conf.XTRA_SERVER_3, NULL, 's'} }; static void loc_default_parameters(void) @@ -910,12 +915,34 @@ LocEngReportXtraServer::LocEngReportXtraServer(void* locEng, LocMsg(), mLocEng(locEng), mMaxLen(maxlength), mServers(new char[3*(mMaxLen+1)]) { + char * cptr = mServers; memset(mServers, 0, 3*(mMaxLen+1)); - strlcpy(mServers, url1, mMaxLen); - strlcpy(&(mServers[mMaxLen+1]), url2, mMaxLen); - strlcpy(&(mServers[(mMaxLen+1)<<1]), url3, mMaxLen); + + // Override modem URLs with uncommented gps.conf urls + if( gps_conf.XTRA_SERVER_1[0] != '\0' ) { + url1 = &gps_conf.XTRA_SERVER_1[0]; + } + if( gps_conf.XTRA_SERVER_2[0] != '\0' ) { + url2 = &gps_conf.XTRA_SERVER_2[0]; + } + if( gps_conf.XTRA_SERVER_3[0] != '\0' ) { + url3 = &gps_conf.XTRA_SERVER_3[0]; + } + // copy non xtra1.gpsonextra.net URLs into the forwarding buffer. + if( NULL == strcasestr(url1, XTRA1_GPSONEXTRA) ) { + strlcpy(cptr, url1, mMaxLen + 1); + cptr += mMaxLen + 1; + } + if( NULL == strcasestr(url2, XTRA1_GPSONEXTRA) ) { + strlcpy(cptr, url2, mMaxLen + 1); + cptr += mMaxLen + 1; + } + if( NULL == strcasestr(url3, XTRA1_GPSONEXTRA) ) { + strlcpy(cptr, url3, mMaxLen + 1); + } locallog(); } + void LocEngReportXtraServer::proc() const { loc_eng_xtra_data_s_type* locEngXtra = &(((loc_eng_data_s_type*)mLocEng)->xtra_module_data); diff --git a/loc_api/libloc_api_50001/loc_eng.h b/loc_api/libloc_api_50001/loc_eng.h index 2dfd50f7..59351311 100644 --- a/loc_api/libloc_api_50001/loc_eng.h +++ b/loc_api/libloc_api_50001/loc_eng.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2009-2013, The Linux Foundation. All rights reserved. +/* Copyright (c) 2009-2014, The Linux Foundation. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are @@ -67,6 +67,8 @@ typedef unsigned char boolean; #define FAILURE FALSE #define INVALID_ATL_CONNECTION_HANDLE -1 +#define MAX_XTRA_SERVER_URL_LENGTH 256 + enum loc_nmea_provider_e_type { NMEA_PROVIDER_AP = 0, // Application Processor Provider of NMEA NMEA_PROVIDER_MP // Modem Processor Provider of NMEA @@ -146,6 +148,9 @@ typedef struct loc_gps_cfg_s unsigned long LPP_PROFILE; uint8_t NMEA_PROVIDER; unsigned long A_GLONASS_POS_PROTOCOL_SELECT; + char XTRA_SERVER_1[MAX_XTRA_SERVER_URL_LENGTH]; + char XTRA_SERVER_2[MAX_XTRA_SERVER_URL_LENGTH]; + char XTRA_SERVER_3[MAX_XTRA_SERVER_URL_LENGTH]; } loc_gps_cfg_s_type; typedef struct