How to interprete profile types?

I want to verify if I'm reading the 'Types' sheet correct:

- All types have a base type. E.g. 'file' has base type 'enum'

- But not all types allow every potential value of the base type. E.g. 'file' has no value name corresponding with enum = 8. This must produce an error if it happens.

- Other types obviously do allow every potential value of the base type. E.g. 'weight' can have any uint16 value, only the value 0xFFFE does not represent a weight, but 'calculating' (and whatever that means is unclear).

- For many other types it is unclear if every potential value is allowed. E.g. 'mesg_count'. This is partly due to the fact that there is nu further documentation of the types. I can not always understand it from the type names.

QUESTION: is there an overview which types allow every potential value of the base type, and which ones do not?

  • What you are seeing in the Profile.xlsx are the publicly documented values. There are messages, fields, and types that are not documented. When you convert a FIT file with the FIT CSV Tool, the "unknown" values are the things that are not publicly documented.

    When decoding files you can choose how you want to handle unknown values. But when encoding values you need to stick to what is documented. Else you could be breaking the interoperability and compatibility of the file. You can create custom messages and custom types for use in custom messages, but you can't modify existing messages or types. If you need to add data to an existing message you can you developer data. Maintaining interoperability and compatibility is mentioned in the license agreement, adding custom messages is covered here https://developer.garmin.com/fit/cookbook/fitgen/ and working developer data is covered here https://developer.garmin.com/fit/cookbook/developer-data/ 

  • Hi Ben, thank you. This answers my question partially. What I still don't understand is how I can distinguish between types that are meant to contain a value (like 'date_time') and the ones that are an enumeration (like 'mesg_num'). Is there a list of types that are meant to contain a value?

  • All of the information that you are looking for is in Profile.xlsx. From the FIT file you will get a message id, field id, and raw value. Using the message and field ids you can look up the profile information which will tell you how to interpret the raw value. The profile provides the data type, which could be an enum, date_time, integer, float etc. The profile may also provide a scale and offset value to apply to the raw values.

    What you see in Profile.xlsx is included in each SDK. Look at profile.js, profile.py, profile.cs, etc. for examples. Most open source SDKs will have used the information in Profile.xlsx to create similar profile data structures.

    Try this, open Profile.xlsx in a spreadsheet app and then export the Types worksheet to a CSV file and then to the same for Messages. The two CSV files are the foundation for creating the profile data structure for your project. You will probably end up writing a script that reads the csv files and then writes out code that is usable in your project.

  • Thanks Ben. Generating code from the CSV is exactly what I did in my learning project (in Swift). I'm using the comment fields per type to see what types generate values other than enumerations.