1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-06-02 19:36:14 +02:00
Gadgetbridge/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/garmin/fit/MesgType.java
Daniele Gobbetti 7ee82e6afa Garmin protocol: add initial support for FIT messages
note: only weather message definition and data tested so far
also enable weather support for Instinct 2S and vivomove style
also cleanup some unused constants that have been migrated to new enums in GFDIMessage
additionally switch to new local implementation of GarminTimeUtils with needed methods
2024-05-01 23:35:15 +01:00

33 lines
918 B
Java

package nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit;
public enum MesgType {
TODAY_WEATHER_CONDITIONS(6, 128),
HOURLY_WEATHER_FORECAST(9, 128),
DAILY_WEATHER_FORECAST(10, 128);
private final int identifier;
private final int globalMesgNum;
MesgType(int id, int globalMesgNum) {
this.identifier = id;
this.globalMesgNum = globalMesgNum;
}
public static MesgType fromIdentifier(int identifier) {
for (final MesgType mesgType : MesgType.values()) {
if (mesgType.getIdentifier() == identifier) {
return mesgType;
}
}
throw new IllegalArgumentException("Unknown type " + identifier); //TODO: perhaps we need to handle unknown message types
}
public int getIdentifier() {
return identifier;
}
public int getGlobalMesgNum() {
return globalMesgNum;
}
}