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
- #fit_entity ⇒ Object
- #has_developer_data? ⇒ Boolean
- #setup(fit_message_definition) ⇒ Object
Class Method Details
.read(io, entity, developer_data_flag, fit_entity) ⇒ Object
60 61 62 63 64 |
# File 'lib/fit4ruby/FitDefinition.rb', line 60 def FitDefinition::read(io, entity, developer_data_flag, fit_entity) @@has_developer_data = developer_data_flag != 0 @@fit_entity = fit_entity super(io) end |
Instance Method Details
#check ⇒ Object
52 53 54 55 56 57 58 |
# 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 } developer_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 |
#fit_entity ⇒ Object
76 77 78 |
# File 'lib/fit4ruby/FitDefinition.rb', line 76 def fit_entity @@fit_entity end |
#has_developer_data? ⇒ Boolean
72 73 74 |
# File 'lib/fit4ruby/FitDefinition.rb', line 72 def has_developer_data? @@has_developer_data end |
#setup(fit_message_definition) ⇒ Object
80 81 82 83 84 85 86 87 88 89 |
# File 'lib/fit4ruby/FitDefinition.rb', line 80 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 |