mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-09-01 03:55:47 +02:00
Xiaomi: Parse HIIT workout summary
This commit is contained in:
parent
8a6171962b
commit
6e2f7e01fc
@ -200,6 +200,7 @@ public class XiaomiActivityFileId implements Comparable<XiaomiActivityFileId> {
|
||||
SPORTS_INDOOR_CYCLING(Type.SPORTS, 0x07),
|
||||
SPORTS_FREESTYLE(Type.SPORTS, 0x08),
|
||||
SPORTS_POOL_SWIMMING(Type.SPORTS, 0x09),
|
||||
SPORTS_HIIT(Type.SPORTS, 0x10),
|
||||
SPORTS_ELLIPTICAL(Type.SPORTS, 0x0B),
|
||||
SPORTS_OUTDOOR_WALKING_V2(Type.SPORTS, 0x16),
|
||||
SPORTS_OUTDOOR_CYCLING(Type.SPORTS, 0x17),
|
||||
|
@ -165,6 +165,10 @@ public class WorkoutSummaryParser extends XiaomiActivityParser implements Activi
|
||||
summary.setActivityKind(ActivityKind.TYPE_SWIMMING);
|
||||
parser = getPoolSwimmingParser(fileId);
|
||||
break;
|
||||
case SPORTS_HIIT:
|
||||
summary.setActivityKind(ActivityKind.TYPE_EXERCISE);
|
||||
parser = getHiitParser(fileId);
|
||||
break;
|
||||
case SPORTS_ELLIPTICAL:
|
||||
summary.setActivityKind(ActivityKind.TYPE_ELLIPTICAL_TRAINER);
|
||||
// TODO
|
||||
@ -424,7 +428,42 @@ public class WorkoutSummaryParser extends XiaomiActivityParser implements Activi
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private XiaomiSimpleActivityParser getPoolSwimmingParser(final XiaomiActivityFileId fileId){
|
||||
private XiaomiSimpleActivityParser getHiitParser(final XiaomiActivityFileId fileId){
|
||||
final int version = fileId.getVersion();
|
||||
final int headerSize;
|
||||
switch (version) {
|
||||
case 5:
|
||||
headerSize = 3;
|
||||
break;
|
||||
default:
|
||||
LOG.warn("Unable to parse workout summary version {}", fileId.getVersion());
|
||||
return null;
|
||||
}
|
||||
|
||||
final XiaomiSimpleActivityParser.Builder builder = new XiaomiSimpleActivityParser.Builder();
|
||||
builder.setHeaderSize(headerSize);
|
||||
builder.addInt(TIME_START, UNIT_UNIX_EPOCH_SECONDS);
|
||||
builder.addInt(TIME_END, UNIT_UNIX_EPOCH_SECONDS);
|
||||
builder.addInt(ACTIVE_SECONDS, UNIT_SECONDS);
|
||||
builder.addShort(CALORIES_BURNT, UNIT_KCAL);
|
||||
builder.addByte(HR_AVG, UNIT_BPM);
|
||||
builder.addByte(HR_MAX, UNIT_BPM);
|
||||
builder.addByte(HR_MIN, UNIT_BPM);
|
||||
builder.addFloat(TRAINING_EFFECT_AEROBIC, UNIT_NONE);
|
||||
builder.addUnknown(1);
|
||||
builder.addUnknown(1);
|
||||
builder.addShort(RECOVERY_TIME, UNIT_HOURS);
|
||||
builder.addInt(HR_ZONE_EXTREME, UNIT_SECONDS);
|
||||
builder.addInt(HR_ZONE_ANAEROBIC, UNIT_SECONDS);
|
||||
builder.addInt(HR_ZONE_AEROBIC, UNIT_SECONDS);
|
||||
builder.addInt(HR_ZONE_FAT_BURN, UNIT_SECONDS);
|
||||
builder.addInt(HR_ZONE_WARM_UP, UNIT_SECONDS);
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private XiaomiSimpleActivityParser getPoolSwimmingParser(final XiaomiActivityFileId fileId) {
|
||||
final int version = fileId.getVersion();
|
||||
final int headerSize;
|
||||
switch (version) {
|
||||
|
Loading…
Reference in New Issue
Block a user