From 4e715387dff6a0c3bae3e2b192d084af5b0f94bb Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Thu, 31 Aug 2017 11:23:27 +0300 Subject: [PATCH] Add params for start and stop recording --- .../net/osmand/aidl/IOsmAndAidlInterface.aidl | 6 ++- OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java | 6 ++- .../net/osmand/aidl/OsmandAidlService.java | 10 +++-- .../aidl/gpx/StartGpxRecordingParams.aidl | 3 ++ .../aidl/gpx/StartGpxRecordingParams.java | 40 +++++++++++++++++++ .../aidl/gpx/StopGpxRecordingParams.aidl | 3 ++ .../aidl/gpx/StopGpxRecordingParams.java | 40 +++++++++++++++++++ 7 files changed, 100 insertions(+), 8 deletions(-) create mode 100644 OsmAnd/src/net/osmand/aidl/gpx/StartGpxRecordingParams.aidl create mode 100644 OsmAnd/src/net/osmand/aidl/gpx/StartGpxRecordingParams.java create mode 100644 OsmAnd/src/net/osmand/aidl/gpx/StopGpxRecordingParams.aidl create mode 100644 OsmAnd/src/net/osmand/aidl/gpx/StopGpxRecordingParams.java diff --git a/OsmAnd/src/net/osmand/aidl/IOsmAndAidlInterface.aidl b/OsmAnd/src/net/osmand/aidl/IOsmAndAidlInterface.aidl index a09b79709b..089f96c04c 100644 --- a/OsmAnd/src/net/osmand/aidl/IOsmAndAidlInterface.aidl +++ b/OsmAnd/src/net/osmand/aidl/IOsmAndAidlInterface.aidl @@ -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); } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java b/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java index 2a967c5a17..7aaeff5eac 100644 --- a/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java +++ b/OsmAnd/src/net/osmand/aidl/OsmandAidlApi.java @@ -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(); diff --git a/OsmAnd/src/net/osmand/aidl/OsmandAidlService.java b/OsmAnd/src/net/osmand/aidl/OsmandAidlService.java index ec5cd9f335..e1da642f59 100644 --- a/OsmAnd/src/net/osmand/aidl/OsmandAidlService.java +++ b/OsmAnd/src/net/osmand/aidl/OsmandAidlService.java @@ -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; } diff --git a/OsmAnd/src/net/osmand/aidl/gpx/StartGpxRecordingParams.aidl b/OsmAnd/src/net/osmand/aidl/gpx/StartGpxRecordingParams.aidl new file mode 100644 index 0000000000..14f4871540 --- /dev/null +++ b/OsmAnd/src/net/osmand/aidl/gpx/StartGpxRecordingParams.aidl @@ -0,0 +1,3 @@ +package net.osmand.aidl.gpx; + +parcelable StartGpxRecordingParams; \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/aidl/gpx/StartGpxRecordingParams.java b/OsmAnd/src/net/osmand/aidl/gpx/StartGpxRecordingParams.java new file mode 100644 index 0000000000..139eac8ea3 --- /dev/null +++ b/OsmAnd/src/net/osmand/aidl/gpx/StartGpxRecordingParams.java @@ -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 CREATOR = new Creator() { + @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; + } +} diff --git a/OsmAnd/src/net/osmand/aidl/gpx/StopGpxRecordingParams.aidl b/OsmAnd/src/net/osmand/aidl/gpx/StopGpxRecordingParams.aidl new file mode 100644 index 0000000000..db08f1811a --- /dev/null +++ b/OsmAnd/src/net/osmand/aidl/gpx/StopGpxRecordingParams.aidl @@ -0,0 +1,3 @@ +package net.osmand.aidl.gpx; + +parcelable StopGpxRecordingParams; \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/aidl/gpx/StopGpxRecordingParams.java b/OsmAnd/src/net/osmand/aidl/gpx/StopGpxRecordingParams.java new file mode 100644 index 0000000000..ada47db418 --- /dev/null +++ b/OsmAnd/src/net/osmand/aidl/gpx/StopGpxRecordingParams.java @@ -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 CREATOR = new Creator() { + @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; + } +}