summaryrefslogtreecommitdiff
path: root/gps/location/LocationAPIClientBase.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gps/location/LocationAPIClientBase.cpp')
-rw-r--r--gps/location/LocationAPIClientBase.cpp39
1 files changed, 21 insertions, 18 deletions
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 <platform_lib_log_util.h>
+#include <loc_pla.h>
+#include <log_util.h>
#include <inttypes.h>
#include <loc_cfg.h>
#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<GeofenceBreachTypeMask>* removedGeofenceBiDict =
+ new BiDict<GeofenceBreachTypeMask>();
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__,