1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-10 12:09:27 +01:00

Zepp OS: display swimming-related activity data

This commit is contained in:
Reiner Herrmann 2023-10-16 23:15:15 +02:00
parent 1d3f9b6ec1
commit 4abde0766d
4 changed files with 50 additions and 5 deletions

View File

@ -145,5 +145,30 @@ public class Huami2021ActivitySummaryParser extends HuamiActivitySummaryParser {
addSummaryData("ascentSeconds", summaryProto.getElevation().getUphillTime(), "seconds");
addSummaryData("descentSeconds", summaryProto.getElevation().getDownhillTime(), "seconds");
}
if (summaryProto.hasSwimmingData()) {
addSummaryData("laps", summaryProto.getSwimmingData().getLaps(), "laps_unit");
switch (summaryProto.getSwimmingData().getLaneLengthUnit()) {
case 0:
addSummaryData("laneLength", summaryProto.getSwimmingData().getLaneLength(), "meters");
break;
case 1:
addSummaryData("laneLength", summaryProto.getSwimmingData().getLaneLength(), "yard");
break;
}
switch (summaryProto.getSwimmingData().getStyle()) {
case 1:
addSummaryData("swimStyle", "breaststroke");
break;
case 2:
addSummaryData("swimStyle", "freestyle");
break;
}
addSummaryData("strokes", summaryProto.getSwimmingData().getStrokes(), "strokes_unit");
addSummaryData("avgStrokeRate", summaryProto.getSwimmingData().getAvgStrokeRate(), "strokes_minute");
addSummaryData("maxStrokeRate", summaryProto.getSwimmingData().getMaxStrokeRate(), "strokes_minute");
addSummaryData("averageStrokeDistance", summaryProto.getSwimmingData().getAvgDps(), "cm");
addSummaryData("swolfIndex", summaryProto.getSwimmingData().getSwolf(), "");
}
}
}

View File

@ -153,7 +153,8 @@ public class ActivitySummaryJsonSummary {
private JSONObject createActivitySummaryGroups(){
final Map<String, List<String>> groupDefinitions = new HashMap<String, List<String>>() {{
put("Strokes", Arrays.asList(
"averageStrokeDistance", "averageStrokesPerSecond", "strokes"
"averageStrokeDistance", "averageStrokesPerSecond", "strokes",
"avgStrokeRate", "maxStrokeRate"
));
put("Swimming", Arrays.asList(
"swolfIndex", "swimStyle"
@ -179,8 +180,8 @@ public class ActivitySummaryJsonSummary {
"aerobicTrainingEffect", "anaerobicTrainingEffect", "currentWorkoutLoad",
"maximumOxygenUptake"
));
put("Laps", Arrays.asList(
"averageLapPace", "laps"
put("laps", Arrays.asList(
"averageLapPace", "laps", "laneLength"
));
}};

View File

@ -10,6 +10,7 @@ message WorkoutSummary {
Distance distance = 4;
Steps steps = 11;
Time time = 7;
SwimmingData swimmingData = 9;
Pace pace = 10;
Altitude altitude = 13;
HeartRate heartRate = 19;
@ -96,3 +97,15 @@ message TrainingEffect {
int32 currentWorkoutLoad = 6;
int32 maximumOxygenUptake = 7; // ml/kg/min
}
message SwimmingData {
uint32 style = 1; // 1: breaststroke, 2: freestyle
uint32 laps = 2;
uint32 strokes = 3;
uint32 avgDps = 4; // cm
uint32 swolf = 5;
uint32 avgStrokeRate = 6; // stroke/min
uint32 maxStrokeRate = 7; // stroke/min
uint32 laneLength = 8;
uint32 laneLengthUnit = 9; // 0: meter, 1: yard
}

View File

@ -1691,9 +1691,13 @@
<string name="minCadence">Min Cadence</string>
<string name="averageStrokeDistance">Average Stroke Distance</string>
<string name="averageStrokesPerSecond">Average Strokes</string>
<string name="avgStrokeRate">Average Stroke Rate</string>
<string name="maxStrokeRate">Max Stroke Rate</string>
<string name="strokes">Total Strokes</string>
<string name="averageLapPace">Average Lap Pace</string>
<string name="swolfIndex">swolfIndex</string>
<string name="swimStyle">swimStyle</string>
<string name="swolfIndex">SWOLF</string>
<string name="swimStyle">Swim Style</string>
<string name="laneLength">Lane Length</string>
<string name="laps">Laps</string>
<string name="ascentSeconds">Ascending</string>
<string name="descentSeconds">Descending</string>
@ -1703,6 +1707,7 @@
<!-- activity summary units-->
<string name="meters">m</string>
<string name="cm">cm</string>
<string name="yard">yard</string>
<string name="ft">ft</string>
<string name="steps_unit">steps</string>
<string name="meters_second">m/s</string>
@ -1710,6 +1715,7 @@
<string name="mi_h">mi/h</string>
<string name="minutes_mi">min/mi</string>
<string name="strokes_second">str/s</string>
<string name="strokes_minute">str/min</string>
<string name="strokes_unit">str</string>
<string name="seconds">sec</string>
<string name="swolf_index">swolf index</string>