Deciphering FIT files for Strava

There are multiple file formats which Strava supports for uploading activities: * FIT * GPX * TCX

Of the three, the FIT format is the only binary format. The other two use XML. I’m working on uploading data to Strava which is collected using a program written in Ada. I figured I might as well try writing all the related programs in Ada as well. Since Ada does not have an XML library built-in and I didn’t want to use a 3rd party library for this, I figured I would use the FIT format. Then I could define Read and Write attributes for all the types that my FIT file uses and upload it. The task wasn’t as simple as I thought it would be.

  1. It is tedious to figure out what data I need to support and even more so, it’s tedious to write out all the definitions (especially if I end up refactoring things a couple times like I tend to do).

  2. I had some trouble figuring out how optional fields work. Are they zeroed out? Is there some indication of which fields are excluded from the data?

  3. It is going to be slow to test, especially on Linux…because I suck at Linux.

The FIT SDK contains all the information needed to decipher the binary format. The first thing I would like to do is create some tests which validate conversion to and from CSV/FIT because that’s what an example program in the FIT SDK does.

First, let’s document what comes in that zip file