aboutsummaryrefslogtreecommitdiff
path: root/gps/core
diff options
context:
space:
mode:
authorcrancocco <shulaibai@hustunique.com>2016-06-25 22:55:16 +0800
committerdavidevinavil <davidevinavil@gmail.com>2017-01-21 18:26:28 +0100
commitb80452111794b613819d5ad51e1690c4dd923e97 (patch)
treedf2b4d14fdd89a40f6e11a24d93949e7bebfd8e5 /gps/core
parent8126cb8c09f99ae625364c98b1301d0c5390e27d (diff)
z2_plus: Update GPS HAL from upstream
* Tag LA.HB.1.3.2-15400-8x96.0 Change-Id: I2ba108f26a2ef4fc78504ef8c08ca41624ccb193
Diffstat (limited to 'gps/core')
-rw-r--r--gps/core/ContextBase.cpp21
-rw-r--r--gps/core/ContextBase.h64
-rw-r--r--gps/core/LocAdapterProxyBase.h6
-rw-r--r--gps/core/gps_extended_c.h3
-rw-r--r--gps/core/loc_core_log.cpp50
5 files changed, 116 insertions, 28 deletions
diff --git a/gps/core/ContextBase.cpp b/gps/core/ContextBase.cpp
index 9f6c4aa..971354d 100644
--- a/gps/core/ContextBase.cpp
+++ b/gps/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/gps/core/ContextBase.h b/gps/core/ContextBase.h
index fe0b860..bd9a19f 100644
--- a/gps/core/ContextBase.h
+++ b/gps/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;
@@ -67,6 +125,12 @@ public:
return mLBSProxy->getIzatDevId();
}
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/gps/core/LocAdapterProxyBase.h b/gps/core/LocAdapterProxyBase.h
index 1ddcca4..e1d0ccf 100644
--- a/gps/core/LocAdapterProxyBase.h
+++ b/gps/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/gps/core/gps_extended_c.h b/gps/core/gps_extended_c.h
index 27deb44..75ee17e 100644
--- a/gps/core/gps_extended_c.h
+++ b/gps/core/gps_extended_c.h
@@ -378,6 +378,7 @@ enum loc_api_adapter_event_index {
LOC_API_ADAPTER_GDT_UPLOAD_END_REQ, // GDT upload end request
LOC_API_ADAPTER_GNSS_MEASUREMENT, // GNSS Measurement report
LOC_API_ADAPTER_REQUEST_TIMEZONE, // Timezone injection request
+ LOC_API_ADAPTER_REPORT_GENFENCE_DWELL_REPORT, // Geofence dwell report
LOC_API_ADAPTER_EVENT_MAX
};
@@ -407,6 +408,7 @@ enum loc_api_adapter_event_index {
#define LOC_API_ADAPTER_BIT_GDT_UPLOAD_END_REQ (1<<LOC_API_ADAPTER_GDT_UPLOAD_END_REQ)
#define LOC_API_ADAPTER_BIT_GNSS_MEASUREMENT (1<<LOC_API_ADAPTER_GNSS_MEASUREMENT)
#define LOC_API_ADAPTER_BIT_REQUEST_TIMEZONE (1<<LOC_API_ADAPTER_REQUEST_TIMEZONE)
+#define LOC_API_ADAPTER_BIT_REPORT_GENFENCE_DWELL (1<<LOC_API_ADAPTER_REPORT_GENFENCE_DWELL_REPORT)
typedef unsigned int LOC_API_ADAPTER_EVENT_MASK_T;
@@ -416,6 +418,7 @@ typedef enum loc_api_adapter_msg_to_check_supported {
LOC_API_ADAPTER_MESSAGE_DISTANCE_BASE_TRACKING, // DBT 2.0
LOC_API_ADAPTER_MESSAGE_ADAPTIVE_LOCATION_BATCHING, // Batching 1.5
LOC_API_ADAPTER_MESSAGE_DISTANCE_BASE_LOCATION_BATCHING, // Batching 2.0
+ LOC_API_ADAPTER_MESSAGE_UPDATE_TBF_ON_THE_FLY, // Updating Tracking TBF On The Fly
LOC_API_ADAPTER_MESSAGE_MAX
} LocCheckingMessagesID;
diff --git a/gps/core/loc_core_log.cpp b/gps/core/loc_core_log.cpp
index 216dd59..3ca6c0a 100644
--- a/gps/core/loc_core_log.cpp
+++ b/gps/core/loc_core_log.cpp
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011-2014, The Linux Foundation. All rights reserved.
+/* Copyright (c) 2011-2015, 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
@@ -49,7 +49,7 @@ void LocPosMode::logv() const
}
/* GPS status names */
-static loc_name_val_s_type gps_status_name[] =
+static const loc_name_val_s_type gps_status_name[] =
{
NAME_VAL( GPS_STATUS_NONE ),
NAME_VAL( GPS_STATUS_SESSION_BEGIN ),
@@ -57,7 +57,7 @@ static loc_name_val_s_type gps_status_name[] =
NAME_VAL( GPS_STATUS_ENGINE_ON ),
NAME_VAL( GPS_STATUS_ENGINE_OFF ),
};
-static int gps_status_num = sizeof(gps_status_name) / sizeof(loc_name_val_s_type);
+static const int gps_status_num = sizeof(gps_status_name) / sizeof(loc_name_val_s_type);
/* Find Android GPS status name */
const char* loc_get_gps_status_name(GpsStatusValue gps_status)
@@ -68,7 +68,7 @@ const char* loc_get_gps_status_name(GpsStatusValue gps_status)
-static loc_name_val_s_type loc_eng_position_modes[] =
+static const loc_name_val_s_type loc_eng_position_modes[] =
{
NAME_VAL( LOC_POSITION_MODE_STANDALONE ),
NAME_VAL( LOC_POSITION_MODE_MS_BASED ),
@@ -79,7 +79,7 @@ static loc_name_val_s_type loc_eng_position_modes[] =
NAME_VAL( LOC_POSITION_MODE_RESERVED_4 ),
NAME_VAL( LOC_POSITION_MODE_RESERVED_5 )
};
-static int loc_eng_position_mode_num = sizeof(loc_eng_position_modes) / sizeof(loc_name_val_s_type);
+static const int loc_eng_position_mode_num = sizeof(loc_eng_position_modes) / sizeof(loc_name_val_s_type);
const char* loc_get_position_mode_name(GpsPositionMode mode)
{
@@ -88,12 +88,12 @@ const char* loc_get_position_mode_name(GpsPositionMode mode)
-static loc_name_val_s_type loc_eng_position_recurrences[] =
+static const loc_name_val_s_type loc_eng_position_recurrences[] =
{
NAME_VAL( GPS_POSITION_RECURRENCE_PERIODIC ),
NAME_VAL( GPS_POSITION_RECURRENCE_SINGLE )
};
-static int loc_eng_position_recurrence_num = sizeof(loc_eng_position_recurrences) / sizeof(loc_name_val_s_type);
+static const int loc_eng_position_recurrence_num = sizeof(loc_eng_position_recurrences) / sizeof(loc_name_val_s_type);
const char* loc_get_position_recurrence_name(GpsPositionRecurrence recur)
{
@@ -102,7 +102,7 @@ const char* loc_get_position_recurrence_name(GpsPositionRecurrence recur)
-static loc_name_val_s_type loc_eng_aiding_data_bits[] =
+static const loc_name_val_s_type loc_eng_aiding_data_bits[] =
{
NAME_VAL( GPS_DELETE_EPHEMERIS ),
NAME_VAL( GPS_DELETE_ALMANAC ),
@@ -118,7 +118,7 @@ static loc_name_val_s_type loc_eng_aiding_data_bits[] =
NAME_VAL( GPS_DELETE_CELLDB_INFO ),
NAME_VAL( GPS_DELETE_ALL)
};
-static int loc_eng_aiding_data_bit_num = sizeof(loc_eng_aiding_data_bits) / sizeof(loc_name_val_s_type);
+static const int loc_eng_aiding_data_bit_num = sizeof(loc_eng_aiding_data_bits) / sizeof(loc_name_val_s_type);
const char* loc_get_aiding_data_mask_names(GpsAidingData data)
{
@@ -126,7 +126,7 @@ const char* loc_get_aiding_data_mask_names(GpsAidingData data)
}
-static loc_name_val_s_type loc_eng_agps_types[] =
+static const loc_name_val_s_type loc_eng_agps_types[] =
{
NAME_VAL( AGPS_TYPE_INVALID ),
NAME_VAL( AGPS_TYPE_ANY ),
@@ -134,7 +134,7 @@ static loc_name_val_s_type loc_eng_agps_types[] =
NAME_VAL( AGPS_TYPE_C2K ),
NAME_VAL( AGPS_TYPE_WWAN_ANY )
};
-static int loc_eng_agps_type_num = sizeof(loc_eng_agps_types) / sizeof(loc_name_val_s_type);
+static const int loc_eng_agps_type_num = sizeof(loc_eng_agps_types) / sizeof(loc_name_val_s_type);
const char* loc_get_agps_type_name(AGpsType type)
{
@@ -142,14 +142,14 @@ const char* loc_get_agps_type_name(AGpsType type)
}
-static loc_name_val_s_type loc_eng_ni_types[] =
+static const loc_name_val_s_type loc_eng_ni_types[] =
{
NAME_VAL( GPS_NI_TYPE_VOICE ),
NAME_VAL( GPS_NI_TYPE_UMTS_SUPL ),
NAME_VAL( GPS_NI_TYPE_UMTS_CTRL_PLANE ),
NAME_VAL( GPS_NI_TYPE_EMERGENCY_SUPL )
};
-static int loc_eng_ni_type_num = sizeof(loc_eng_ni_types) / sizeof(loc_name_val_s_type);
+static const int loc_eng_ni_type_num = sizeof(loc_eng_ni_types) / sizeof(loc_name_val_s_type);
const char* loc_get_ni_type_name(GpsNiType type)
{
@@ -157,13 +157,13 @@ const char* loc_get_ni_type_name(GpsNiType type)
}
-static loc_name_val_s_type loc_eng_ni_responses[] =
+static const loc_name_val_s_type loc_eng_ni_responses[] =
{
NAME_VAL( GPS_NI_RESPONSE_ACCEPT ),
NAME_VAL( GPS_NI_RESPONSE_DENY ),
NAME_VAL( GPS_NI_RESPONSE_DENY )
};
-static int loc_eng_ni_reponse_num = sizeof(loc_eng_ni_responses) / sizeof(loc_name_val_s_type);
+static const int loc_eng_ni_reponse_num = sizeof(loc_eng_ni_responses) / sizeof(loc_name_val_s_type);
const char* loc_get_ni_response_name(GpsUserResponseType response)
{
@@ -171,7 +171,7 @@ const char* loc_get_ni_response_name(GpsUserResponseType response)
}
-static loc_name_val_s_type loc_eng_ni_encodings[] =
+static const loc_name_val_s_type loc_eng_ni_encodings[] =
{
NAME_VAL( GPS_ENC_NONE ),
NAME_VAL( GPS_ENC_SUPL_GSM_DEFAULT ),
@@ -179,55 +179,55 @@ static loc_name_val_s_type loc_eng_ni_encodings[] =
NAME_VAL( GPS_ENC_SUPL_UCS2 ),
NAME_VAL( GPS_ENC_UNKNOWN )
};
-static int loc_eng_ni_encoding_num = sizeof(loc_eng_ni_encodings) / sizeof(loc_name_val_s_type);
+static const int loc_eng_ni_encoding_num = sizeof(loc_eng_ni_encodings) / sizeof(loc_name_val_s_type);
const char* loc_get_ni_encoding_name(GpsNiEncodingType encoding)
{
return loc_get_name_from_val(loc_eng_ni_encodings, loc_eng_ni_encoding_num, (long) encoding);
}
-static loc_name_val_s_type loc_eng_agps_bears[] =
+static const loc_name_val_s_type loc_eng_agps_bears[] =
{
NAME_VAL( AGPS_APN_BEARER_INVALID ),
NAME_VAL( AGPS_APN_BEARER_IPV4 ),
NAME_VAL( AGPS_APN_BEARER_IPV6 ),
NAME_VAL( AGPS_APN_BEARER_IPV4V6 )
};
-static int loc_eng_agps_bears_num = sizeof(loc_eng_agps_bears) / sizeof(loc_name_val_s_type);
+static const int loc_eng_agps_bears_num = sizeof(loc_eng_agps_bears) / sizeof(loc_name_val_s_type);
const char* loc_get_agps_bear_name(AGpsBearerType bearer)
{
return loc_get_name_from_val(loc_eng_agps_bears, loc_eng_agps_bears_num, (long) bearer);
}
-static loc_name_val_s_type loc_eng_server_types[] =
+static const loc_name_val_s_type loc_eng_server_types[] =
{
NAME_VAL( LOC_AGPS_CDMA_PDE_SERVER ),
NAME_VAL( LOC_AGPS_CUSTOM_PDE_SERVER ),
NAME_VAL( LOC_AGPS_MPC_SERVER ),
NAME_VAL( LOC_AGPS_SUPL_SERVER )
};
-static int loc_eng_server_types_num = sizeof(loc_eng_server_types) / sizeof(loc_name_val_s_type);
+static const int loc_eng_server_types_num = sizeof(loc_eng_server_types) / sizeof(loc_name_val_s_type);
const char* loc_get_server_type_name(LocServerType type)
{
return loc_get_name_from_val(loc_eng_server_types, loc_eng_server_types_num, (long) type);
}
-static loc_name_val_s_type loc_eng_position_sess_status_types[] =
+static const loc_name_val_s_type loc_eng_position_sess_status_types[] =
{
NAME_VAL( LOC_SESS_SUCCESS ),
NAME_VAL( LOC_SESS_INTERMEDIATE ),
NAME_VAL( LOC_SESS_FAILURE )
};
-static int loc_eng_position_sess_status_num = sizeof(loc_eng_position_sess_status_types) / sizeof(loc_name_val_s_type);
+static const int loc_eng_position_sess_status_num = sizeof(loc_eng_position_sess_status_types) / sizeof(loc_name_val_s_type);
const char* loc_get_position_sess_status_name(enum loc_sess_status status)
{
return loc_get_name_from_val(loc_eng_position_sess_status_types, loc_eng_position_sess_status_num, (long) status);
}
-static loc_name_val_s_type loc_eng_agps_status_names[] =
+static const loc_name_val_s_type loc_eng_agps_status_names[] =
{
NAME_VAL( GPS_REQUEST_AGPS_DATA_CONN ),
NAME_VAL( GPS_RELEASE_AGPS_DATA_CONN ),
@@ -235,7 +235,7 @@ static loc_name_val_s_type loc_eng_agps_status_names[] =
NAME_VAL( GPS_AGPS_DATA_CONN_DONE ),
NAME_VAL( GPS_AGPS_DATA_CONN_FAILED )
};
-static int loc_eng_agps_status_num = sizeof(loc_eng_agps_status_names) / sizeof(loc_name_val_s_type);
+static const int loc_eng_agps_status_num = sizeof(loc_eng_agps_status_names) / sizeof(loc_name_val_s_type);
const char* loc_get_agps_status_name(AGpsStatusValue status)
{