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
This commit is contained in:
parent
93db35b825
commit
0df749e363
2 changed files with 28 additions and 23 deletions
|
@ -242,30 +242,33 @@ GeofenceAdapter::addGeofencesCommand(LocationAPI* client, size_t count, Geofence
|
||||||
if (NULL == mIds || NULL == mOptions || NULL == mInfos) {
|
if (NULL == mIds || NULL == mOptions || NULL == mInfos) {
|
||||||
errs[i] = LOCATION_ERROR_INVALID_PARAMETER;
|
errs[i] = LOCATION_ERROR_INVALID_PARAMETER;
|
||||||
} else {
|
} else {
|
||||||
mApi.addGeofence(mIds[i],
|
mApi.addToCallQueue(new LocApiResponse(*mAdapter.getContext(),
|
||||||
mOptions[i],
|
[&mAdapter = mAdapter, mCount = mCount, mClient = mClient,
|
||||||
mInfos[i],
|
mOptions = mOptions, mInfos = mInfos, mIds = mIds, &mApi = mApi,
|
||||||
new LocApiResponseData<LocApiGeofenceData>(*mAdapter.getContext(),
|
errs, i] (LocationError err ) {
|
||||||
[&mAdapter = mAdapter, mOptions = mOptions, mClient = mClient,
|
mApi.addGeofence(mIds[i], mOptions[i], mInfos[i],
|
||||||
mCount = mCount, mIds = mIds, mInfos = mInfos, errs, i]
|
new LocApiResponseData<LocApiGeofenceData>(*mAdapter.getContext(),
|
||||||
(LocationError err, LocApiGeofenceData data) {
|
[&mAdapter = mAdapter, mOptions = mOptions, mClient = mClient,
|
||||||
if (LOCATION_ERROR_SUCCESS == err) {
|
mCount = mCount, mIds = mIds, mInfos = mInfos, errs, i]
|
||||||
mAdapter.saveGeofenceItem(mClient,
|
(LocationError err, LocApiGeofenceData data) {
|
||||||
mIds[i],
|
if (LOCATION_ERROR_SUCCESS == err) {
|
||||||
data.hwId,
|
mAdapter.saveGeofenceItem(mClient,
|
||||||
mOptions[i],
|
mIds[i],
|
||||||
mInfos[i]);
|
data.hwId,
|
||||||
}
|
mOptions[i],
|
||||||
errs[i] = err;
|
mInfos[i]);
|
||||||
|
}
|
||||||
|
errs[i] = err;
|
||||||
|
|
||||||
// Send aggregated response on last item and cleanup
|
// Send aggregated response on last item and cleanup
|
||||||
if (i == mCount-1) {
|
if (i == mCount-1) {
|
||||||
mAdapter.reportResponse(mClient, mCount, errs, mIds);
|
mAdapter.reportResponse(mClient, mCount, errs, mIds);
|
||||||
delete[] errs;
|
delete[] errs;
|
||||||
delete[] mIds;
|
delete[] mIds;
|
||||||
delete[] mOptions;
|
delete[] mOptions;
|
||||||
delete[] mInfos;
|
delete[] mInfos;
|
||||||
}
|
}
|
||||||
|
}));
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -488,6 +488,7 @@ private:
|
||||||
for (size_t i = 0; i < count; i++) {
|
for (size_t i = 0; i < count; i++) {
|
||||||
ids[i] = mAPI.mGeofenceBiDict.getId(sessions[i]);
|
ids[i] = mAPI.mGeofenceBiDict.getId(sessions[i]);
|
||||||
}
|
}
|
||||||
|
LOC_LOGD("%s:]Returned geofence-id: %d in add geofence", __FUNCTION__, *ids);
|
||||||
mAPI.onAddGeofencesCb(count, errors, ids);
|
mAPI.onAddGeofencesCb(count, errors, ids);
|
||||||
free(ids);
|
free(ids);
|
||||||
}
|
}
|
||||||
|
@ -505,6 +506,7 @@ private:
|
||||||
for (size_t i = 0; i < count; i++) {
|
for (size_t i = 0; i < count; i++) {
|
||||||
ids[i] = mRemovedGeofenceBiDict->getId(sessions[i]);
|
ids[i] = mRemovedGeofenceBiDict->getId(sessions[i]);
|
||||||
}
|
}
|
||||||
|
LOC_LOGD("%s:]Returned geofence-id: %d in remove geofence", __FUNCTION__, *ids);
|
||||||
mAPI.onRemoveGeofencesCb(count, errors, ids);
|
mAPI.onRemoveGeofencesCb(count, errors, ids);
|
||||||
free(ids);
|
free(ids);
|
||||||
delete(mRemovedGeofenceBiDict);
|
delete(mRemovedGeofenceBiDict);
|
||||||
|
|
Loading…
Reference in a new issue