From 2879bd69a51d9b5e6f8306ad65c683b549c3affc Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Sat, 15 Jul 2023 10:11:04 -0700 Subject: [PATCH] Garmin: parse the ACTIVITY message record The ACTIVITY message contains a "local timestamp" in addition to the regular timestamp. That gives us the timezone information. Or rather, it would give us the timezone info if we actually used it. But now we at least parse it, so that we *could* use it. Signed-off-by: Linus Torvalds --- src/garmin_parser.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/garmin_parser.c b/src/garmin_parser.c index 07ae0f5..44a080c 100644 --- a/src/garmin_parser.c +++ b/src/garmin_parser.c @@ -635,6 +635,15 @@ DECLARE_FIELD(DEVICE_INFO, firmware, UINT16) garmin->record_data.pending |= RECORD_DEVICE_INFO; } +// ACTIVITY +DECLARE_FIELD(ACTIVITY, total_timer_time, UINT32) { } +DECLARE_FIELD(ACTIVITY, num_sessions, UINT16) { } +DECLARE_FIELD(ACTIVITY, type, ENUM) { } +DECLARE_FIELD(ACTIVITY, event, ENUM) { } +DECLARE_FIELD(ACTIVITY, event_type, ENUM) { } +DECLARE_FIELD(ACTIVITY, local_timestamp, UINT32) { } +DECLARE_FIELD(ACTIVITY, event_group, UINT8) { } + // SPORT DECLARE_FIELD(SPORT, sub_sport, ENUM) { garmin->dive.sub_sport = (ENUM) data; @@ -999,7 +1008,19 @@ DECLARE_MESG(DEVICE_INFO) = { } }; -DECLARE_MESG(ACTIVITY) = { }; +DECLARE_MESG(ACTIVITY) = { + .maxfield = 7, + .field = { + SET_FIELD(ACTIVITY, 0, total_timer_time, UINT32), + SET_FIELD(ACTIVITY, 1, num_sessions, UINT16), + SET_FIELD(ACTIVITY, 2, type, ENUM), + SET_FIELD(ACTIVITY, 3, event, ENUM), + SET_FIELD(ACTIVITY, 4, event_type, ENUM), + SET_FIELD(ACTIVITY, 5, local_timestamp, UINT32), + SET_FIELD(ACTIVITY, 6, event_group, UINT8), + } +}; + DECLARE_MESG(FILE_CREATOR) = { }; DECLARE_MESG(DIVE_SETTINGS) = {