mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-04 01:09:47 +01:00
Start to support activity summary version 518
Incomplete, lot of missing stuff. no swimming, etc.
This commit is contained in:
parent
b31fab1efc
commit
555eb34575
@ -203,26 +203,73 @@ public class FetchSportsSummaryOperation extends AbstractFetchOperation {
|
||||
summary.setBaseLatitude(baseLatitude);
|
||||
summary.setBaseAltitude(baseAltitude);
|
||||
|
||||
// unused data (for now)
|
||||
float distanceMeters = buffer.getFloat();
|
||||
float ascentMeters = buffer.getFloat();
|
||||
float descentMeters = buffer.getFloat();
|
||||
float maxAltitude = buffer.getFloat();
|
||||
float minAltitude = buffer.getFloat();
|
||||
int maxLatitude = buffer.getInt(); // format?
|
||||
int minLatitude = buffer.getInt(); // format?
|
||||
int maxLongitude = buffer.getInt(); // format?
|
||||
int minLongitude = buffer.getInt(); // format?
|
||||
int steps = buffer.getInt();
|
||||
int activeSeconds = buffer.getInt();
|
||||
float caloriesBurnt = buffer.getFloat();
|
||||
float maxSpeed = buffer.getFloat();
|
||||
float minPace = buffer.getFloat(); // format?
|
||||
float maxPace = buffer.getFloat(); // format?
|
||||
float totalStride = buffer.getFloat();
|
||||
int steps;
|
||||
int activeSeconds;
|
||||
int maxLatitude;
|
||||
int minLatitude;
|
||||
int maxLongitude;
|
||||
int minLongitude;
|
||||
float caloriesBurnt;
|
||||
float distanceMeters;
|
||||
float ascentMeters = 0;
|
||||
float descentMeters = 0;
|
||||
float maxAltitude = 0;
|
||||
float minAltitude = 0;
|
||||
float maxSpeed = 0;
|
||||
float minPace;
|
||||
float maxPace;
|
||||
float totalStride = 0;
|
||||
float averageStride;
|
||||
short averageHR;
|
||||
short averageKMPaceSeconds;
|
||||
|
||||
// Just assuming, Bip has 259 which seems like 256+x
|
||||
// Bip S now has 518 so assuming 512+x, might be wrong
|
||||
|
||||
if (version >= 512) {
|
||||
steps = buffer.getInt();
|
||||
activeSeconds = buffer.getInt();
|
||||
//unknown
|
||||
buffer.getLong();
|
||||
buffer.getLong();
|
||||
caloriesBurnt = buffer.getFloat();
|
||||
distanceMeters = buffer.getFloat();
|
||||
//unknown
|
||||
buffer.getLong();
|
||||
buffer.getLong();
|
||||
buffer.getLong();
|
||||
buffer.getLong();
|
||||
maxPace = buffer.getFloat();
|
||||
minPace = buffer.getFloat();
|
||||
//unknown
|
||||
buffer.getLong();
|
||||
buffer.getLong();
|
||||
buffer.getLong();
|
||||
buffer.getLong();
|
||||
buffer.getInt();
|
||||
averageHR = buffer.getShort();
|
||||
averageKMPaceSeconds = buffer.getShort();
|
||||
averageStride = buffer.getShort();
|
||||
buffer.getShort(); // unknown
|
||||
} else {
|
||||
distanceMeters = buffer.getFloat();
|
||||
ascentMeters = buffer.getFloat();
|
||||
descentMeters = buffer.getFloat();
|
||||
maxAltitude = buffer.getFloat();
|
||||
minAltitude = buffer.getFloat();
|
||||
maxLatitude = buffer.getInt(); // format?
|
||||
minLatitude = buffer.getInt(); // format?
|
||||
maxLongitude = buffer.getInt(); // format?
|
||||
minLongitude = buffer.getInt(); // format?
|
||||
steps = buffer.getInt();
|
||||
activeSeconds = buffer.getInt();
|
||||
caloriesBurnt = buffer.getFloat();
|
||||
maxSpeed = buffer.getFloat();
|
||||
minPace = buffer.getFloat();
|
||||
maxPace = buffer.getFloat();
|
||||
totalStride = buffer.getFloat();
|
||||
|
||||
buffer.getInt(); // unknown
|
||||
|
||||
if (activityKind == ActivityKind.TYPE_SWIMMING) {
|
||||
// 28 bytes
|
||||
float averageStrokeDistance = buffer.getFloat();
|
||||
@ -236,16 +283,6 @@ public class FetchSportsSummaryOperation extends AbstractFetchOperation {
|
||||
buffer.getInt(); // unknown
|
||||
buffer.getShort(); // unknown
|
||||
|
||||
LOG.debug("unused swim data:" +
|
||||
"\naverageStrokeDistance=" + averageStrokeDistance +
|
||||
"\naverageStrokesPerSecond=" + averageStrokesPerSecond +
|
||||
"\naverageLapPace" + averageLapPace +
|
||||
"\nstrokes=" + strokes +
|
||||
"\nswolfIndex=" + swolfIndex +
|
||||
"\nswimStyle=" + swimStyle + // 1 = breast, 2 = freestyle
|
||||
"\nlaps=" + laps +
|
||||
""
|
||||
);
|
||||
addSummaryData("averageStrokeDistance", averageStrokeDistance, "meter", "Strokes");
|
||||
addSummaryData("averageStrokesPerSecond", averageStrokesPerSecond, "strokes_second", "Strokes");
|
||||
addSummaryData("averageLapPace", averageLapPace, "second", "Laps");
|
||||
@ -263,44 +300,17 @@ public class FetchSportsSummaryOperation extends AbstractFetchOperation {
|
||||
int descentSeconds = buffer.getInt() / 1000; //ms?
|
||||
buffer.getInt(); // unknown;
|
||||
int flatSeconds = buffer.getInt() / 1000; // ms?
|
||||
LOG.debug("unused non-swim data:" +
|
||||
"\nascentSeconds=" + ascentSeconds +
|
||||
"\ndescentSeconds=" + descentSeconds +
|
||||
"\nflatSeconds=" + flatSeconds +
|
||||
""
|
||||
);
|
||||
|
||||
addSummaryData("ascentSeconds", ascentSeconds, "seconds", "Elevation");
|
||||
addSummaryData("descentSeconds", descentSeconds, "seconds", "Elevation");
|
||||
addSummaryData("flatSeconds", flatSeconds, "seconds", "Elevation");
|
||||
}
|
||||
|
||||
short averageHR = buffer.getShort();
|
||||
averageHR = buffer.getShort();
|
||||
|
||||
short averageKMPaceSeconds = buffer.getShort();
|
||||
short averageStride = buffer.getShort();
|
||||
|
||||
LOG.debug("unused common:" +
|
||||
"\ndistanceMeters=" + distanceMeters +
|
||||
"\nascentMeters=" + ascentMeters +
|
||||
"\ndescentMeters=" + descentMeters +
|
||||
"\nmaxAltitude=" + maxAltitude +
|
||||
"\nminAltitude=" + minAltitude +
|
||||
//"\nmaxLatitude=" + maxLatitude + // not useful
|
||||
//"\nminLatitude=" + minLatitude + // not useful
|
||||
//"\nmaxLongitude=" + maxLongitude + // not useful
|
||||
//"\nminLongitude=" + minLongitude + // not useful
|
||||
"\nsteps=" + steps +
|
||||
"\nactiveSeconds=" + activeSeconds +
|
||||
"\ncaloriesBurnt=" + caloriesBurnt +
|
||||
"\nmaxSpeed=" + maxSpeed +
|
||||
"\nminPace=" + minPace +
|
||||
"\nmaxPace=" + maxPace +
|
||||
"\ntotalStride=" + totalStride +
|
||||
"\naverageHR=" + averageHR +
|
||||
"\naverageKMPaceSeconds=" + averageKMPaceSeconds +
|
||||
"\naverageStride=" + averageStride +
|
||||
""
|
||||
);
|
||||
averageKMPaceSeconds = buffer.getShort();
|
||||
averageStride = buffer.getShort();
|
||||
}
|
||||
|
||||
// summary.setBaseCoordinate(new GPSCoordinate(baseLatitude, baseLongitude, baseAltitude));
|
||||
// summary.setDistanceMeters(distanceMeters);
|
||||
@ -329,8 +339,12 @@ public class FetchSportsSummaryOperation extends AbstractFetchOperation {
|
||||
addSummaryData("distanceMeters", distanceMeters, "meters", "Activity");
|
||||
addSummaryData("ascentMeters", ascentMeters, "meters", "Elevation");
|
||||
addSummaryData("descentMeters", descentMeters, "meters", "Elevation");
|
||||
if (maxAltitude != -100000) {
|
||||
addSummaryData("maxAltitude", maxAltitude, "meters", "Elevation");
|
||||
}
|
||||
if (minAltitude != 100000) {
|
||||
addSummaryData("minAltitude", minAltitude, "meters", "Elevation");
|
||||
}
|
||||
addSummaryData("steps", steps, "steps_unit", "Activity");
|
||||
addSummaryData("activeSeconds", activeSeconds, "seconds", "Activity");
|
||||
addSummaryData("caloriesBurnt", caloriesBurnt, "calories_unit", "Activity");
|
||||
|
Loading…
Reference in New Issue
Block a user