Garmin: Add mapping for fit hill score

This commit is contained in:
José Rebelo
2026-01-21 21:43:38 +00:00
parent d3c1df3ad6
commit 9f97b0fc90
3 changed files with 143 additions and 0 deletions
@@ -2013,6 +2013,17 @@ public class GlobalFITMessage {
new FieldDefinitionPrimitive(253, BaseType.UINT32, "timestamp", FieldDefinitionFactory.FIELD.TIMESTAMP)
));
// Source: matrix
public static GlobalFITMessage HILL_SCORE = new GlobalFITMessage(403, "HILL_SCORE", Arrays.asList(
new FieldDefinitionPrimitive(0, BaseType.UINT8, "hill_score"),
new FieldDefinitionPrimitive(1, BaseType.UINT8, "hill_strength"),
new FieldDefinitionPrimitive(2, BaseType.UINT8, "hill_endurance"),
new FieldDefinitionPrimitive(3, BaseType.ENUM, "unknown_3"), // 2?
new FieldDefinitionPrimitive(4, BaseType.ENUM, "unknown_4"), // 2?
new FieldDefinitionPrimitive(5, BaseType.ENUM, "unknown_5"),
new FieldDefinitionPrimitive(253, BaseType.UINT32, "timestamp", FieldDefinitionFactory.FIELD.TIMESTAMP)
));
// Source: #5708
public static GlobalFITMessage ENDURANCE_SCORE = new GlobalFITMessage(403, "ENDURANCE_SCORE", Arrays.asList(
new FieldDefinitionPrimitive(0, BaseType.UINT16, "endurance_score"),
@@ -2189,6 +2200,7 @@ public class GlobalFITMessage {
put(394, CPE_STATUS);
put(397, SKIN_TEMP_RAW);
put(398, SKIN_TEMP_OVERNIGHT);
put(402, HILL_SCORE);
put(403, ENDURANCE_SCORE);
put(409, HSA_WRIST_TEMPERATURE_DATA);
put(412, NAP);
@@ -0,0 +1,130 @@
/* Copyright (C) 2026 Freeyourgadget
This file is part of Gadgetbridge.
Gadgetbridge is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Gadgetbridge is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>. */
package nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.messages;
import androidx.annotation.Nullable;
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.FitRecordDataBuilder;
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 {@link nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.codegen.FitCodeGen}
*
* @noinspection unused
*/
public class FitHillScore extends RecordData {
public FitHillScore(final RecordDefinition recordDefinition, final RecordHeader recordHeader) {
super(recordDefinition, recordHeader);
final int globalNumber = recordDefinition.getGlobalFITMessage().getNumber();
if (globalNumber != 403) {
throw new IllegalArgumentException("FitHillScore expects global messages of " + 403 + ", got " + globalNumber);
}
}
@Nullable
public Integer getHillScore() {
return getFieldByNumber(0, Integer.class);
}
@Nullable
public Integer getHillStrength() {
return getFieldByNumber(1, Integer.class);
}
@Nullable
public Integer getHillEndurance() {
return getFieldByNumber(2, Integer.class);
}
@Nullable
public Integer getUnknown3() {
return getFieldByNumber(3, Integer.class);
}
@Nullable
public Integer getUnknown4() {
return getFieldByNumber(4, Integer.class);
}
@Nullable
public Integer getUnknown5() {
return getFieldByNumber(5, Integer.class);
}
@Nullable
public Long getTimestamp() {
return getFieldByNumber(253, Long.class);
}
/**
* @noinspection unused
*/
public static class Builder extends FitRecordDataBuilder {
public Builder() {
super(403);
}
public Builder setHillScore(final Integer value) {
setFieldByNumber(0, value);
return this;
}
public Builder setHillStrength(final Integer value) {
setFieldByNumber(1, value);
return this;
}
public Builder setHillEndurance(final Integer value) {
setFieldByNumber(2, value);
return this;
}
public Builder setUnknown3(final Integer value) {
setFieldByNumber(3, value);
return this;
}
public Builder setUnknown4(final Integer value) {
setFieldByNumber(4, value);
return this;
}
public Builder setUnknown5(final Integer value) {
setFieldByNumber(5, value);
return this;
}
public Builder setTimestamp(final Long value) {
setFieldByNumber(253, value);
return this;
}
@Override
public FitHillScore build() {
return (FitHillScore) super.build();
}
@Override
public FitHillScore build(final int localMessageType) {
return (FitHillScore) super.build(localMessageType);
}
}
}
@@ -172,6 +172,7 @@ public class FitRecordDataFactory {
case 394 -> new FitCpeStatus(recordDefinition, recordHeader);
case 397 -> new FitSkinTempRaw(recordDefinition, recordHeader);
case 398 -> new FitSkinTempOvernight(recordDefinition, recordHeader);
case 403 -> new FitHillScore(recordDefinition, recordHeader);
case 403 -> new FitEnduranceScore(recordDefinition, recordHeader);
case 409 -> new FitHsaWristTemperatureData(recordDefinition, recordHeader);
case 412 -> new FitNap(recordDefinition, recordHeader);