tormoder/fit

Writer excludes fields that are missing from the first data message

Closed this issue · 0 comments

bpg commented

In some real life scenarios sensors may connect / disconnect / reconnect during the recording of an activity. As the result, the activity file may have several "blocks" of records with different definition messages that have different set of fields. A common use case is when a power meter was connected to a Garmin bike computer after the activity recording has been started.

In the current fit file model we combine all messages of the same type in one collection (per type), with message fields initialized with "invalid" values for all the fields that don't have a valid data. When this file is writing back by the writer it is quite possible to have such message with missing fields as the first message in the collection, which then will be used as a template to build a definition message for all records of this type. All fields of the following records that don't have a matching definition field will be excluded from the final result.