mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-06-06 21:28:11 +02:00
09c44f05f8
* Remove the dependency on PredefinedLocalMessage from generic fit parsing code * Standardize toString methods, omit types for known fields * Return null on unknown field number or names, instead of crashing * Map more Global FIT messages (device info, monitoring, sleep stages, sleep stats, stress level) * Prioritize "timestamp" over "253_timestamp" if specified explicitly in the global message definition * Introduce RecordData wrappers for each global message, allowing us to have proper types when getting data. If missing or unknown, the getter returns null. All classes are auto-generated by the FitCodeGen. * Persist a list of RecordData, instead of a Map from RecordDefinition * Fix parsing of compressed timestamps - keep them in computedTimestamp on each data record * Use timestamp16 if available in Monitoring records
40 lines
1.5 KiB
Java
40 lines
1.5 KiB
Java
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;
|
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.fieldDefinitions.FieldDefinitionGoalType.Type;
|
|
import nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.fieldDefinitions.FieldDefinitionGoalSource.Source;
|
|
|
|
//
|
|
// WARNING: This class was auto-generated, please avoid modifying it directly.
|
|
// See nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.codegen.FitCodeGen
|
|
//
|
|
public class FitGoals extends RecordData {
|
|
public FitGoals(final RecordDefinition recordDefinition, final RecordHeader recordHeader) {
|
|
super(recordDefinition, recordHeader);
|
|
|
|
final int globalNumber = recordDefinition.getGlobalFITMessage().getNumber();
|
|
if (globalNumber != 15) {
|
|
throw new IllegalArgumentException("FitFileId expects global messages of " + 15 + ", got " + globalNumber);
|
|
}
|
|
}
|
|
|
|
@Nullable
|
|
public Type getType() {
|
|
return (Type) getFieldByNumber(4);
|
|
}
|
|
|
|
@Nullable
|
|
public Long getTargetValue() {
|
|
return (Long) getFieldByNumber(7);
|
|
}
|
|
|
|
@Nullable
|
|
public Source getSource() {
|
|
return (Source) getFieldByNumber(11);
|
|
}
|
|
}
|