1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-09 19:49:30 +01:00

Xiaomi: Identify strength training, elliptical and outdoor running

This commit is contained in:
José Rebelo 2023-12-26 22:07:35 +00:00
parent aa7c2b1731
commit c9fec4e33a

View File

@ -89,19 +89,17 @@ public class WorkoutSummaryParser extends XiaomiActivityParser implements Activi
@Override
public BaseActivitySummary parseBinaryData(final BaseActivitySummary summary) {
final JSONObject summaryData = new JSONObject();
final ByteBuffer buf = ByteBuffer.wrap(summary.getRawSummaryData()).order(ByteOrder.LITTLE_ENDIAN);
final XiaomiActivityFileId fileId = XiaomiActivityFileId.from(buf);
switch (fileId.getSubtype()) {
case SPORTS_OUTDOOR_RUNNING:
break;
return parseOutdoorRunning(summary, fileId, buf);
case SPORTS_FREESTYLE:
break;
return parseFreestyle(summary, fileId, buf);
case SPORTS_ELLIPTICAL:
break;
return parseElliptical(summary, fileId, buf);
case SPORTS_OUTDOOR_WALKING:
return parseOutdoorWalking(summary, fileId, buf);
case SPORTS_OUTDOOR_CYCLING:
@ -113,6 +111,30 @@ public class WorkoutSummaryParser extends XiaomiActivityParser implements Activi
return null;
}
private BaseActivitySummary parseOutdoorRunning(final BaseActivitySummary summary, final XiaomiActivityFileId fileId, final ByteBuffer buf) {
summary.setActivityKind(ActivityKind.TYPE_RUNNING);
// TODO
return summary;
}
private BaseActivitySummary parseFreestyle(final BaseActivitySummary summary, final XiaomiActivityFileId fileId, final ByteBuffer buf) {
summary.setActivityKind(ActivityKind.TYPE_STRENGTH_TRAINING);
// TODO
return summary;
}
private BaseActivitySummary parseElliptical(final BaseActivitySummary summary, final XiaomiActivityFileId fileId, final ByteBuffer buf) {
summary.setActivityKind(ActivityKind.TYPE_ELLIPTICAL_TRAINER);
// TODO
return summary;
}
private BaseActivitySummary parseOutdoorWalking(final BaseActivitySummary summary, final XiaomiActivityFileId fileId, final ByteBuffer buf) {
final JSONObject summaryData = new JSONObject();