mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Garmin: Add mapping for fit hill score
This commit is contained in:
+12
@@ -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);
|
||||
|
||||
+130
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user