LocationManager: expose more information from the backend to the apps

note: GnssStatus was accidentally bundled into ab5b600bf1
This commit is contained in:
Mis012
2025-03-26 21:25:39 +01:00
parent d2e2ab37bc
commit 12121d2d48
5 changed files with 87 additions and 9 deletions

View File

@@ -4,12 +4,27 @@ public class Location {
private double latitude;
private double longitude;
private double altitude;
private double accuracy;
private double speed;
private double bearing;
private long timestamp;
public Location (double latitude, double longitude, double bearing) {
/* for internal use */
public Location (double latitude,
double longitude,
double altitude,
double accuracy,
double speed,
double bearing,
long timestamp) {
this.latitude = latitude;
this.longitude = longitude;
this.altitude = altitude;
this.accuracy = accuracy;
this.speed = speed;
this.bearing = bearing;
this.timestamp = timestamp;
}
public double getLatitude() {
@@ -20,8 +35,43 @@ public class Location {
return longitude;
}
public double getBearing() {
return bearing;
public boolean hasAltitude() {
return altitude != -Double.MAX_VALUE;
}
public double getAltitude() {
return altitude;
}
public boolean hasAccuracy() {
return true;
}
public float getAccuracy() {
return (float)accuracy;
}
public boolean hasSpeed() {
return speed != -1;
}
public float getSpeed() {
return (float)speed;
}
public boolean hasBearing() {
return bearing != -1;
}
public float getBearing() {
return (float)bearing;
}
public long getTime() {
return timestamp;
}
public String getProvider() {
return "fused";
}
}