diff --git a/loc_api/libloc_api_50001/loc.cpp b/loc_api/libloc_api_50001/loc.cpp index 4cf4ba95..1ff6f328 100644 --- a/loc_api/libloc_api_50001/loc.cpp +++ b/loc_api/libloc_api_50001/loc.cpp @@ -202,7 +202,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 @@ -254,8 +254,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: @@ -1147,6 +1147,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); } diff --git a/loc_api/libloc_api_50001/loc_eng.cpp b/loc_api/libloc_api_50001/loc_eng.cpp index 7d3d6c76..9f62ce22 100644 --- a/loc_api/libloc_api_50001/loc_eng.cpp +++ b/loc_api/libloc_api_50001/loc_eng.cpp @@ -2052,14 +2052,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)) @@ -2331,10 +2329,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,