Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register

   

FIT Java SDK file size

RankRankRankRank

Total Posts: 122

Joined 2010-10-25

PM

Having added in HRV messages to my FIT export code the size of the generated FIT files has ballooned dramatically. I believe this is due to the way the underlying Java SDK is not doing any caching of the definitions but putting in a new one for every new message type. While I was just using standard Activity records this was not a big issue but now with intermingled HRV messages things are not looking so good.

What's the chance of a fix for the Java FIT source code for this issue.      
RankRankRank

Total Posts: 91

Joined 2012-10-12

PM

Hi Ifor,
Are you by chance using the same local id for hrv and record or other messages? If so a new definition will necessarily be generated each time you write a different message type. You can set a different local id using myMesg.setLocalNum(i).

Regards
ShaneP      
RankRankRankRank

Total Posts: 122

Joined 2010-10-25

PM

OK I have given this a go. To be honest I never even knew this API call existed it's not in the encoder example. I have just used the number of beats in the HRV message as the localNum leaving the standard records on the default 0 which has sorted things out nicely.      
Rank

Total Posts: 9

Joined 0

PM

Can you explain this issue with a bit more details? What is actually setLocalNum method for and how we should use it?      
RankRankRank

Total Posts: 91

Joined 2012-10-12

PM

Each FIT message header includes the local message number which indicates how the message should be interpreted (using previously encountered message definition for that local number).

If the same local number is used for *different* messages the message definition must be resent each time the message meaning changes. If different local numbers are used the message definitions do not replace one another and do not need to be rewritten.

So 2 messages both using Local0
Local1 Def, HRV
Local1 Data HRV
Local1 Def, Record
Local1 Data, Record
Local1 Def, HRV
Local1 Data, HRV
Local1 Def, Record
Local1 Data, Record
...

If different Local numbers are used the definitions need only be sent once
Local1 Def, HRV
Local2 Def, Record
Local1 Data, HRV
Local2 Data, Record
Local1 Data, HRV
Local2 Data, Record
Local1 Data, HRV
Local2 Data, Record
...

See the FIT Protocol Document for more details, in particular §4.1.1 and §4.6.3.