Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When converting to fit format, a name should be generated if there's none in the original format #876

Open
ari-s opened this issue May 1, 2022 · 3 comments

Comments

@ari-s
Copy link

ari-s commented May 1, 2022

It looks like fit files have a name inside them. At least some devices delete fit-files if that is not set.

Therefore, in the case the original file does not have a corresponding value I suggest to generate one, e.g. from the filename (maybe discarding the extension)

gpx files can have a name tag directly below the gpx root.

When I convert such a file to fit and put it on my garmin watch, the watch deletes the file. This should be avoided, hence the suggested workaround.

@robertlipe
Copy link
Collaborator

Our writers have no idea where any given data element comes from as it may have been filtered, merged, interpolated, etc. So the GPX idea falls a bit flat, but we may be able to work with the name of the fit file we're writing - the file writer definitely knows that.

However, we have about a bazillion "name" things in our formats and code. By inspection (I don't think any of my 100+ GPSes do .fit) the only thing that catches my eye as possibly funny is that here:
[garmin_fit](https://github.com/GPSBabel/gpsbabel/blob/29b154f81bad73cf9dd8da07b4f92fdb3ebd361e/garmin_fit.cc

We use the name of the first route we see (which, in GPX parlance would be a ) and that name may or may not exist, but we pass it to

GarminFitFormat::fit_write_header_msgs(const gpsbabel::DateTime& ctime, const QString& name) const

which makes it down to
GarminFitFormat::fit_write_fixed_string(const QString& s, unsigned int len) const

...which looks like it would just write a 0 terminator and then the number of bytes written (1: the terminator) which looks like some kind of FIT thing.

Maybe it would be better to not write an empty string? Maybe we need some kind of rte->rte_name.isEmpty() ? "default" : rte->rte_name to just write SOMETHING there. If that basically fixes it, we can figure out how we can clean the output name (which might be usb:: or \share\some\long\name or file:\\c:\some\name or have unsavory punctuation or something, but let's figure out if just writing something is better than writing nothing. Or, if testing that we have nothing and not wrting that at all is better.

Since you have the test case and the affected hardware, it'll probably be up to you to do the experimentation.

@tsteven4
Copy link
Collaborator

tsteven4 commented Dec 8, 2022

Writers can see session information. In the common use case of one input file I think we should be able to recover the input file name.

@tsteven4
Copy link
Collaborator

tsteven4 commented Dec 8, 2022

It isn't clear to that the name in the course message is what the OP needs on his watch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants