SDK 14.0 c examples defines:
in fit_example.h:
#define FIT_SESSION_MESG_DEF_SIZE 269
Here is how this definition is used:
// write Session record
FIT_SESSION_MESG fit_session;
Fit_InitMesg(fit_mesg_defs[FIT_MESG_SESSION], &fit;_session);
fit_session.timestamp = (FIT_DATE_TIME) next_second;
fit_session.sport = FIT_SPORT_SWIMMING;
fit_session.total_elapsed_time = nDurationInMillis;
fit_session.total_timer_time = nDurationInMillis;
fit_session.total_distance = 0;
fit_session.total_ascent = 0;
WriteMessageDefinition(0, fit_mesg_defs[FIT_MESG_SESSION], FIT_SESSION_MESG_DEF_SIZE, fp);
WriteMessage(0, &fit;_session, FIT_SESSION_MESG_SIZE, fp);
but the encode routines call for FIT_UINT8 for the param which is too small to contain the value 269.
Here are the encode routines:
void WriteMessageDefinition(FIT_UINT8 local_mesg_number, const void *mesg_def_pointer, FIT_UINT8 mesg_def_size, FILE *fp)
void WriteMessage(FIT_UINT8 local_mesg_number, const void *mesg_pointer, FIT_UINT8 mesg_size, FILE *fp)
void WriteData(const void *data, FIT_UINT8 data_size, FILE *fp)
If I change the params to FIT_UNIT16 it breaks the crc.
The session message has too many fields which makes it too large to have msg size fit in an unsigned char (8 bits) field. The largest size allowed should be 255.
when I use decode on the encoded fit file I get Error decoding file. when it gets to reading the session message.
Strava fit files ask for session messages for their uploads. they claim they use the following fields:
session
sport
total_elapsed_time
total_timer_time
total_distance
total_ascent