Add params for start and stop recording

This commit is contained in:
PavelRatushny 2017-08-31 11:23:27 +03:00
parent 5aee9c5cd5
commit 4e715387df
7 changed files with 100 additions and 8 deletions

View file

@ -22,6 +22,8 @@ import net.osmand.aidl.calculateroute.CalculateRouteParams;
import net.osmand.aidl.gpx.ImportGpxParams;
import net.osmand.aidl.gpx.ShowGpxParams;
import net.osmand.aidl.gpx.StartGpxRecordingParams;
import net.osmand.aidl.gpx.StopGpxRecordingParams;
import net.osmand.aidl.gpx.HideGpxParams;
import net.osmand.aidl.gpx.ASelectedGpxFile;
@ -77,7 +79,7 @@ interface IOsmAndAidlInterface {
boolean removeFavorite(in RemoveFavoriteParams params);
boolean updateFavorite(in UpdateFavoriteParams params);
boolean startGpxRecording();
boolean stopGpxRecording();
boolean startGpxRecording(in StartGpxRecordingParams params);
boolean stopGpxRecording(in StopGpxRecordingParams params);
}

View file

@ -13,6 +13,8 @@ import net.osmand.IndexConstants;
import net.osmand.aidl.favorite.AFavorite;
import net.osmand.aidl.favorite.group.AFavoriteGroup;
import net.osmand.aidl.gpx.ASelectedGpxFile;
import net.osmand.aidl.gpx.StartGpxRecordingParams;
import net.osmand.aidl.gpx.StopGpxRecordingParams;
import net.osmand.aidl.maplayer.AMapLayer;
import net.osmand.aidl.maplayer.point.AMapPoint;
import net.osmand.aidl.mapmarker.AMapMarker;
@ -844,7 +846,7 @@ public class OsmandAidlApi {
return true;
}
boolean startGpxRecording() {
boolean startGpxRecording(StartGpxRecordingParams params) {
final OsmandMonitoringPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class);
if (plugin != null) {
plugin.startGPXMonitoring(null);
@ -854,7 +856,7 @@ public class OsmandAidlApi {
return false;
}
boolean stopGpxRecording() {
boolean stopGpxRecording(StopGpxRecordingParams params) {
final OsmandMonitoringPlugin plugin = OsmandPlugin.getEnabledPlugin(OsmandMonitoringPlugin.class);
if (plugin != null) {
plugin.stopRecording();

View file

@ -16,6 +16,8 @@ import net.osmand.aidl.gpx.ASelectedGpxFile;
import net.osmand.aidl.gpx.HideGpxParams;
import net.osmand.aidl.gpx.ImportGpxParams;
import net.osmand.aidl.gpx.ShowGpxParams;
import net.osmand.aidl.gpx.StartGpxRecordingParams;
import net.osmand.aidl.gpx.StopGpxRecordingParams;
import net.osmand.aidl.map.SetMapLocationParams;
import net.osmand.aidl.maplayer.AddMapLayerParams;
import net.osmand.aidl.maplayer.RemoveMapLayerParams;
@ -322,18 +324,18 @@ public class OsmandAidlService extends Service {
}
@Override
public boolean startGpxRecording() throws RemoteException {
public boolean startGpxRecording(StartGpxRecordingParams params) throws RemoteException {
try {
return getApi().startGpxRecording();
return getApi().startGpxRecording(params);
} catch (Exception e) {
return false;
}
}
@Override
public boolean stopGpxRecording() throws RemoteException {
public boolean stopGpxRecording(StopGpxRecordingParams params) throws RemoteException {
try {
return getApi().stopGpxRecording();
return getApi().stopGpxRecording(params);
} catch (Exception e) {
return false;
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.gpx;
parcelable StartGpxRecordingParams;

View file

@ -0,0 +1,40 @@
package net.osmand.aidl.gpx;
import android.os.Parcel;
import android.os.Parcelable;
public class StartGpxRecordingParams implements Parcelable {
public StartGpxRecordingParams() {
}
public StartGpxRecordingParams(Parcel in) {
readFromParcel(in);
}
public static final Creator<StartGpxRecordingParams> CREATOR = new Creator<StartGpxRecordingParams>() {
@Override
public StartGpxRecordingParams createFromParcel(Parcel in) {
return new StartGpxRecordingParams(in);
}
@Override
public StartGpxRecordingParams[] newArray(int size) {
return new StartGpxRecordingParams[size];
}
};
@Override
public void writeToParcel(Parcel out, int flags) {
}
private void readFromParcel(Parcel in) {
}
@Override
public int describeContents() {
return 0;
}
}

View file

@ -0,0 +1,3 @@
package net.osmand.aidl.gpx;
parcelable StopGpxRecordingParams;

View file

@ -0,0 +1,40 @@
package net.osmand.aidl.gpx;
import android.os.Parcel;
import android.os.Parcelable;
public class StopGpxRecordingParams implements Parcelable {
public StopGpxRecordingParams() {
}
public StopGpxRecordingParams(Parcel in) {
readFromParcel(in);
}
public static final Creator<StopGpxRecordingParams> CREATOR = new Creator<StopGpxRecordingParams>() {
@Override
public StopGpxRecordingParams createFromParcel(Parcel in) {
return new StopGpxRecordingParams(in);
}
@Override
public StopGpxRecordingParams[] newArray(int size) {
return new StopGpxRecordingParams[size];
}
};
@Override
public void writeToParcel(Parcel out, int flags) {
}
private void readFromParcel(Parcel in) {
}
@Override
public int describeContents() {
return 0;
}
}