Class: PostRunner::DailyMonitoringAnalyzer::MonitoringSample

Inherits:
Object
  • Object
show all
Defined in:
lib/postrunner/DailyMonitoringAnalyzer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(m) ⇒ MonitoringSample



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/postrunner/DailyMonitoringAnalyzer.rb', line 28

def initialize(m)
  @timestamp = m.timestamp
  types = [
    'generic', 'running', 'cycling', 'transition',
    'fitness_equipment', 'swimming', 'walking', 'unknown7',
    'resting', 'unknown9'
  ]
  if (cati = m.current_activity_type_intensity)
    @activity_type = types[cati & 0x1F]
    @activity_intensity = (cati >> 5) & 0x7
  else
    @activity_type = m.activity_type
  end
  @active_time = m.active_time
  @active_calories = m.active_calories
  @ascent = m.ascent
  @descent = m.descent
  @floors_climbed = m.floors_climbed
  @floors_descended = m.floors_descended
  @cycles = m.cycles
  @distance = m.distance
  @duration_min = m.duration_min
  @heart_rate = m.heart_rate
  @steps = m.steps
  @weekly_moderate_activity_minutes = m.weekly_moderate_activity_minutes
  @weekly_vigorous_activity_minutes = m.weekly_vigorous_activity_minutes
end

Instance Attribute Details

#active_caloriesObject (readonly)

Returns the value of attribute active_calories.



23
24
25
# File 'lib/postrunner/DailyMonitoringAnalyzer.rb', line 23

def active_calories
  @active_calories
end

#activity_typeObject (readonly)

Returns the value of attribute activity_type.



23
24
25
# File 'lib/postrunner/DailyMonitoringAnalyzer.rb', line 23

def activity_type
  @activity_type
end

#cyclesObject (readonly)

Returns the value of attribute cycles.



23
24
25
# File 'lib/postrunner/DailyMonitoringAnalyzer.rb', line 23

def cycles
  @cycles
end

#distanceObject (readonly)

Returns the value of attribute distance.



23
24
25
# File 'lib/postrunner/DailyMonitoringAnalyzer.rb', line 23

def distance
  @distance
end

#floors_climbedObject (readonly)

Returns the value of attribute floors_climbed.



23
24
25
# File 'lib/postrunner/DailyMonitoringAnalyzer.rb', line 23

def floors_climbed
  @floors_climbed
end

#floors_descendedObject (readonly)

Returns the value of attribute floors_descended.



23
24
25
# File 'lib/postrunner/DailyMonitoringAnalyzer.rb', line 23

def floors_descended
  @floors_descended
end

#stepsObject (readonly)

Returns the value of attribute steps.



23
24
25
# File 'lib/postrunner/DailyMonitoringAnalyzer.rb', line 23

def steps
  @steps
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



23
24
25
# File 'lib/postrunner/DailyMonitoringAnalyzer.rb', line 23

def timestamp
  @timestamp
end

#weekly_moderate_activity_minutesObject (readonly)

Returns the value of attribute weekly_moderate_activity_minutes.



23
24
25
# File 'lib/postrunner/DailyMonitoringAnalyzer.rb', line 23

def weekly_moderate_activity_minutes
  @weekly_moderate_activity_minutes
end

#weekly_vigorous_activity_minutesObject (readonly)

Returns the value of attribute weekly_vigorous_activity_minutes.



23
24
25
# File 'lib/postrunner/DailyMonitoringAnalyzer.rb', line 23

def weekly_vigorous_activity_minutes
  @weekly_vigorous_activity_minutes
end