From 09c85861d656358f6f516bb206c5287d101d03ad Mon Sep 17 00:00:00 2001 From: Kevin Tang Date: Tue, 7 Jun 2016 15:14:06 -0700 Subject: [PATCH] msm8974-common: gps: Making SUPL ES run time configurable SUPL ES gets updated as part of the sim specific AGPS config hot swap update. We keep that lastest SUPL ES and send that as part of the NI request, to let NI handler to know the config status. Change-Id: I566725d5db9b3abdbd9a423b86c10b819217f4f6 CRs-Fixed: 1024879 --- gps/core/gps_extended_c.h | 4 ++-- gps/loc_api/libloc_api_50001/loc.cpp | 16 +++++++++++++++- gps/loc_api/libloc_api_50001/loc_eng.cpp | 3 +++ gps/loc_api/libloc_api_50001/loc_eng.h | 9 +++++---- gps/loc_api/libloc_api_50001/loc_eng_ni.cpp | 2 +- 5 files changed, 26 insertions(+), 8 deletions(-) diff --git a/gps/core/gps_extended_c.h b/gps/core/gps_extended_c.h index fb08364..ebf9e5b 100644 --- a/gps/core/gps_extended_c.h +++ b/gps/core/gps_extended_c.h @@ -165,14 +165,14 @@ typedef struct { } AGpsExtCallbacks; +typedef void (*loc_ni_notify_callback)(GpsNiNotification *notification, bool esEnalbed); /** GPS NI callback structure. */ typedef struct { /** * Sends the notification request from HAL to GPSLocationProvider. */ - gps_ni_notify_callback notify_cb; - gps_create_thread create_thread_cb; + loc_ni_notify_callback notify_cb; } GpsNiExtCallbacks; typedef enum loc_server_type { diff --git a/gps/loc_api/libloc_api_50001/loc.cpp b/gps/loc_api/libloc_api_50001/loc.cpp index 505fc94..67e6efe 100644 --- a/gps/loc_api/libloc_api_50001/loc.cpp +++ b/gps/loc_api/libloc_api_50001/loc.cpp @@ -52,9 +52,15 @@ using namespace loc_core; //Globals defns static gps_location_callback gps_loc_cb = NULL; static gps_sv_status_callback gps_sv_cb = NULL; +static gps_ni_notify_callback gps_ni_cb = NULL; static void local_loc_cb(UlpLocation* location, void* locExt); static void local_sv_cb(GpsSvStatus* sv_status, void* svExt); +static void local_ni_cb(GpsNiNotification *notification, bool esEnalbed); + +GpsNiExtCallbacks sGpsNiExtCallbacks = { + local_ni_cb +}; static const GpsGeofencingInterface* get_geofence_interface(void); @@ -960,7 +966,8 @@ SIDE EFFECTS void loc_ni_init(GpsNiCallbacks *callbacks) { ENTRY_LOG(); - loc_eng_ni_init(loc_afw_data,(GpsNiExtCallbacks*) callbacks); + gps_ni_cb = callbacks->notify_cb; + loc_eng_ni_init(loc_afw_data, &sGpsNiExtCallbacks); EXIT_LOG(%s, VOID_RET); } @@ -1075,3 +1082,10 @@ static void local_sv_cb(GpsSvStatus* sv_status, void* svExt) EXIT_LOG(%s, VOID_RET); } +static void local_ni_cb(GpsNiNotification *notification, bool esEnalbed) +{ + if (NULL != gps_ni_cb) { + gps_ni_cb(notification); + } +} + diff --git a/gps/loc_api/libloc_api_50001/loc_eng.cpp b/gps/loc_api/libloc_api_50001/loc_eng.cpp index 6dc14dd..60e68ed 100644 --- a/gps/loc_api/libloc_api_50001/loc_eng.cpp +++ b/gps/loc_api/libloc_api_50001/loc_eng.cpp @@ -102,6 +102,7 @@ static const loc_param_s_type gps_conf_table[] = {"A_GLONASS_POS_PROTOCOL_SELECT", &gps_conf.A_GLONASS_POS_PROTOCOL_SELECT, NULL, 'n'}, {"AGPS_CERT_WRITABLE_MASK", &gps_conf.AGPS_CERT_WRITABLE_MASK, NULL, 'n'}, {"SUPL_MODE", &gps_conf.SUPL_MODE, NULL, 'n'}, + {"SUPL_ES", &gps_conf.SUPL_ES, NULL, 'n'}, {"INTERMEDIATE_POS", &gps_conf.INTERMEDIATE_POS, NULL, 'n'}, {"ACCURACY_THRES", &gps_conf.ACCURACY_THRES, NULL, 'n'}, {"NMEA_PROVIDER", &gps_conf.NMEA_PROVIDER, NULL, 'n'}, @@ -143,6 +144,7 @@ static void loc_default_parameters(void) gps_conf.GPS_LOCK = 0; gps_conf.SUPL_VER = 0x10000; gps_conf.SUPL_MODE = 0x3; + gps_conf.SUPL_ES = 0; gps_conf.CAPABILITIES = 0x7; /* LTE Positioning Profile configuration is disable by default*/ gps_conf.LPP_PROFILE = 0; @@ -2738,6 +2740,7 @@ void loc_eng_configuration_update (loc_eng_data_s_type &loc_eng_data, gps_conf_tmp.LPP_PROFILE = gps_conf.LPP_PROFILE; gps_conf_tmp.A_GLONASS_POS_PROTOCOL_SELECT = gps_conf.A_GLONASS_POS_PROTOCOL_SELECT; gps_conf_tmp.SUPL_MODE = gps_conf.SUPL_MODE; + gps_conf_tmp.SUPL_ES = gps_conf.SUPL_ES; gps_conf_tmp.GPS_LOCK = gps_conf.GPS_LOCK; gps_conf = gps_conf_tmp; } diff --git a/gps/loc_api/libloc_api_50001/loc_eng.h b/gps/loc_api/libloc_api_50001/loc_eng.h index b4f2564..59e6c14 100644 --- a/gps/loc_api/libloc_api_50001/loc_eng.h +++ b/gps/loc_api/libloc_api_50001/loc_eng.h @@ -89,7 +89,7 @@ typedef struct loc_eng_data_s loc_sv_status_cb_ext sv_status_cb; agps_status_extended agps_status_cb; gps_nmea_callback nmea_cb; - gps_ni_notify_callback ni_notify_cb; + loc_ni_notify_callback ni_notify_cb; gps_set_capabilities set_capabilities_cb; gps_acquire_wakelock acquire_wakelock_cb; gps_release_wakelock release_wakelock_cb; @@ -150,12 +150,13 @@ typedef struct loc_gps_cfg_s uint32_t ACCURACY_THRES; uint32_t SUPL_VER; uint32_t SUPL_MODE; + uint32_t SUPL_ES; 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]; + 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; diff --git a/gps/loc_api/libloc_api_50001/loc_eng_ni.cpp b/gps/loc_api/libloc_api_50001/loc_eng_ni.cpp index 4597b98..d79e635 100644 --- a/gps/loc_api/libloc_api_50001/loc_eng_ni.cpp +++ b/gps/loc_api/libloc_api_50001/loc_eng_ni.cpp @@ -189,7 +189,7 @@ void loc_eng_ni_request_handler(loc_eng_data_s_type &loc_eng_data, } CALLBACK_LOG_CALLFLOW("ni_notify_cb - id", %d, notif->notification_id); - loc_eng_data.ni_notify_cb((GpsNiNotification*)notif); + loc_eng_data.ni_notify_cb((GpsNiNotification*)notif, gps_conf.SUPL_ES != 0); } EXIT_LOG(%s, VOID_RET); }