summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDante Russo <drusso@codeaurora.org>2017-02-22 00:19:05 +0000
committerandroid-build-merger <android-build-merger@google.com>2017-02-22 00:19:05 +0000
commitc52f9c8e6613ff7642483e1b3397c0e8588c5414 (patch)
treed1cd72048099cb64af1489d23c33ce0848caa635
parent6a27094a7b642a0abe5b74b7335b0d45103b41e3 (diff)
parentda16d7831ac9c02ff31a7baa1b1c112d6a38d7b6 (diff)
downloadgps-c52f9c8e6613ff7642483e1b3397c0e8588c5414.tar.gz
Move local gps/sap configuration to Context
am: da16d7831a Change-Id: I8bff0456c8535c37f2033a096a24bc56f427efc8
-rw-r--r--msm8909/core/ContextBase.cpp21
-rw-r--r--msm8909/core/ContextBase.h64
-rw-r--r--msm8909/core/LocAdapterProxyBase.h6
-rw-r--r--msm8909/loc_api/libloc_api_50001/loc.cpp2
-rw-r--r--msm8909/loc_api/libloc_api_50001/loc_eng.cpp22
-rw-r--r--msm8909/loc_api/libloc_api_50001/loc_eng.h65
6 files changed, 92 insertions, 88 deletions
diff --git a/msm8909/core/ContextBase.cpp b/msm8909/core/ContextBase.cpp
index f8a6122..8449476 100644
--- a/msm8909/core/ContextBase.cpp
+++ b/msm8909/core/ContextBase.cpp
@@ -40,6 +40,27 @@
namespace loc_core {
+loc_gps_cfg_s_type ContextBase::mGps_conf {0};
+loc_sap_cfg_s_type ContextBase::mSap_conf {0};
+
+uint32_t ContextBase::getCarrierCapabilities() {
+ #define carrierMSA (uint32_t)0x2
+ #define carrierMSB (uint32_t)0x1
+ #define gpsConfMSA (uint32_t)0x4
+ #define gpsConfMSB (uint32_t)0x2
+ uint32_t capabilities = mGps_conf.CAPABILITIES;
+ if ((mGps_conf.SUPL_MODE & carrierMSA) != carrierMSA) {
+ capabilities &= ~gpsConfMSA;
+ }
+ if ((mGps_conf.SUPL_MODE & carrierMSB) != carrierMSB) {
+ capabilities &= ~gpsConfMSB;
+ }
+
+ LOC_LOGV("getCarrierCapabilities: CAPABILITIES %x, SUPL_MODE %x, carrier capabilities %x",
+ mGps_conf.CAPABILITIES, mGps_conf.SUPL_MODE, capabilities);
+ return capabilities;
+}
+
LBSProxyBase* ContextBase::getLBSProxy(const char* libName)
{
LBSProxyBase* proxy = NULL;
diff --git a/msm8909/core/ContextBase.h b/msm8909/core/ContextBase.h
index 7ad7c8a..e56ff10 100644
--- a/msm8909/core/ContextBase.h
+++ b/msm8909/core/ContextBase.h
@@ -35,6 +35,64 @@
#include <LocApiBase.h>
#include <LBSProxyBase.h>
+#define MAX_XTRA_SERVER_URL_LENGTH 256
+
+/* GPS.conf support */
+/* NOTE: the implementaiton of the parser casts number
+ fields to 32 bit. To ensure all 'n' fields working,
+ they must all be 32 bit fields. */
+typedef struct loc_gps_cfg_s
+{
+ uint32_t INTERMEDIATE_POS;
+ uint32_t ACCURACY_THRES;
+ uint32_t SUPL_VER;
+ uint32_t SUPL_MODE;
+ uint32_t CAPABILITIES;
+ uint32_t LPP_PROFILE;
+ uint32_t 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];
+ uint32_t USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL;
+ uint32_t NMEA_PROVIDER;
+ uint32_t GPS_LOCK;
+ uint32_t A_GLONASS_POS_PROTOCOL_SELECT;
+ uint32_t AGPS_CERT_WRITABLE_MASK;
+} loc_gps_cfg_s_type;
+
+/* NOTE: the implementaiton of the parser casts number
+ fields to 32 bit. To ensure all 'n' fields working,
+ they must all be 32 bit fields. */
+/* Meanwhile, *_valid fields are 8 bit fields, and 'f'
+ fields are double. Rigid as they are, it is the
+ the status quo, until the parsing mechanism is
+ change, that is. */
+typedef struct
+{
+ uint8_t GYRO_BIAS_RANDOM_WALK_VALID;
+ double GYRO_BIAS_RANDOM_WALK;
+ uint32_t SENSOR_ACCEL_BATCHES_PER_SEC;
+ uint32_t SENSOR_ACCEL_SAMPLES_PER_BATCH;
+ uint32_t SENSOR_GYRO_BATCHES_PER_SEC;
+ uint32_t SENSOR_GYRO_SAMPLES_PER_BATCH;
+ uint32_t SENSOR_ACCEL_BATCHES_PER_SEC_HIGH;
+ uint32_t SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH;
+ uint32_t SENSOR_GYRO_BATCHES_PER_SEC_HIGH;
+ uint32_t SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH;
+ uint32_t SENSOR_CONTROL_MODE;
+ uint32_t SENSOR_USAGE;
+ uint32_t SENSOR_ALGORITHM_CONFIG_MASK;
+ uint8_t ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID;
+ double ACCEL_RANDOM_WALK_SPECTRAL_DENSITY;
+ uint8_t ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID;
+ double ANGLE_RANDOM_WALK_SPECTRAL_DENSITY;
+ uint8_t RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID;
+ double RATE_RANDOM_WALK_SPECTRAL_DENSITY;
+ uint8_t VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID;
+ double VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY;
+ uint32_t SENSOR_PROVIDER;
+} loc_sap_cfg_s_type;
+
namespace loc_core {
class LocAdapterBase;
@@ -65,6 +123,12 @@ public:
mLBSProxy->requestUlp(adapter, capabilities);
}
inline void sendMsg(const LocMsg *msg) { getMsgTask()->sendMsg(msg); }
+
+ static loc_gps_cfg_s_type mGps_conf;
+ static loc_sap_cfg_s_type mSap_conf;
+
+ static uint32_t getCarrierCapabilities();
+
};
} // namespace loc_core
diff --git a/msm8909/core/LocAdapterProxyBase.h b/msm8909/core/LocAdapterProxyBase.h
index 18cdded..0c5a5fb 100644
--- a/msm8909/core/LocAdapterProxyBase.h
+++ b/msm8909/core/LocAdapterProxyBase.h
@@ -46,15 +46,15 @@ protected:
inline virtual ~LocAdapterProxyBase() {
delete mLocAdapterBase;
}
- ContextBase* getContext() const {
- return mLocAdapterBase->getContext();
- }
inline void updateEvtMask(LOC_API_ADAPTER_EVENT_MASK_T event,
loc_registration_mask_status isEnabled) {
mLocAdapterBase->updateEvtMask(event,isEnabled);
}
public:
+ inline ContextBase* getContext() const {
+ return mLocAdapterBase->getContext();
+ }
inline virtual void handleEngineUpEvent() {};
inline virtual void handleEngineDownEvent() {};
inline virtual bool reportPosition(UlpLocation& /* location */,
diff --git a/msm8909/loc_api/libloc_api_50001/loc.cpp b/msm8909/loc_api/libloc_api_50001/loc.cpp
index 6252097..dbb3242 100644
--- a/msm8909/loc_api/libloc_api_50001/loc.cpp
+++ b/msm8909/loc_api/libloc_api_50001/loc.cpp
@@ -318,7 +318,7 @@ static int loc_init(GpsCallbacks* callbacks)
loc_afw_data.adapter->mSupportsTimeInjection = !loc_afw_data.adapter->hasCPIExtendedCapabilities()
&& !loc_afw_data.adapter->hasNativeXtraClient();
loc_afw_data.adapter->setGpsLockMsg(0);
- loc_afw_data.adapter->requestUlp(getCarrierCapabilities());
+ loc_afw_data.adapter->requestUlp(ContextBase::getCarrierCapabilities());
if(retVal) {
LOC_LOGE("loc_eng_init() fail!");
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng.cpp b/msm8909/loc_api/libloc_api_50001/loc_eng.cpp
index 230e90a..98a3c49 100644
--- a/msm8909/loc_api/libloc_api_50001/loc_eng.cpp
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng.cpp
@@ -90,8 +90,6 @@ using namespace loc_core;
boolean configAlreadyRead = false;
unsigned int agpsStatus = 0;
-loc_gps_cfg_s_type gps_conf;
-loc_sap_cfg_s_type sap_conf;
/* Parameter spec table */
static const loc_param_s_type gps_conf_table[] =
@@ -500,7 +498,7 @@ struct LocEngSuplMode : public LocMsg {
locallog();
}
inline virtual void proc() const {
- mUlp->setCapabilities(getCarrierCapabilities());
+ mUlp->setCapabilities(ContextBase::getCarrierCapabilities());
}
inline void locallog() const {
}
@@ -1725,24 +1723,6 @@ inline void LocEngReportGnssMeasurement::log() const {
}
#define INIT_CHECK(ctx, ret) STATE_CHECK(ctx, "instance not initialized", ret)
-uint32_t getCarrierCapabilities() {
- #define carrierMSA (uint32_t)0x2
- #define carrierMSB (uint32_t)0x1
- #define gpsConfMSA (uint32_t)0x4
- #define gpsConfMSB (uint32_t)0x2
- uint32_t capabilities = gps_conf.CAPABILITIES;
- if ((gps_conf.SUPL_MODE & carrierMSA) != carrierMSA) {
- capabilities &= ~gpsConfMSA;
- }
- if ((gps_conf.SUPL_MODE & carrierMSB) != carrierMSB) {
- capabilities &= ~gpsConfMSB;
- }
-
- LOC_LOGV("getCarrierCapabilities: CAPABILITIES %x, SUPL_MODE %x, carrier capabilities %x",
- gps_conf.CAPABILITIES, gps_conf.SUPL_MODE, capabilities);
- return capabilities;
-}
-
/*===========================================================================
FUNCTION loc_eng_init
diff --git a/msm8909/loc_api/libloc_api_50001/loc_eng.h b/msm8909/loc_api/libloc_api_50001/loc_eng.h
index 6502c5d..f9b59fd 100644
--- a/msm8909/loc_api/libloc_api_50001/loc_eng.h
+++ b/msm8909/loc_api/libloc_api_50001/loc_eng.h
@@ -67,7 +67,8 @@ typedef unsigned char boolean;
#define FAILURE FALSE
#define INVALID_ATL_CONNECTION_HANDLE -1
-#define MAX_XTRA_SERVER_URL_LENGTH 256
+#define gps_conf ContextBase::mGps_conf
+#define sap_conf ContextBase::mSap_conf
enum loc_nmea_provider_e_type {
NMEA_PROVIDER_AP = 0, // Application Processor Provider of NMEA
@@ -141,68 +142,6 @@ typedef struct loc_eng_data_s
loc_ext_parser sv_ext_parser;
} loc_eng_data_s_type;
-/* GPS.conf support */
-/* NOTE: the implementaiton of the parser casts number
- fields to 32 bit. To ensure all 'n' fields working,
- they must all be 32 bit fields. */
-typedef struct loc_gps_cfg_s
-{
- uint32_t INTERMEDIATE_POS;
- uint32_t ACCURACY_THRES;
- uint32_t SUPL_VER;
- uint32_t SUPL_MODE;
- uint32_t CAPABILITIES;
- uint32_t LPP_PROFILE;
- uint32_t 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];
- uint32_t USE_EMERGENCY_PDN_FOR_EMERGENCY_SUPL;
- uint32_t NMEA_PROVIDER;
- uint32_t GPS_LOCK;
- uint32_t A_GLONASS_POS_PROTOCOL_SELECT;
- uint32_t AGPS_CERT_WRITABLE_MASK;
-} loc_gps_cfg_s_type;
-
-/* NOTE: the implementaiton of the parser casts number
- fields to 32 bit. To ensure all 'n' fields working,
- they must all be 32 bit fields. */
-/* Meanwhile, *_valid fields are 8 bit fields, and 'f'
- fields are double. Rigid as they are, it is the
- the status quo, until the parsing mechanism is
- change, that is. */
-typedef struct
-{
- uint8_t GYRO_BIAS_RANDOM_WALK_VALID;
- double GYRO_BIAS_RANDOM_WALK;
- uint32_t SENSOR_ACCEL_BATCHES_PER_SEC;
- uint32_t SENSOR_ACCEL_SAMPLES_PER_BATCH;
- uint32_t SENSOR_GYRO_BATCHES_PER_SEC;
- uint32_t SENSOR_GYRO_SAMPLES_PER_BATCH;
- uint32_t SENSOR_ACCEL_BATCHES_PER_SEC_HIGH;
- uint32_t SENSOR_ACCEL_SAMPLES_PER_BATCH_HIGH;
- uint32_t SENSOR_GYRO_BATCHES_PER_SEC_HIGH;
- uint32_t SENSOR_GYRO_SAMPLES_PER_BATCH_HIGH;
- uint32_t SENSOR_CONTROL_MODE;
- uint32_t SENSOR_USAGE;
- uint32_t SENSOR_ALGORITHM_CONFIG_MASK;
- uint8_t ACCEL_RANDOM_WALK_SPECTRAL_DENSITY_VALID;
- double ACCEL_RANDOM_WALK_SPECTRAL_DENSITY;
- uint8_t ANGLE_RANDOM_WALK_SPECTRAL_DENSITY_VALID;
- double ANGLE_RANDOM_WALK_SPECTRAL_DENSITY;
- uint8_t RATE_RANDOM_WALK_SPECTRAL_DENSITY_VALID;
- double RATE_RANDOM_WALK_SPECTRAL_DENSITY;
- uint8_t VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY_VALID;
- double VELOCITY_RANDOM_WALK_SPECTRAL_DENSITY;
- uint32_t SENSOR_PROVIDER;
-} loc_sap_cfg_s_type;
-
-extern loc_gps_cfg_s_type gps_conf;
-extern loc_sap_cfg_s_type sap_conf;
-
-
-uint32_t getCarrierCapabilities();
-
//loc_eng functions
int loc_eng_init(loc_eng_data_s_type &loc_eng_data,
LocCallbacks* callbacks,