tormoder / fit

A Go package for decoding and encoding Garmin FIT files
MIT License
245 stars 42 forks source link

Troubles creating "course" file types #55

Closed pieterclaerhout closed 3 years ago

pieterclaerhout commented 3 years ago

I'm trying to use this library to generate fit files of the type "course".

I'm able to generate them, but they always come out as invalid.

After a lot of investigation, it turns out that the main issue is that for a "course" file, the SDK doesn't allow you to define event messages (it only allows this for "activity" files). From what I can read in the Garmin Fit SDK and the cookbook samples, the timer events are required.

Am I overlooking something or does the SDK currently doesn't allow you to do this?

tormoder commented 3 years ago

Thanks for reporting the issue.

I made the file types structs a long time ago based on the PDF, FIT FILE TYPES Description, found in the SDK distribution. The Event message is (still) not mentioned there under Course File section.

But, as you say, I can see it mentioned here: https://developer.garmin.com/fit/file-types/course/

I think it would be easy to just add an EventMsg slice (as for ActivityFile) here: https://github.com/tormoder/fit/blob/master/file_types.go#L61 and adjust the add method.

I can try to do it later, but a PR is also welcome.

pieterclaerhout commented 3 years ago

Adding that fixed it and I've submitted a PR :-)

tormoder commented 3 years ago

Tagged v0.10.0.