Class: Fit4Ruby::FitDefinition
- Inherits:
-
BinData::Record
- Object
- BinData::Record
- Fit4Ruby::FitDefinition
- Defined in:
- lib/fit4ruby/FitDefinition.rb
Overview
The FitDefinition contains the blueprints for FitMessageRecord segments of FIT files. Before a message record can occur in a FIT file, its definition must be included in the FIT file. The definition holds enough information about the message record to define its size. It also contains some basic information how to interpret the data in the record. To fully understand the message record data the full definition in the GlobalFitMessage is required.
Constant Summary collapse
- @@has_developer_data =
false
Class Method Summary collapse
Instance Method Summary collapse
- #check ⇒ Object
- #endian ⇒ Object
- #has_developer_data? ⇒ Boolean
- #setup(fit_message_definition) ⇒ Object
Class Method Details
.read(io, entity, developer_data_flag) ⇒ Object
59 60 61 62 |
# File 'lib/fit4ruby/FitDefinition.rb', line 59 def FitDefinition::read(io, entity, developer_data_flag) @@has_developer_data = developer_data_flag != 0 super(io) end |
Instance Method Details
#check ⇒ Object
52 53 54 55 56 57 |
# File 'lib/fit4ruby/FitDefinition.rb', line 52 def check if architecture.snapshot > 1 Log.fatal "Illegal architecture value #{architecture.snapshot}" end data_fields.each { |f| f.check } end |
#endian ⇒ Object
48 49 50 |
# File 'lib/fit4ruby/FitDefinition.rb', line 48 def endian architecture.snapshot == 0 ? :little : :big end |
#has_developer_data? ⇒ Boolean
70 71 72 |
# File 'lib/fit4ruby/FitDefinition.rb', line 70 def has_developer_data? @@has_developer_data end |
#setup(fit_message_definition) ⇒ Object
74 75 76 77 78 79 80 81 82 83 |
# File 'lib/fit4ruby/FitDefinition.rb', line 74 def setup() .fields_by_number.each do |number, f| fdf = FitDefinitionField.new fdf.field_definition_number = number fdf.set_type(f.type) data_fields << fdf end self.field_count = data_fields.length end |