Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

Getting started with the decode c example

Rank

Total Posts: 6

Joined 0

PM

I'm struggling to get starated with the SDK reading fit files.

When using the c example of decode (from within Visual Studio), the fit file is opened successfully, but in this call:

convert_return = FitConvert_Read(buf, buf_size),

The return value (i.e., convert_return) is 0 during the approximately 20,000 call (in one of several fit files I've tried) and the only message that is output is:

"File converted successfully."

convert_return is never FIT_CONVERT_MESSAGE_AVAILABLE, and no other messages are output.

Am I missing something conceptually? Does the c decode example work?

The C++ example outputs the Type, Manufacture, Product, and Serial number, but not activity data. Shouldn't it output the activity?

The csv example does output all the data, but I'd prefer not to go to csv...

Thanks!      
Avatar
Rank

Total Posts: 7

Joined 2012-02-22

PM

I haven't looked too closely at the C Decode but try decoding the settings file in the top level examples folder of the SDK archive (examples\\settings.fit). You should observe the FIT_USER_PROFILE_MESG and FIT_FILE_ID_MESG messages being decoded.

For the Cpp Decode demo, try decoding the settings.fit file again and step into the FileId Listener (the OnMesg(fit::FileIdMesg&) function). The demo is just outputting particular fields although if you look at the mesg object in the debugger you will see its been decoded correctly. You can modify the OnMesg function to suit your application or write new listeners for other messages of interest.      
Rank

Total Posts: 6

Joined 0

PM

Thanks pilsworth.

It turned out that in the C example, FIT_LOCAL_MESGS (which was defined as 1) needed to be changed to 16. Then I received the session, activity, etc messages.

Oddy, FIT_LOCAL_MESGS was documented as "Sets maximum number of local messages that can be decoded. Lower to minimize RAM requirements." Lowering the number might minimize RAM requirements, but it also prevents messages from coming through.      
Rank

Total Posts: 6

Joined 0

PM

Thanks Pilsworth. It turned out I needed to increase the FIT_LOCAL_MESGS define from 1 to 16. The comment regarding FIT_LOCAL_MESGS says "Sets maximum number of local messages that can be decoded. Lower to minimize RAM requirements." Leaving this at 1 might minimize ram requirements, but it also limits the messages that are decoded.