The ANT ‘Flexibile & Interoperatble Data Transfer’ (FIT) protocol
ANT devices and Garmin GPS units, like the Edge 810 I use, store all device information in .FIT files. This format is defined in the FIT SDK. It is a binary protocol, not human readable, designed for embedded devices (having limited resources).
Since I wanted to decode the activity files, containing the GPS track, I decided to write a file reader.
The .FIT reader is delivered in a JAR file, together with Javadocs. The FitReader class is the entry point. The readFile() method does the job. It returns a FitRecordRepository instance, containing the FitRecords read. A FitRecord is identified by the FIT Message name as defined in the Global Profile (see FIT SDK). The FitRecordRepository instance and FitRecords can be used for querying. Refer to the javadocs, the FitReader source code and tests, for some example code.
The code uses date4j for DateTime calculation.
The Compressed TimeStamp is not supported yet
Garmin Track Converter
The ‘proof of the pudding’ for the FitReader is the Garmin Track Converter which I wrote to convert tracks logged with my Garmin Edge 810 bike computer. The converter takes in the .FIT files and converts the tracks to .GPX format, to be used in other programs.
Waypoints that can be indicated by the user are not stored in the track .FIT. Up to 100 waypoints can be stored in a separate file, Locations.fit. The converter takes this file into account and selects the waypoints that were logged during the track. These selected waypoints <wpt> are combined with the track data <trk> in the GPX file.
The name and serial number of the device is stored in the description of the track.
Available on GitHub: