summaryrefslogtreecommitdiff
path: root/geofence
diff options
context:
space:
mode:
authorNilesh Gharde <ngharde@codeaurora.org>2019-08-29 14:24:46 +0530
committerNilesh Gharde <ngharde@codeaurora.org>2019-09-04 11:42:19 +0530
commit0df749e3635c8568c38babdfad81a4b0d1e5ce39 (patch)
tree810dbf4d82e1584d5adac4145698ab0e3a3fd04f /geofence
parent93db35b82539baf5c2b80bc8314cf79070dcbc22 (diff)
downloadgps-0df749e3635c8568c38babdfad81a4b0d1e5ce39.tar.gz
Adding one level of context swith for Geofence_add
Added one more context switch for geofence add command. To even out total number of the context switch as it is for remove/modify/pause command. This will prevent out of order execution of sent msg tasks. Change-Id: Icf1f39ee3526e2e45cfe3e84945f71524941069b CRs-Fixed: 2516790
Diffstat (limited to 'geofence')
-rw-r--r--geofence/GeofenceAdapter.cpp49
1 files changed, 26 insertions, 23 deletions
diff --git a/geofence/GeofenceAdapter.cpp b/geofence/GeofenceAdapter.cpp
index b8746fb..e299589 100644
--- a/geofence/GeofenceAdapter.cpp
+++ b/geofence/GeofenceAdapter.cpp
@@ -242,30 +242,33 @@ GeofenceAdapter::addGeofencesCommand(LocationAPI* client, size_t count, Geofence
if (NULL == mIds || NULL == mOptions || NULL == mInfos) {
errs[i] = LOCATION_ERROR_INVALID_PARAMETER;
} else {
- mApi.addGeofence(mIds[i],
- mOptions[i],
- mInfos[i],
- new LocApiResponseData<LocApiGeofenceData>(*mAdapter.getContext(),
- [&mAdapter = mAdapter, mOptions = mOptions, mClient = mClient,
- mCount = mCount, mIds = mIds, mInfos = mInfos, errs, i]
- (LocationError err, LocApiGeofenceData data) {
- if (LOCATION_ERROR_SUCCESS == err) {
- mAdapter.saveGeofenceItem(mClient,
- mIds[i],
- data.hwId,
- mOptions[i],
- mInfos[i]);
- }
- errs[i] = err;
+ mApi.addToCallQueue(new LocApiResponse(*mAdapter.getContext(),
+ [&mAdapter = mAdapter, mCount = mCount, mClient = mClient,
+ mOptions = mOptions, mInfos = mInfos, mIds = mIds, &mApi = mApi,
+ errs, i] (LocationError err ) {
+ mApi.addGeofence(mIds[i], mOptions[i], mInfos[i],
+ new LocApiResponseData<LocApiGeofenceData>(*mAdapter.getContext(),
+ [&mAdapter = mAdapter, mOptions = mOptions, mClient = mClient,
+ mCount = mCount, mIds = mIds, mInfos = mInfos, errs, i]
+ (LocationError err, LocApiGeofenceData data) {
+ if (LOCATION_ERROR_SUCCESS == err) {
+ mAdapter.saveGeofenceItem(mClient,
+ mIds[i],
+ data.hwId,
+ mOptions[i],
+ mInfos[i]);
+ }
+ errs[i] = err;
- // Send aggregated response on last item and cleanup
- if (i == mCount-1) {
- mAdapter.reportResponse(mClient, mCount, errs, mIds);
- delete[] errs;
- delete[] mIds;
- delete[] mOptions;
- delete[] mInfos;
- }
+ // Send aggregated response on last item and cleanup
+ if (i == mCount-1) {
+ mAdapter.reportResponse(mClient, mCount, errs, mIds);
+ delete[] errs;
+ delete[] mIds;
+ delete[] mOptions;
+ delete[] mInfos;
+ }
+ }));
}));
}
}