Class: Joule::SRM::Parser
- Inherits:
-
Base::Parser
- Object
- Base::Parser
- Joule::SRM::Parser
- Defined in:
- lib/joule/srm/parser.rb
Constant Summary collapse
- HEADER_SIZE =
86
- MARKER_SIZE =
270
- BLOCK_SIZE =
6
Instance Attribute Summary
Attributes inherited from Base::Parser
Instance Method Summary collapse
Methods inherited from Base::Parser
Methods included from Calculator::PeakPowerCalculator
#calculate_peak_power_value, #calculate_peak_power_values
Methods included from Calculator::MarkerCalculator
#calculate_marker_averages, #calculate_marker_maximums, #calculate_marker_totals, #calculate_marker_training_metrics, #calculate_marker_values
Constructor Details
This class inherits a constructor from Joule::Base::Parser
Instance Method Details
#parse_properties ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/joule/srm/parser.rb', line 17 def parse_properties() str = @data.slice(0, HEADER_SIZE) @workout.properties = Joule::SRM::Properties.new @workout.properties.ident=str.slice(0,4) @workout.properties.srm_date = str.slice(4,2).unpack('S')[0] @workout.properties.wheel_size = str.slice(6,2).unpack('S')[0] @workout.properties.record_interval_numerator = str.slice(8,1).unpack('C')[0] @workout.properties.record_interval_denominator = str.slice(9,1).unpack('C')[0] @workout.properties.block_count = str.slice(10,2).unpack('S')[0] @workout.properties.marker_count = str.slice(12,2).unpack('S')[0] @workout.properties.comment = str.slice(16,70).toutf8.strip str=@data.slice(HEADER_SIZE + (MARKER_SIZE * (@workout.properties.marker_count + 1 )) + (BLOCK_SIZE * @workout.properties.block_count) , 6) @workout.properties.zero_offset = str.slice(0,2).unpack('S')[0] @workout.properties.slope = str.slice(2,2).unpack('S')[0] @workout.properties.record_count = str.slice(4,2).unpack('S')[0] end |
#parse_workout ⇒ Object
10 11 12 13 14 15 |
# File 'lib/joule/srm/parser.rb', line 10 def parse_workout() parse_markers parse_blocks parse_data_points parse_data_point_times end |