Remarks about saving/replaying a .fit with sim

I can now reproduce the issue e.g.:
1. import the sample SimpleDataField in Eclipse
2. generate a Run Configuration for device e.g. Fenix 5
3. run the SimpleDataField in the sim
4. in the sim menu select 'Simulation > FIT Data > Simulate Data'
5. start the timer in the sim by klicking on the start button and let it run for e.g. 1 min
6. stop the timer in the sim by kicking on the start button again
7. in the sim menu select 'Simulation > FIT Data > Stop'
8. in the sim menu select 'Simulation > FIT Data > Save FIT session > enter a file name'

In the generated .fit there is something wrong or it's not properly recorded.

If replaying the .fit in the sim using 'Simulation > FIT Data > Playback File > select the file name' nothing happens.

If converting the .fit to .csv with the FIT CSV Tool an error occurs:
>>>java -jar F:\FitSDKRelease_21.20.00\java\FitCSVTool.jar -b SimpleDataFieldF5.fit SimpleDataFieldF5.csv
FIT CSV Tool - Protocol 2.0 Profile 21,20 Release
Exception in thread "main" java.lang.RuntimeException: com.garmin.fit.FitRuntime
Exception: FIT decode error: File is not FIT format. Check file header data typ
e. Error at byte: 24
at com.garmin.fit.csv.CSVTool.run(CSVTool.java:246)
at com.garmin.fit.csv.CSVTool.main(CSVTool.java:332)
Caused by: com.garmin.fit.FitRuntimeException: FIT decode error: File is not FIT
format. Check file header data type. Error at byte: 24
at com.garmin.fit.Decode.read(Decode.java:659)
at com.garmin.fit.Decode.resume(Decode.java:371)
at com.garmin.fit.Decode.read(Decode.java:348)
at com.garmin.fit.csv.CSVTool.run(CSVTool.java:220)
... 1 more

If the timer isn't started in the sim (#5. and #6. above) the saved .fit is correct and can be replayed or converted to .csv without an error. But some values in Activity.Info are initially 'null' (e.g. info.elapsedDistance and info.elapsedTime) and contains only results if the timer is running. So if the timer can't be started because of corrupting the .fit, the device in the sim can't display results and the user can't control the results during recording af the .fit.

So I'm not sure about the logic of the sim. Is this behavior correct or is it a bug?

  • Try adding

    7a. Data Fields>Timer>Save Activity

    While you stopped the activity with the button, you never actually saved it (finalized it).  Simply stopping is the same as a pause.

    Tried your steps with the addition of 7a, and things work fine.

    C:\CIQ\FitSDKRelease_21.20.00\java>fittocsv session3.fit
    FIT CSV Tool - Protocol 2.0 Profile 21.20 Release
    FIT binary file session3.fit decoded to session3*.csv files.
    Press any key to continue . . .

    BTW, the step 7 you use isn't needed.  

  • These steps are much clearer when you do a devive app.  Simply stopping the recording is how you pause an activity.  timerTime stops, but elapsedTime continues until you do a save.

    Stopping the simulated data playback is something that really doesn't happen on a real device and leaves things in limbo.

  • Many thanks Jim.

    This is the solution and you've saved my day Grinning

    BTW: I think it's a good idea if the sim is more detailed described in the Programmers Guide or have I missed some papers .

  • There could probably be a whole section in the PG just about the sim but there's not, as there's a whole bunch of stuff there.  And there are differences based on app type.  As I mentioned, in device apps this is different, as there you programmaticly start/stop/resume/save/discard/addLaps for activities.