summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPandari Sabhapathi <pandaris@codeaurora.org>2014-08-19 18:44:33 -0700
committerPandari Sabhapathi <pandaris@codeaurora.org>2014-09-11 16:43:11 -0700
commit5cef7caea34d49a0a6989fa87d322b333f7332c5 (patch)
treea54a4060e097fb16c14a74e37481b2766efa3531
parent8a5b0aaa29222c45b8d2a6a431e679995e66e25d (diff)
downloadgps-5cef7caea34d49a0a6989fa87d322b333f7332c5.tar.gz
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
-rw-r--r--etc/gps.conf6
-rw-r--r--loc_api/libloc_api_50001/loc_eng.cpp35
-rw-r--r--loc_api/libloc_api_50001/loc_eng.h7
3 files changed, 40 insertions, 8 deletions
diff --git a/etc/gps.conf b/etc/gps.conf
index 5a2a176..ccc3483 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
#Version check for XTRA
#DISABLE = 0
diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp
index 1e8075f..d7c62e3 100644
--- a/loc_api/libloc_api_50001/loc_eng.cpp
+++ b/loc_api/libloc_api_50001/loc_eng.cpp
@@ -44,7 +44,7 @@
#include <sys/time.h>
#include <netdb.h>
#include <time.h>
-
+#include <new>
#include <LocEngAdapter.h>
#include <cutils/sched_policy.h>
@@ -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,9 @@ static loc_param_s_type loc_parameter_table[] =
{"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)
@@ -928,12 +933,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 109d02d..ad40606 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
@@ -147,6 +149,9 @@ typedef struct loc_gps_cfg_s
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