1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-27 02:55:50 +01:00

Map activity kinds for Garmin, CMF and Zepp OS

This commit is contained in:
José Rebelo 2024-08-15 16:36:07 +01:00
parent 9354765d34
commit 404e432adf
6 changed files with 695 additions and 411 deletions

View File

@ -57,6 +57,229 @@ public enum ActivityKind {
// FIXME: Deprecate these - they're just kept around while we do not support reading from the old db // FIXME: Deprecate these - they're just kept around while we do not support reading from the old db
VIVOMOVE_HR_TRANSITION(0x00000001 | 0x00000010 | 0x00000020 | 0x00000200 | 0x00000040, R.string.transition), VIVOMOVE_HR_TRANSITION(0x00000001 | 0x00000010 | 0x00000020 | 0x00000200 | 0x00000040, R.string.transition),
// Non-legacy activity kinds after 0x04000000
NAVIGATE(0x04000000, R.string.activity_type_navigate),
INDOOR_TRACK(0x04000001, R.string.activity_type_indoor_track),
HANDCYCLING(0x04000002, R.string.activity_type_handcycling),
E_BIKE(0x04000003, R.string.activity_type_e_bike),
BIKE_COMMUTE(0x04000004, R.string.activity_type_bike_commute),
HANDCYCLING_INDOOR(0x04000005, R.string.activity_type_handcycling_indoor),
TRANSITION(0x04000006, R.string.activity_type_transition),
FITNESS_EQUIPMENT(0x04000007, R.string.activity_type_fitness_equipment),
STAIR_STEPPER(0x04000008, R.string.activity_type_stair_stepper),
PILATES(0x04000009, R.string.activity_type_pilates),
POOL_SWIM(0x0400000a, R.string.activity_type_pool_swimming),
TENNIS(0x0400000b, R.string.activity_type_tennis),
PLATFORM_TENNIS(0x0400000c, R.string.activity_type_platform_tennis),
TABLE_TENNIS(0x0400000d, R.string.activity_type_table_tennis),
AMERICAN_FOOTBALL(0x0400000e, R.string.activity_type_american_football),
TRAINING(0x0400000f, R.string.activity_type_training),
CARDIO(0x04000010, R.string.activity_type_cardio),
BREATHWORK(0x04000011, R.string.activity_type_breathwork),
INDOOR_WALKING(0x04000012, R.string.activity_type_indoor_walking),
XC_CLASSIC_SKI(0x04000013, R.string.activity_type_xc_classic_ski),
SKIING(0x04000014, R.string.activity_type_skiing),
SNOWBOARDING(0x04000015, R.string.activity_type_snowboarding),
ROWING(0x04000016, R.string.activity_type_rowing),
MOUNTAINEERING(0x04000017, R.string.activity_type_mountaineering),
MULTISPORT(0x04000019, R.string.activity_type_multisport),
PADDLING(0x0400001a, R.string.activity_type_paddling),
FLYING(0x0400001b, R.string.activity_type_flying),
MOTORCYCLING(0x0400001d, R.string.activity_type_motorcycling),
BOATING(0x0400001e, R.string.activity_type_boating),
DRIVING(0x0400001f, R.string.activity_type_driving),
GOLF(0x04000020, R.string.activity_type_golf),
HANG_GLIDING(0x04000021, R.string.activity_type_hang_gliding),
HUNTING(0x04000023, R.string.activity_type_hunting),
FISHING(0x04000024, R.string.activity_type_fishing),
INLINE_SKATING(0x04000025, R.string.activity_type_inline_skating),
ROCK_CLIMBING(0x04000026, R.string.activity_type_rock_climbing),
CLIMB_INDOOR(0x04000027, R.string.activity_type_climb_indoor),
BOULDERING(0x04000028, R.string.activity_type_bouldering),
SAIL_RACE(0x0400002a, R.string.activity_type_sail_race),
SAIL_EXPEDITION(0x0400002b, R.string.activity_type_sail_expedition),
ICE_SKATING(0x0400002c, R.string.activity_type_ice_skating),
SKY_DIVING(0x0400002d, R.string.activity_type_sky_diving),
SNOWSHOE(0x0400002e, R.string.activity_type_snowshoe),
SNOWMOBILING(0x0400002f, R.string.activity_type_snowmobiling),
STAND_UP_PADDLEBOARDING(0x04000030, R.string.activity_type_stand_up_paddleboarding),
SURFING(0x04000031, R.string.activity_type_surfing),
WAKEBOARDING(0x04000032, R.string.activity_type_wakeboarding),
WATER_SKIING(0x04000033, R.string.activity_type_water_skiing),
KAYAKING(0x04000034, R.string.activity_type_kayaking),
RAFTING(0x04000035, R.string.activity_type_rafting),
WINDSURFING(0x04000036, R.string.activity_type_windsurfing),
KITESURFING(0x04000037, R.string.activity_type_kitesurfing),
TACTICAL(0x04000038, R.string.activity_type_tactical),
JUMPMASTER(0x04000039, R.string.activity_type_jumpmaster),
BOXING(0x0400003a, R.string.activity_type_boxing),
FLOOR_CLIMBING(0x0400003b, R.string.activity_type_floor_climbing),
BASEBALL(0x0400003c, R.string.activity_type_baseball),
SOFTBALL(0x0400003d, R.string.activity_type_softball),
SOFTBALL_SLOW_PITCH(0x0400003e, R.string.activity_type_softball_slow_pitch),
SHOOTING(0x0400003f, R.string.activity_type_shooting),
AUTO_RACING(0x04000040, R.string.activity_type_auto_racing),
WINTER_SPORT(0x04000041, R.string.activity_type_winter_sport),
GRINDING(0x04000042, R.string.activity_type_grinding),
HEALTH_SNAPSHOT(0x04000043, R.string.activity_type_health_snapshot),
MARINE(0x04000044, R.string.activity_type_marine),
HIIT(0x04000045, R.string.activity_type_hiit),
VIDEO_GAMING(0x04000046, R.string.activity_type_video_gaming),
RACKET(0x04000047, R.string.activity_type_racket),
PICKLEBALL(0x04000048, R.string.activity_type_pickleball),
PADEL(0x04000049, R.string.activity_type_padel),
SQUASH(0x0400004a, R.string.activity_type_squash),
RACQUETBALL(0x0400004b, R.string.activity_type_racquetball),
PUSH_WALK_SPEED(0x0400004c, R.string.activity_type_push_walk_speed),
INDOOR_PUSH_WALK_SPEED(0x0400004d, R.string.activity_type_indoor_push_walk_speed),
PUSH_RUN_SPEED(0x0400004e, R.string.activity_type_push_run_speed),
INDOOR_PUSH_RUN_SPEED(0x0400004f, R.string.activity_type_indoor_push_run_speed),
MEDITATION(0x04000050, R.string.activity_type_meditation),
PARA_SPORT(0x04000051, R.string.activity_type_para_sport),
DISC_GOLF(0x04000052, R.string.activity_type_disc_golf),
ULTIMATE_DISC(0x04000053, R.string.activity_type_ultimate_disc),
TEAM_SPORT(0x04000054, R.string.activity_type_team_sport),
RUGBY(0x04000055, R.string.activity_type_rugby),
HOCKEY(0x04000056, R.string.activity_type_hockey),
LACROSSE(0x04000057, R.string.activity_type_lacrosse),
VOLLEYBALL(0x04000058, R.string.activity_type_volleyball),
WATER_TUBING(0x04000059, R.string.activity_type_water_tubing),
WAKESURFING(0x0400005a, R.string.activity_type_wakesurfing),
MIXED_MARTIAL_ARTS(0x0400005b, R.string.activity_type_mixed_martial_arts), // aka MMA
DANCE(0x0400005c, R.string.activity_type_dance),
MOUNTAIN_HIKE(0x040000e2, R.string.activity_type_mountain_hike),
CROSS_TRAINER(0x0400005d, R.string.activity_type_cross_trainer),
FREE_TRAINING(0x0400005e, R.string.activity_type_free_training),
DYNAMIC_CYCLE(0x0400005f, R.string.activity_type_dynamic_cycle),
KICKBOXING(0x04000060, R.string.activity_type_kickboxing),
FITNESS_EXERCISES(0x04000061, R.string.activity_type_fitness_exercises),
CROSSFIT(0x04000062, R.string.activity_type_crossfit),
FUNCTIONAL_TRAINING(0x04000063, R.string.activity_type_functional_training),
PHYSICAL_TRAINING(0x04000064, R.string.activity_type_physical_training),
TAEKWONDO(0x04000065, R.string.activity_type_taekwondo),
TAE_BO(0x04000066, R.string.activity_type_tae_bo),
CROSS_COUNTRY_RUNNING(0x04000067, R.string.activity_type_cross_country_running),
KARATE(0x04000068, R.string.activity_type_karate),
FENCING(0x04000069, R.string.activity_type_fencing),
CORE_TRAINING(0x0400006a, R.string.activity_type_core_training),
KENDO(0x0400006b, R.string.activity_type_kendo),
HORIZONTAL_BAR(0x0400006c, R.string.activity_type_horizontal_bar),
PARALLEL_BAR(0x0400006d, R.string.activity_type_parallel_bar),
COOLDOWN(0x0400006e, R.string.activity_type_cooldown),
CROSS_TRAINING(0x0400006f, R.string.activity_type_cross_training),
SIT_UPS(0x04000070, R.string.activity_type_sit_ups),
FITNESS_GAMING(0x04000071, R.string.activity_type_fitness_gaming),
AEROBIC_EXERCISE(0x04000072, R.string.activity_type_aerobic_exercise),
ROLLING(0x04000073, R.string.activity_type_rolling),
FLEXIBILITY(0x04000074, R.string.activity_type_flexibility),
GYMNASTICS(0x04000075, R.string.activity_type_gymnastics),
TRACK_AND_FIELD(0x04000076, R.string.activity_type_track_and_field),
PUSH_UPS(0x04000077, R.string.activity_type_push_ups),
BATTLE_ROPE(0x04000078, R.string.activity_type_battle_rope),
SMITH_MACHINE(0x04000079, R.string.activity_type_smith_machine),
PULL_UPS(0x0400007a, R.string.activity_type_pull_ups),
PLANK(0x0400007b, R.string.activity_type_plank),
JAVELIN(0x0400007c, R.string.activity_type_javelin),
LONG_JUMP(0x0400007d, R.string.activity_type_long_jump),
HIGH_JUMP(0x0400007e, R.string.activity_type_high_jump),
TRAMPOLINE(0x0400007f, R.string.activity_type_trampoline),
DUMBBELL(0x04000080, R.string.activity_type_dumbbell),
BELLY_DANCE(0x04000081, R.string.activity_type_belly_dance),
JAZZ_DANCE(0x04000082, R.string.activity_type_jazz_dance),
LATIN_DANCE(0x04000083, R.string.activity_type_latin_dance),
BALLET(0x04000084, R.string.activity_type_ballet),
STREET_DANCE(0x04000085, R.string.activity_type_street_dance),
ZUMBA(0x04000086, R.string.activity_type_zumba),
ROLLER_SKATING(0x04000087, R.string.activity_type_roller_skating),
MARTIAL_ARTS(0x04000088, R.string.activity_type_martial_arts),
TAI_CHI(0x04000089, R.string.activity_type_tai_chi),
HULA_HOOPING(0x0400008a, R.string.activity_type_hula_hooping),
DISC_SPORTS(0x0400008b, R.string.activity_type_disc_sports),
DARTS(0x0400008c, R.string.activity_type_darts),
ARCHERY(0x0400008d, R.string.activity_type_archery),
HORSE_RIDING(0x0400008e, R.string.activity_type_horse_riding),
KITE_FLYING(0x0400008f, R.string.activity_type_kite_flying),
SWING(0x04000090, R.string.activity_type_swing),
STAIRS(0x04000091, R.string.activity_type_stairs),
MIND_AND_BODY(0x04000092, R.string.activity_type_mind_and_body),
WRESTLING(0x04000093, R.string.activity_type_wrestling),
KABADDI(0x04000094, R.string.activity_type_kabaddi),
KARTING(0x04000095, R.string.activity_type_karting),
BILLIARDS(0x04000096, R.string.activity_type_billiards),
BOWLING(0x04000097, R.string.activity_type_bowling),
SHUTTLECOCK(0x04000098, R.string.activity_type_shuttlecock),
HANDBALL(0x04000099, R.string.activity_type_handball),
DODGEBALL(0x0400009a, R.string.activity_type_dodgeball),
AUSTRALIAN_FOOTBALL(0x0400009b, R.string.activity_type_australian_football),
LACROSS(0x0400009c, R.string.activity_type_lacross),
SHOT(0x0400009d, R.string.activity_type_shot),
BEACH_SOCCER(0x0400009e, R.string.activity_type_beach_soccer),
BEACH_VOLLEYBALL(0x0400009f, R.string.activity_type_beach_volleyball),
GATEBALL(0x040000a0, R.string.activity_type_gateball),
SEPAK_TAKRAW(0x040000a1, R.string.activity_type_sepak_takraw),
SAILING(0x040000a2, R.string.activity_type_sailing),
JET_SKIING(0x040000a3, R.string.activity_type_jet_skiing),
SKATING(0x040000a4, R.string.activity_type_skating),
ICE_HOCKEY(0x040000a5, R.string.activity_type_ice_hockey),
CURLING(0x040000a6, R.string.activity_type_curling),
CROSS_COUNTRY_SKIING(0x040000a8, R.string.activity_type_cross_country_skiing),
SNOW_SPORTS(0x040000a9, R.string.activity_type_snow_sports),
LUGE(0x040000ab, R.string.activity_type_luge),
SKATEBOARDING(0x040000ac, R.string.activity_type_skateboarding),
PARACHUTING(0x040000ae, R.string.activity_type_parachuting),
PARKOUR(0x040000af, R.string.activity_type_parkour),
INDOOR_RUNNING(0x040000b0, R.string.activity_type_indoor_running),
OUTDOOR_RUNNING(0x040000b1, R.string.activity_type_outdoor_running),
OUTDOOR_WALKING(0x040000b2, R.string.activity_type_outdoor_walking),
OUTDOOR_CYCLING(0x040000b3, R.string.activity_type_outdoor_cycling),
AEROBIC_COMBO(0x040000b4, R.string.activity_type_aerobic_combo),
AEROBICS(0x040000b5, R.string.activity_type_aerobics),
AIR_WALKER(0x040000b6, R.string.activity_type_air_walker),
ARTISTIC_SWIMMING(0x040000b7, R.string.activity_type_artistic_swimming),
BALLROOM_DANCE(0x040000b8, R.string.activity_type_ballroom_dance),
BMX(0x040000b9, R.string.activity_type_bmx),
BOARD_GAME(0x040000ba, R.string.activity_type_board_game),
BOCCE(0x040000bb, R.string.activity_type_bocce),
BREAKING(0x040000bc, R.string.activity_type_breaking),
BRIDGE(0x040000bd, R.string.activity_type_bridge),
CARDIO_COMBAT(0x040000be, R.string.activity_type_cardio_combat),
CHECKERS(0x040000bf, R.string.activity_type_checkers),
CHESS(0x040000c0, R.string.activity_type_chess),
DRAGON_BOAT(0x040000c1, R.string.activity_type_dragon_boat),
ESPORTS(0x040000c2, R.string.activity_type_esports),
FINSWIMMING(0x040000c3, R.string.activity_type_finswimming),
FLOWRIDING(0x040000c4, R.string.activity_type_flowriding),
FOLK_DANCE(0x040000c5, R.string.activity_type_folk_dance),
FRISBEE(0x040000c6, R.string.activity_type_frisbee),
FUTSAL(0x040000c7, R.string.activity_type_futsal),
HACKY_SACK(0x040000c8, R.string.activity_type_hacky_sack),
HIP_HOP(0x040000c9, R.string.activity_type_hip_hop),
HULA_HOOP(0x040000ca, R.string.activity_type_hula_hoop),
INDOOR_FITNESS(0x040000cb, R.string.activity_type_indoor_fitness),
INDOOR_ICE_SKATING(0x040000cc, R.string.activity_type_indoor_ice_skating),
JAI_ALAI(0x040000cd, R.string.activity_type_jai_alai),
JUDO(0x040000ce, R.string.activity_type_judo),
JUJITSU(0x040000cf, R.string.activity_type_jujitsu),
MASS_GYMNASTICS(0x040000d0, R.string.activity_type_mass_gymnastics),
MODERN_DANCE(0x040000d1, R.string.activity_type_modern_dance),
MUAY_THAI(0x040000d2, R.string.activity_type_muay_thai),
PARALLEL_BARS(0x040000d3, R.string.activity_type_parallel_bars),
POLE_DANCE(0x040000d4, R.string.activity_type_pole_dance),
RACE_WALKING(0x040000d5, R.string.activity_type_race_walking),
SHUFFLEBOARD(0x040000d6, R.string.activity_type_shuffleboard),
SNORKELING(0x040000d7, R.string.activity_type_snorkeling),
SOMATOSENSORY_GAME(0x040000d8, R.string.activity_type_somatosensory_game),
SPINNING(0x040000d9, R.string.activity_type_spinning),
SQUARE_DANCE(0x040000da, R.string.activity_type_square_dance),
STAIR_CLIMBER(0x040000db, R.string.activity_type_stair_climber),
STEPPER(0x040000dc, R.string.activity_type_stepper),
STRETCHING(0x040000dd, R.string.activity_type_stretching),
TABLE_FOOTBALL(0x040000de, R.string.activity_type_table_football),
TUG_OF_WAR(0x040000df, R.string.activity_type_tug_of_war),
WALL_BALL(0x040000e0, R.string.activity_type_wall_ball),
WATER_POLO(0x040000e1, R.string.activity_type_water_polo),
WEIQI(0x040000e3, R.string.activity_type_weiqi),
; ;
private final int code; private final int code;

View File

@ -17,155 +17,146 @@
package nodomain.freeyourgadget.gadgetbridge.service.devices.cmfwatchpro; package nodomain.freeyourgadget.gadgetbridge.service.devices.cmfwatchpro;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind; import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind;
public enum CmfActivityType { public enum CmfActivityType {
// Core (non-removable in official app) // Core (non-removable in official app)
INDOOR_RUNNING(0x03, R.string.activity_type_indoor_running, ActivityKind.RUNNING), INDOOR_RUNNING(0x03, ActivityKind.INDOOR_RUNNING),
OUTDOOR_RUNNING(0x02, R.string.activity_type_outdoor_running, ActivityKind.RUNNING), OUTDOOR_RUNNING(0x02, ActivityKind.OUTDOOR_RUNNING),
// Fitness // Fitness
OUTDOOR_WALKING(0x01, R.string.activity_type_outdoor_walking, ActivityKind.WALKING), OUTDOOR_WALKING(0x01, ActivityKind.OUTDOOR_WALKING),
INDOOR_WALKING(0x19, R.string.activity_type_indoor_walking, ActivityKind.WALKING), INDOOR_WALKING(0x19, ActivityKind.INDOOR_WALKING),
OUTDOOR_CYCLING(0x05, R.string.activity_type_outdoor_cycling, ActivityKind.CYCLING), OUTDOOR_CYCLING(0x05, ActivityKind.OUTDOOR_CYCLING),
INDOOR_CYCLING(0x72, R.string.activity_type_indoor_cycling, ActivityKind.INDOOR_CYCLING), INDOOR_CYCLING(0x72, ActivityKind.INDOOR_CYCLING),
MOUNTAIN_HIKE(0x04, R.string.activity_type_mountain_hike, ActivityKind.HIKING), MOUNTAIN_HIKE(0x04, ActivityKind.MOUNTAIN_HIKE),
HIKING(0x1A, R.string.activity_type_hiking, ActivityKind.HIKING), HIKING(0x1A, ActivityKind.HIKING),
CROSS_TRAINER(0x18, R.string.activity_type_cross_trainer), CROSS_TRAINER(0x18, ActivityKind.CROSS_TRAINER),
FREE_TRAINING(0x10, R.string.activity_type_free_training, ActivityKind.STRENGTH_TRAINING), FREE_TRAINING(0x10, ActivityKind.FREE_TRAINING),
STRENGTH_TRAINING(0x13, R.string.activity_type_strength_training, ActivityKind.STRENGTH_TRAINING), STRENGTH_TRAINING(0x13, ActivityKind.STRENGTH_TRAINING),
YOGA(0x0F, R.string.activity_type_yoga, ActivityKind.YOGA), YOGA(0x0F, ActivityKind.YOGA),
BOXING(0x21, R.string.activity_type_boxing), BOXING(0x21, ActivityKind.BOXING),
ROWER(0x0E, R.string.activity_type_rower, ActivityKind.ROWING_MACHINE), ROWER(0x0E, ActivityKind.ROWING_MACHINE),
DYNAMIC_CYCLE(0x0D, R.string.activity_type_dynamic_cycle), DYNAMIC_CYCLE(0x0D, ActivityKind.DYNAMIC_CYCLE),
STAIR_STEPPER(0x73, R.string.activity_type_stair_stepper), STAIR_STEPPER(0x73, ActivityKind.STAIR_STEPPER),
TREADMILL(0x26, R.string.activity_type_treadmill, ActivityKind.TREADMILL), TREADMILL(0x26, ActivityKind.TREADMILL),
KICKBOXING(0x35, R.string.activity_type_kickboxing), KICKBOXING(0x35, ActivityKind.KICKBOXING),
HIIT(0x5C, R.string.activity_type_hiit), HIIT(0x5C, ActivityKind.HIIT),
FITNESS_EXERCISES(0x4E, R.string.activity_type_fitness_exercises), FITNESS_EXERCISES(0x4E, ActivityKind.FITNESS_EXERCISES),
JUMP_ROPING(0x06, R.string.activity_type_jump_roping, ActivityKind.JUMP_ROPING), // moved to leisure sports in watch 2 JUMP_ROPING(0x06, ActivityKind.JUMP_ROPING), // moved to leisure sports in watch 2
PILATES(0x2C, R.string.activity_type_pilates), PILATES(0x2C, ActivityKind.PILATES),
CROSSFIT(0x74, R.string.activity_type_crossfit), CROSSFIT(0x74, ActivityKind.CROSSFIT),
FUNCTIONAL_TRAINING(0x2E, R.string.activity_type_functional_training), FUNCTIONAL_TRAINING(0x2E, ActivityKind.FUNCTIONAL_TRAINING),
PHYSICAL_TRAINING(0x2F, R.string.activity_type_physical_training), PHYSICAL_TRAINING(0x2F, ActivityKind.PHYSICAL_TRAINING),
TAEKWONDO(0x25, R.string.activity_type_taekwondo), TAEKWONDO(0x25, ActivityKind.TAEKWONDO),
TAE_BO(0x50, R.string.activity_type_tae_bo), TAE_BO(0x50, ActivityKind.TAE_BO),
CROSS_COUNTRY_RUNNING(0x1B, R.string.activity_type_cross_country_running), CROSS_COUNTRY_RUNNING(0x1B, ActivityKind.CROSS_COUNTRY_RUNNING),
KARATE(0x29, R.string.activity_type_karate), KARATE(0x29, ActivityKind.KARATE),
FENCING(0x54, R.string.activity_type_fencing), FENCING(0x54, ActivityKind.FENCING),
CORE_TRAINING(0x4B, R.string.activity_type_core_training), CORE_TRAINING(0x4B, ActivityKind.CORE_TRAINING),
KENDO(0x75, R.string.activity_type_kendo), KENDO(0x75, ActivityKind.KENDO),
HORIZONTAL_BAR(0x56, R.string.activity_type_horizontal_bar), HORIZONTAL_BAR(0x56, ActivityKind.HORIZONTAL_BAR),
PARALLEL_BAR(0x57, R.string.activity_type_parallel_bar), PARALLEL_BAR(0x57, ActivityKind.PARALLEL_BAR),
COOLDOWN(0x92, R.string.activity_type_cooldown), COOLDOWN(0x92, ActivityKind.COOLDOWN),
CROSS_TRAINING(0x2B, R.string.activity_type_cross_training), CROSS_TRAINING(0x2B, ActivityKind.CROSS_TRAINING),
SIT_UPS(0x11, R.string.activity_type_sit_ups), SIT_UPS(0x11, ActivityKind.SIT_UPS),
FITNESS_GAMING(0x4D, R.string.activity_type_fitness_gaming), FITNESS_GAMING(0x4D, ActivityKind.FITNESS_GAMING),
AEROBIC_EXERCISE(0x94, R.string.activity_type_aerobic_exercise), AEROBIC_EXERCISE(0x94, ActivityKind.AEROBIC_EXERCISE),
ROLLING(0x95, R.string.activity_type_rolling), ROLLING(0x95, ActivityKind.ROLLING),
FLEXIBILITY(0x31, R.string.activity_type_flexibility), FLEXIBILITY(0x31, ActivityKind.FLEXIBILITY),
GYMNASTICS(0x23, R.string.activity_type_gymnastics), GYMNASTICS(0x23, ActivityKind.GYMNASTICS),
TRACK_AND_FIELD(0x27, R.string.activity_type_track_and_field), TRACK_AND_FIELD(0x27, ActivityKind.TRACK_AND_FIELD),
PUSH_UPS(0x67, R.string.activity_type_push_ups), PUSH_UPS(0x67, ActivityKind.PUSH_UPS),
BATTLE_ROPE(0x99, R.string.activity_type_battle_rope), BATTLE_ROPE(0x99, ActivityKind.BATTLE_ROPE),
SMITH_MACHINE(0x9A, R.string.activity_type_smith_machine), SMITH_MACHINE(0x9A, ActivityKind.SMITH_MACHINE),
PULL_UPS(0x66, R.string.activity_type_pull_ups), PULL_UPS(0x66, ActivityKind.PULL_UPS),
PLANK(0x68, R.string.activity_type_plank), PLANK(0x68, ActivityKind.PLANK),
JAVELIN(0x9E, R.string.activity_type_javelin), JAVELIN(0x9E, ActivityKind.JAVELIN),
LONG_JUMP(0x6C, R.string.activity_type_long_jump), LONG_JUMP(0x6C, ActivityKind.LONG_JUMP),
HIGH_JUMP(0x6A, R.string.activity_type_high_jump), HIGH_JUMP(0x6A, ActivityKind.HIGH_JUMP),
TRAMPOLINE(0x5F, R.string.activity_type_trampoline), TRAMPOLINE(0x5F, ActivityKind.TRAMPOLINE),
DUMBBELL(0x9F, R.string.activity_type_dumbbell), DUMBBELL(0x9F, ActivityKind.DUMBBELL),
// Dance // Dance
BELLY_DANCE(0x76, R.string.activity_type_belly_dance), BELLY_DANCE(0x76, ActivityKind.BELLY_DANCE),
JAZZ_DANCE(0x77, R.string.activity_type_jazz_dance), JAZZ_DANCE(0x77, ActivityKind.JAZZ_DANCE),
LATIN_DANCE(0x33, R.string.activity_type_latin_dance), LATIN_DANCE(0x33, ActivityKind.LATIN_DANCE),
BALLET(0x36, R.string.activity_type_ballet), BALLET(0x36, ActivityKind.BALLET),
STREET_DANCE(0x34, R.string.activity_type_street_dance), STREET_DANCE(0x34, ActivityKind.STREET_DANCE),
ZUMBA(0x9B, R.string.activity_type_zumba), ZUMBA(0x9B, ActivityKind.ZUMBA),
OTHER_DANCE(0x78, R.string.activity_type_other_dance), OTHER_DANCE(0x78, ActivityKind.DANCE),
// Leisure sports // Leisure sports
ROLLER_SKATING(0x58, R.string.activity_type_roller_skating), ROLLER_SKATING(0x58, ActivityKind.ROLLER_SKATING),
MARTIAL_ARTS(0x38, R.string.activity_type_martial_arts), MARTIAL_ARTS(0x38, ActivityKind.MARTIAL_ARTS),
TAI_CHI(0x1F, R.string.activity_type_tai_chi), TAI_CHI(0x1F, ActivityKind.TAI_CHI),
HULA_HOOPING(0x59, R.string.activity_type_hula_hooping), HULA_HOOPING(0x59, ActivityKind.HULA_HOOPING),
DISC_SPORTS(0x43, R.string.activity_type_disc_sports), DISC_SPORTS(0x43, ActivityKind.DISC_SPORTS),
DARTS(0x5A, R.string.activity_type_darts), DARTS(0x5A, ActivityKind.DARTS),
ARCHERY(0x30, R.string.activity_type_archery), ARCHERY(0x30, ActivityKind.ARCHERY),
HORSE_RIDING(0x1D, R.string.activity_type_horse_riding), HORSE_RIDING(0x1D, ActivityKind.HORSE_RIDING),
KITE_FLYING(0x70, R.string.activity_type_kite_flying), KITE_FLYING(0x70, ActivityKind.KITE_FLYING),
SWING(0x71, R.string.activity_type_swing), SWING(0x71, ActivityKind.SWING),
STAIRS(0x15, R.string.activity_type_stairs), STAIRS(0x15, ActivityKind.STAIRS),
FISHING(0x42, R.string.activity_type_fishing), FISHING(0x42, ActivityKind.FISHING),
HAND_CYCLING(0x96, R.string.activity_type_hand_cycling), HAND_CYCLING(0x96, ActivityKind.HANDCYCLING),
MIND_AND_BODY(0x97, R.string.activity_type_mind_and_body), MIND_AND_BODY(0x97, ActivityKind.MIND_AND_BODY),
WRESTLING(0x53, R.string.activity_type_wrestling), WRESTLING(0x53, ActivityKind.WRESTLING),
KABADDI(0x9C, R.string.activity_type_kabaddi), KABADDI(0x9C, ActivityKind.KABADDI),
KARTING(0xA0, R.string.activity_type_karting), KARTING(0xA0, ActivityKind.KARTING),
// Ball sports // Ball sports
BADMINTON(0x09, R.string.activity_type_badminton), BADMINTON(0x09, ActivityKind.BADMINTON),
TABLE_TENNIS(0x0A, R.string.activity_type_table_tennis, ActivityKind.PINGPONG), TABLE_TENNIS(0x0A, ActivityKind.TABLE_TENNIS),
TENNIS(0x0C, R.string.activity_type_tennis), TENNIS(0x0C, ActivityKind.TENNIS),
BILLIARDS(0x7C, R.string.activity_type_billiards), BILLIARDS(0x7C, ActivityKind.BILLIARDS),
BOWLING(0x3B, R.string.activity_type_bowling), BOWLING(0x3B, ActivityKind.BOWLING),
VOLLEYBALL(0x49, R.string.activity_type_volleyball), VOLLEYBALL(0x49, ActivityKind.VOLLEYBALL),
SHUTTLECOCK(0x20, R.string.activity_type_shuttlecock), SHUTTLECOCK(0x20, ActivityKind.SHUTTLECOCK),
HANDBALL(0x39, R.string.activity_type_handball), HANDBALL(0x39, ActivityKind.HANDBALL),
BASEBALL(0x3A, R.string.activity_type_baseball), BASEBALL(0x3A, ActivityKind.BASEBALL),
SOFTBALL(0x55, R.string.activity_type_softball), SOFTBALL(0x55, ActivityKind.SOFTBALL),
CRICKET(0x0B, R.string.activity_type_cricket), CRICKET(0x0B, ActivityKind.CRICKET),
RUGBY(0x44, R.string.activity_type_rugby), RUGBY(0x44, ActivityKind.RUGBY),
HOCKEY(0x1E, R.string.activity_type_hockey), HOCKEY(0x1E, ActivityKind.HOCKEY),
SQUASH(0x3C, R.string.activity_type_squash), SQUASH(0x3C, ActivityKind.SQUASH),
DODGEBALL(0x81, R.string.activity_type_dodgeball), DODGEBALL(0x81, ActivityKind.DODGEBALL),
SOCCER(0x07, R.string.activity_type_soccer, ActivityKind.SOCCER), SOCCER(0x07, ActivityKind.SOCCER),
BASKETBALL(0x08, R.string.activity_type_basketball, ActivityKind.BASKETBALL), BASKETBALL(0x08, ActivityKind.BASKETBALL),
AUSTRALIAN_FOOTBALL(0x37, R.string.activity_type_australian_football), AUSTRALIAN_FOOTBALL(0x37, ActivityKind.AUSTRALIAN_FOOTBALL),
GOLF(0x45, R.string.activity_type_golf), GOLF(0x45, ActivityKind.GOLF),
PICKLEBALL(0x5B, R.string.activity_type_pickleball), PICKLEBALL(0x5B, ActivityKind.PICKLEBALL),
LACROSS(0x98, R.string.activity_type_lacross), LACROSS(0x98, ActivityKind.LACROSS),
SHOT(0x9D, R.string.activity_type_shot), SHOT(0x9D, ActivityKind.SHOT),
BEACH_SOCCER(0x7d, R.string.activity_type_beach_soccer), BEACH_SOCCER(0x7d, ActivityKind.BEACH_SOCCER),
BEACH_VOLLEYBALL(0x7e, R.string.activity_type_beach_volleyball), BEACH_VOLLEYBALL(0x7e, ActivityKind.BEACH_VOLLEYBALL),
GATEBALL(0x7f, R.string.activity_type_gateball), GATEBALL(0x7f, ActivityKind.GATEBALL),
SEPAK_TAKRAW(0x80, R.string.activity_type_sepak_takraw), SEPAK_TAKRAW(0x80, ActivityKind.SEPAK_TAKRAW),
// Water sports // Water sports
SAILING(0x82, R.string.activity_type_sailing), SAILING(0x82, ActivityKind.SAILING),
SURFING(0x64, R.string.activity_type_surfing), SURFING(0x64, ActivityKind.SURFING),
JET_SKIING(0x87, R.string.activity_type_jet_skiing), JET_SKIING(0x87, ActivityKind.JET_SKIING),
// Snow sports // Snow sports
SKATING(0x4C, R.string.activity_type_skating), SKATING(0x4C, ActivityKind.SKATING),
ICE_HOCKEY(0x24, R.string.activity_type_ice_hockey), ICE_HOCKEY(0x24, ActivityKind.ICE_HOCKEY),
CURLING(0x3D, R.string.activity_type_curling), CURLING(0x3D, ActivityKind.CURLING),
SNOWBOARDING(0x3E, R.string.activity_type_snowboarding), SNOWBOARDING(0x3E, ActivityKind.SNOWBOARDING),
CROSS_COUNTRY_SKIING(0x6E, R.string.activity_type_cross_country_skiing), CROSS_COUNTRY_SKIING(0x6E, ActivityKind.CROSS_COUNTRY_SKIING),
SNOW_SPORTS(0x48, R.string.activity_type_snow_sports), SNOW_SPORTS(0x48, ActivityKind.SNOW_SPORTS),
SKIING(0x22, R.string.activity_type_skiing), SKIING(0x22, ActivityKind.SKIING),
LUGE(0x8a, R.string.activity_type_luge), LUGE(0x8a, ActivityKind.LUGE),
// Extreme sports // Extreme sports
SKATEBOARDING(0x60, R.string.activity_type_skateboarding), SKATEBOARDING(0x60, ActivityKind.SKATEBOARDING),
ROCK_CLIMBING(0x69, R.string.activity_type_rock_climbing), ROCK_CLIMBING(0x69, ActivityKind.ROCK_CLIMBING),
HUNTING(0x93, R.string.activity_type_hunting), HUNTING(0x93, ActivityKind.HUNTING),
// Other // Other
PARACHUTING(0x8e, R.string.activity_type_parachuting), PARACHUTING(0x8e, ActivityKind.PARACHUTING),
AUTO_RACING(0x8f, R.string.activity_type_auto_racing), AUTO_RACING(0x8f, ActivityKind.AUTO_RACING),
PARKOUR(0x62, R.string.activity_type_parkour), PARKOUR(0x62, ActivityKind.PARKOUR),
; ;
private final byte code; private final byte code;
@StringRes
private final int nameRes;
private final ActivityKind activityKind; private final ActivityKind activityKind;
CmfActivityType(final int code, final int nameRes) { CmfActivityType(final int code, final ActivityKind activityKind) {
this(code, nameRes, ActivityKind.UNKNOWN);
}
CmfActivityType(final int code, final int nameRes, final ActivityKind activityKind) {
this.code = (byte) code; this.code = (byte) code;
this.nameRes = nameRes;
this.activityKind = activityKind; this.activityKind = activityKind;
} }
@ -177,11 +168,6 @@ public enum CmfActivityType {
return activityKind; return activityKind;
} }
@StringRes
public int getNameRes() {
return nameRes;
}
@Nullable @Nullable
public static CmfActivityType fromCode(final byte code) { public static CmfActivityType fromCode(final byte code) {
for (final CmfActivityType cmd : CmfActivityType.values()) { for (final CmfActivityType cmd : CmfActivityType.values()) {

View File

@ -357,55 +357,15 @@ public class FitImporter {
private ActivityKind getActivityKind(final Integer sport, final Integer subsport) { private ActivityKind getActivityKind(final Integer sport, final Integer subsport) {
final Optional<GarminSport> garminSport = GarminSport.fromCodes(sport, subsport); final Optional<GarminSport> garminSport = GarminSport.fromCodes(sport, subsport);
if (garminSport.isEmpty()) { if (garminSport.isPresent()) {
return garminSport.get().getActivityKind();
} else {
LOG.warn("Unknown garmin sport {}/{}", sport, subsport); LOG.warn("Unknown garmin sport {}/{}", sport, subsport);
return ActivityKind.UNKNOWN;
}
switch (garminSport.get()) { final Optional<GarminSport> optGarminSportFallback = GarminSport.fromCodes(sport, 0);
case RUN: if (!optGarminSportFallback.isEmpty()) {
case PUSH_RUN_SPEED: return optGarminSportFallback.get().getActivityKind();
case INDOOR_PUSH_RUN_SPEED: }
case INDOOR_TRACK:
return ActivityKind.RUNNING;
case TREADMILL:
return ActivityKind.TREADMILL;
case E_BIKE:
case BIKE:
case BIKE_COMMUTE:
return ActivityKind.CYCLING;
case BIKE_INDOOR:
return ActivityKind.INDOOR_CYCLING;
case ELLIPTICAL:
return ActivityKind.ELLIPTICAL_TRAINER;
case STAIR_STEPPER:
case PILATES:
case CARDIO:
return ActivityKind.EXERCISE;
case POOL_SWIM:
return ActivityKind.SWIMMING;
case OPEN_WATER:
return ActivityKind.SWIMMING_OPENWATER;
case SOCCER:
return ActivityKind.SOCCER;
case STRENGTH:
return ActivityKind.STRENGTH_TRAINING;
case YOGA:
return ActivityKind.YOGA;
case WALK:
case WALK_INDOOR:
case PUSH_WALK_SPEED:
case INDOOR_PUSH_WALK_SPEED:
return ActivityKind.WALKING;
case HIKE:
return ActivityKind.HIKING;
case CLIMB_INDOOR:
case BOULDERING:
return ActivityKind.CLIMBING;
case BASKETBALL:
return ActivityKind.BASKETBALL;
case JUMP_ROPE:
return ActivityKind.JUMP_ROPING;
} }
return ActivityKind.UNKNOWN; return ActivityKind.UNKNOWN;

View File

@ -2,125 +2,129 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.garmin.fit.enums;
import java.util.Optional; import java.util.Optional;
import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind;
// Taken from CHANGELOG.fit of a Venu 3, // Taken from CHANGELOG.fit of a Venu 3,
// Garmin API doc (https://developer.garmin.com/connect-iq/api-docs/Toybox/Activity.html) // Garmin API doc (https://developer.garmin.com/connect-iq/api-docs/Toybox/Activity.html)
// and FIT files // and FIT files
public enum GarminSport { public enum GarminSport {
NAVIGATE(0, 50), NAVIGATE(0, 50, ActivityKind.NAVIGATE),
RUN(1, 0), RUN(1, 0, ActivityKind.RUNNING),
TREADMILL(1, 1), TREADMILL(1, 1, ActivityKind.TREADMILL),
INDOOR_TRACK(1, 45), INDOOR_TRACK(1, 45, ActivityKind.INDOOR_TRACK),
BIKE(2, 0), BIKE(2, 0, ActivityKind.CYCLING),
BIKE_INDOOR(2, 6), BIKE_INDOOR(2, 6, ActivityKind.INDOOR_CYCLING),
HANDCYCLING(2, 12), HANDCYCLING(2, 12, ActivityKind.HANDCYCLING),
E_BIKE(2, 28), E_BIKE(2, 28, ActivityKind.E_BIKE),
BIKE_COMMUTE(2, 48), BIKE_COMMUTE(2, 48, ActivityKind.BIKE_COMMUTE),
HANDCYCLING_INDOOR(2, 88), HANDCYCLING_INDOOR(2, 88, ActivityKind.HANDCYCLING_INDOOR),
TRANSITION(3, 0), TRANSITION(3, 0, ActivityKind.TRANSITION),
FITNESS_EQUIPMENT(4, 0), FITNESS_EQUIPMENT(4, 0, ActivityKind.FITNESS_EQUIPMENT),
ELLIPTICAL(4, 15), ELLIPTICAL(4, 15, ActivityKind.ELLIPTICAL_TRAINER),
STAIR_STEPPER(4, 16), STAIR_STEPPER(4, 16, ActivityKind.STAIR_STEPPER),
PILATES(4, 44), PILATES(4, 44, ActivityKind.PILATES),
SWIMMING(5, 0), SWIMMING(5, 0, ActivityKind.SWIMMING),
POOL_SWIM(5, 17), POOL_SWIM(5, 17, ActivityKind.POOL_SWIM),
OPEN_WATER(5, 18), OPEN_WATER(5, 18, ActivityKind.SWIMMING_OPENWATER),
BASKETBALL(6, 0), BASKETBALL(6, 0, ActivityKind.BASKETBALL),
SOCCER(7, 0), SOCCER(7, 0, ActivityKind.SOCCER),
TENNIS(8, 0), TENNIS(8, 0, ActivityKind.TENNIS),
PLATFORM_TENNIS(8, 93), PLATFORM_TENNIS(8, 93, ActivityKind.PLATFORM_TENNIS),
TABLE_TENNIS(8, 97), TABLE_TENNIS(8, 97, ActivityKind.TABLE_TENNIS),
AMERICAN_FOOTBALL(9, 0), AMERICAN_FOOTBALL(9, 0, ActivityKind.AMERICAN_FOOTBALL),
TRAINING(10, 0), TRAINING(10, 0, ActivityKind.TRAINING),
STRENGTH(10, 20), STRENGTH(10, 20, ActivityKind.STRENGTH_TRAINING),
CARDIO(10, 26), CARDIO(10, 26, ActivityKind.CARDIO),
YOGA(10, 43), YOGA(10, 43, ActivityKind.YOGA),
BREATHWORK(10, 62), BREATHWORK(10, 62, ActivityKind.BREATHWORK),
WALK(11, 0), WALK(11, 0, ActivityKind.WALKING),
WALK_INDOOR(11, 27), WALK_INDOOR(11, 27, ActivityKind.INDOOR_WALKING),
XC_CLASSIC_SKI(12, 0), XC_CLASSIC_SKI(12, 0, ActivityKind.XC_CLASSIC_SKI),
SKI(13, 0), SKI(13, 0, ActivityKind.SKIING),
SNOWBOARD(14, 0), SNOWBOARD(14, 0, ActivityKind.SNOWBOARDING),
ROWING(15, 0), ROWING(15, 0, ActivityKind.ROWING),
MOUNTAINEERING(16, 0), MOUNTAINEERING(16, 0, ActivityKind.MOUNTAINEERING),
HIKE(17, 0), HIKE(17, 0, ActivityKind.HIKING),
MULTISPORT(18, 0), MULTISPORT(18, 0, ActivityKind.MULTISPORT),
PADDLING(19, 0), PADDLING(19, 0, ActivityKind.PADDLING),
FLYING(20, 0), FLYING(20, 0, ActivityKind.FLYING),
E_BIKING(21, 0), E_BIKING(21, 0, ActivityKind.E_BIKE),
MOTORCYCLING(22, 0), MOTORCYCLING(22, 0, ActivityKind.MOTORCYCLING),
BOATING(23, 0), BOATING(23, 0, ActivityKind.BOATING),
DRIVING(24, 0), DRIVING(24, 0, ActivityKind.DRIVING),
GOLF(25, 0), GOLF(25, 0, ActivityKind.GOLF),
HANG_GLIDING(26, 0), HANG_GLIDING(26, 0, ActivityKind.HANG_GLIDING),
HORSEBACK_RIDING(27,0), HORSEBACK_RIDING(27,0, ActivityKind.HORSE_RIDING),
HUNTING(28, 0), HUNTING(28, 0, ActivityKind.HUNTING),
FISHING(29, 0), FISHING(29, 0, ActivityKind.FISHING),
INLINE_SKATING(30, 0), INLINE_SKATING(30, 0, ActivityKind.INLINE_SKATING),
ROCK_CLIMBING(31, 0), ROCK_CLIMBING(31, 0, ActivityKind.ROCK_CLIMBING),
CLIMB_INDOOR(31, 68), CLIMB_INDOOR(31, 68, ActivityKind.CLIMB_INDOOR),
BOULDERING(31, 69), BOULDERING(31, 69, ActivityKind.BOULDERING),
SAIL(32, 0), SAIL(32, 0, ActivityKind.SAILING),
SAIL_RACE(32, 65), SAIL_RACE(32, 65, ActivityKind.SAIL_RACE),
SAIL_EXPEDITION(32, 66), SAIL_EXPEDITION(32, 66, ActivityKind.SAIL_EXPEDITION),
ICE_SKATING(33, 0), ICE_SKATING(33, 0, ActivityKind.ICE_SKATING),
SKY_DIVING(34, 0), SKY_DIVING(34, 0, ActivityKind.SKY_DIVING),
SNOWSHOE(35, 0), SNOWSHOE(35, 0, ActivityKind.SNOWSHOE),
SNOWMOBILING(36, 0), SNOWMOBILING(36, 0, ActivityKind.SNOWMOBILING),
STAND_UP_PADDLEBOARDING(37, 0), STAND_UP_PADDLEBOARDING(37, 0, ActivityKind.STAND_UP_PADDLEBOARDING),
SURFING(38, 0), SURFING(38, 0, ActivityKind.SURFING),
WAKEBOARDING(39, 0), WAKEBOARDING(39, 0, ActivityKind.WAKEBOARDING),
WATER_SKIING(40, 0), WATER_SKIING(40, 0, ActivityKind.WATER_SKIING),
KAYAKING(41, 0), KAYAKING(41, 0, ActivityKind.KAYAKING),
RAFTING(42, 0), RAFTING(42, 0, ActivityKind.RAFTING),
WINDSURFING(43, 0), WINDSURFING(43, 0, ActivityKind.WINDSURFING),
KITESURFING(44, 0), KITESURFING(44, 0, ActivityKind.KITESURFING),
TACTICAL(45, 0), TACTICAL(45, 0, ActivityKind.TACTICAL),
JUMPMASTER(46, 0), JUMPMASTER(46, 0, ActivityKind.JUMPMASTER),
BOXING(47, 0), BOXING(47, 0, ActivityKind.BOXING),
FLOOR_CLIMBING(48, 0), FLOOR_CLIMBING(48, 0, ActivityKind.FLOOR_CLIMBING),
BASEBALL(49, 0), BASEBALL(49, 0, ActivityKind.BASEBALL),
SOFTBALL(50, 0), SOFTBALL(50, 0, ActivityKind.SOFTBALL),
SOFTBALL_SLOW_PITCH(51, 0), SOFTBALL_SLOW_PITCH(51, 0, ActivityKind.SOFTBALL_SLOW_PITCH),
SHOOTING(56, 0), SHOOTING(56, 0, ActivityKind.SHOOTING),
AUTO_RACING(57, 0), AUTO_RACING(57, 0, ActivityKind.AUTO_RACING),
WINTER_SPORT(58, 0), WINTER_SPORT(58, 0, ActivityKind.WINTER_SPORT),
GRINDING(59, 0), GRINDING(59, 0, ActivityKind.GRINDING),
HEALTH_SNAPSHOT(60, 0), HEALTH_SNAPSHOT(60, 0, ActivityKind.HEALTH_SNAPSHOT),
MARINE(61, 0), MARINE(61, 0, ActivityKind.MARINE),
HIIT(62, 0), HIIT(62, 0, ActivityKind.HIIT),
VIDEO_GAMING(63, 0), VIDEO_GAMING(63, 0, ActivityKind.VIDEO_GAMING),
RACKET(64, 0), RACKET(64, 0, ActivityKind.RACKET),
PICKLEBALL(64, 84), PICKLEBALL(64, 84, ActivityKind.PICKLEBALL),
PADEL(64, 85), PADEL(64, 85, ActivityKind.PADEL),
SQUASH(64, 94), SQUASH(64, 94, ActivityKind.SQUASH),
RACQUETBALL(64, 96), RACQUETBALL(64, 96, ActivityKind.RACQUETBALL),
PUSH_WALK_SPEED(65, 0), PUSH_WALK_SPEED(65, 0, ActivityKind.PUSH_WALK_SPEED),
INDOOR_PUSH_WALK_SPEED(65, 86), INDOOR_PUSH_WALK_SPEED(65, 86, ActivityKind.INDOOR_PUSH_WALK_SPEED),
PUSH_RUN_SPEED(66, 0), PUSH_RUN_SPEED(66, 0, ActivityKind.PUSH_RUN_SPEED),
INDOOR_PUSH_RUN_SPEED(66, 87), INDOOR_PUSH_RUN_SPEED(66, 87, ActivityKind.INDOOR_PUSH_RUN_SPEED),
MEDITATION(67, 0), MEDITATION(67, 0, ActivityKind.MEDITATION),
PARA_SPORT(68, 0), PARA_SPORT(68, 0, ActivityKind.PARA_SPORT),
DISC_GOLF(69, 0), DISC_GOLF(69, 0, ActivityKind.DISC_GOLF),
ULTIMATE_DISC(69, 92), ULTIMATE_DISC(69, 92, ActivityKind.ULTIMATE_DISC),
TEAM_SPORT(70, 0), TEAM_SPORT(70, 0, ActivityKind.TEAM_SPORT),
CRICKET(71, 0), CRICKET(71, 0, ActivityKind.CRICKET),
RUGBY(72, 0), RUGBY(72, 0, ActivityKind.RUGBY),
HOCKEY(73, 0), HOCKEY(73, 0, ActivityKind.HOCKEY),
LACROSSE(74, 0), LACROSSE(74, 0, ActivityKind.LACROSSE),
VOLLEYBALL(75, 0), VOLLEYBALL(75, 0, ActivityKind.VOLLEYBALL),
WATER_TUBING(76, 0), WATER_TUBING(76, 0, ActivityKind.WATER_TUBING),
WAKESURFING(77, 0), WAKESURFING(77, 0, ActivityKind.WAKESURFING),
MIXED_MARTIAL_ARTS(80, 0), // aka MMA MIXED_MARTIAL_ARTS(80, 0, ActivityKind.MIXED_MARTIAL_ARTS), // aka MMA
DANCE(83, 0), DANCE(83, 0, ActivityKind.DANCE),
JUMP_ROPE(84, 0), JUMP_ROPE(84, 0, ActivityKind.JUMP_ROPING),
; ;
private final int type; private final int type;
private final int subtype; private final int subtype;
private final ActivityKind activityKind;
GarminSport(final int type, final int subtype) { GarminSport(final int type, final int subtype, final ActivityKind activityKind) {
this.type = type; this.type = type;
this.subtype = subtype; this.subtype = subtype;
this.activityKind = activityKind;
} }
public int getType() { public int getType() {
@ -131,6 +135,10 @@ public enum GarminSport {
return subtype; return subtype;
} }
public ActivityKind getActivityKind() {
return activityKind;
}
public static Optional<GarminSport> fromCodes(final int type, final int subtype) { public static Optional<GarminSport> fromCodes(final int type, final int subtype) {
for (final GarminSport value : GarminSport.values()) { for (final GarminSport value : GarminSport.values()) {
if (value.getType() == type && value.getSubtype() == subtype) { if (value.getType() == type && value.getSubtype() == subtype) {

View File

@ -25,134 +25,136 @@ import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind;
* The workout types, used to start / when workout tracking starts on the band. * The workout types, used to start / when workout tracking starts on the band.
*/ */
public enum ZeppOsActivityType { public enum ZeppOsActivityType {
AerobicCombo(0x33), AerobicCombo(0x33, ActivityKind.AEROBIC_COMBO),
Aerobics(0x6d), Aerobics(0x6d, ActivityKind.AEROBICS),
AirWalker(0x90), AirWalker(0x90, ActivityKind.AIR_WALKER),
Archery(0x5d), Archery(0x5d, ActivityKind.ARCHERY),
ArtisticSwimming(0x9c), ArtisticSwimming(0x9c, ActivityKind.ARTISTIC_SWIMMING),
Badminton(0x5c), Badminton(0x5c, ActivityKind.BADMINTON),
Ballet(0x47), Ballet(0x47, ActivityKind.BALLET),
BallroomDance(0x4b), BallroomDance(0x4b, ActivityKind.BALLROOM_DANCE),
Baseball(0x4f), Baseball(0x4f, ActivityKind.BASEBALL),
Basketball(0x55), Basketball(0x55, ActivityKind.BASKETBALL),
BattleRope(0xa7), BattleRope(0xa7, ActivityKind.BATTLE_ROPE),
BeachVolleyball(0x7a), BeachVolleyball(0x7a, ActivityKind.BEACH_VOLLEYBALL),
BellyDance(0x48), BellyDance(0x48, ActivityKind.BELLY_DANCE),
Billiards(0x97), Billiards(0x97, ActivityKind.BILLIARDS),
bmx(0x30), bmx(0x30, ActivityKind.BMX),
BoardGame(0xb1), BoardGame(0xb1, ActivityKind.BOARD_GAME),
Bocce(0xaa), Bocce(0xaa, ActivityKind.BOCCE),
Bowling(0x50), Bowling(0x50, ActivityKind.BOWLING),
Boxing(0x61), Boxing(0x61, ActivityKind.BOXING),
Breaking(0xa8), Breaking(0xa8, ActivityKind.BREAKING),
Bridge(0xb0), Bridge(0xb0, ActivityKind.BRIDGE),
CardioCombat(0x72), CardioCombat(0x72, ActivityKind.CARDIO_COMBAT),
Checkers(0xae), Checkers(0xae, ActivityKind.CHECKERS),
Chess(0xad), Chess(0xad, ActivityKind.CHESS),
CoreTraining(0x32), CoreTraining(0x32, ActivityKind.CORE_TRAINING),
Cricket(0x4e), Cricket(0x4e, ActivityKind.CRICKET),
CrossTraining(0x82), CrossTraining(0x82, ActivityKind.CROSS_TRAINING),
Curling(0x29), Curling(0x29, ActivityKind.CURLING),
Dance(0x4c), Dance(0x4c, ActivityKind.DANCE),
Darts(0x75), Darts(0x75, ActivityKind.DARTS),
Dodgeball(0x99), Dodgeball(0x99, ActivityKind.DODGEBALL),
DragonBoat(0x8a), DragonBoat(0x8a, ActivityKind.DRAGON_BOAT),
Driving(0x84), Driving(0x84, ActivityKind.DRIVING),
Elliptical(0x09), Elliptical(0x09, ActivityKind.ELLIPTICAL_TRAINER),
Esports(0xbd), Esports(0xbd, ActivityKind.ESPORTS),
Esquestrian(0x5e), Esquestrian(0x5e, ActivityKind.HORSE_RIDING),
Fencing(0x94), Fencing(0x94, ActivityKind.FENCING),
Finswimming(0x9b), Finswimming(0x9b, ActivityKind.FINSWIMMING),
Fishing(0x40), Fishing(0x40, ActivityKind.FISHING),
Flexibility(0x37), Flexibility(0x37, ActivityKind.FLEXIBILITY),
Flowriding(0xac), Flowriding(0xac, ActivityKind.FLOWRIDING),
FolkDance(0x92), FolkDance(0x92, ActivityKind.FOLK_DANCE),
Freestyle(0x05), Freestyle(0x05, ActivityKind.FREE_TRAINING),
Frisbee(0x74), Frisbee(0x74, ActivityKind.FRISBEE),
Futsal(0xa4), Futsal(0xa4, ActivityKind.FUTSAL),
Gateball(0x57), Gateball(0x57, ActivityKind.GATEBALL),
Gymnastics(0x3b), Gymnastics(0x3b, ActivityKind.GYMNASTICS),
HackySack(0xa9), HackySack(0xa9, ActivityKind.HACKY_SACK),
Handball(0x5b), Handball(0x5b, ActivityKind.HANDBALL),
HIIT(0x31), HIIT(0x31, ActivityKind.HIIT),
HipHop(0xa5), HipHop(0xa5, ActivityKind.HIP_HOP),
HorizontalBar(0x95), HorizontalBar(0x95, ActivityKind.HORIZONTAL_BAR),
HulaHoop(0x73), HulaHoop(0x73, ActivityKind.HULA_HOOP),
IceHockey(0x9e), IceHockey(0x9e, ActivityKind.ICE_HOCKEY),
IceSkating(0x2c), IceSkating(0x2c, ActivityKind.ICE_SKATING),
IndoorCycling(0x08), IndoorCycling(0x08, ActivityKind.INDOOR_CYCLING),
IndoorFitness(0x18), IndoorFitness(0x18, ActivityKind.INDOOR_FITNESS),
IndoorIceSkating(0x2d), IndoorIceSkating(0x2d, ActivityKind.INDOOR_ICE_SKATING),
JaiAlai(0xab), JaiAlai(0xab, ActivityKind.JAI_ALAI),
JazzDance(0x71), JazzDance(0x71, ActivityKind.JAZZ_DANCE),
Judo(0x62), Judo(0x62, ActivityKind.JUDO),
Jujitsu(0x93), Jujitsu(0x93, ActivityKind.JUJITSU),
JumpRope(0x15), JumpRope(0x15, ActivityKind.JUMP_ROPING),
Karate(0x60), Karate(0x60, ActivityKind.KARATE),
Kayaking(0x8c), Kayaking(0x8c, ActivityKind.KAYAKING),
Kendo(0x5f), Kendo(0x5f, ActivityKind.KENDO),
Kickboxing(0x68), Kickboxing(0x68, ActivityKind.KICKBOXING),
KiteFlying(0x76), KiteFlying(0x76, ActivityKind.KITE_FLYING),
LatinDance(0x70), LatinDance(0x70, ActivityKind.LATIN_DANCE),
MartialArts(0x67), MartialArts(0x67, ActivityKind.MARTIAL_ARTS),
MassGymnastics(0x6f), MassGymnastics(0x6f, ActivityKind.MASS_GYMNASTICS),
ModernDance(0xb9), ModernDance(0xb9, ActivityKind.MODERN_DANCE),
MuayThai(0x65), MuayThai(0x65, ActivityKind.MUAY_THAI),
OutdoorCycling(0x04), OutdoorCycling(0x04, ActivityKind.OUTDOOR_CYCLING),
OutdoorHiking(0x0f), OutdoorHiking(0x0f, ActivityKind.HIKING),
OutdoorRunning(0x01), OutdoorRunning(0x01, ActivityKind.OUTDOOR_RUNNING),
OutdoorSwimming(0x07), OutdoorSwimming(0x07, ActivityKind.SWIMMING_OPENWATER),
ParallelBars(0x96), ParallelBars(0x96, ActivityKind.PARALLEL_BARS),
Parkour(0x81), Parkour(0x81, ActivityKind.PARKOUR),
Pilates(0x3d), Pilates(0x3d, ActivityKind.PILATES),
PoleDance(0xa6), PoleDance(0xa6, ActivityKind.POLE_DANCE),
PoolSwimming(0x06), PoolSwimming(0x06, ActivityKind.POOL_SWIM),
RaceWalking(0x83), RaceWalking(0x83, ActivityKind.RACE_WALKING),
RockClimbing(0x46), RockClimbing(0x46, ActivityKind.ROCK_CLIMBING),
RollerSkating(0x45), RollerSkating(0x45, ActivityKind.ROLLER_SKATING),
Rowing(0x17), Rowing(0x17, ActivityKind.ROWING),
Sailing(0x41), Sailing(0x41, ActivityKind.SAILING),
SepakTakraw(0x98), SepakTakraw(0x98, ActivityKind.SEPAK_TAKRAW),
Shuffleboard(0xa0), Shuffleboard(0xa0, ActivityKind.SHUFFLEBOARD),
Shuttlecock(0xa2), Shuttlecock(0xa2, ActivityKind.SHUTTLECOCK),
Skateboarding(0x43), Skateboarding(0x43, ActivityKind.SKATEBOARDING),
Snorkeling(0x9d), Snorkeling(0x9d, ActivityKind.SNORKELING),
Soccer(0xbf), Soccer(0xbf, ActivityKind.SOCCER),
Softball(0x56), Softball(0x56, ActivityKind.SOFTBALL),
SomatosensoryGame(0xa3), SomatosensoryGame(0xa3, ActivityKind.SOMATOSENSORY_GAME),
Spinning(0x8f), Spinning(0x8f, ActivityKind.SPINNING),
SquareDance(0x49), SquareDance(0x49, ActivityKind.SQUARE_DANCE),
Squash(0x51), Squash(0x51, ActivityKind.SQUASH),
StairClimber(0x36), StairClimber(0x36, ActivityKind.STAIR_CLIMBER),
Stepper(0x39), Stepper(0x39, ActivityKind.STEPPER),
StreetDance(0x4a), StreetDance(0x4a, ActivityKind.STREET_DANCE),
Strength(0x34), Strength(0x34, ActivityKind.STRENGTH_TRAINING),
Stretching(0x35), Stretching(0x35, ActivityKind.STRETCHING),
Swinging(0x9f), Swinging(0x9f, ActivityKind.SWING),
TableFootball(0xa1), TableFootball(0xa1, ActivityKind.TABLE_FOOTBALL),
TableTennis(0x59), TableTennis(0x59, ActivityKind.TABLE_TENNIS),
TaiChi(0x64), TaiChi(0x64, ActivityKind.TAI_CHI),
Taekwondo(0x66), Taekwondo(0x66, ActivityKind.TAEKWONDO),
Tennis(0x11), Tennis(0x11, ActivityKind.TENNIS),
Treadmill(0x02), Treadmill(0x02, ActivityKind.TREADMILL),
TugOfWar(0x77), TugOfWar(0x77, ActivityKind.TUG_OF_WAR),
Volleyball(0x58), Volleyball(0x58, ActivityKind.VOLLEYBALL),
Walking(0x03), Walking(0x03, ActivityKind.WALKING),
WallBall(0x91), WallBall(0x91, ActivityKind.WALL_BALL),
WaterPolo(0x9a), WaterPolo(0x9a, ActivityKind.WATER_POLO),
WaterRowing(0x42), WaterRowing(0x42, ActivityKind.ROWING),
Weiqi(0xaf), Weiqi(0xaf, ActivityKind.WEIQI),
Wrestling(0x63), Wrestling(0x63, ActivityKind.WRESTLING),
Yoga(0x3c), Yoga(0x3c, ActivityKind.YOGA),
Zumba(0x4d), Zumba(0x4d, ActivityKind.ZUMBA),
; ;
private static final Logger LOG = LoggerFactory.getLogger(ZeppOsActivityType.class); private static final Logger LOG = LoggerFactory.getLogger(ZeppOsActivityType.class);
private final byte code; private final byte code;
private final ActivityKind activityKind;
ZeppOsActivityType(final int code) { ZeppOsActivityType(final int code, final ActivityKind activityKind) {
this.code = (byte) code; this.code = (byte) code;
this.activityKind = activityKind;
} }
public byte getCode() { public byte getCode() {

View File

@ -1434,6 +1434,111 @@
<string name="activity_type_trail_run">Trail run</string> <string name="activity_type_trail_run">Trail run</string>
<string name="activity_type_wrestling">Wrestling</string> <string name="activity_type_wrestling">Wrestling</string>
<string name="activity_type_unknown">Unknown activity</string> <string name="activity_type_unknown">Unknown activity</string>
<string name="activity_type_navigate">Navigate</string>
<string name="activity_type_indoor_track">Indoor Track</string>
<string name="activity_type_handcycling">Handcycling</string>
<string name="activity_type_e_bike">E-Bike</string>
<string name="activity_type_bike_commute">Bike Commute</string>
<string name="activity_type_handcycling_indoor">Handcycling Indoor</string>
<string name="activity_type_transition">Transition</string>
<string name="activity_type_fitness_equipment">Fitness Equipment</string>
<string name="activity_type_platform_tennis">Platform Tennis</string>
<string name="activity_type_american_football">American Football</string>
<string name="activity_type_training">Training</string>
<string name="activity_type_cardio">Cardio</string>
<string name="activity_type_breathwork">Breathwork</string>
<string name="activity_type_xc_classic_ski">XC Classic Ski</string>
<string name="activity_type_mountaineering">Mountaineering</string>
<string name="activity_type_multisport">Multisport</string>
<string name="activity_type_paddling">Paddling</string>
<string name="activity_type_flying">Flying</string>
<string name="activity_type_motorcycling">Motorcycling</string>
<string name="activity_type_boating">Boating</string>
<string name="activity_type_driving">Driving</string>
<string name="activity_type_hang_gliding">Hang Gliding</string>
<string name="activity_type_inline_skating">Inline Skating</string>
<string name="activity_type_climb_indoor">Climb Indoor</string>
<string name="activity_type_bouldering">Bouldering</string>
<string name="activity_type_sail_race">Sail Race</string>
<string name="activity_type_sail_expedition">Sail Expedition</string>
<string name="activity_type_ice_skating">Ice Skating</string>
<string name="activity_type_sky_diving">Sky Diving</string>
<string name="activity_type_snowshoe">Snowshoe</string>
<string name="activity_type_snowmobiling">Snowmobiling</string>
<string name="activity_type_stand_up_paddleboarding">Standup Paddleboarding</string>
<string name="activity_type_wakeboarding">Wakeboarding</string>
<string name="activity_type_water_skiing">Water Skiing</string>
<string name="activity_type_kayaking">Kayaking</string>
<string name="activity_type_rafting">Rafting</string>
<string name="activity_type_tactical">Tactical</string>
<string name="activity_type_jumpmaster">Jumpmaster</string>
<string name="activity_type_floor_climbing">Floor Climbing</string>
<string name="activity_type_softball_slow_pitch">Softball Slow Pitch</string>
<string name="activity_type_shooting">Shooting</string>
<string name="activity_type_winter_sport">Winter Sport</string>
<string name="activity_type_grinding">Grinding</string>
<string name="activity_type_health_snapshot">Health Snapshot</string>
<string name="activity_type_marine">Marine</string>
<string name="activity_type_video_gaming">Video Gaming</string>
<string name="activity_type_racket">Racket</string>
<string name="activity_type_padel">Padel</string>
<string name="activity_type_racquetball">Racquetball</string>
<string name="activity_type_push_walk_speed">Push - Walk Speed</string>
<string name="activity_type_indoor_push_walk_speed">Indoor Push - Walk Speed</string>
<string name="activity_type_push_run_speed">Push - Run Speed</string>
<string name="activity_type_indoor_push_run_speed">Indoor Push - Run Speed</string>
<string name="activity_type_meditation">Meditation</string>
<string name="activity_type_para_sport">Para Sport</string>
<string name="activity_type_disc_golf">Disc Golf</string>
<string name="activity_type_ultimate_disc">Ultimate Disc</string>
<string name="activity_type_team_sport">Team Sport</string>
<string name="activity_type_lacrosse">Lacrosse</string>
<string name="activity_type_water_tubing">Water Tubing</string>
<string name="activity_type_wakesurfing">Wakesurfing</string>
<string name="activity_type_mixed_martial_arts">Mixed Martial Arts</string>
<string name="activity_type_aerobic_combo">Aerobic combo</string>
<string name="activity_type_aerobics">Aerobics</string>
<string name="activity_type_air_walker">Air walker</string>
<string name="activity_type_artistic_swimming">Artistic swimming</string>
<string name="activity_type_ballroom_dance">Ballroom dance</string>
<string name="activity_type_bmx">BMX</string>
<string name="activity_type_board_game">Board game</string>
<string name="activity_type_bocce">Bocce</string>
<string name="activity_type_breaking">Breaking</string>
<string name="activity_type_bridge">Bridge</string>
<string name="activity_type_cardio_combat">Cardio combat</string>
<string name="activity_type_checkers">Checkers</string>
<string name="activity_type_chess">Chess</string>
<string name="activity_type_dragon_boat">Dragon boat</string>
<string name="activity_type_esports">Esports</string>
<string name="activity_type_finswimming">Finswimming</string>
<string name="activity_type_flowriding">Flowriding</string>
<string name="activity_type_folk_dance">Folk dance</string>
<string name="activity_type_frisbee">Frisbee</string>
<string name="activity_type_futsal">Futsal</string>
<string name="activity_type_hacky_sack">Hacky sack</string>
<string name="activity_type_hip_hop">Hip-hop</string>
<string name="activity_type_hula_hoop">Hula hoop</string>
<string name="activity_type_jai_alai">Jai alai</string>
<string name="activity_type_judo">Judo</string>
<string name="activity_type_jujitsu">Jujitsu</string>
<string name="activity_type_mass_gymnastics">Mass gymnastics</string>
<string name="activity_type_modern_dance">Modern dance</string>
<string name="activity_type_muay_thai">Muay thai</string>
<string name="activity_type_parallel_bars">Parallel bars</string>
<string name="activity_type_pole_dance">Pole dance</string>
<string name="activity_type_race_walking">Race walking</string>
<string name="activity_type_shuffleboard">Shuffleboard</string>
<string name="activity_type_snorkeling">Snorkeling</string>
<string name="activity_type_somatosensory_game">Somatosensory game</string>
<string name="activity_type_spinning">Spinning</string>
<string name="activity_type_square_dance">Square dance</string>
<string name="activity_type_stair_climber">Stair climber</string>
<string name="activity_type_table_football">Table football</string>
<string name="activity_type_tug_of_war">Tug of war</string>
<string name="activity_type_wall_ball">Wall ball</string>
<string name="activity_type_water_polo">Water polo</string>
<string name="activity_type_weiqi">Weiqi</string>
<string name="activity_summaries">Sport Activities</string> <string name="activity_summaries">Sport Activities</string>
<string name="activity_summary_detail">Sport Activity Detail</string> <string name="activity_summary_detail">Sport Activity Detail</string>
<string name="activity_summary_edit_name_title">Edit label</string> <string name="activity_summary_edit_name_title">Edit label</string>