Method: Joule::SRM::Parser#parse_properties

Defined in:
lib/joule/srm/parser.rb

#parse_propertiesObject



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