I'm working on writing some workout FIT files using a language that is not supported by the SDK. Since my use case is primarily just for workouts, I thought I could wade through the documentation and understand how to build them.
Unfortunately I'm a bit stuck finding the appropriate data in the documentation. Here's a sample of a workout fit file that I'm stuck trying to understand.
x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xa xb xc xd xe xf
0 : 0e 10 4d 08 ce 03 00 00 2e 46 49 54 29 b7 40 00 [..M......FIT).@.]
10 : 00 00 00 07 03 04 8c 04 04 86 07 04 86 01 02 84 [................]
20 : 02 02 84 05 02 84 00 01 00 00 3c 92 68 24 e8 d4 [..........<.h$..]
30 : 3a 3e ff ff ff ff 01 00 fe ff ff ff 05 40 00 00 [:>...........@..]
40 : 31 00 03 02 14 07 00 02 84 01 01 02 00 00 00 00 [1...............]
50 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [................]
60 : 00 00 00 00 40 00 00 1a 00 0c 05 04 8c 08 20 07 [....@......... .]
70 : 0a 04 86 06 02 84 07 02 84 0c 02 84 0e 02 84 04 [................]
80 : 01 00 09 01 00 0b 01 00 0d 01 00 0f 01 00 00 20 [............... ]
90 : 00 00 00 52 75 6e 20 57 6f 72 6b 6f 75 74 00 6e [...Run Workout.n]
A0 : 6f 74 65 73 00 00 00 00 00 01 01 00 00 00 20 00 [otes.......... .]
B0 : 03 09 01 00 00 00 00 03 00 ff ff ff ff ff ff 01 [................]
C0 : 01 ff ff ff 40 00 00 1b 00 0f 00 10 07 02 04 86 [....@...........]
D0 : 04 04 86 05 04 86 06 04 86 08 c8 07 fe 02 84 0a [................]
So you have the file header:
x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xa xb xc xd xe xf
0 : 0e 10 4d 08 ce 03 00 00 2e 46 49 54 29 b7 [..M......FIT).]
Then right after it there's the definition message
x0 x1 x2 x3 x4 x5 x6 x7 x8 x9 xa xb xc xd xe xf
0 : 40 00 00 00 00 07 [@.....]
This indicates there's 7 fields following the first 6 bytes, correct?
Field: 03 04 8c
Field: 04 04 86
Field: 07 04 86
Field: 01 02 84
Field: 02 02 84
Field: 05 02 84
Field: 00 01 00
So if this is correct so far, each 3 bytes are: the Field Definition Number, how many bytes are needed, type of variable.
- Do the bytes needed, directly follow the 3 bytes?
- Unfortunately it's not at all clear to me how to find the meaning of these 3 bytes. The SDK overview just says see the File Enum and each language has its own way of sorting these out and it would take me a while to walk through the code to understand what its doing.
I'm hoping a little nudge in the right direction will quickly help me figure out how to encode/decode these messages.