diff options
-rw-r--r-- | core/ContextBase.h | 1 | ||||
-rw-r--r-- | core/LBSProxyBase.h | 1 | ||||
-rw-r--r-- | core/LocAdapterBase.cpp | 4 | ||||
-rw-r--r-- | core/LocAdapterBase.h | 1 | ||||
-rw-r--r-- | core/LocDualContext.cpp | 22 | ||||
-rw-r--r-- | core/LocDualContext.h | 1 | ||||
-rw-r--r-- | loc_api/libloc_api_50001/Android.mk | 13 | ||||
-rw-r--r-- | loc_api/libloc_api_50001/LocEngAdapter.cpp | 4 | ||||
-rw-r--r-- | loc_api/libloc_api_50001/LocEngAdapter.h | 2 | ||||
-rw-r--r-- | loc_api/libloc_api_50001/loc.cpp | 188 | ||||
-rw-r--r-- | loc_api/libloc_api_50001/loc.h | 2 | ||||
-rw-r--r-- | loc_api/libloc_api_50001/loc_eng.cpp | 74 | ||||
-rw-r--r-- | loc_api/libloc_api_50001/loc_eng.h | 1 | ||||
-rw-r--r-- | loc_api/libloc_api_50001/loc_eng_msg.h | 7 | ||||
-rw-r--r-- | utils/loc_cfg.cpp | 37 |
15 files changed, 67 insertions, 291 deletions
diff --git a/core/ContextBase.h b/core/ContextBase.h index 2adbedd..ff7a4b3 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 0b7dbdf..75ae992 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 b304653..fe0972c 100644 --- a/core/LocAdapterBase.cpp +++ b/core/LocAdapterBase.cpp @@ -136,10 +136,6 @@ bool LocAdapterBase:: DEFAULT_IMPL(false) void LocAdapterBase:: - shutdown() -DEFAULT_IMPL() - -void LocAdapterBase:: reportGpsMeasurementData(GpsData &gpsMeasurementData) DEFAULT_IMPL() } // namespace loc_core diff --git a/core/LocAdapterBase.h b/core/LocAdapterBase.h index 9d5f6a8..f8fdc48 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/core/LocDualContext.cpp b/core/LocDualContext.cpp index 41ad4f0..d68cb3b 100644 --- a/core/LocDualContext.cpp +++ b/core/LocDualContext.cpp @@ -61,6 +61,8 @@ ContextBase* LocDualContext::mInjectContext = NULL; const char* LocDualContext::mLocationHalName = "Loc_hal_worker"; const char* LocDualContext::mLBSLibName = "liblbs_core.so"; +pthread_mutex_t LocDualContext::mGetLocContextMutex = PTHREAD_MUTEX_INITIALIZER; + const MsgTask* LocDualContext::getMsgTask(MsgTask::tCreate tCreator, const char* name) { @@ -84,22 +86,30 @@ const MsgTask* LocDualContext::getMsgTask(MsgTask::tAssociate tAssociate, ContextBase* LocDualContext::getLocFgContext(MsgTask::tCreate tCreator, const char* name) { + pthread_mutex_lock(&LocDualContext::mGetLocContextMutex); + LOC_LOGD("%s:%d]: querying ContextBase with tCreator", __func__, __LINE__); if (NULL == mFgContext) { + LOC_LOGD("%s:%d]: creating msgTask with tCreator", __func__, __LINE__); const MsgTask* msgTask = getMsgTask(tCreator, name); mFgContext = new LocDualContext(msgTask, mFgExclMask); } if(NULL == mInjectContext) { + LOC_LOGD("%s:%d]: mInjectContext is FgContext", __func__, __LINE__); mInjectContext = mFgContext; injectFeatureConfig(mInjectContext); } + pthread_mutex_unlock(&LocDualContext::mGetLocContextMutex); return mFgContext; } ContextBase* LocDualContext::getLocFgContext(MsgTask::tAssociate tAssociate, - const char* name) + const char* name) { + pthread_mutex_lock(&LocDualContext::mGetLocContextMutex); + LOC_LOGD("%s:%d]: querying ContextBase with tAssociate", __func__, __LINE__); if (NULL == mFgContext) { + LOC_LOGD("%s:%d]: creating msgTask with tAssociate", __func__, __LINE__); const MsgTask* msgTask = getMsgTask(tAssociate, name); mFgContext = new LocDualContext(msgTask, mFgExclMask); @@ -109,14 +119,17 @@ ContextBase* LocDualContext::getLocFgContext(MsgTask::tAssociate tAssociate, mInjectContext = mFgContext; injectFeatureConfig(mInjectContext); } + pthread_mutex_unlock(&LocDualContext::mGetLocContextMutex); return mFgContext; - } ContextBase* LocDualContext::getLocBgContext(MsgTask::tCreate tCreator, const char* name) { + pthread_mutex_lock(&LocDualContext::mGetLocContextMutex); + LOC_LOGD("%s:%d]: querying ContextBase with tCreator", __func__, __LINE__); if (NULL == mBgContext) { + LOC_LOGD("%s:%d]: creating msgTask with tCreator", __func__, __LINE__); const MsgTask* msgTask = getMsgTask(tCreator, name); mBgContext = new LocDualContext(msgTask, mBgExclMask); @@ -126,13 +139,17 @@ ContextBase* LocDualContext::getLocBgContext(MsgTask::tCreate tCreator, mInjectContext = mBgContext; injectFeatureConfig(mInjectContext); } + pthread_mutex_unlock(&LocDualContext::mGetLocContextMutex); return mBgContext; } ContextBase* LocDualContext::getLocBgContext(MsgTask::tAssociate tAssociate, const char* name) { + pthread_mutex_lock(&LocDualContext::mGetLocContextMutex); + LOC_LOGD("%s:%d]: querying ContextBase with tAssociate", __func__, __LINE__); if (NULL == mBgContext) { + LOC_LOGD("%s:%d]: creating msgTask with tAssociate", __func__, __LINE__); const MsgTask* msgTask = getMsgTask(tAssociate, name); mBgContext = new LocDualContext(msgTask, mBgExclMask); @@ -142,6 +159,7 @@ ContextBase* LocDualContext::getLocBgContext(MsgTask::tAssociate tAssociate, mInjectContext = mBgContext; injectFeatureConfig(mInjectContext); } + pthread_mutex_unlock(&LocDualContext::mGetLocContextMutex); return mBgContext; } diff --git a/core/LocDualContext.h b/core/LocDualContext.h index cdc4df3..1e96ea5 100644 --- a/core/LocDualContext.h +++ b/core/LocDualContext.h @@ -45,6 +45,7 @@ class LocDualContext : public ContextBase { const char* name); static const MsgTask* getMsgTask(MsgTask::tAssociate tAssociate, const char* name); + static pthread_mutex_t mGetLocContextMutex; protected: LocDualContext(const MsgTask* msgTask, diff --git a/loc_api/libloc_api_50001/Android.mk b/loc_api/libloc_api_50001/Android.mk index ed50484..2bd4b2c 100644 --- a/loc_api/libloc_api_50001/Android.mk +++ b/loc_api/libloc_api_50001/Android.mk @@ -95,19 +95,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 2f025af..c47502b 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 e5d1018..6302662 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 9fc5623..e2527b5 100644 --- a/loc_api/libloc_api_50001/loc.cpp +++ b/loc_api/libloc_api_50001/loc.cpp @@ -45,17 +45,6 @@ #include <LocDualContext.h> #include <cutils/properties.h> -#ifdef MODEM_POWER_VOTE -#include <pm-service.h> -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ -#include <mdm_detect.h> -#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 = { @@ -136,24 +124,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(); @@ -204,7 +174,7 @@ static const GnssConfigurationInterface sLocEngConfigInterface = static loc_eng_data_s_type loc_afw_data; static int gss_fd = -1; - +static int sGnssType = GNSS_UNKNOWN; /*=========================================================================== FUNCTION gps_get_hardware_interface @@ -256,8 +226,8 @@ extern "C" const GpsInterface* get_gps_interface() target = loc_get_target(); LOC_LOGD("Target name check returned %s", loc_get_target_name(target)); - int gnssType = getTargetGnssType(target); - switch (gnssType) + sGnssType = getTargetGnssType(target); + switch (sGnssType) { case GNSS_GSS: case GNSS_AUTO: @@ -305,11 +275,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; @@ -339,7 +304,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; @@ -361,133 +326,12 @@ 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 DESCRIPTION @@ -511,7 +355,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; @@ -1008,7 +851,10 @@ SIDE EFFECTS static int loc_xtra_init(GpsXtraCallbacks* callbacks) { ENTRY_LOG(); - int ret_val = loc_eng_xtra_init(loc_afw_data, (GpsXtraExtCallbacks*)callbacks); + GpsXtraExtCallbacks extCallbacks; + memset(&extCallbacks, 0, sizeof(extCallbacks)); + extCallbacks.download_request_cb = callbacks->download_request_cb; + int ret_val = loc_eng_xtra_init(loc_afw_data, &extCallbacks); EXIT_LOG(%d, ret_val); return ret_val; @@ -1193,6 +1039,15 @@ static void loc_configuration_update(const char* config_data, int32_t length) { ENTRY_LOG(); loc_eng_configuration_update(loc_afw_data, config_data, length); + switch (sGnssType) + { + case GNSS_GSS: + case GNSS_AUTO: + case GNSS_QCA1530: + //APQ + gps_conf.CAPABILITIES &= ~(GPS_CAPABILITY_MSA | GPS_CAPABILITY_MSB); + break; + } EXIT_LOG(%s, VOID_RET); } @@ -1219,12 +1074,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 6352866..e56fdcf 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 448cc79..e3e52d4 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; @@ -1774,7 +1751,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; @@ -1955,7 +1931,6 @@ static int loc_eng_start_handler(loc_eng_data_s_type &loc_eng_data) ret_val == LOC_API_ADAPTER_ERR_INTERNAL) { loc_eng_data.adapter->setInSession(TRUE); - loc_inform_gps_status(loc_eng_data, GPS_STATUS_SESSION_BEGIN); } } @@ -2001,11 +1976,6 @@ static int loc_eng_stop_handler(loc_eng_data_s_type &loc_eng_data) if (loc_eng_data.adapter->isInSession()) { ret_val = loc_eng_data.adapter->stopFix(); - if (ret_val == LOC_API_ADAPTER_ERR_SUCCESS) - { - loc_inform_gps_status(loc_eng_data, GPS_STATUS_SESSION_END); - } - loc_eng_data.adapter->setInSession(FALSE); } @@ -2058,14 +2028,12 @@ int loc_eng_set_position_mode(loc_eng_data_s_type &loc_eng_data, ENTRY_LOG_CALLFLOW(); INIT_CHECK(loc_eng_data.adapter, return -1); - int gnssType = getTargetGnssType(loc_get_target()); - - // The position mode for GSS/QCA1530 can only be standalone - bool is1530 = gnssType == GNSS_QCA1530; - bool isAPQ = gnssType == GNSS_GSS; - if ((isAPQ || is1530) && params.mode != LOC_POSITION_MODE_STANDALONE) { + // The position mode for AUTO/GSS/QCA1530 can only be standalone + if (!(gps_conf.CAPABILITIES & GPS_CAPABILITY_MSB) && + !(gps_conf.CAPABILITIES & GPS_CAPABILITY_MSA) && + (params.mode != LOC_POSITION_MODE_STANDALONE)) { params.mode = LOC_POSITION_MODE_STANDALONE; - LOC_LOGD("Position mode changed to standalone for target with GSS/qca1530."); + LOC_LOGD("Position mode changed to standalone for target with AUTO/GSS/qca1530."); } if(! loc_eng_data.adapter->getUlpProxy()->sendFixMode(params)) @@ -2337,10 +2305,8 @@ void loc_eng_agps_init(loc_eng_data_s_type &loc_eng_data, AGpsExtCallbacks* call AGPS_TYPE_WIFI, true); - int gnssType = getTargetGnssType(loc_get_target()); - bool isAPQ = (gnssType == GNSS_GSS); - bool is1530 = (gnssType == GNSS_QCA1530); - if (!isAPQ && !is1530) { + if ((gps_conf.CAPABILITIES & GPS_CAPABILITY_MSA) || + (gps_conf.CAPABILITIES & GPS_CAPABILITY_MSB)) { loc_eng_data.agnss_nif = new AgpsStateMachine(servicerTypeAgps, (void *)loc_eng_data.agps_status_cb, AGPS_TYPE_SUPL, @@ -2886,8 +2852,6 @@ void loc_eng_handle_engine_up(loc_eng_data_s_type &loc_eng_data) loc_eng_agps_reinit(loc_eng_data); } - loc_eng_report_status(loc_eng_data, GPS_STATUS_ENGINE_ON); - // modem is back up. If we crashed in the middle of navigating, we restart. if (loc_eng_data.adapter->isInSession()) { // This sets the copy in adapter to modem @@ -2958,30 +2922,6 @@ int loc_eng_read_config(void) } /*=========================================================================== -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 DESCRIPTION diff --git a/loc_api/libloc_api_50001/loc_eng.h b/loc_api/libloc_api_50001/loc_eng.h index 813da48..a203e6b 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 e3c48fb..5626c34 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 */ diff --git a/utils/loc_cfg.cpp b/utils/loc_cfg.cpp index 7ffe6a4..5c33320 100644 --- a/utils/loc_cfg.cpp +++ b/utils/loc_cfg.cpp @@ -52,8 +52,8 @@ *============================================================================*/ /* Parameter data */ -static uint8_t DEBUG_LEVEL = 0xff; -static uint8_t TIMESTAMP = 0; +static uint32_t DEBUG_LEVEL = 0xff; +static uint32_t TIMESTAMP = 0; /* Parameter spec table */ static loc_param_s_type loc_param_table[] = @@ -330,24 +330,25 @@ int loc_update_conf(const char* conf_data, int32_t length, // make a copy, so we do not tokenize the original data char* conf_copy = (char*)malloc(length+1); - if(conf_copy !=NULL) + if (conf_copy != NULL) { - memcpy(conf_copy, conf_data, length); - // we hard NULL the end of string to be safe - conf_copy[length] = 0; - } + memcpy(conf_copy, conf_data, length); + // we hard NULL the end of string to be safe + conf_copy[length] = 0; + + // start with one record off + uint32_t num_params = table_length - 1; + char* saveptr = NULL; + char* input_buf = strtok_r(conf_copy, "\n", &saveptr); + ret = 0; - // start with one record off - uint32_t num_params = table_length - 1; - char* saveptr = NULL; - char* input_buf = strtok_r(conf_copy, "\n", &saveptr); - ret = 0; - - LOC_LOGD("%s:%d]: num_params: %d\n", __func__, __LINE__, num_params); - while(num_params && input_buf) { - ret++; - num_params -= loc_fill_conf_item(input_buf, config_table, table_length); - input_buf = strtok_r(NULL, "\n", &saveptr); + LOC_LOGD("%s:%d]: num_params: %d\n", __func__, __LINE__, num_params); + while(num_params && input_buf) { + ret++; + num_params -= loc_fill_conf_item(input_buf, config_table, table_length); + input_buf = strtok_r(NULL, "\n", &saveptr); + } + free(conf_copy); } } |