1.3. records
- class fitdecode.records.FitChunk(index, offset, bytes)
- index
zero-based index of this frame in the file
- offset
the offset at which this frame starts in the file
- class fitdecode.records.FitHeader(header_size, proto_ver, profile_ver, body_size, crc, crc_matched, chunk)
- frame_type = 1
- header_size
- proto_ver
- profile_ver
- body_size
- crc
may be null
- crc_matched
- class fitdecode.records.FitDefinitionMessage(is_developer_data, local_mesg_num, time_offset, mesg_type, global_mesg_num, endian, field_defs, dev_field_defs, chunk)
- frame_type = 3
- is_developer_data
- local_mesg_num
- time_offset
- mesg_type
- global_mesg_num
- endian
- field_defs
list of
FieldDefinition
- dev_field_defs
list of
DevFieldDefinition
- property name
- property all_field_defs
- class fitdecode.records.FitDataMessage(is_developer_data, local_mesg_num, time_offset, def_mesg, fields, chunk)
- frame_type = 4
- is_developer_data
Is this a “developer” message?
- local_mesg_num
The local definition number of this message
- def_mesg
- property name
Message name
- property global_mesg_num
The global definition number of this message
- property mesg_type
The
MessageType
object this message is associated to
- has_field(field_name_or_num)
Is the desired field present in this message?
field_name_or_num is the name of the field (
str
), or its definition number (int
).See also
- get_field(field_name_or_num, idx=0)
Get the desired
FieldData
object.field_name_or_num is the name of the field (
str
), or its definition number (int
).idx is the zero-based index of the specified field among other fields with the same name/number. I.e. not the index of the field in the list of fields of this message. That is,
idx=0
is the first field_name_or_num field found in this message.idx is useful in case a message contains multiple fields with the same field_name_or_num.
See also
- get_fields(field_name_or_num)
Like
get_field
but yield everyFieldData
object matching field_name_or_num fields in this message - i.e. generator.See also
- get_raw_value(field_name_or_num, *, idx=0, fallback=<object object>, raw_value=True, fit_type=None, py_type=<object object>)
- get_value(field_name_or_num, *, idx=0, fallback=<object object>, raw_value=False, fit_type=None, py_type=<object object>)
Get the value (or raw_value) of a field specified by its name or its definition number (field_name_or_num), with optional type checking.
idx has the same meaning than for
get_field
.fallback can be specified to avoid
KeyError
being raised in case no field matched field_name_or_num.fit_type can be a
str
to indicate a given FIT type is expected (as defined in FIT profile; e.g.date_time
,manufacturer
, …), in which caseTypeError
may be raised in case of a type mismatch.py_type can be a Python type or a
tuple
of types to expect (as passed toisinstance
), in which caseTypeError
may be raised in case of a type mismatch.raw_value can be set to a true value so that the returned value is field’s
raw_value
property instead ofvalue
. This does not impact the way fit_type and py_type are interpreted.Special case: field_name_or_num can be
None
, in which case the field will be selected using idx only. In this case, idx is interpreted to be the zero-based index in the list of fields.See also
- get_values(field_name_or_num, *, raw_value=False, fit_type=None, py_type=<object object>)
Like
get_value
but yield every value of all the fields that match field_name_or_num - i.e. generator.It is not possible to specify a fallback value so
KeyError
will always be raised in case the specified field was not found.The other arguments have the same meaning than for
get_value
.See also