mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-03-13 01:30:09 +01:00
Add HDOP data and remove elevation zero in Xiaomi GPX exports.
This commit is contained in:
parent
9a52723139
commit
7458c582e1
@ -154,6 +154,15 @@ public class GPXExporter implements ActivityTrackExporter {
|
||||
ser.startTag(NS_GPX_URI, "desc").text(description).endTag(NS_GPX_URI, "desc");
|
||||
}
|
||||
//ser.startTag(NS_GPX_URI, "src").text(source).endTag(NS_GPX_URI, "src");
|
||||
if (location.hasHdop()) {
|
||||
ser.startTag(NS_GPX_URI, "hdop").text(formatDouble(location.getHdop())).endTag(NS_GPX_URI, "hdop");
|
||||
}
|
||||
if (location.hasVdop()) {
|
||||
ser.startTag(NS_GPX_URI, "vdop").text(formatDouble(location.getVdop())).endTag(NS_GPX_URI, "vdop");
|
||||
}
|
||||
if (location.hasPdop()) {
|
||||
ser.startTag(NS_GPX_URI, "pdop").text(formatDouble(location.getPdop())).endTag(NS_GPX_URI, "pdop");
|
||||
}
|
||||
|
||||
exportTrackpointExtensions(ser, point, trackPoints);
|
||||
|
||||
|
@ -28,8 +28,12 @@ public class GPSCoordinate {
|
||||
private final double latitude;
|
||||
private final double longitude;
|
||||
private final double altitude;
|
||||
private double hdop;
|
||||
private double vdop;
|
||||
private double pdop;
|
||||
|
||||
public static final double UNKNOWN_ALTITUDE = -20000d;
|
||||
public static final double UNKNOWN_DOP = -1d;
|
||||
|
||||
public static final int GPS_DECIMAL_DEGREES_SCALE = 6; // precise to 111.132mm at equator: https://en.wikipedia.org/wiki/Decimal_degrees
|
||||
|
||||
@ -37,6 +41,9 @@ public class GPSCoordinate {
|
||||
this.longitude = longitude;
|
||||
this.latitude = latitude;
|
||||
this.altitude = altitude;
|
||||
this.hdop = UNKNOWN_DOP;
|
||||
this.vdop = UNKNOWN_DOP;
|
||||
this.pdop = UNKNOWN_DOP;
|
||||
}
|
||||
|
||||
public GPSCoordinate(double longitude, double latitude) {
|
||||
@ -55,6 +62,36 @@ public class GPSCoordinate {
|
||||
return altitude;
|
||||
}
|
||||
|
||||
public void setHdop(double hdop) {
|
||||
this.hdop = hdop;
|
||||
}
|
||||
|
||||
public boolean hasHdop() {
|
||||
return (Double.compare(hdop, UNKNOWN_DOP) > 0);
|
||||
}
|
||||
|
||||
public double getHdop() { return hdop; }
|
||||
|
||||
public void setVdop(double vdop) {
|
||||
this.vdop = vdop;
|
||||
}
|
||||
|
||||
public boolean hasVdop() {
|
||||
return (Double.compare(vdop, UNKNOWN_DOP) > 0);
|
||||
}
|
||||
|
||||
public double getVdop() { return vdop; }
|
||||
|
||||
public void setPdop(double pdop) {
|
||||
this.pdop = pdop;
|
||||
}
|
||||
|
||||
public boolean hasPdop() {
|
||||
return (Double.compare(pdop, UNKNOWN_DOP) > 0);
|
||||
}
|
||||
|
||||
public double getPdop() { return pdop; }
|
||||
|
||||
public double getDistance(GPSCoordinate source) {
|
||||
final Location end = new Location("end");
|
||||
end.setLatitude(this.getLatitude());
|
||||
|
@ -105,13 +105,16 @@ public class WorkoutGpsParser extends XiaomiActivityParser {
|
||||
final int ts = buf.getInt();
|
||||
final float longitude = buf.getFloat();
|
||||
final float latitude = buf.getFloat();
|
||||
final int unk1 = buf.getInt(); // 0
|
||||
final float hdop = buf.getFloat() / 4.8f;
|
||||
final float speed = (buf.getShort() >> 2) / 10.0f;
|
||||
|
||||
final ActivityPoint ap = new ActivityPoint(new Date(ts * 1000L));
|
||||
ap.setLocation(new GPSCoordinate(longitude, latitude, 0));
|
||||
final GPSCoordinate gpsc = new GPSCoordinate(longitude, latitude);
|
||||
gpsc.setHdop(hdop);
|
||||
ap.setLocation(gpsc);
|
||||
|
||||
activityTrack.addTrackPoint(ap);
|
||||
LOG.trace("ActivityPoint: ts={} lon={} lat={} unk1={} speed={}", ts, longitude, latitude, unk1, speed);
|
||||
LOG.trace("ActivityPoint: ts={} lon={} lat={} hdop={} speed={}", ts, longitude, latitude, hdop, speed);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user