Support FR310xt latest firmware

Fit file format can now have a 12 and 14 byte header. This
patch adds support for 14 byte headers since this is required
by the latest 310xt firmware.

Fixes #430.
This commit is contained in:
Mark Liversedge
2011-08-27 09:05:04 +01:00
parent a3fa6e861c
commit deffbcc52a

View File

@@ -542,15 +542,20 @@ struct FitFileReaderState
return NULL;
}
int header_size = read_uint8();
if (header_size != 12) {
if (header_size != 12 && header_size != 14) {
errors << QString("bad header size: %1").arg(header_size);
delete rideFile;
return NULL;
}
int protocol_version = read_uint8();
(void) protocol_version;
// if the header size is 14 we have profile minor then profile major
// version. We still don't do anything with this information
int profile_version = read_uint16(false); // always littleEndian
if (header_size == 14) profile_version = read_uint16(false);
(void) profile_version; // not sure what to do with this
int data_size = read_uint32(false); // always littleEndian
char fit_str[5];
if (file.read(fit_str, 4) != 4) {