mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-26 02:25:50 +01:00
Bangle.js: actTrack reorder activity details
This commit is contained in:
parent
e23c5f2dd4
commit
c2c53d5495
@ -966,68 +966,6 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
summary.setRawDetailsPath(String.valueOf(inputFile));
|
summary.setRawDetailsPath(String.valueOf(inputFile));
|
||||||
|
|
||||||
JSONObject summaryData = new JSONObject();
|
JSONObject summaryData = new JSONObject();
|
||||||
// private JSONObject createActivitySummaryGroups(){
|
|
||||||
// final Map<String, List<String>> groupDefinitions = new HashMap<String, List<String>>() {{
|
|
||||||
// put("Strokes", Arrays.asList(
|
|
||||||
// "averageStrokeDistance", "averageStrokesPerSecond", "strokes"
|
|
||||||
// ));
|
|
||||||
|
|
||||||
// put("Swimming", Arrays.asList(
|
|
||||||
// "swolfIndex", "swimStyle"
|
|
||||||
// ));
|
|
||||||
|
|
||||||
// put("Elevation", Arrays.asList(
|
|
||||||
// "ascentMeters", "descentMeters", "maxAltitude", "minAltitude", "averageAltitude",
|
|
||||||
// "baseAltitude", "ascentSeconds", "descentSeconds", "flatSeconds", "ascentDistance",
|
|
||||||
// "descentDistance", "flatDistance", "elevationGain", "elevationLoss"
|
|
||||||
// ));
|
|
||||||
if (storedLogObject.has("Altitude") || storedLogObject.has("Barometer Altitude")) {
|
|
||||||
summaryData = addSummaryData(summaryData, "ascentMeters", 3, "mm");
|
|
||||||
summaryData = addSummaryData(summaryData, "descentMeters", 3, "mm");
|
|
||||||
summaryData = addSummaryData(summaryData, "maxAltitude", 3, "mm");
|
|
||||||
summaryData = addSummaryData(summaryData, "minAltitude", 3, "mm");
|
|
||||||
summaryData = addSummaryData(summaryData, "averageAltitude", 3, "mm");
|
|
||||||
summaryData = addSummaryData(summaryData, "baseAltitude", 3, "mm");
|
|
||||||
summaryData = addSummaryData(summaryData, "ascentSeconds", 3, "mm");
|
|
||||||
summaryData = addSummaryData(summaryData, "descentSeconds", 3, "mm");
|
|
||||||
summaryData = addSummaryData(summaryData, "flatSeconds", 3, "mm");
|
|
||||||
if (analyticsObject.has("Intermittent Distance")) {
|
|
||||||
summaryData = addSummaryData(summaryData, "ascentDistance", 3, "mm");
|
|
||||||
summaryData = addSummaryData(summaryData, "descentDistance", 3, "mm");
|
|
||||||
summaryData = addSummaryData(summaryData, "flatDistance", 3, "mm");
|
|
||||||
}
|
|
||||||
summaryData = addSummaryData(summaryData, "elevationGain", 3, "mm");
|
|
||||||
summaryData = addSummaryData(summaryData, "elevationLoss", 3, "mm");
|
|
||||||
}
|
|
||||||
// put("Speed", Arrays.asList(
|
|
||||||
// "averageSpeed", "maxSpeed", "minSpeed", "averageKMPaceSeconds", "minPace",
|
|
||||||
// "maxPace", "averageSpeed2", "averageCadence", "maxCadence", "minCadence"
|
|
||||||
// ));
|
|
||||||
try {
|
|
||||||
if (analyticsObject.has("Speed")) {
|
|
||||||
//summaryData = addSummaryData(summaryData,"averageSpeed",averageOfJSONArray(analyticsObject.getJSONArray("Speed")),"mm"); // This seems to be calculated somewhere else automatically.
|
|
||||||
summaryData = addSummaryData(summaryData, "maxSpeed", maxOfJSONArray(analyticsObject.getJSONArray("Speed")), "m/s");
|
|
||||||
//summaryData = addSummaryData(summaryData, "minSpeed", minOfJSONArray(analyticsObject.getJSONArray("Speed")), "m/s");
|
|
||||||
//summaryData = addSummaryData(summaryData, "averageKMPaceSeconds", averageOfJSONArray(analyticsObject.getJSONArray("Pace")), "s/km"); // Is this also calculated automatically then?
|
|
||||||
//summaryData = addSummaryData(summaryData, "averageKMPaceSeconds",
|
|
||||||
// (float) (1000.0 * analyticsObject.getJSONArray("Elapsed Time").getDouble(logLength-1) /
|
|
||||||
// analyticsObject.getJSONArray("Total Distance").getDouble(logLength-1)),
|
|
||||||
// "s/km"
|
|
||||||
//);
|
|
||||||
summaryData = addSummaryData(summaryData, "minPace", minOfJSONArray(analyticsObject.getJSONArray("Pace")), "s/km");
|
|
||||||
summaryData = addSummaryData(summaryData, "maxPace", maxOfJSONArray(analyticsObject.getJSONArray("Pace")), "s/km");
|
|
||||||
//summaryData = addSummaryData(summaryData,"averageSpeed2",3,"mm");
|
|
||||||
}
|
|
||||||
if (analyticsObject.has("Cadence")) {
|
|
||||||
summaryData = addSummaryData(summaryData, "averageCadence",
|
|
||||||
60 * sumOfJSONArray(storedLogObject.getJSONArray("Steps")) /
|
|
||||||
(float) analyticsObject.getJSONArray("Elapsed Time").getDouble(logLength - 1),
|
|
||||||
"steps/min"
|
|
||||||
);
|
|
||||||
summaryData = addSummaryData(summaryData, "maxCadence", maxOfJSONArray(analyticsObject.getJSONArray("Cadence")), "steps/min");
|
|
||||||
summaryData = addSummaryData(summaryData, "minCadence", minOfJSONArray(analyticsObject.getJSONArray("Cadence")), "steps/min");
|
|
||||||
}
|
|
||||||
|
|
||||||
// put("Activity", Arrays.asList(
|
// put("Activity", Arrays.asList(
|
||||||
// "distanceMeters", "steps", "activeSeconds", "caloriesBurnt", "totalStride",
|
// "distanceMeters", "steps", "activeSeconds", "caloriesBurnt", "totalStride",
|
||||||
// "averageHR", "maxHR", "minHR", "averageStride", "maxStride", "minStride"
|
// "averageHR", "maxHR", "minHR", "averageStride", "maxStride", "minStride"
|
||||||
@ -1054,9 +992,77 @@ public class BangleJSDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
summaryData = addSummaryData(summaryData, "maxStride", maxOfJSONArray(analyticsObject.getJSONArray("Stride")), "m/stride");
|
summaryData = addSummaryData(summaryData, "maxStride", maxOfJSONArray(analyticsObject.getJSONArray("Stride")), "m/stride");
|
||||||
summaryData = addSummaryData(summaryData, "minStride", minOfJSONArray(analyticsObject.getJSONArray("Stride")), "m/stride");
|
summaryData = addSummaryData(summaryData, "minStride", minOfJSONArray(analyticsObject.getJSONArray("Stride")), "m/stride");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// put("Speed", Arrays.asList(
|
||||||
|
// "averageSpeed", "maxSpeed", "minSpeed", "averageKMPaceSeconds", "minPace",
|
||||||
|
// "maxPace", "averageSpeed2", "averageCadence", "maxCadence", "minCadence"
|
||||||
|
// ));
|
||||||
|
try {
|
||||||
|
if (analyticsObject.has("Speed")) {
|
||||||
|
//summaryData = addSummaryData(summaryData,"averageSpeed",averageOfJSONArray(analyticsObject.getJSONArray("Speed")),"mm"); // This seems to be calculated somewhere else automatically.
|
||||||
|
summaryData = addSummaryData(summaryData, "maxSpeed", maxOfJSONArray(analyticsObject.getJSONArray("Speed")), "m/s");
|
||||||
|
summaryData = addSummaryData(summaryData, "minSpeed", minOfJSONArray(analyticsObject.getJSONArray("Speed")), "m/s");
|
||||||
|
//summaryData = addSummaryData(summaryData, "averageKMPaceSeconds", averageOfJSONArray(analyticsObject.getJSONArray("Pace")), "s/km"); // Is this also calculated automatically then?
|
||||||
|
//summaryData = addSummaryData(summaryData, "averageKMPaceSeconds",
|
||||||
|
// (float) (1000.0 * analyticsObject.getJSONArray("Elapsed Time").getDouble(logLength-1) /
|
||||||
|
// analyticsObject.getJSONArray("Total Distance").getDouble(logLength-1)),
|
||||||
|
// "s/km"
|
||||||
|
//);
|
||||||
|
summaryData = addSummaryData(summaryData, "minPace", minOfJSONArray(analyticsObject.getJSONArray("Pace")), "s/km");
|
||||||
|
summaryData = addSummaryData(summaryData, "maxPace", maxOfJSONArray(analyticsObject.getJSONArray("Pace")), "s/km");
|
||||||
|
//summaryData = addSummaryData(summaryData,"averageSpeed2",3,"mm");
|
||||||
|
}
|
||||||
|
if (analyticsObject.has("Cadence")) {
|
||||||
|
summaryData = addSummaryData(summaryData, "averageCadence",
|
||||||
|
60 * sumOfJSONArray(storedLogObject.getJSONArray("Steps")) /
|
||||||
|
(float) analyticsObject.getJSONArray("Elapsed Time").getDouble(logLength - 1),
|
||||||
|
"steps/min"
|
||||||
|
);
|
||||||
|
summaryData = addSummaryData(summaryData, "maxCadence", maxOfJSONArray(analyticsObject.getJSONArray("Cadence")), "steps/min");
|
||||||
|
summaryData = addSummaryData(summaryData, "minCadence", minOfJSONArray(analyticsObject.getJSONArray("Cadence")), "steps/min");
|
||||||
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LOG.error(e + ". (thrown when trying to add summary data");
|
LOG.error(e + ". (thrown when trying to add summary data");
|
||||||
}
|
}
|
||||||
|
// private JSONObject createActivitySummaryGroups(){
|
||||||
|
// final Map<String, List<String>> groupDefinitions = new HashMap<String, List<String>>() {{
|
||||||
|
// put("Strokes", Arrays.asList(
|
||||||
|
// "averageStrokeDistance", "averageStrokesPerSecond", "strokes"
|
||||||
|
// ));
|
||||||
|
|
||||||
|
// put("Swimming", Arrays.asList(
|
||||||
|
// "swolfIndex", "swimStyle"
|
||||||
|
// ));
|
||||||
|
|
||||||
|
// put("Elevation", Arrays.asList(
|
||||||
|
// "ascentMeters", "descentMeters", "maxAltitude", "minAltitude", "averageAltitude",
|
||||||
|
// "baseAltitude", "ascentSeconds", "descentSeconds", "flatSeconds", "ascentDistance",
|
||||||
|
// "descentDistance", "flatDistance", "elevationGain", "elevationLoss"
|
||||||
|
// ));
|
||||||
|
if (storedLogObject.has("Altitude") || storedLogObject.has("Barometer Altitude")) {
|
||||||
|
String altitudeToUseKey = null;
|
||||||
|
if (storedLogObject.has("Altitude")) {
|
||||||
|
altitudeToUseKey = "Altitude";
|
||||||
|
} else if (storedLogObject.has("Barometer Altitude")) {
|
||||||
|
altitudeToUseKey = "Barometer Altitude";
|
||||||
|
}
|
||||||
|
//summaryData = addSummaryData(summaryData, "ascentMeters", 3, "m");
|
||||||
|
//summaryData = addSummaryData(summaryData, "descentMeters", 3, "m");
|
||||||
|
summaryData = addSummaryData(summaryData, "maxAltitude", maxOfJSONArray(storedLogObject.getJSONArray(altitudeToUseKey)), "m");
|
||||||
|
summaryData = addSummaryData(summaryData, "minAltitude", minOfJSONArray(storedLogObject.getJSONArray(altitudeToUseKey)), "m");
|
||||||
|
summaryData = addSummaryData(summaryData, "averageAltitude", averageOfJSONArray(storedLogObject.getJSONArray(altitudeToUseKey)), "m");
|
||||||
|
//summaryData = addSummaryData(summaryData, "baseAltitude", 3, "m");
|
||||||
|
//summaryData = addSummaryData(summaryData, "ascentSeconds", 3, "s");
|
||||||
|
//summaryData = addSummaryData(summaryData, "descentSeconds", 3, "s");
|
||||||
|
//summaryData = addSummaryData(summaryData, "flatSeconds", 3, "s");
|
||||||
|
//if (analyticsObject.has("Intermittent Distance")) {
|
||||||
|
// summaryData = addSummaryData(summaryData, "ascentDistance", 3, "m");
|
||||||
|
// summaryData = addSummaryData(summaryData, "descentDistance", 3, "m");
|
||||||
|
// summaryData = addSummaryData(summaryData, "flatDistance", 3, "m");
|
||||||
|
//}
|
||||||
|
//summaryData = addSummaryData(summaryData, "elevationGain", 3, "mm");
|
||||||
|
//summaryData = addSummaryData(summaryData, "elevationLoss", 3, "mm");
|
||||||
|
}
|
||||||
// put("HeartRateZones", Arrays.asList(
|
// put("HeartRateZones", Arrays.asList(
|
||||||
// "hrZoneNa", "hrZoneWarmUp", "hrZoneFatBurn", "hrZoneAerobic", "hrZoneAnaerobic",
|
// "hrZoneNa", "hrZoneWarmUp", "hrZoneFatBurn", "hrZoneAerobic", "hrZoneAnaerobic",
|
||||||
// "hrZoneExtreme"
|
// "hrZoneExtreme"
|
||||||
|
Loading…
Reference in New Issue
Block a user