mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Garmin: Parse max met data and training load
This commit is contained in:
+17
@@ -436,6 +436,15 @@ public class GlobalFITMessage {
|
||||
new FieldDefinitionPrimitive(253, BaseType.UINT32, "timestamp", FieldDefinitionFactory.FIELD.TIMESTAMP)
|
||||
));
|
||||
|
||||
public static GlobalFITMessage MAX_MET_DATA = new GlobalFITMessage(229, "MAX_MET_DATA", Arrays.asList(
|
||||
new FieldDefinitionPrimitive(0, BaseType.UINT32, "update_time", FieldDefinitionFactory.FIELD.TIMESTAMP),
|
||||
new FieldDefinitionPrimitive(2, BaseType.UINT16, "vo2_max", 10, 0),
|
||||
new FieldDefinitionPrimitive(5, BaseType.ENUM, "sport"),
|
||||
new FieldDefinitionPrimitive(6, BaseType.ENUM, "sub_sport"),
|
||||
new FieldDefinitionPrimitive(8, BaseType.ENUM, "max_met_category"), // 0 generic
|
||||
new FieldDefinitionPrimitive(9, BaseType.ENUM, "calibrated_data") // 1?
|
||||
));
|
||||
|
||||
public static GlobalFITMessage RESPIRATION_RATE = new GlobalFITMessage(297, "RESPIRATION_RATE", Arrays.asList(
|
||||
new FieldDefinitionPrimitive(0, BaseType.SINT16, "respiration_rate", 100, 0), // breaths / min
|
||||
new FieldDefinitionPrimitive(253, BaseType.UINT32, "timestamp", FieldDefinitionFactory.FIELD.TIMESTAMP)
|
||||
@@ -482,6 +491,12 @@ public class GlobalFITMessage {
|
||||
new FieldDefinitionPrimitive(253, BaseType.UINT32, "timestamp", FieldDefinitionFactory.FIELD.TIMESTAMP)
|
||||
));
|
||||
|
||||
public static GlobalFITMessage TRAINING_LOAD = new GlobalFITMessage(378, "TRAINING_LOAD", Arrays.asList(
|
||||
new FieldDefinitionPrimitive(3, BaseType.UINT16, "training_load_acute"),
|
||||
new FieldDefinitionPrimitive(4, BaseType.UINT16, "training_load_chronic"),
|
||||
new FieldDefinitionPrimitive(253, BaseType.UINT32, "timestamp", FieldDefinitionFactory.FIELD.TIMESTAMP)
|
||||
));
|
||||
|
||||
public static GlobalFITMessage SKIN_TEMP_OVERNIGHT = new GlobalFITMessage(398, "SKIN_TEMP_OVERNIGHT", Arrays.asList(
|
||||
new FieldDefinitionPrimitive(0, BaseType.UINT32, "local_timestamp"), // garmin timestamp, but in user timezone
|
||||
new FieldDefinitionPrimitive(1, BaseType.FLOAT32, "average_deviation"),
|
||||
@@ -532,6 +547,7 @@ public class GlobalFITMessage {
|
||||
put(222, ALARM_SETTINGS);
|
||||
put(225, SET);
|
||||
put(227, STRESS_LEVEL);
|
||||
put(229, MAX_MET_DATA);
|
||||
put(269, SPO2);
|
||||
put(273, SLEEP_DATA_INFO);
|
||||
put(274, SLEEP_DATA_RAW);
|
||||
@@ -540,6 +556,7 @@ public class GlobalFITMessage {
|
||||
put(346, SLEEP_STATS);
|
||||
put(370, HRV_SUMMARY);
|
||||
put(371, HRV_VALUE);
|
||||
put(378, TRAINING_LOAD);
|
||||
put(397, SKIN_TEMP_RAW);
|
||||
put(398, SKIN_TEMP_OVERNIGHT);
|
||||
put(412, NAP);
|
||||
|
||||
+2
@@ -42,6 +42,8 @@ import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
|
||||
@RequiresApi(api = Build.VERSION_CODES.O)
|
||||
public class FitCodeGen {
|
||||
public static void main(final String[] args) throws Exception {
|
||||
// To run this in Android Studio, right click and select "Run 'FitCodeGen.main()' with Coverage"
|
||||
// for some reason, the classpath is broken otherwise.
|
||||
new FitCodeGen().generate();
|
||||
}
|
||||
|
||||
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.messages;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.RecordData;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.RecordDefinition;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.RecordHeader;
|
||||
|
||||
//
|
||||
// WARNING: This class was auto-generated, please avoid modifying it directly.
|
||||
// See nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.codegen.FitCodeGen
|
||||
//
|
||||
public class FitMaxMetData extends RecordData {
|
||||
public FitMaxMetData(final RecordDefinition recordDefinition, final RecordHeader recordHeader) {
|
||||
super(recordDefinition, recordHeader);
|
||||
|
||||
final int globalNumber = recordDefinition.getGlobalFITMessage().getNumber();
|
||||
if (globalNumber != 229) {
|
||||
throw new IllegalArgumentException("FitMaxMetData expects global messages of " + 229 + ", got " + globalNumber);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Long getUpdateTime() {
|
||||
return (Long) getFieldByNumber(0);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Float getVo2Max() {
|
||||
return (Float) getFieldByNumber(2);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Integer getSport() {
|
||||
return (Integer) getFieldByNumber(5);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Integer getSubSport() {
|
||||
return (Integer) getFieldByNumber(6);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Integer getMaxMetCategory() {
|
||||
return (Integer) getFieldByNumber(8);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Integer getCalibratedData() {
|
||||
return (Integer) getFieldByNumber(9);
|
||||
}
|
||||
}
|
||||
+4
@@ -75,6 +75,8 @@ public class FitRecordDataFactory {
|
||||
return new FitSet(recordDefinition, recordHeader);
|
||||
case 227:
|
||||
return new FitStressLevel(recordDefinition, recordHeader);
|
||||
case 229:
|
||||
return new FitMaxMetData(recordDefinition, recordHeader);
|
||||
case 269:
|
||||
return new FitSpo2(recordDefinition, recordHeader);
|
||||
case 273:
|
||||
@@ -91,6 +93,8 @@ public class FitRecordDataFactory {
|
||||
return new FitHrvSummary(recordDefinition, recordHeader);
|
||||
case 371:
|
||||
return new FitHrvValue(recordDefinition, recordHeader);
|
||||
case 378:
|
||||
return new FitTrainingLoad(recordDefinition, recordHeader);
|
||||
case 397:
|
||||
return new FitSkinTempRaw(recordDefinition, recordHeader);
|
||||
case 398:
|
||||
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
package nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.messages;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.RecordData;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.RecordDefinition;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.RecordHeader;
|
||||
|
||||
//
|
||||
// WARNING: This class was auto-generated, please avoid modifying it directly.
|
||||
// See nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.codegen.FitCodeGen
|
||||
//
|
||||
public class FitTrainingLoad extends RecordData {
|
||||
public FitTrainingLoad(final RecordDefinition recordDefinition, final RecordHeader recordHeader) {
|
||||
super(recordDefinition, recordHeader);
|
||||
|
||||
final int globalNumber = recordDefinition.getGlobalFITMessage().getNumber();
|
||||
if (globalNumber != 378) {
|
||||
throw new IllegalArgumentException("FitTrainingLoad expects global messages of " + 378 + ", got " + globalNumber);
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Integer getTrainingLoadAcute() {
|
||||
return (Integer) getFieldByNumber(3);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Integer getTrainingLoadChronic() {
|
||||
return (Integer) getFieldByNumber(4);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Long getTimestamp() {
|
||||
return (Long) getFieldByNumber(253);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user