From 598e737f10f70e98aea7005d96f2917edfcc6e18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Rebelo?= Date: Sat, 12 Oct 2024 13:33:37 +0100 Subject: [PATCH] Garmin: Map some missing fields in FitRecord --- .../devices/garmin/fit/GlobalFITMessage.java | 10 ++++- .../garmin/fit/messages/FitRecord.java | 44 ++++++++++++++++++- 2 files changed, 51 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/garmin/fit/GlobalFITMessage.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/garmin/fit/GlobalFITMessage.java index 7322c6e58..75dc79a85 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/garmin/fit/GlobalFITMessage.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/garmin/fit/GlobalFITMessage.java @@ -139,10 +139,18 @@ public class GlobalFITMessage { new FieldDefinitionPrimitive(1, BaseType.SINT32, "longitude", FieldDefinitionFactory.FIELD.COORDINATE), new FieldDefinitionPrimitive(2, BaseType.UINT16, "altitude", 5, 500), // m new FieldDefinitionPrimitive(3, BaseType.UINT8, "heart_rate"), + new FieldDefinitionPrimitive(4, BaseType.UINT8, "cadence"), // rpm new FieldDefinitionPrimitive(5, BaseType.UINT32, "distance", 100, 0), // m new FieldDefinitionPrimitive(6, BaseType.UINT16, "speed", 1000, 0), // m/s - new FieldDefinitionPrimitive(73, BaseType.UINT32, "enhanced_speed"), // mm/s + new FieldDefinitionPrimitive(7, BaseType.UINT16, "power"), // watt + new FieldDefinitionPrimitive(29, BaseType.UINT32, "accumulated_power"), // watt + new FieldDefinitionPrimitive(39, BaseType.UINT16, "oscillation", 10, 0), // mm + new FieldDefinitionPrimitive(42, BaseType.ENUM, "activity"), + new FieldDefinitionPrimitive(53, BaseType.UINT8, "fractional_cadence", 128, 0), // rpm + new FieldDefinitionPrimitive(73, BaseType.UINT32, "enhanced_speed", 1000, 0), // mm/s new FieldDefinitionPrimitive(78, BaseType.UINT32, "enhanced_altitude", 5, 500), // m + new FieldDefinitionPrimitive(83, BaseType.UINT16, "vertical_ratio", 100, 0), // % + new FieldDefinitionPrimitive(85, BaseType.UINT16, "step_length", 10, 0), // mm new FieldDefinitionPrimitive(136, BaseType.UINT8, "wrist_heart_rate"), new FieldDefinitionPrimitive(143, BaseType.UINT8, "body_battery"), new FieldDefinitionPrimitive(253, BaseType.UINT32, "timestamp", FieldDefinitionFactory.FIELD.TIMESTAMP) diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/garmin/fit/messages/FitRecord.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/garmin/fit/messages/FitRecord.java index 9c868f3a4..7889ab721 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/garmin/fit/messages/FitRecord.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/garmin/fit/messages/FitRecord.java @@ -45,6 +45,11 @@ public class FitRecord extends RecordData { return (Integer) getFieldByNumber(3); } + @Nullable + public Integer getCadence() { + return (Integer) getFieldByNumber(4); + } + @Nullable public Double getDistance() { return (Double) getFieldByNumber(5); @@ -56,8 +61,33 @@ public class FitRecord extends RecordData { } @Nullable - public Long getEnhancedSpeed() { - return (Long) getFieldByNumber(73); + public Integer getPower() { + return (Integer) getFieldByNumber(7); + } + + @Nullable + public Long getAccumulatedPower() { + return (Long) getFieldByNumber(29); + } + + @Nullable + public Float getOscillation() { + return (Float) getFieldByNumber(39); + } + + @Nullable + public Integer getActivity() { + return (Integer) getFieldByNumber(42); + } + + @Nullable + public Float getFractionalCadence() { + return (Float) getFieldByNumber(53); + } + + @Nullable + public Double getEnhancedSpeed() { + return (Double) getFieldByNumber(73); } @Nullable @@ -65,6 +95,16 @@ public class FitRecord extends RecordData { return (Double) getFieldByNumber(78); } + @Nullable + public Float getVerticalRatio() { + return (Float) getFieldByNumber(83); + } + + @Nullable + public Float getStepLength() { + return (Float) getFieldByNumber(85); + } + @Nullable public Integer getWristHeartRate() { return (Integer) getFieldByNumber(136);