diff options
author | Chris Schlaeger <chris@linux.com> | 2015-03-31 22:05:10 +0200 |
---|---|---|
committer | Chris Schlaeger <chris@linux.com> | 2015-03-31 22:05:10 +0200 |
commit | 09481a2a108da1a43d78dce529f90f0d522b900c (patch) | |
tree | 270a3c38572ec6504fc99edbdf76de2c8b33f9ca /spec | |
parent | 8ce62c8c06a43e4f1f5945a35d8d7f6ff170d2bf (diff) | |
download | postrunner-09481a2a108da1a43d78dce529f90f0d522b900c.zip |
Fixing the device_info handling
Diffstat (limited to 'spec')
-rw-r--r-- | spec/spec_helper.rb | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 67620f3..7c15dbb 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -1,3 +1,15 @@ +#!/usr/bin/env ruby -w +# encoding: UTF-8 +# +# = spec_helper.rb -- PostRunner - Manage the data from your Garmin sport devices. +# +# Copyright (c) 2014, 2015 by Chris Schlaeger <cs@taskjuggler.org> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of version 2 of the GNU General Public License as +# published by the Free Software Foundation. +# + def create_fit_file(name, date, duration_minutes = 30) Fit4Ruby.write(name, create_fit_activity(date, duration_minutes)) end @@ -13,9 +25,10 @@ def create_fit_activity(date, duration_minutes) a.new_event({ :timestamp => ts, :event => 'timer', :event_type => 'start_time' }) - a.new_device_info({ :timestamp => ts, :device_index => 0 }) - a.new_device_info({ :timestamp => ts, :device_index => 1, - :battery_status => 'ok' }) + a.new_device_info({ :timestamp => ts, :manufacturer => 'garmin', + :device_index => 0 }) + a.new_device_info({ :timestamp => ts, :manufacturer => 'garmin', + :device_index => 1, :battery_status => 'ok' }) 0.upto((a.total_timer_time / 60) - 1) do |mins| a.new_record({ :timestamp => ts, @@ -34,7 +47,7 @@ def create_fit_activity(date, duration_minutes) }) if mins > 0 && mins % 5 == 0 - a.new_lap({ :timestamp => ts }) + a.new_lap({ :timestamp => ts, :sport => 'running' }) end ts += 60 end @@ -46,10 +59,11 @@ def create_fit_activity(date, duration_minutes) :event_type => 'marker', :data => 52 }) a.new_event({ :timestamp => ts, :event => 'timer', :event_type => 'stop_all' }) - a.new_device_info({ :timestamp => ts, :device_index => 0 }) + a.new_device_info({ :timestamp => ts, :manufacturer => 'garmin', + :device_index => 0 }) ts += 1 - a.new_device_info({ :timestamp => ts, :device_index => 1, - :battery_status => 'low' }) + a.new_device_info({ :timestamp => ts, :manufacturer => 'garmin', + :device_index => 1, :battery_status => 'low' }) ts += 120 a.new_event({ :timestamp => ts, :event => 'recovery_hr', :event_type => 'marker', :data => 132 }) |