Skip to content

Commit

Permalink
Garmin: parse the ACTIVITY message record
Browse files Browse the repository at this point in the history
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 <torvalds@linux-foundation.org>
  • Loading branch information
torvalds committed Jul 15, 2023
1 parent 4a2dec5 commit 2879bd6
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/garmin_parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) = {
Expand Down

0 comments on commit 2879bd6

Please sign in to comment.