From e5c53750f06e9d9739b45ec108260ead7ff80941 Mon Sep 17 00:00:00 2001 From: Isaac Chen Date: Mon, 31 Dec 2018 10:55:08 +0100 Subject: wayne-common: Synchorize gps to P * QC Tag: LA.UM.7.2.r1-04900-sdm660.0 Signed-off-by: Isaac Chen Change-Id: I34383e8fbf394b774f83f8d662873e8786ff1bbf --- gps/location/LocationAPIClientBase.cpp | 39 ++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 18 deletions(-) (limited to 'gps/location/LocationAPIClientBase.cpp') diff --git a/gps/location/LocationAPIClientBase.cpp b/gps/location/LocationAPIClientBase.cpp index 50b4b83..626968c 100644 --- a/gps/location/LocationAPIClientBase.cpp +++ b/gps/location/LocationAPIClientBase.cpp @@ -29,12 +29,12 @@ #define LOG_NDDEBUG 0 #define LOG_TAG "LocSvc_APIClientBase" -#include +#include +#include #include #include #include "LocationAPIClientBase.h" -#define FLP_CONF_FILE "/etc/flp.conf" #define GEOFENCE_SESSION_ID 0xFFFFFFFF #define CONFIG_SESSION_ID 0xFFFFFFFF @@ -153,7 +153,6 @@ uint32_t LocationAPIControlClient::locAPIGnssUpdateConfig(GnssConfig config) memcpy(&mConfig, &config, sizeof(GnssConfig)); - uint32_t session = 0; uint32_t* idArray = mLocationControlAPI->gnssUpdateConfig(config); LOC_LOGV("%s:%d] gnssUpdateConfig return array: %p", __FUNCTION__, __LINE__, idArray); if (idArray != nullptr) { @@ -365,7 +364,7 @@ int32_t LocationAPIClientBase::locAPIGetBatchSize() { {"BATCH_SIZE", &mBatchSize, nullptr, 'n'}, }; - UTIL_READ_CONF(FLP_CONF_FILE, flp_conf_param_table); + UTIL_READ_CONF(LOC_PATH_FLP_CONF, flp_conf_param_table); if (mBatchSize < 0) { // set mBatchSize to 0 if we got an illegal value from config file mBatchSize = 0; @@ -562,10 +561,16 @@ uint32_t LocationAPIClientBase::locAPIGetBatchedLocations(uint32_t id, size_t co if (mLocationAPI) { if (mSessionBiDict.hasId(id)) { SessionEntity entity = mSessionBiDict.getExtById(id); - uint32_t batchingSession = entity.batchingSession; - mRequestQueues[REQUEST_SESSION].push(new GetBatchedLocationsRequest(*this)); - mLocationAPI->getBatchedLocations(batchingSession, count); - retVal = LOCATION_ERROR_SUCCESS; + if (entity.sessionMode != SESSION_MODE_ON_FIX) { + uint32_t batchingSession = entity.batchingSession; + mRequestQueues[REQUEST_SESSION].push(new GetBatchedLocationsRequest(*this)); + mLocationAPI->getBatchedLocations(batchingSession, count); + retVal = LOCATION_ERROR_SUCCESS; + } else { + LOC_LOGE("%s:%d] Unsupported for session id: %d, mode is SESSION_MODE_ON_FIX", + __FUNCTION__, __LINE__, id); + retVal = LOCATION_ERROR_NOT_SUPPORTED; + } } else { retVal = LOCATION_ERROR_ID_UNKNOWN; LOC_LOGE("%s:%d] invalid session: %d.", __FUNCTION__, __LINE__, id); @@ -614,26 +619,24 @@ void LocationAPIClientBase::locAPIRemoveGeofences(size_t count, uint32_t* ids) } if (mRequestQueues[REQUEST_GEOFENCE].getSession() == GEOFENCE_SESSION_ID) { + BiDict* removedGeofenceBiDict = + new BiDict(); size_t j = 0; - uint32_t id_cb; - LocationError err; for (size_t i = 0; i < count; i++) { sessions[j] = mGeofenceBiDict.getSession(ids[i]); - id_cb = ids[i]; if (sessions[j] > 0) { + GeofenceBreachTypeMask type = mGeofenceBiDict.getExtBySession(sessions[j]); mGeofenceBiDict.rmBySession(sessions[j]); - err = LOCATION_ERROR_SUCCESS; - onRemoveGeofencesCb(1, &err, &id_cb); + removedGeofenceBiDict->set(ids[i], sessions[j], type); j++; - } else { - err = LOCATION_ERROR_ID_UNKNOWN; - onRemoveGeofencesCb(1, &err, &id_cb); } } - if (j > 0) { - mRequestQueues[REQUEST_GEOFENCE].push(new RemoveGeofencesRequest(*this)); + mRequestQueues[REQUEST_GEOFENCE].push(new RemoveGeofencesRequest(*this, + removedGeofenceBiDict)); mLocationAPI->removeGeofences(j, sessions); + } else { + delete(removedGeofenceBiDict); } } else { LOC_LOGE("%s:%d] invalid session: %d.", __FUNCTION__, __LINE__, -- cgit v1.2.3