lib/fit_parser/file.rb in fit_parser-1.0.0 vs lib/fit_parser/file.rb in fit_parser-1.0.1

- old
+ new

@@ -1,7 +1,9 @@ module FitParser class File + MSG_NUM_FIELD_DESCRIPTION = 206 + def self.read(io) new.read(io) end attr_reader :header, :records, :crc @@ -16,10 +18,13 @@ dev_definitions = {} while io.pos < @header.end_pos record = Record.new(definitions, dev_definitions) @records << record.read(io) content = record.content - if content[:raw_field_0] == 0 + if content[:global_message_number] == MSG_NUM_FIELD_DESCRIPTION + field_definition_local_message_type = record.header.local_message_type + end + if !content[:global_message_number] && field_definition_local_message_type && record.header.local_message_type == field_definition_local_message_type dev_definitions[content[:raw_field_0].to_s] ||= {} dev_definitions[content[:raw_field_0].to_s][content[:raw_field_1].to_s] = content end definitions = record.definitions end