Skip to content

Segments FIT File Structure

BenniG82 edited this page Jan 5, 2015 · 24 revisions

File structure

Below you will find the structure of a segment fit file. There are currently some values with an unknown purpose, so I'm using constant values for them. The file structure has been analyzed by using a couple of existing segment files from Garmin Connect. There may be supported messages/message definitions which are not listed here since they are not used by Garmin Connect at the moment.

General Headers

Header No.1

Msg-Definition

Name Value Comment
Type Definition
Arch 1
Number 0
Local Number 0
Fields 6
Message-Type file_id Well known datatype in FIT SDK, no further inspection

Sample Message

Name Value Comment
Type Message
Message-Type file_id
References Local Number 0
Fields 6
Field "type" 34
Field "manufacturer" 1
Field "garmin_product" 65534
Field "time_created" Seconds since 1990-01-01 00:00:00
Field "serial_number" 1
Field "number" 1

Header No.2

Msg-Definition

Name Value Comment
Type Definition
Arch 1
Number 49
Local Number 1
Fields 2
Message-Type file_creator Well known datatype in FIT SDK, no further inspection

Sample Message

Name Value Comment
Type Message
Message-Type file_creator
References Local Number 1
Fields 2
Field "hardware_version" 0
Field "software_version" 0

Segment Metadata

Header No.1 - Name, UID

Msg-Definition

Name Value Comment
Type Definition
Arch 1
Number 148
Local Number 2
Fields 6
Message-Type segment_meta_general (This type name is choosen by me)
Field 0 "segment_name" num: 0; type=7 [String] Segment Name
Field 1 "segment_uid" num: 1; type=7 [String] Segment UID from garmin-connect (e.g. E9B8A28D1932479D981D5256F8A8BB0E)
Field 2 "unknown_enum" num: 2; type=0 [Enum] Unknown. Value always 2
Field 3 "unknown_enum2" num: 3; type=0 [Enum] Unknown. Value always 1
Field 4 "exporting_user_id" num: 4; type=134 [UInt32] A user id from connect?
Field 5 "unknown_uint8" num: 6; type=2 [UInt8] Unknown. Value always 0

Sample Message

Name Value Comment
Type Message
Message-Type segment_meta_general
References Local Number 2
Fields 6
Field "segment_name" Testsegment für 1000er
Field "segment_uid" a7e23d28612879d67fbf9d23ac8b33b3
Field "unknown_enum" Value always 2
Field "unknown_enum2" Value always 1
Field "exporting_user_id" 1234 (Value does not matter)
Field "unknown_uint8" Value always 0

Header No.2 - Leaderboard

Msg-Definition

Name Value Comment
Type Definition
Arch 1
Number 149
Local Number 3
Fields 5
Message-Type segment_leaderborad (This type name is choosen by me)
Field 0 "leader_type" num: 1; type=0 [Enum] Type of the Leader
0=Segment leader
1=Personal best
2="Connection"
3=Group leader
4=Challenger
5 or greater="H"
Field 1 "unknown_uint32" num: 2; type=134 [UInt32] Not present in the actual messages?!
Field 2 "source_activity" num: 3; type=134 [UInt32] ID of the Garmin Connect activity
Field 3 "finish_time" num: 4; type=134 [UInt32] Time to finish in milliseconds
Field 4 "message_index" num: 254; type=132 [UInt16] Field for the message-counter

Sample Message

TBD

Header No.3 - Segment Position and Length

Msg-Definition

Name Value Comment
Type Definition
Arch 1
Number 142
Local Number 4
Fields 14
Message-Type segment_meta_geo (This type name is choosen by me)
Field 0 "segment_start_lat" num: 3; type=133 [SInt32][semicircles] Latitude of segment start
Field 1 "segment_start_long" num: 4; type=133 [SInt32][semicircles] Longitude of segment start
Field 2 "segment_end_lat" num: 5; type=133 [SInt32][semicircles] Latitude of segment end
Field 3 "segment_end_long" num: 6; type=133 [SInt32][semicircles] Longitude of segment end
Field 4 "distance" num: 9; type=134 [UInt32][centimeters] Length of the segment
Field 5 "ascent" num: 21; type=132 [UInt16][meters] Total ascent
Field 6 "descent" num: 22; type=132 [UInt16][meters] Total descent
Field 7 "unknown_enum" num: 23; type=0 [Enum] Unknown. Always 2
Field 8 "segment_max_lat" num: 25; type=133 [SInt32][semicircles] Maximum latitude covered by the segment
Field 9 "segment_max_long" num: 26; type=133 [SInt32][semicircles] Maximum longitude covered by the segment
Field 10 "segment_min_lat" num: 27; type=133 [SInt32][semicircles] Minimum latitude covered by the segment
Field 11 "segment_min_long" num: 28; type=133 [SInt32][semicircles] Minimum longitude covered by the segment
Field 12 "segment_uid" num: 65; type=7 [String] Segment UID
Field 13 "message_index" num: 254; type=132 [UInt16] Field for the message-counter

Sample Message

TBD

Segment Trackpoint and timing

Msg-Definition

Name Value Comment
Type Definition
Arch 1
Number 150
Local Number 5
Fields 6
Message-Type segment_track_point (This type name is choosen by me)
Field 0 "point_lat" num: 1; type=133 [SInt32][semicircles] Longitude
Field 1 "point_long" num: 2; type=133 [SInt32][semicircles] Latitude
Field 2 "distance" num: 3; type=134 [UInt32][centimeters] Distance from start to point
Field 3 "elevation" num: 4; type=132 [UInt16][m] Altitude of the point. Scale 5, Offet 100
Field 4 "timer" num: 5; type=134 [UInt32][millis] Time from start to point. Subfields allowed for multiple competitors
Field 5 "message_index" num: 254; type=132 [UInt16] Field for the message-counter

Sample Message

TBD