diff --git a/core/ContextBase.h b/core/ContextBase.h index 2adbedd6..ff7a4b33 100644 --- a/core/ContextBase.h +++ b/core/ContextBase.h @@ -58,6 +58,7 @@ public: inline LocApiProxyBase* getLocApiProxy() { return mLocApiProxy; } inline bool hasAgpsExtendedCapabilities() { return mLBSProxy->hasAgpsExtendedCapabilities(); } inline bool hasCPIExtendedCapabilities() { return mLBSProxy->hasCPIExtendedCapabilities(); } + inline void modemPowerVote(bool power) const { return mLBSProxy->modemPowerVote(power); } inline void requestUlp(LocAdapterBase* adapter, unsigned long capabilities) { mLBSProxy->requestUlp(adapter, capabilities); diff --git a/core/LBSProxyBase.h b/core/LBSProxyBase.h index 0b7dbdf1..75ae9922 100644 --- a/core/LBSProxyBase.h +++ b/core/LBSProxyBase.h @@ -53,6 +53,7 @@ public: unsigned long capabilities) const {} inline virtual bool hasAgpsExtendedCapabilities() const { return false; } inline virtual bool hasCPIExtendedCapabilities() const { return false; } + inline virtual void modemPowerVote(bool power) const {} virtual void injectFeatureConfig(ContextBase* context) const {} }; diff --git a/core/LocAdapterBase.cpp b/core/LocAdapterBase.cpp index 4e62693d..4f7e4f23 100644 --- a/core/LocAdapterBase.cpp +++ b/core/LocAdapterBase.cpp @@ -135,10 +135,6 @@ bool LocAdapterBase:: requestNiNotify(GpsNiNotification ¬ify, const void* data) DEFAULT_IMPL(false) -void LocAdapterBase:: - shutdown() -DEFAULT_IMPL() - void LocAdapterBase:: reportGpsMeasurementData(GpsData &gpsMeasurementData) DEFAULT_IMPL() diff --git a/core/LocAdapterBase.h b/core/LocAdapterBase.h index c7e3f1c1..5f4660b8 100644 --- a/core/LocAdapterBase.h +++ b/core/LocAdapterBase.h @@ -110,7 +110,6 @@ public: virtual bool requestNiNotify(GpsNiNotification ¬ify, const void* data); inline virtual bool isInSession() { return false; } - virtual void shutdown(); ContextBase* getContext() const { return mContext; } virtual void reportGpsMeasurementData(GpsData &gpsMeasurementData); }; diff --git a/loc_api/libloc_api_50001/Android.mk b/loc_api/libloc_api_50001/Android.mk index 27c53cf2..4f80e0a6 100644 --- a/loc_api/libloc_api_50001/Android.mk +++ b/loc_api/libloc_api_50001/Android.mk @@ -96,19 +96,6 @@ LOCAL_C_INCLUDES:= \ $(TARGET_OUT_HEADERS)/gps.utils \ $(TARGET_OUT_HEADERS)/libloc_core -ifeq ($(filter $(TARGET_DEVICE), apq8064 msm8960),) -$(call print-vars, $(TARGET_DEVICE)) -LOCAL_SHARED_LIBRARIES += \ - libmdmdetect \ - libperipheral_client - -LOCAL_C_INCLUDES += \ - $(TARGET_OUT_HEADERS)/libmdmdetect/inc \ - $(TARGET_OUT_HEADERS)/libperipheralclient/inc -LOCAL_CFLAGS += \ - -DMODEM_POWER_VOTE -endif - LOCAL_PRELINK_MODULE := false LOCAL_MODULE_RELATIVE_PATH := hw diff --git a/loc_api/libloc_api_50001/LocEngAdapter.cpp b/loc_api/libloc_api_50001/LocEngAdapter.cpp index 0c497aa3..fd6f9b09 100644 --- a/loc_api/libloc_api_50001/LocEngAdapter.cpp +++ b/loc_api/libloc_api_50001/LocEngAdapter.cpp @@ -53,10 +53,6 @@ void LocInternalAdapter::getZppInt() { sendMsg(new LocEngGetZpp(mLocEngAdapter)); } -void LocInternalAdapter::shutdown() { - sendMsg(new LocEngShutdown(mLocEngAdapter)); -} - LocEngAdapter::LocEngAdapter(LOC_API_ADAPTER_EVENT_MASK_T mask, void* owner, ContextBase* context, MsgTask::tCreate tCreator) : diff --git a/loc_api/libloc_api_50001/LocEngAdapter.h b/loc_api/libloc_api_50001/LocEngAdapter.h index 8ae8992a..9e01b98c 100644 --- a/loc_api/libloc_api_50001/LocEngAdapter.h +++ b/loc_api/libloc_api_50001/LocEngAdapter.h @@ -64,7 +64,6 @@ public: virtual void stopFixInt(); virtual void getZppInt(); virtual void setUlpProxy(UlpProxyBase* ulp); - virtual void shutdown(); }; typedef void (*loc_msg_sender)(void* loc_eng_data_p, void* msgp); @@ -305,6 +304,7 @@ public: mPowerVote = powerOn ? (mPowerVote | POWER_VOTE_VALUE) : (mPowerVote & ~POWER_VOTE_VALUE); requestPowerVote(); + mContext->modemPowerVote(powerOn); } inline bool getPowerVote() const { return (mPowerVote & POWER_VOTE_VALUE) != 0 ; diff --git a/loc_api/libloc_api_50001/loc.cpp b/loc_api/libloc_api_50001/loc.cpp index 1ff6f328..d735b97a 100644 --- a/loc_api/libloc_api_50001/loc.cpp +++ b/loc_api/libloc_api_50001/loc.cpp @@ -45,17 +45,6 @@ #include #include -#ifdef MODEM_POWER_VOTE -#include -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ -#include -#ifdef __cplusplus -} -#endif /* __cplusplus */ -#endif /*MODEM_POWER_VOTE*/ - using namespace loc_core; #define LOC_PM_CLIENT_NAME "GPS" @@ -81,7 +70,6 @@ static int loc_set_position_mode(GpsPositionMode mode, GpsPositionRecurrence re uint32_t min_interval, uint32_t preferred_accuracy, uint32_t preferred_time); static const void* loc_get_extension(const char* name); -static void loc_close_mdm_node(); // Defines the GpsInterface in gps.h static const GpsInterface sLocEngInterface = { @@ -134,24 +122,6 @@ static const GpsNiInterface sLocEngNiInterface = loc_ni_respond, }; -#ifdef MODEM_POWER_VOTE -typedef struct { - //MAX_NAME_LEN defined in mdm_detect.h - char modem_name[MAX_NAME_LEN]; - //MAX_PATH_LEN defined in mdm_detect.h - char powerup_node[MAX_PATH_LEN]; - //this handle is used by peripheral mgr - void *handle; - int mdm_fd; - MdmType mdm_type; - bool peripheral_mgr_supported; - bool peripheral_mgr_registered; -}s_loc_mdm_info; -static s_loc_mdm_info loc_mdm_info; -static void loc_pm_event_notifier(void *client_data, enum pm_event event); -#endif /*MODEM_POWER_VOTE*/ -// For shutting down MDM in fusion devices -static int mdm_fd = -1; static int loc_gps_measurement_init(GpsMeasurementCallbacks* callbacks); static void loc_gps_measurement_close(); @@ -303,11 +273,6 @@ SIDE EFFECTS static int loc_init(GpsCallbacks* callbacks) { int retVal = -1; -#ifdef MODEM_POWER_VOTE - enum pm_event mdm_state; - static int mdm_index = -1; - int peripheral_mgr_ret = PM_RET_FAILED; -#endif /*MODEM_POWER_VOTE*/ ENTRY_LOG(); LOC_API_ADAPTER_EVENT_MASK_T event; @@ -337,7 +302,7 @@ static int loc_init(GpsCallbacks* callbacks) NULL, /* location_ext_parser */ NULL, /* sv_ext_parser */ callbacks->request_utc_time_cb, /* request_utc_time_cb */ - loc_close_mdm_node /*loc_shutdown_cb*/}; + }; gps_loc_cb = callbacks->location_cb; gps_sv_cb = callbacks->sv_status_cb; @@ -359,132 +324,11 @@ static int loc_init(GpsCallbacks* callbacks) LOC_LOGD("loc_eng_init() success!"); -#ifdef MODEM_POWER_VOTE - //if index is 0 or more, then we've looked for mdm already - LOC_LOGD("%s:%d]: mdm_index: %d", __func__, __LINE__, - mdm_index); - if (mdm_index < 0) { - struct dev_info modem_info; - memset(&modem_info, 0, sizeof(struct dev_info)); - if(get_system_info(&modem_info) != RET_SUCCESS) { - LOC_LOGE("%s:%d]: Error: get_system_info returned error\n", - __func__, __LINE__); - goto err; - } - - for(mdm_index = 0; - mdm_index < modem_info.num_modems; - mdm_index++) { - if(modem_info.mdm_list[mdm_index].mdm_name) { - //Copy modem name to register with peripheral manager - strlcpy(loc_mdm_info.modem_name, - modem_info.mdm_list[mdm_index].mdm_name, - sizeof(loc_mdm_info.modem_name)); - //copy powerup node name if we need to use mdmdetect method - strlcpy(loc_mdm_info.powerup_node, - modem_info.mdm_list[mdm_index].powerup_node, - sizeof(loc_mdm_info.powerup_node)); - loc_mdm_info.mdm_type = modem_info.mdm_list[mdm_index].type; - LOC_LOGD("%s:%d]: Found modem: %s, powerup node:%s at index: %d", - __func__, __LINE__, loc_mdm_info.modem_name, loc_mdm_info.powerup_node, - mdm_index); - break; - } - } - } - - if(loc_mdm_info.peripheral_mgr_registered != true) { - peripheral_mgr_ret = pm_client_register(loc_pm_event_notifier, - &loc_mdm_info, - loc_mdm_info.modem_name, - LOC_PM_CLIENT_NAME, - &mdm_state, - &loc_mdm_info.handle); - if(peripheral_mgr_ret == PM_RET_SUCCESS) { - loc_mdm_info.peripheral_mgr_supported = true; - loc_mdm_info.peripheral_mgr_registered = true; - LOC_LOGD("%s:%d]: registered with peripheral mgr for %s", - __func__, __LINE__, loc_mdm_info.modem_name); - } - else if(peripheral_mgr_ret == PM_RET_UNSUPPORTED) { - loc_mdm_info.peripheral_mgr_registered = true; - loc_mdm_info.peripheral_mgr_supported = false; - LOC_LOGD("%s:%d]: peripheral mgr unsupported for: %s", - __func__, __LINE__, loc_mdm_info.modem_name); - } - else { - //Not setting any flags here so that we can try again the next time around - LOC_LOGE("%s:%d]: Error: pm_client_register returned: %d", - __func__, __LINE__, peripheral_mgr_ret); - } - } - - if(loc_mdm_info.peripheral_mgr_supported == false && - loc_mdm_info.peripheral_mgr_registered == true) { - //Peripheral mgr is not supported - //use legacy method to open the powerup node - LOC_LOGD("%s:%d]: powerup_node: %s", __func__, __LINE__, - loc_mdm_info.powerup_node); - loc_mdm_info.mdm_fd = open(loc_mdm_info.powerup_node, O_RDONLY); - - if (loc_mdm_info.mdm_fd < 0) { - LOC_LOGE("Error: %s open failed: %s\n", - loc_mdm_info.powerup_node, strerror(errno)); - } else { - LOC_LOGD("%s opens success!", loc_mdm_info.powerup_node); - } - } - else if(loc_mdm_info.peripheral_mgr_supported == true && - loc_mdm_info.peripheral_mgr_registered == true) { - LOC_LOGD("%s:%d]: Voting for modem power up", __func__, __LINE__); - pm_client_connect(loc_mdm_info.handle); - } - else { - LOC_LOGD("%s:%d]: Not voted for modem power up due to errors", __func__, __LINE__); - } -#endif /*MODEM_POWER_VOTE*/ err: EXIT_LOG(%d, retVal); return retVal; } -/*=========================================================================== -FUNCTION loc_close_mdm_node - -DESCRIPTION - closes loc_mdm_info.mdm_fd which is the modem powerup node obtained in loc_init - -DEPENDENCIES - None - -RETURN VALUE - None - -SIDE EFFECTS - N/A - -===========================================================================*/ -static void loc_close_mdm_node() -{ - ENTRY_LOG(); -#ifdef MODEM_POWER_VOTE - if(loc_mdm_info.peripheral_mgr_supported == true) { - LOC_LOGD("%s:%d]: Voting for modem power down", __func__, __LINE__); - pm_client_disconnect(loc_mdm_info.handle); - } - else if (loc_mdm_info.mdm_fd >= 0) { - LOC_LOGD("closing the powerup node"); - close(loc_mdm_info.mdm_fd); - loc_mdm_info.mdm_fd = -1; - LOC_LOGD("finished closing the powerup node"); - } - else { - LOC_LOGD("powerup node has not been opened yet."); - } -#endif /*MODEM_POWER_VOTE*/ - EXIT_LOG(%s, VOID_RET); -} - /*=========================================================================== FUNCTION loc_cleanup @@ -509,7 +353,6 @@ static void loc_cleanup() loc_afw_data.adapter->setGpsLockMsg(gps_conf.GPS_LOCK); loc_eng_cleanup(loc_afw_data); - loc_close_mdm_node(); gps_loc_cb = NULL; gps_sv_cb = NULL; @@ -1182,12 +1025,3 @@ static void local_sv_cb(GpsSvStatus* sv_status, void* svExt) EXIT_LOG(%s, VOID_RET); } -#ifdef MODEM_POWER_VOTE -static void loc_pm_event_notifier(void *client_data, enum pm_event event) -{ - ENTRY_LOG(); - LOC_LOGD("%s:%d]: event: %d", __func__, __LINE__, (int)event); - pm_client_event_acknowledge(loc_mdm_info.handle, event); - EXIT_LOG(%s, VOID_RET); -} -#endif /*MODEM_POWER_VOTE*/ diff --git a/loc_api/libloc_api_50001/loc.h b/loc_api/libloc_api_50001/loc.h index 63528664..e56fdcf8 100644 --- a/loc_api/libloc_api_50001/loc.h +++ b/loc_api/libloc_api_50001/loc.h @@ -44,7 +44,6 @@ extern "C" { typedef void (*loc_location_cb_ext) (UlpLocation* location, void* locExt); typedef void (*loc_sv_status_cb_ext) (GpsSvStatus* sv_status, void* svExt); typedef void* (*loc_ext_parser)(void* data); -typedef void (*loc_shutdown_cb) (void); typedef struct { loc_location_cb_ext location_cb; @@ -58,7 +57,6 @@ typedef struct { loc_ext_parser location_ext_parser; loc_ext_parser sv_ext_parser; gps_request_utc_time request_utc_time_cb; - loc_shutdown_cb shutdown_cb; } LocCallbacks; #ifdef __cplusplus diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp index 998681f0..3bb4168f 100644 --- a/loc_api/libloc_api_50001/loc_eng.cpp +++ b/loc_api/libloc_api_50001/loc_eng.cpp @@ -205,7 +205,6 @@ static void loc_eng_handle_engine_up(loc_eng_data_s_type &loc_eng_data) ; static int loc_eng_start_handler(loc_eng_data_s_type &loc_eng_data); static int loc_eng_stop_handler(loc_eng_data_s_type &loc_eng_data); static int loc_eng_get_zpp_handler(loc_eng_data_s_type &loc_eng_data); -static void loc_eng_handle_shutdown(loc_eng_data_s_type &loc_eng_data); static void deleteAidingData(loc_eng_data_s_type &logEng); static AgpsStateMachine* getAgpsStateMachine(loc_eng_data_s_type& logEng, AGpsExtType agpsType); @@ -345,28 +344,6 @@ void LocEngGetZpp::send() const { mAdapter->sendMsg(this); } - -LocEngShutdown::LocEngShutdown(LocEngAdapter* adapter) : - LocMsg(), mAdapter(adapter) -{ - locallog(); -} -inline void LocEngShutdown::proc() const -{ - loc_eng_data_s_type* locEng = (loc_eng_data_s_type*)mAdapter->getOwner(); - LOC_LOGD("%s:%d]: Calling loc_eng_handle_shutdown", __func__, __LINE__); - loc_eng_handle_shutdown(*locEng); -} -inline void LocEngShutdown::locallog() const -{ - LOC_LOGV("LocEngShutdown"); -} -inline void LocEngShutdown::log() const -{ - locallog(); -} - -// case LOC_ENG_MSG_SET_TIME: struct LocEngSetTime : public LocMsg { LocEngAdapter* mAdapter; const GpsUtcTime mTime; @@ -1780,7 +1757,6 @@ int loc_eng_init(loc_eng_data_s_type &loc_eng_data, LocCallbacks* callbacks, loc_eng_data.sv_ext_parser = callbacks->sv_ext_parser ? callbacks->sv_ext_parser : noProc; loc_eng_data.intermediateFix = gps_conf.INTERMEDIATE_POS; - loc_eng_data.shutdown_cb = callbacks->shutdown_cb; // initial states taken care of by the memset above // loc_eng_data.engine_status -- GPS_STATUS_NONE; // loc_eng_data.fix_session_status -- GPS_STATUS_NONE; @@ -2951,30 +2927,6 @@ int loc_eng_read_config(void) return 0; } -/*=========================================================================== -FUNCTION loc_eng_handle_shutdown - -DESCRIPTION - Calls the shutdown callback function in the loc interface to close - the modem node - -DEPENDENCIES - None - -RETURN VALUE - 0: success - -SIDE EFFECTS - N/A - -===========================================================================*/ -void loc_eng_handle_shutdown(loc_eng_data_s_type &locEng) -{ - ENTRY_LOG(); - locEng.shutdown_cb(); - EXIT_LOG(%d, 0); -} - /*=========================================================================== FUNCTION loc_eng_gps_measurement_init diff --git a/loc_api/libloc_api_50001/loc_eng.h b/loc_api/libloc_api_50001/loc_eng.h index 813da482..a203e6bb 100644 --- a/loc_api/libloc_api_50001/loc_eng.h +++ b/loc_api/libloc_api_50001/loc_eng.h @@ -137,7 +137,6 @@ typedef struct loc_eng_data_s loc_ext_parser location_ext_parser; loc_ext_parser sv_ext_parser; - loc_shutdown_cb shutdown_cb; } loc_eng_data_s_type; /* GPS.conf support */ diff --git a/loc_api/libloc_api_50001/loc_eng_msg.h b/loc_api/libloc_api_50001/loc_eng_msg.h index 731f9288..9c7b9bcd 100644 --- a/loc_api/libloc_api_50001/loc_eng_msg.h +++ b/loc_api/libloc_api_50001/loc_eng_msg.h @@ -299,13 +299,6 @@ struct LocEngReportGpsMeasurement : public LocMsg { virtual void log() const; }; -struct LocEngShutdown : public LocMsg { - LocEngAdapter* mAdapter; - LocEngShutdown(LocEngAdapter* adapter); - virtual void proc() const; - void locallog() const; - virtual void log() const; -}; #ifdef __cplusplus } #endif /* __cplusplus */