fit4ruby 3.9.0 → 3.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1f0a74c755c07cbbcfd9b17b9efeb16a62696fd9076c9ece178e00e51b3ce075
4
- data.tar.gz: 81ee48cea068828a6ad08c5f4f274270ec96179159e585ecc9068eccbf1be3a4
3
+ metadata.gz: d40c0fc77ae8184b42aa80643dfb6b0f036b3eab7f37bdb8ee66b76a9feaafc5
4
+ data.tar.gz: 6e8ce1d3472e67a3c7ba58200fdf6b395e009349e68dca0618a92b3176f8ff19
5
5
  SHA512:
6
- metadata.gz: 0f140497b1f269075e912da5988238db3a279ef5baf20e4ce29f3b960307c3b87a4ada116283f17f5965a7e0e25e9b3e5bcdce7306b14ae49cb16d837692b239
7
- data.tar.gz: 829a3ff7cee37f26218915d8370a0dd44fe6c24152c634f073fb0d25a543c3e50783188fe81f6d5cbbb00af42974eba1aed51f59ee25a108718773b7a65f8ad8
6
+ metadata.gz: 366a5e5b4f55ee4918c822e26eda16d6381a1e872b8af68504283def72f096e00717dc68f9bd52403d8e6662c4e2aff83d12d26e201d568794bca407513b5bd8
7
+ data.tar.gz: a4eda75c90f65d26b9786570ee0fa07e578a3d627996170385411305b17a7a9697b043de70b335e485f3ca5780cdb0157506d34212ab0c54947c4111fb951fbf
data/README.md CHANGED
@@ -10,7 +10,7 @@ me comments and patches. It was developed to form the back-end of
10
10
 
11
11
  ## Supported Devices
12
12
 
13
- Tested devices: Garmin FR620
13
+ Tested devices: Garmin FR620, Fenix 3, Fenix 5, Fenix 5X, Fenix 6X
14
14
 
15
15
  Other Garmin devices that generate FIT files may work as well. Since I
16
16
  don't have any other devices, I can't add support for them.
@@ -30,6 +30,8 @@ require 'fit4ruby/HRV'
30
30
  require 'fit4ruby/HeartRateZones'
31
31
  require 'fit4ruby/Event'
32
32
  require 'fit4ruby/PersonalRecords'
33
+ require 'fit4ruby/Workout'
34
+ require 'fit4ruby/WorkoutStep'
33
35
 
34
36
  module Fit4Ruby
35
37
 
@@ -54,6 +56,8 @@ module Fit4Ruby
54
56
  :epo_data,
55
57
  :user_profiles,
56
58
  :user_data,
59
+ :workouts,
60
+ :workout_steps,
57
61
  :sensor_settings,
58
62
  :developer_data_ids,
59
63
  :field_descriptions,
@@ -405,6 +409,22 @@ module Fit4Ruby
405
409
  new_fit_data_record('user_profile', field_values)
406
410
  end
407
411
 
412
+ # Add a new Workout to the Activity.
413
+ # @param field_values [Hash] A Hash that provides initial values for
414
+ # certain fields of the FitDataRecord.
415
+ # @return [UserProfile]
416
+ def new_workout(field_values = {})
417
+ new_fit_data_record('workout', field_values)
418
+ end
419
+
420
+ # Add a new WorkoutSet to the Activity.
421
+ # @param field_values [Hash] A Hash that provides initial values for
422
+ # certain fields of the FitDataRecord.
423
+ # @return [UserProfile]
424
+ def new_workout_set(field_values = {})
425
+ new_fit_data_record('workout_set', field_values)
426
+ end
427
+
408
428
  # Add a new PhysiologicalMetrics to the Activity.
409
429
  # @param field_values [Hash] A Hash that provides initial values for
410
430
  # certain fields of the FitDataRecord.
@@ -522,6 +542,10 @@ module Fit4Ruby
522
542
  @data_sources << (record = DataSources.new(field_values))
523
543
  when 'user_data'
524
544
  @user_data << (record = UserData.new(field_values))
545
+ when 'workout'
546
+ @workouts << (record = Workout.new(field_values))
547
+ when 'workout_step'
548
+ @workout_steps << (record = WorkoutStep.new(field_values))
525
549
  when 'user_profile'
526
550
  @user_profiles << (record = UserProfile.new(field_values))
527
551
  when 'physiological_metrics'
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # = FitDataRecord.rb -- Fit4Ruby - FIT file processing library for Ruby
5
5
  #
6
- # Copyright (c) 2014, 2015, 2020 by Chris Schlaeger <cs@taskjuggler.org>
6
+ # Copyright (c) 2014, 2015, 2020, 2021 by Chris Schlaeger <cs@taskjuggler.org>
7
7
  #
8
8
  # This program is free software; you can redistribute it and/or modify
9
9
  # it under the terms of version 2 of the GNU General Public License as
@@ -21,7 +21,7 @@ module Fit4Ruby
21
21
  include Converters
22
22
  include BDFieldNameTranslator
23
23
 
24
- RecordOrder = [ 'user_data', 'user_profile',
24
+ RecordOrder = [ 'user_data', 'user_profile', 'workout', 'workout_set',
25
25
  'device_info', 'data_sources', 'event',
26
26
  'record', 'lap', 'length', 'session', 'heart_rate_zones',
27
27
  'personal_records' ]
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # = GlobalFitDictionaries.rb -- Fit4Ruby - FIT file processing library for Ruby
5
5
  #
6
- # Copyright (c) 2014 by Chris Schlaeger <cs@taskjuggler.org>
6
+ # Copyright (c) 2014, 2021 by Chris Schlaeger <cs@taskjuggler.org>
7
7
  #
8
8
  # This program is free software; you can redistribute it and/or modify
9
9
  # it under the terms of version 2 of the GNU General Public License as
@@ -714,6 +714,9 @@ module Fit4Ruby
714
714
  entry 1, 'rest'
715
715
  entry 2, 'warmup'
716
716
  entry 3, 'cooldown'
717
+ entry 4, 'recovery'
718
+ entry 5, 'interval'
719
+ entry 6, 'other'
717
720
 
718
721
  dict 'hr_zone_calc'
719
722
  entry 0, 'custom'
@@ -933,6 +936,36 @@ module Fit4Ruby
933
936
  entry 17, 'hiking'
934
937
  entry 18, 'multisport'
935
938
  entry 19, 'paddling'
939
+ entry 20, 'flying'
940
+ entry 21, 'e_biking'
941
+ entry 22, 'motorcycling'
942
+ entry 23, 'boating'
943
+ entry 24, 'driving'
944
+ entry 25, 'golf'
945
+ entry 26, 'hang_gliding'
946
+ entry 27, 'horseback_riding'
947
+ entry 28, 'hunting'
948
+ entry 29, 'fishing'
949
+ entry 30, 'inline_skating'
950
+ entry 31, 'rock_climbing'
951
+ entry 32, 'sailing'
952
+ entry 33, 'ice_skating'
953
+ entry 34, 'sky_diving'
954
+ entry 35, 'snowshoeing'
955
+ entry 36, 'snowmobiling'
956
+ entry 37, 'stand_up_paddleboarding'
957
+ entry 38, 'surfing'
958
+ entry 39, 'wakeboarding'
959
+ entry 40, 'water_skiing'
960
+ entry 41, 'kayaking'
961
+ entry 42, 'rafting'
962
+ entry 43, 'windsurfing'
963
+ entry 44, 'kitesurfing'
964
+ entry 45, 'tactical'
965
+ entry 46, 'jumpmaster'
966
+ entry 47, 'boxing'
967
+ entry 48, 'floor_climbing'
968
+ entry 53, 'diving'
936
969
  entry 254, 'all'
937
970
 
938
971
  dict 'swim_stroke'
@@ -1023,6 +1056,79 @@ module Fit4Ruby
1023
1056
  entry 2, 'maintaining'
1024
1057
  entry 3, 'up'
1025
1058
 
1059
+ dict 'wkt_step_duration'
1060
+ entry 0, 'time'
1061
+ entry 1, 'distance'
1062
+ entry 2, 'hr_less_than'
1063
+ entry 3, 'hr_greater_than'
1064
+ entry 4, 'calories'
1065
+ entry 5, 'open'
1066
+ entry 6, 'repeat_until_steps_cmplt'
1067
+ entry 7, 'repeat_until_time'
1068
+ entry 8, 'repeat_until_distance'
1069
+ entry 9, 'repeat_until_calories'
1070
+ entry 10, 'repeat_until_hr_less_than'
1071
+ entry 11, 'repeat_until_hr_greater_than'
1072
+ entry 12, 'repeat_until_power_less_than'
1073
+ entry 13, 'repeat_until_power_greater_than'
1074
+ entry 14, 'power_less_than'
1075
+ entry 15, 'power_greater_than'
1076
+ entry 16, 'training_peaks_tss'
1077
+ entry 17, 'repeat_until_power_last_lap_less_than'
1078
+ entry 18, 'repeat_until_max_power_last_lap_less_than'
1079
+ entry 19, 'power_3s_less_than'
1080
+ entry 20, 'power_10s_less_than'
1081
+ entry 21, 'power_30s_less_than'
1082
+ entry 22, 'power_3s_greater_than'
1083
+ entry 23, 'power_10s_greater_than'
1084
+ entry 24, 'power_30s_greater_than'
1085
+ entry 25, 'power_lap_less_than'
1086
+ entry 26, 'power_lap_greater_than'
1087
+ entry 27, 'repeat_until_training_peaks_tss'
1088
+ entry 28, 'repetition_time'
1089
+ entry 29, 'reps'
1090
+ entry 31, 'time_only'
1091
+
1092
+ dict 'wkt_step_target'
1093
+ entry 0, 'speed'
1094
+ entry 1, 'heart_rate'
1095
+ entry 2, 'open'
1096
+ entry 3, 'cadence'
1097
+ entry 4, 'power'
1098
+ entry 5, 'grade'
1099
+ entry 6, 'resistance'
1100
+ entry 7, 'power_3s'
1101
+ entry 8, 'power_10s'
1102
+ entry 9, 'power_30s'
1103
+ entry 10, 'power_lap'
1104
+ entry 11, 'swim_stroke'
1105
+ entry 12, 'speed_lap'
1106
+ entry 13, 'heart_rate_lap'
1107
+
1108
+ dict 'workout_capabilities'
1109
+ entry 0x1, 'interval'
1110
+ entry 0x2, 'custom'
1111
+ entry 0x4, 'fitness_equipment'
1112
+ entry 0x8, 'firstbeat'
1113
+ entry 0x10, 'new_leaf'
1114
+ entry 0x20, 'tcx'
1115
+ entry 0x80, 'speed'
1116
+ entry 0x100, 'heart_rate'
1117
+ entry 0x200, 'distance'
1118
+ entry 0x400, 'cadence'
1119
+ entry 0x800, 'power'
1120
+ entry 0x1000, 'grade'
1121
+ entry 0x2000, 'resistance'
1122
+ entry 0x4000, 'protected'
1123
+
1124
+ dict 'workout_equipment'
1125
+ entry 0, 'none'
1126
+ entry 1, 'swim_fins'
1127
+ entry 2, 'swim_kickboard'
1128
+ entry 3, 'swim_paddles'
1129
+ entry 4, 'swim_pull_buoy'
1130
+ entry 5, 'swim_snorkel'
1131
+
1026
1132
  end
1027
1133
 
1028
1134
  end
@@ -3,7 +3,7 @@
3
3
  #
4
4
  # = GlobalFitMessages.rb -- Fit4Ruby - FIT file processing library for Ruby
5
5
  #
6
- # Copyright (c) 2014, 2015, 2020 by Chris Schlaeger <cs@taskjuggler.org>
6
+ # Copyright (c) 2014, 2015, 2020, 2021 by Chris Schlaeger <cs@taskjuggler.org>
7
7
  #
8
8
  # This program is free software; you can redistribute it and/or modify
9
9
  # it under the terms of version 2 of the GNU General Public License as
@@ -461,19 +461,23 @@ module Fit4Ruby
461
461
  field 169, 'uint16', 'undocumented_field_169'
462
462
  field 170, 'uint16', 'undocumented_field_170'
463
463
  field 177, 'uint16', 'undocumented_field_177'
464
- field 178, 'uint16', 'undocumented_field_178'
464
+ field 178, 'uint16', 'est_sweat_loss', :unit => 'ml' # guessed
465
465
  field 179, 'uint16', 'undocumented_field_179'
466
466
  field 180, 'uint16', 'undocumented_field_180'
467
- field 181, 'float32', 'undocumented_field_181'
468
- field 183, 'uint16', 'undocumented_field_183'
467
+ field 181, 'float32', 'total_grit', :unit => 'kGrit'
468
+ field 182, 'float32', 'total_flow', :unit => 'Flow'
469
+ field 183, 'uint16', 'jump_count'
469
470
  field 184, 'enum', 'undocumented_field_184'
470
471
  field 185, 'uint8', 'undocumented_field_185'
471
- field 187, 'float32', 'undocumented_field_187'
472
+ field 186, 'float32', 'avg_grit', :unit => 'kGrit'
473
+ field 187, 'float32', 'avg_flow', :unit => 'Flow'
472
474
  field 188, 'enum', 'undocumented_field_188'
473
475
  field 189, 'uint16', 'undocumented_field_189'
474
476
  field 190, 'uint16', 'undocumented_field_190'
475
477
  field 194, 'uint8', 'undocumented_field_194'
476
478
  field 195, 'uint8', 'undocumented_field_195'
479
+ field 199, 'uint8', 'total_fractional_ascent', :scale => 100, :unit => 'm'
480
+ field 200, 'uint8', 'total_fractional_descent', :scale => 100, :unit => 'm'
477
481
  field 253, 'uint32', 'timestamp', :type => 'date_time'
478
482
  field 254, 'uint16', 'message_index'
479
483
 
@@ -745,6 +749,48 @@ module Fit4Ruby
745
749
  # counter.
746
750
  field 2, 'byte', 'undocumented_field_2', :array => true
747
751
 
752
+ message 26, 'workout'
753
+ field 4, 'enum', 'sport', :dict => 'sport'
754
+ field 5, 'uint32z', 'capabilities', :dict => 'workout_capabilities'
755
+ field 6, 'uint16', 'num_valid_step'
756
+ field 8, 'string', 'wkt_name'
757
+ field 11, 'enum', 'sub_sport', :dict => 'sub_sport'
758
+ field 14, 'uint16', 'pool_length', :scale => 100, :unit => 'm'
759
+ field 15, 'enum', 'pool_length_unit'
760
+
761
+ message 27, 'workout_step'
762
+ field 0, 'string', 'wkt_step_name'
763
+ field 1, 'enum', 'duration_type', :dict => 'wkt_step_duration'
764
+ alt_field 2, 'duration_type' do
765
+ field :default, 'uint32', 'duration_value'
766
+ field 'distance', 'uint32', 'duration_distance', :scale => 100, :unit => 'm'
767
+ field 'time', 'uint32', 'duration_time', :scale => 1000, :unit => 's'
768
+ field 'repeat_until_steps_cmplt', 'uint32', 'duration_reps'
769
+ end
770
+ field 3, 'enum', 'target_type', :dict => 'wkt_step_target'
771
+ alt_field 4, 'target_type' do
772
+ field :default, 'uint32', 'target_value'
773
+ field 'speed', 'uint32', 'target_speed_zone'
774
+ field 'cadence', 'uint32', 'target_cadence_zone'
775
+ field 'power', 'uint32', 'target_power_zone'
776
+ end
777
+ alt_field 5, 'target_type' do
778
+ field :default, 'uint32', 'custom_target_value_low'
779
+ field 'speed', 'uint32', 'custom_target_speed_low', :scale => 1000, :unit => 'm/s'
780
+ end
781
+ alt_field 6, 'target_type' do
782
+ field :default, 'uint32', 'custom_target_value_high'
783
+ field 'speed', 'uint32', 'custom_target_speed_high', :scale => 1000, :unit => 'm/s'
784
+ end
785
+ field 7, 'enum', 'intensity', :dict => 'intensity'
786
+ field 8, 'string', 'notes'
787
+ field 9, 'enum', 'equipment', :dict => 'workout_equipment'
788
+ field 10, 'uint16', 'exercise_category'
789
+ field 11, 'uint16', 'exercise_name'
790
+ field 12, 'uint16', 'exercise_weight', :scale => 100, :unit => 'kg'
791
+ field 13, 'uint16', 'weight_display_unit'
792
+ field 254, 'uint16', 'message_index'
793
+
748
794
  # Message 29 is just a guess. It's not officially documented.
749
795
  # Found in LCTNS.FIT on Fenix 3
750
796
  message 29, 'location'
@@ -0,0 +1,31 @@
1
+ #!/usr/bin/env ruby -w
2
+ # encoding: UTF-8
3
+ #
4
+ # = Workout.rb -- Fit4Ruby - FIT file processing library for Ruby
5
+ #
6
+ # Copyright (c) 2021 by Chris Schlaeger <cs@taskjuggler.org>
7
+ #
8
+ # This program is free software; you can redistribute it and/or modify
9
+ # it under the terms of version 2 of the GNU General Public License as
10
+ # published by the Free Software Foundation.
11
+ #
12
+
13
+ require 'fit4ruby/FitDataRecord'
14
+
15
+ module Fit4Ruby
16
+
17
+ class Workout < FitDataRecord
18
+
19
+ def initialize(field_values = {})
20
+ super('workout')
21
+ set_field_values(field_values)
22
+ end
23
+
24
+ def check(index)
25
+ end
26
+
27
+ end
28
+
29
+ end
30
+
31
+
@@ -0,0 +1,32 @@
1
+ #!/usr/bin/env ruby -w
2
+ # encoding: UTF-8
3
+ #
4
+ # = WorkoutStep.rb -- Fit4Ruby - FIT file processing library for Ruby
5
+ #
6
+ # Copyright (c) 2021 by Chris Schlaeger <cs@taskjuggler.org>
7
+ #
8
+ # This program is free software; you can redistribute it and/or modify
9
+ # it under the terms of version 2 of the GNU General Public License as
10
+ # published by the Free Software Foundation.
11
+ #
12
+
13
+ require 'fit4ruby/FitDataRecord'
14
+
15
+ module Fit4Ruby
16
+
17
+ class WorkoutStep < FitDataRecord
18
+
19
+ def initialize(field_values = {})
20
+ super('workout_step')
21
+ set_field_values(field_values)
22
+ end
23
+
24
+ def check(index)
25
+ end
26
+
27
+ end
28
+
29
+ end
30
+
31
+
32
+
@@ -1,4 +1,4 @@
1
1
  module Fit4Ruby
2
2
  # The version number of the library.
3
- VERSION = '3.9.0'
3
+ VERSION = '3.10.0'
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fit4ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.9.0
4
+ version: 3.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Schlaeger
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-11-17 00:00:00.000000000 Z
11
+ date: 2022-08-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bindata
@@ -164,6 +164,8 @@ files:
164
164
  - lib/fit4ruby/TrainingStatus.rb
165
165
  - lib/fit4ruby/UserData.rb
166
166
  - lib/fit4ruby/UserProfile.rb
167
+ - lib/fit4ruby/Workout.rb
168
+ - lib/fit4ruby/WorkoutStep.rb
167
169
  - lib/fit4ruby/version.rb
168
170
  - spec/FileNameCoder_spec.rb
169
171
  - spec/FitFile_spec.rb
@@ -176,7 +178,7 @@ homepage: https://github.com/scrapper/fit4ruby
176
178
  licenses:
177
179
  - GNU GPL version 2
178
180
  metadata: {}
179
- post_install_message:
181
+ post_install_message:
180
182
  rdoc_options: []
181
183
  require_paths:
182
184
  - lib
@@ -191,8 +193,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
193
  - !ruby/object:Gem::Version
192
194
  version: '0'
193
195
  requirements: []
194
- rubygems_version: 3.2.22
195
- signing_key:
196
+ rubygems_version: 3.2.32
197
+ signing_key:
196
198
  specification_version: 4
197
199
  summary: Library to read and write GARMIN FIT files.
198
200
  test_files: