From afbcf661d5891e81a97a8d75a5ac9b1b4c65bd50 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: I5c7f16a2c64e716a6cb005fec33b35a039601341 --- configs/gps.conf | 6 +++--- gps/libloc_api_50001/loc_eng.cpp | 36 ++++++++++++++++++++++++++++---- gps/libloc_api_50001/loc_eng.h | 8 ++++++- 3 files changed, 42 insertions(+), 8 deletions(-) diff --git a/configs/gps.conf b/configs/gps.conf index 7f34616..af8ebcd 100644 --- a/configs/gps.conf +++ b/configs/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/xtra2.bin -XTRA_SERVER_2=http://xtra2.gpsonextra.net/xtra2.bin -XTRA_SERVER_3=http://xtra3.gpsonextra.net/xtra2.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/gps/libloc_api_50001/loc_eng.cpp b/gps/libloc_api_50001/loc_eng.cpp index 2c92d46..78bccaa 100644 --- a/gps/libloc_api_50001/loc_eng.cpp +++ b/gps/libloc_api_50001/loc_eng.cpp @@ -44,7 +44,7 @@ #include #include #include - +#include #include #include @@ -84,6 +84,8 @@ #define SAP_CONF_FILE "/etc/sap.conf" #endif +#define XTRA1_GPSONEXTRA "xtra1.gpsonextra.net" + using namespace loc_core; boolean configAlreadyRead = false; @@ -119,6 +121,10 @@ static loc_param_s_type loc_parameter_table[] = {"LPP_PROFILE", &gps_conf.LPP_PROFILE, NULL, 'n'}, {"A_GLONASS_POS_PROTOCOL_SELECT", &gps_conf.A_GLONASS_POS_PROTOCOL_SELECT, NULL, 'n'}, {"SENSOR_PROVIDER", &sap_conf.SENSOR_PROVIDER, NULL, 'n'}, + {"XTRA_VERSION_CHECK", &gps_conf.XTRA_VERSION_CHECK, 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) @@ -909,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/gps/libloc_api_50001/loc_eng.h b/gps/libloc_api_50001/loc_eng.h index e50e4a5..4febb2d 100644 --- a/gps/libloc_api_50001/loc_eng.h +++ b/gps/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,10 @@ typedef struct loc_gps_cfg_s unsigned long LPP_PROFILE; uint8_t NMEA_PROVIDER; unsigned long A_GLONASS_POS_PROTOCOL_SELECT; + unsigned long XTRA_VERSION_CHECK; + 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