1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2025-01-27 10:07:32 +01:00

Mi Band 9: Fix swimming parsing

This commit is contained in:
José Rebelo 2025-01-18 13:05:49 +00:00
parent 87fa5b44d7
commit 9e003fc562

View File

@ -616,6 +616,9 @@ public class WorkoutSummaryParser extends XiaomiActivityParser implements Activi
case 6: case 6:
headerSize = 4; headerSize = 4;
break; break;
case 7:
headerSize = 5;
break;
default: default:
LOG.warn("Unable to parse workout summary version {}", fileId.getVersion()); LOG.warn("Unable to parse workout summary version {}", fileId.getVersion());
return null; return null;
@ -628,42 +631,28 @@ public class WorkoutSummaryParser extends XiaomiActivityParser implements Activi
builder.addInt(ACTIVE_SECONDS, UNIT_SECONDS); builder.addInt(ACTIVE_SECONDS, UNIT_SECONDS);
builder.addInt(DISTANCE_METERS, UNIT_METERS); builder.addInt(DISTANCE_METERS, UNIT_METERS);
builder.addShort(CALORIES_BURNT, UNIT_KCAL); builder.addShort(CALORIES_BURNT, UNIT_KCAL);
if (version >= 7) {
builder.addUnknown(4);
}
builder.addUnknown(11); builder.addUnknown(11);
builder.addShort(STROKES, UNIT_STROKES); builder.addShort(STROKES, UNIT_STROKES);
builder.addByte(SWIM_STYLE, UNIT_NONE); builder.addByte(SWIM_STYLE, UNIT_NONE);
if (version >= 7) {
builder.addUnknown(1);
}
builder.addUnknown(1); builder.addUnknown(1);
builder.addShort(LAPS, UNIT_LAPS); builder.addShort(LAPS, UNIT_LAPS);
builder.addShort(SWOLF_AVG, UNIT_NONE); builder.addShort(SWOLF_AVG, UNIT_NONE);
builder.addUnknown(2); // minSWOLF builder.addShort("minSWOLF", UNIT_NONE);
builder.addByte("configuredLaneLength", UNIT_METERS); builder.addByte("configuredLaneLength", UNIT_METERS);
builder.addUnknown(6); builder.addUnknown(6);
// builder.addInt("activeSec2", UNIT_SECONDS); // builder.addInt("activeSec2", UNIT_SECONDS);
builder.addInt("configuredTimeGoal", UNIT_SECONDS); builder.addInt("configuredTimeGoal", UNIT_SECONDS);
builder.addShort("configuredCaloriesGoal", UNIT_KCAL); builder.addShort("configuredCaloriesGoal", UNIT_KCAL);
builder.addUnknown(8); builder.addUnknown(8);
builder.addByte("configuredLengthsGoal", UNIT_NONE); builder.addShort("configuredLengthsGoal", UNIT_NONE);
builder.addUnknown(14); builder.addUnknown(13);
builder.addByte("vitality_gain", UNIT_NONE); builder.addByte("vitality_gain", UNIT_NONE);
builder.addUnknown(60);
// builder.addInt("startingTime2", UNIT_UNIX_EPOCH_SECONDS);
// builder.addInt("endTime2", UNIT_UNIX_EPOCH_SECONDS);
// builder.addUnknown(4);
// builder.addInt("activeSec3", UNIT_SECONDS);
// builder.addInt("activeSec4", UNIT_SECONDS);
// builder.addUnknown(8);
// builder.addInt("caloriesBurnt2", UNIT_KCAL);
// builder.addInt("distanceMeter2", UNIT_METERS);
// builder.addUnknown(4);
builder.addInt(LAP_PACE_AVERAGE, UNIT_SECONDS);
builder.addInt(PACE_MAX, UNIT_SECONDS); // not confirmed
builder.addUnknown(4);
builder.addInt(STROKE_RATE_AVG, UNIT_STROKES_PER_MINUTE);
builder.addUnknown(14);
// builder.addInt("laps2", UNIT_LAPS);
// builder.addShort("avgSWOLF2", UNIT_NONE);
builder.addShort("minSWOLF", UNIT_NONE);
builder.addShort("maxSWOLF", UNIT_NONE);
// builder.addInt("totalStrokes2", UNIT_STROKES);
return builder.build(); return builder.build();
} }