Welcome Guest,Register Now
Log In

ANT Forum

Welcome guest, please Login or Register


Inconsistency in FIT SDK while processing fields with default values


Total Posts: 1

Joined 2019-05-06


I am on SDK 20.66.00-0-gc7b345b. As for me there is some inconsistency in FIT SDK while processing developer fields with default values.
1) FIT SDK C++ decoder does not save value for fields with defaults. However it still saves this entry. As a result we have an entry with no value. I am referring to FieldBase::Read() with returns FIT_TRUE even for entries with default values, i.e:
if (memcmp(pointbaseTypeInvalids[GetType() & FIT_BASE_TYPE_NUM_MASK]typeSize) != 0)
.insert(values.end(), byteDatabyteData bytesLeft);

2) FIT SDK C++ encoder on the other hand does not ignore fields with default value and writes them to file.

It seems to me that SDK should have the same behavior while processing default values. Either ignore them completely or save as is.
Also I do not see any reason to save field, but do not save it's value. So propose to update FieldBase::Read() to return FIT_FALSE when field with default values is encountered. This way we can detect such fields and ignore them during decoding. For example, add a check like to Decode::ReadByte():
if (FIT_TRUE == field.Read(&fieldData;, fldDefn->GetSize()))

Total Posts: 120

Joined 2013-05-07


Hi Ros,

When encoding a field, if the value is invalid, it is encoded as invalid. The record is not removed, because to some decoders, the presence of the record, even with a null value, is valuable information.

When decoding an invalid, the value is reported as null. From what I understand, reporting invalids as nulls is the behavior for native and developer data fields alike.