-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Added get_route api function & aidl get_position #9304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ATMI
wants to merge
13
commits into
osmandapp:master
Choose a base branch
from
ATMI:feature/aidl_ex
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
f47eaf8
get_route api function
ATMI d16d530
aidl method stub to get location
ATMI b899b04
aidl output parameter as parcelable
ATMI 34261ca
APosition constructor params order fixed
ATMI 685e370
Merge remote-tracking branch 'origin/master' into feature/aidl_ex
ATMI 4a279ed
Merge remote-tracking branch 'osmandapp/master' into feature/aidl_ex
ATMI a219ef2
Order of AIDL methods rearranged; Added getCurrentRouteSegmentIndex()…
ATMI 1545783
Merge remote-tracking branch 'osmandapp/master' into feature/aidl_ex
ATMI 93c5901
get rid of duplicate class LatLonParcelable, use ALatLon instead; add…
ATMI ea341fa
Merge remote-tracking branch 'osmandapp/master' into feature/aidl_ex
ATMI 04c7327
getApplicationMode() aidl method added
ATMI 9c75003
Refactored due to https://github.com/osmandapp/OsmAnd/pull/9304#discu…
ATMI d5d8f1b
Merge remote-tracking branch 'osmandapp/master' into feature/aidl_ex
ATMI File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
OsmAnd-api/src/net/osmand/aidlapi/calculateroute/CalculatedRoute.aidl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| package net.osmand.aidlapi.calculateroute; | ||
|
|
||
| parcelable CalculatedRoute; |
133 changes: 133 additions & 0 deletions
133
OsmAnd-api/src/net/osmand/aidlapi/calculateroute/CalculatedRoute.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| package net.osmand.aidlapi.calculateroute; | ||
|
|
||
| import android.os.Bundle; | ||
| import android.os.Parcel; | ||
|
|
||
| import net.osmand.aidlapi.AidlParams; | ||
| import net.osmand.aidlapi.map.ALatLon; | ||
|
|
||
| import java.util.ArrayList; | ||
|
|
||
| public class CalculatedRoute extends AidlParams { | ||
|
|
||
| private boolean isRouteCalculated; | ||
|
|
||
| private String appMode; | ||
|
|
||
| private ArrayList<ALatLon> routePoints; | ||
| private int routeDistance; | ||
|
|
||
| private float routingTime; | ||
| private long creationTime; | ||
|
|
||
| private float calculationTime; | ||
|
|
||
| public CalculatedRoute() { | ||
|
|
||
| } | ||
|
|
||
| public CalculatedRoute(boolean isRouteCalculated, String appMode, ArrayList<ALatLon> routePoints, int routeDistance, float routingTime, long creationTime, float calculationTime) { | ||
| this.isRouteCalculated = isRouteCalculated; | ||
| this.appMode = appMode; | ||
| this.routePoints = routePoints; | ||
| this.routeDistance = routeDistance; | ||
| this.routingTime = routingTime; | ||
| this.creationTime = creationTime; | ||
| this.calculationTime = calculationTime; | ||
| } | ||
|
|
||
| protected CalculatedRoute(Parcel in) { | ||
| readFromParcel(in); | ||
| } | ||
|
|
||
| public static final Creator<CalculatedRoute> CREATOR = new Creator<CalculatedRoute>() { | ||
| @Override | ||
| public CalculatedRoute createFromParcel(Parcel in) { | ||
| return new CalculatedRoute(in); | ||
| } | ||
|
|
||
| @Override | ||
| public CalculatedRoute[] newArray(int size) { | ||
| return new CalculatedRoute[size]; | ||
| } | ||
| }; | ||
|
|
||
| public boolean isRouteCalculated() { | ||
| return isRouteCalculated; | ||
| } | ||
|
|
||
| public String getAppMode() { | ||
| return appMode; | ||
| } | ||
|
|
||
| public ArrayList<ALatLon> getRoutePoints() { | ||
| return routePoints; | ||
| } | ||
|
|
||
| public int getRouteDistance() { | ||
| return routeDistance; | ||
| } | ||
|
|
||
| public float getRoutingTime() { | ||
| return routingTime; | ||
| } | ||
|
|
||
| public long getCreationTime() { | ||
| return creationTime; | ||
| } | ||
|
|
||
| public float getCalculationTime() { | ||
| return calculationTime; | ||
| } | ||
|
|
||
| public void setRouteCalculated(boolean routeCalculated) { | ||
| isRouteCalculated = routeCalculated; | ||
| } | ||
|
|
||
| public void setAppMode(String appMode) { | ||
| this.appMode = appMode; | ||
| } | ||
|
|
||
| public void setRoutePoints(ArrayList<ALatLon> routePoints) { | ||
| this.routePoints = routePoints; | ||
| } | ||
|
|
||
| public void setRouteDistance(int routeDistance) { | ||
| this.routeDistance = routeDistance; | ||
| } | ||
|
|
||
| public void setRoutingTime(float routingTime) { | ||
| this.routingTime = routingTime; | ||
| } | ||
|
|
||
| public void setCreationTime(long creationTime) { | ||
| this.creationTime = creationTime; | ||
| } | ||
|
|
||
| public void setCalculationTime(float calculationTime) { | ||
| this.calculationTime = calculationTime; | ||
| } | ||
|
|
||
| @Override | ||
| protected void readFromBundle(Bundle bundle) { | ||
| bundle.setClassLoader(ALatLon.class.getClassLoader()); | ||
| isRouteCalculated = bundle.getBoolean("isRouteCalculated"); | ||
| appMode = bundle.getString("appMode"); | ||
| routePoints = bundle.getParcelableArrayList("routePoints"); | ||
| routeDistance = bundle.getInt("routeDistance"); | ||
| routingTime = bundle.getFloat("routingTime"); | ||
| creationTime = bundle.getLong("creationTime"); | ||
| calculationTime = bundle.getFloat("calculationTime"); | ||
| } | ||
|
|
||
| @Override | ||
| protected void writeToBundle(Bundle bundle) { | ||
| bundle.putBoolean("isRouteCalculated", isRouteCalculated); | ||
| bundle.putString("appMode", appMode); | ||
| bundle.putParcelableArrayList("routePoints", routePoints); | ||
| bundle.putInt("routeDistance", routeDistance); | ||
| bundle.putFloat("routingTime", routingTime); | ||
| bundle.putLong("creationTime", creationTime); | ||
| bundle.putFloat("calculationTime", calculationTime); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| package net.osmand.aidlapi.map; | ||
|
|
||
| parcelable ALocation; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| package net.osmand.aidlapi.map; | ||
|
|
||
| import android.os.Bundle; | ||
| import android.os.Parcel; | ||
|
|
||
| import net.osmand.aidlapi.AidlParams; | ||
|
|
||
| public class ALocation extends AidlParams { | ||
|
|
||
| public double getLatitude() { | ||
| return latitude; | ||
| } | ||
|
|
||
| public void setLatitude(double latitude) { | ||
| this.latitude = latitude; | ||
| } | ||
|
|
||
| public double getLongitude() { | ||
| return longitude; | ||
| } | ||
|
|
||
| public void setLongitude(double longitude) { | ||
| this.longitude = longitude; | ||
| } | ||
|
|
||
| public double getAltitude() { | ||
| return altitude; | ||
| } | ||
|
|
||
| public void setAltitude(double altitude) { | ||
| this.altitude = altitude; | ||
| } | ||
|
|
||
| public double getSpeed() { | ||
| return speed; | ||
| } | ||
|
|
||
| public void setSpeed(double speed) { | ||
| this.speed = speed; | ||
| } | ||
|
|
||
| public double getBearing() { | ||
| return bearing; | ||
| } | ||
|
|
||
| public void setBearing(double bearing) { | ||
| this.bearing = bearing; | ||
| } | ||
|
|
||
| private double latitude; | ||
| private double longitude; | ||
| private double altitude; | ||
| private double speed; | ||
| private double bearing; | ||
|
|
||
| public ALocation(double latitude, double longitude, double altitude, double speed, double bearing) { | ||
| this.latitude = latitude; | ||
| this.longitude = longitude; | ||
| this.altitude = altitude; | ||
| this.speed = speed; | ||
| this.bearing = bearing; | ||
| } | ||
|
|
||
| public ALocation(Parcel in) { | ||
| readFromParcel(in); | ||
| } | ||
|
|
||
| public static final Creator<ALocation> CREATOR = new | ||
| Creator<ALocation>() { | ||
| public ALocation createFromParcel(Parcel in) { | ||
| return new ALocation(in); | ||
| } | ||
|
|
||
| public ALocation[] newArray(int size) { | ||
| return new ALocation[size]; | ||
| } | ||
| }; | ||
|
|
||
| public ALocation() { | ||
| } | ||
|
|
||
| @Override | ||
| public int hashCode() { | ||
| final int prime = 31; | ||
| int result = 1; | ||
| int temp; | ||
| temp = (int)Math.floor(latitude * 10000); | ||
| result = prime * result + temp; | ||
| temp = (int)Math.floor(longitude * 10000); | ||
| result = prime * result + temp; | ||
| temp = (int)Math.floor(altitude * 10000); | ||
| result = prime * result + temp; | ||
| temp = (int)Math.floor(speed * 10000); | ||
| result = prime * result + temp; | ||
| temp = (int)Math.floor(bearing * 10000); | ||
| result = prime * result + temp; | ||
| return result; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean equals(Object obj) { | ||
| if (this == obj) | ||
| return true; | ||
| if (obj == null) | ||
| return false; | ||
| if (getClass() != obj.getClass()) | ||
| return false; | ||
|
|
||
| ALocation other = (ALocation) obj; | ||
| return Math.abs(latitude - other.latitude) < 0.00001 | ||
| && Math.abs(longitude - other.longitude) < 0.00001 | ||
| && Math.abs(altitude - other.altitude) < 1 | ||
| && Math.abs(speed - other.speed) < 1; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "Lat " + ((float)latitude) + " Lon " + ((float)longitude) + " Alt " + ((float)altitude); | ||
| } | ||
|
|
||
|
|
||
| @Override | ||
| protected void readFromBundle(Bundle bundle) { | ||
| latitude = bundle.getDouble("latitude", latitude); | ||
| longitude = bundle.getDouble("longitude", longitude); | ||
| altitude = bundle.getDouble("altitude", altitude); | ||
| speed = bundle.getDouble("speed", speed); | ||
| bearing = bundle.getDouble("bearing", bearing); | ||
| } | ||
|
|
||
| @Override | ||
| protected void writeToBundle(Bundle bundle) { | ||
| bundle.putDouble("latitude", latitude); | ||
| bundle.putDouble("longitude", longitude); | ||
| bundle.putDouble("altitude", altitude); | ||
| bundle.putDouble("speed", speed); | ||
| bundle.putDouble("bearing", bearing); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| package net.osmand.aidlapi.map; | ||
|
|
||
| parcelable ALocationType; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| package net.osmand.aidlapi.map; | ||
|
|
||
| import android.os.Parcel; | ||
| import android.os.Parcelable; | ||
|
|
||
| public enum ALocationType implements Parcelable { | ||
| CURRENT(0), | ||
| PROJECTION(1), | ||
| ROUTE_END(2), | ||
| ; | ||
|
|
||
| final int value; | ||
|
|
||
| ALocationType(int value) { | ||
| this.value = value; | ||
| } | ||
|
|
||
| public static final Creator<ALocationType> CREATOR = new Creator<ALocationType>() { | ||
| @Override | ||
| public ALocationType createFromParcel(Parcel in) { | ||
| return ALocationType.valueOf(in.readString()); | ||
| } | ||
|
|
||
| @Override | ||
| public ALocationType[] newArray(int size) { | ||
| return new ALocationType[size]; | ||
| } | ||
| }; | ||
|
|
||
| public int getValue() { | ||
| return value; | ||
| } | ||
|
|
||
| @Override | ||
| public int describeContents() { | ||
| return 0; | ||
| } | ||
|
|
||
| @Override | ||
| public void writeToParcel(Parcel dest, int flags) { | ||
| dest.writeString(name()); | ||
| } | ||
| } |
3 changes: 3 additions & 0 deletions
3
OsmAnd-api/src/net/osmand/aidlapi/navigation/NavigationStatus.aidl
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| package net.osmand.aidlapi.navigation; | ||
|
|
||
| parcelable NavigationStatus; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be refactored into 3 differnet methods:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done in latest commit