blib/lib/Geo/FIT.pm

filter: Statementstmt 62.4% 708 / 1134 Branchbran 44.8% 280 / 624 Conditioncond 33.3% 25 / 75 MC/DCmcdc 19.5% 9 / 46 Subroutinesub 71.1% 69 / 97 Podpod 39.7% 33 / 83 totaltotal 54.5% 1124 / 2059 CC 329 SCAR 46.0
CC
329
Cov
55%
syscallback_devdata_field_desc
650.0
print_all_json
462.0
fetch_definition_message
202.8
CRAP 99.1
« blib/script/fit2tcx.pl ↑ Summary blib/script/locations2gpx.pl »
1 package Geo::FIT;
2 16 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 16 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 16 our $VERSION = '1.08';
6  
7 =encoding utf-8
8  
9 =head1 NAME
10  
11 Geo::FIT - Decode Garmin FIT files
12  
13 =head1 SYNOPSIS
14  
15 use Geo::FIT;
16  
17 Create an instance, assign a FIT file to it, open it:
18  
19 my $fit = Geo::FIT->new();
20 $fit->file( $fname );
21 $fit->open or die $fit->error;
22  
23 Register a callback to get some info on where we've been and when:
24  
25 my $record_callback = sub {
26 my ($self, $descriptor, $values) = @_;
27  
28 my $time= $self->field_value( 'timestamp', $descriptor, $values );
29 my $lat = $self->field_value( 'position_lat', $descriptor, $values );
30 my $lon = $self->field_value( 'position_long', $descriptor, $values );
31  
32 print "Time was: ", join("\t", $time, $lat, $lon), "\n"
33 };
34  
35 $fit->data_message_callback_by_name('record', $record_callback ) or die $fit->error;
36  
37 my @header_things = $fit->fetch_header;
38  
39 1 while ( $fit->fetch );
40  
41 $fit->close;
42  
43 =head1 DESCRIPTION
44  
45 C<Geo::FIT> is a Perl class to provide interfaces to decode Garmin FIT files (*.fit).
46  
47 The module also provides a script to read and print the contents of FIT files (L<fitdump.pl>), a script to convert FIT files to TCX files (L<fit2tcx.pl>), and a script to convert a locations file to GPX format (L<locations2gpx.pl>).
48  
49 =cut
50  
51 16 ▶use Carp qw/ croak /;
Subroutine BEGIN: called CC=1 SCAR=0.0
52 16 ▶use Clone;
Subroutine BEGIN: called CC=1 SCAR=0.0
53 16 ▶use FileHandle;
Subroutine BEGIN: called CC=1 SCAR=0.0
54 16 ▶use POSIX qw(BUFSIZ);
Subroutine BEGIN: called CC=1 SCAR=0.0
55 16 ▶use Time::Local;
Subroutine BEGIN: called CC=1 SCAR=0.0
56 16 ▶use Scalar::Util qw(blessed looks_like_number);
Subroutine BEGIN: called CC=1 SCAR=0.0
57  
58 16 my $uint64_invalid;
59 BEGIN {
60 16 ▶ eval { $uint64_invalid = unpack('Q', pack('a', -1)) };
Subroutine BEGIN: called CC=2 SCAR=7.0
61 16 ▶ unless (defined $uint64_invalid) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $uint64_invalid) 16 0 16
62 16 require Math::BigInt;
63 16 import Math::BigInt
64 }
65 }
66  
67 16 require Exporter;
68 16 our @ISA = qw(Exporter);
69 16 our @EXPORT = qw(
70 FIT_ENUM
71 FIT_SINT8
72 FIT_UINT8
73 FIT_SINT16
74 FIT_UINT16
75 FIT_SINT32
76 FIT_UINT32
77 FIT_SINT64
78 FIT_UINT64
79 FIT_STRING
80 FIT_FLOAT32
81 FIT_FLOAT64
82 FIT_UINT8Z
83 FIT_UINT16Z
84 FIT_UINT32Z
85 FIT_UINT64Z
86 FIT_BYTE
87 FIT_BASE_TYPE_MAX
88 FIT_HEADER_LENGTH
89 );
90  
91 sub FIT_ENUM() {0;}
92 sub FIT_SINT8() {1;}
93 sub FIT_UINT8() {2;}
94 sub FIT_SINT16() {3;}
95 sub FIT_UINT16() {4;}
96 sub FIT_SINT32() {5;}
97 sub FIT_UINT32() {6;}
98 sub FIT_STRING() {7;}
99 sub FIT_FLOAT32() {8;}
100 sub FIT_FLOAT64() {9;}
101 sub FIT_UINT8Z() {10;}
102 sub FIT_UINT16Z() {11;}
103 sub FIT_UINT32Z() {12;}
104 sub FIT_BYTE() {13;}
105 sub FIT_SINT64() {14;}
106 sub FIT_UINT64() {15;}
107 sub FIT_UINT64Z() {16;}
108 sub FIT_BASE_TYPE_MAX() {FIT_UINT64Z;}
109  
110 16 my ($rechd_offset_compressed_timestamp_header, $rechd_mask_compressed_timestamp_header,
111 $rechd_offset_cth_local_message_type, $rechd_length_cth_local_message_type,
112 $rechd_mask_cth_local_message_type, $rechd_length_cth_timestamp, $rechd_mask_cth_timestamp,
113 $rechd_offset_definition_message, $rechd_mask_definition_message, $rechd_offset_devdata_message,
114 $rechd_mask_devdata_message, $rechd_length_local_message_type, $rechd_mask_local_message_type,
115 $cthd_offset_local_message_type, $cthd_length_local_message_type, $cthd_mask_local_message_type,
116 $cthd_length_time_offset, $cthd_mask_time_offset
117 );
118  
119 16 $rechd_offset_compressed_timestamp_header = 7;
120 16 $rechd_mask_compressed_timestamp_header = 1 << $rechd_offset_compressed_timestamp_header;
121 16 $rechd_offset_cth_local_message_type = 5;
122 16 $rechd_length_cth_local_message_type = 2;
123 16 $rechd_mask_cth_local_message_type = ((1 << $rechd_length_cth_local_message_type) - 1) << $rechd_offset_cth_local_message_type;
124 16 $rechd_length_cth_timestamp = $rechd_offset_cth_local_message_type;
125 16 $rechd_mask_cth_timestamp = (1 << $rechd_length_cth_timestamp) - 1;
126 16 $rechd_offset_definition_message = 6;
127 16 $rechd_mask_definition_message = 1 << $rechd_offset_definition_message;
128 16 $rechd_offset_devdata_message = 5;
129 16 $rechd_mask_devdata_message = 1 << $rechd_offset_devdata_message;
130 16 $rechd_length_local_message_type = 4;
131 16 $rechd_mask_local_message_type = (1 << $rechd_length_local_message_type) - 1;
132 16 $cthd_offset_local_message_type = 5;
133 16 $cthd_length_local_message_type = 2;
134 16 $cthd_mask_local_message_type = (1 << $cthd_length_local_message_type) - 1;
135 16 $cthd_length_time_offset = 5;
136 16 $cthd_mask_time_offset = (1 << $cthd_length_time_offset) - 1;
137  
138 16 my ($defmsg_min_template, $defmsg_min_length);
139 16 $defmsg_min_template = 'C C C S C';
140 16 $defmsg_min_length = length(pack($defmsg_min_template));
141  
142 16 my ($deffld_template, $deffld_length, $deffld_mask_endian_p, $deffld_mask_type);
143 16 $deffld_template = 'C C C';
144 16 $deffld_length = length(pack($deffld_template));
145 16 $deffld_mask_endian_p = 1 << 7;
146 16 $deffld_mask_type = (1 << 5) - 1;
147  
148 16 my ($devdata_min_template, $devdata_min_length, $devdata_deffld_template, $devdata_deffld_length);
149 16 $devdata_min_template = 'C';
150 16 $devdata_min_length = length(pack($devdata_min_template));
151 16 $devdata_deffld_template = 'C C C';
152 16 $devdata_deffld_length = length(pack($deffld_template));
153  
154 16 my @invalid = (0xFF) x ($deffld_mask_type + 1);
155 16 $invalid[FIT_SINT8] = 0x7F;
156 16 $invalid[FIT_SINT16] = 0x7FFF;
157 16 $invalid[FIT_UINT16] = 0xFFFF;
158 16 $invalid[FIT_SINT32] = 0x7FFFFFFF;
159 16 $invalid[FIT_UINT32] = 0xFFFFFFFF;
160 16 $invalid[FIT_STRING] = $invalid[FIT_UINT8Z] = $invalid[FIT_UINT16Z] = $invalid[FIT_UINT32Z] = $invalid[FIT_UINT64Z] = 0;
161 #$invalid[FIT_FLOAT32] = NaN;
162 #$invalid[FIT_FLOAT64] = NaN;
163 16 $invalid[FIT_FLOAT32] = unpack('f', pack('V', 0xFFFFFFFF));
164 16 $invalid[FIT_FLOAT64] = unpack('d', pack('V V', 0xFFFFFFFF, 0xFFFFFFFF));
165  
166 16 my ($big_int_base32, $sint64_2c_mask, $sint64_2c_base, $sint64_2c_sign);
167  
168 16 ▶if (defined $uint64_invalid) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $uint64_invalid) { } 0 16 16
169 0 $invalid[FIT_UINT64] = $uint64_invalid;
170 0 $invalid[FIT_SINT64] = eval '0x7FFFFFFFFFFFFFFF';
171 } else {
172 16 $invalid[FIT_UINT64] = Math::BigInt->new('0xFFFFFFFFFFFFFFFF');
173 16 $invalid[FIT_SINT64] = Math::BigInt->new('0x7FFFFFFFFFFFFFFF');
174 16 $big_int_base32 = Math::BigInt->new('0x100000000');
175 16 $sint64_2c_mask = Math::BigInt->new('0xFFFFFFFFFFFFFFFF');
176 16 $sint64_2c_base = Math::BigInt->new('0x10000000000000000');
177 16 $sint64_2c_sign = Math::BigInt->new('0x1000000000000000');
178 }
179  
180 sub packfilter_uint64_big_endian {
181 0 ▶ my @res = $_[0]->bdiv($big_int_base32);
Subroutine packfilter_uint64_big_endian: not called CC=1 SCAR=6.9
Pod undocumented
182 0 @res;
183 }
184  
185 sub packfilter_uint64_little_endian {
186 0 ▶ my @res = $_[0]->bdiv($big_int_base32);
Subroutine packfilter_uint64_little_endian: not called CC=1 SCAR=6.9
Pod undocumented
187 0 @res[1, 0];
188 }
189  
190 16 ▶my $my_endian = unpack('L', pack('N', 1)) == 1 ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
unpack('L', "\000\000\000\cA") == 1 ? : 0 16 16
191  
192 16 ▶*packfilter_uint64 = $my_endian ? \&packfilter_uint64_big_endian : \&packfilter_uint64_little_endian;
Branch: 1 branch
BranchTrueFalseTotal
$my_endian ? : 0 16 16
193  
194 sub unpackfilter_uint64_big_endian {
195 0 ▶ my ($hi, $lo) = @_;
Subroutine unpackfilter_uint64_big_endian: not called CC=1 SCAR=6.9
Pod undocumented
196 0 Math::BigInt->new($hi)->blsft(32)->badd($lo);
197 }
198  
199 sub unpackfilter_uint64_little_endian {
200 0 ▶ &unpackfilter_uint64_big_endian(@_[1, 0]);
Subroutine unpackfilter_uint64_little_endian: not called CC=1 SCAR=6.9
Pod undocumented
201 }
202  
203 16 ▶*unpackfilter_uint64 = $my_endian ? \&unpackfilter_uint64_big_endian : \&unpackfilter_uint64_little_endian;
Branch: 1 branch
BranchTrueFalseTotal
$my_endian ? : 0 16 16
204  
205 sub packfilter_sint64_big_endian {
206 0 ▶ if ($_[0]->bcmp(0) < 0) {
Subroutine packfilter_sint64_big_endian: not called CC=2 SCAR=17.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]->bcmp(0) < 0) { } 0 0 0
207 0 &packfilter_uint64_big_endian($sint64_2c_mask->band($sint64_2c_base->badd($_[0])));
208 } else {
209 0 &packfilter_uint64_big_endian($_[0]);
210 }
211 }
212  
213 sub packfilter_sint64_little_endian {
214 0 ▶ if ($_[0]->bcmp(0) < 0) {
Subroutine packfilter_sint64_little_endian: not called CC=2 SCAR=17.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
if ($_[0]->bcmp(0) < 0) { } 0 0 0
215 0 &packfilter_uint64_little_endian($sint64_2c_mask->band($sint64_2c_base->badd($_[0])));
216 } else {
217 0 &packfilter_uint64_little_endian($_[0]);
218 }
219 }
220  
221 16 ▶*packfilter_sint64 = $my_endian ? \&packfilter_sint64_big_endian : \&packfilter_sint64_little_endian;
Branch: 1 branch
BranchTrueFalseTotal
$my_endian ? : 0 16 16
222  
223 sub unpackfilter_sint64_big_endian {
224 0 ▶ my ($hi, $lo) = @_;
Subroutine unpackfilter_sint64_big_endian: not called CC=2 SCAR=17.9
Pod undocumented
225 0 my $n = Math::BigInt->new($hi)->blsft(32)->badd($lo)->band($sint64_2c_mask);
226  
227 0 ▶ if ($n->band($sint64_2c_sign)->bcmp(0) == 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($n->band($sint64_2c_sign)->bcmp(0) == 0) { } 0 0 0
228 0 $n;
229 } else {
230 0 $n->bsub($sint64_2c_base);
231 }
232 }
233  
234 sub unpackfilter_sint64_little_endian {
235 0 ▶ &unpackfilter_sint64_big_endian(@_[1, 0]);
Subroutine unpackfilter_sint64_little_endian: not called CC=1 SCAR=6.9
Pod undocumented
236 }
237  
238 16 ▶*unpackfilter_sint64 = $my_endian ? \&unpackfilter_sint64_big_endian : \&unpackfilter_sint64_little_endian;
Branch: 1 branch
BranchTrueFalseTotal
$my_endian ? : 0 16 16
239  
240 sub invalid {
241 0 ▶ my ($self, $type) = @_;
Subroutine invalid: not called CC=1 SCAR=6.9
Pod documented
242 0 $invalid[$type & $deffld_mask_type];
243 }
244  
245 16 my @size = (1) x ($deffld_mask_type + 1);
246 16 $size[FIT_SINT16] = $size[FIT_UINT16] = $size[FIT_UINT16Z] = 2;
247 16 $size[FIT_SINT32] = $size[FIT_UINT32] = $size[FIT_UINT32Z] = $size[FIT_FLOAT32] = 4;
248 16 $size[FIT_FLOAT64] = $size[FIT_SINT64] = $size[FIT_UINT64] = $size[FIT_UINT64Z] = 8;
249  
250 16 my (@template, @packfactor, @packfilter, @unpackfilter);
251 16 @template = ('C') x ($deffld_mask_type + 1);
252 16 @packfactor = (1) x ($deffld_mask_type + 1);
253 16 @packfilter = (undef) x ($deffld_mask_type + 1);
254 16 @unpackfilter = (undef) x ($deffld_mask_type + 1);
255  
256 16 $template[FIT_SINT8] = 'c';
257 16 $template[FIT_SINT16] = 's';
258 16 $template[FIT_UINT16] = $template[FIT_UINT16Z] = 'S';
259 16 $template[FIT_SINT32] = 'l';
260 16 $template[FIT_UINT32] = $template[FIT_UINT32Z] = 'L';
261 16 $template[FIT_FLOAT32] = 'f';
262 16 $template[FIT_FLOAT64] = 'd';
263  
264 16 ▶if (defined $uint64_invalid) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $uint64_invalid) { } 0 16 16
265 0 $template[FIT_SINT64] = 'q';
266 0 $template[FIT_UINT64] = $template[FIT_UINT64Z] = 'Q';
267 } else {
268 16 $template[FIT_SINT64] = $template[FIT_UINT64] = $template[FIT_UINT64Z] = 'L';
269 16 $packfactor[FIT_SINT64] = $packfactor[FIT_UINT64] = $packfactor[FIT_UINT64Z] = 2;
270 16 $packfilter[FIT_SINT64] = \&packfilter_sint64;
271 16 $unpackfilter[FIT_SINT64] = \&unpackfilter_sint64;
272 16 $packfilter[FIT_UINT64] = $packfilter[FIT_UINT64Z] = \&packfilter_uint64;
273 16 $unpackfilter[FIT_UINT64] = $unpackfilter[FIT_UINT64Z] = \&unpackfilter_uint64;
274 }
275  
276 16 my %named_type = (
277 'file' => +{
278 '_base_type' => FIT_ENUM,
279 'device' => 1,
280 'settings' => 2,
281 'sport' => 3,
282 'activity' => 4,
283 'workout' => 5,
284 'course' => 6,
285 'schedules' => 7,
286 'weight' => 9,
287 'totals' => 10,
288 'goals' => 11,
289 'blood_pressure' => 14,
290 'monitoring_a' => 15,
291 'activity_summary' => 20,
292 'monitoring_daily' => 28,
293 'monitoring_b' => 32,
294 'segment' => 34,
295 'segment_list' => 35,
296 'exd_configuration' => 40,
297 'mfg_range_min' => 0xF7,
298 'mfg_range_max' => 0xFE,
299 },
300  
301 'mesg_num' => +{
302 '_base_type' => FIT_UINT16,
303 'file_id' => 0,
304 'capabilities' => 1,
305 'device_settings' => 2,
306 'user_profile' => 3,
307 'hrm_profile' => 4,
308 'sdm_profile' => 5,
309 'bike_profile' => 6,
310 'zones_target' => 7,
311 'hr_zone' => 8,
312 'power_zone' => 9,
313 'met_zone' => 10,
314 'sport' => 12,
315 'goal' => 15,
316 'session' => 18,
317 'lap' => 19,
318 'record' => 20,
319 'event' => 21,
320 'source' => 22, # undocumented
321 'device_info' => 23,
322 'workout' => 26,
323 'workout_step' => 27,
324 'schedule' => 28,
325 'location' => 29, # undocumented
326 'weight_scale' => 30,
327 'course' => 31,
328 'course_point' => 32,
329 'totals' => 33,
330 'activity' => 34,
331 'software' => 35,
332 'file_capabilities' => 37,
333 'mesg_capabilities' => 38,
334 'field_capabilities' => 39,
335 'file_creator' => 49,
336 'blood_pressure' => 51,
337 'speed_zone' => 53,
338 'monitoring' => 55,
339 'training_file' => 72,
340 'hrv' => 78,
341 'ant_rx' => 80,
342 'ant_tx' => 81,
343 'ant_channel_id' => 82,
344 'length' => 101,
345 'monitoring_info' => 103,
346 'battery' => 104, # undocumented
347 'pad' => 105,
348 'slave_device' => 106,
349 'connectivity' => 127,
350 'weather_conditions' => 128,
351 'weather_alert' => 129,
352 'cadence_zone' => 131,
353 'hr' => 132,
354 'segment_lap' => 142,
355 'memo_glob' => 145,
356 'sensor' => 147, # undocumented
357 'segment_id' => 148,
358 'segment_leaderboard_entry' => 149,
359 'segment_point' => 150,
360 'segment_file' => 151,
361 'workout_session' => 158,
362 'watchface_settings' => 159,
363 'gps_metadata' => 160,
364 'camera_event' => 161,
365 'timestamp_correlation' => 162,
366 'gyroscope_data' => 164,
367 'accelerometer_data' => 165,
368 'three_d_sensor_calibration' => 167,
369 'video_frame' => 169,
370 'obdii_data' => 174,
371 'nmea_sentence' => 177,
372 'aviation_attitude' => 178,
373 'video' => 184,
374 'video_title' => 185,
375 'video_description' => 186,
376 'video_clip' => 187,
377 'ohr_settings' => 188,
378 'exd_screen_configuration' => 200,
379 'exd_data_field_configuration' => 201,
380 'exd_data_concept_configuration' => 202,
381 'field_description' => 206,
382 'developer_data_id' => 207,
383 'magnetometer_data' => 208,
384 'barometer_data' => 209,
385 'one_d_sensor_calibration' => 210,
386 'time_in_zone' => 216,
387 'set' => 225,
388 'stress_level' => 227,
389 'dive_settings' => 258,
390 'dive_gas' => 259,
391 'dive_alarm' => 262,
392 'exercise_title' => 264,
393 'dive_summary' => 268,
394 'jump' => 285,
395 'split' => 312,
396 'climb_pro' => 317,
397 'tank_update' => 319,
398 'tank_summary' => 323,
399 'device_aux_battery_info' => 375,
400 'dive_apnea_alarm' => 393,
401 'mfg_range_min' => 0xFF00,
402 'mfg_range_max' => 0xFFFE,
403 },
404  
405 'checksum' => +{
406 '_base_type' => FIT_UINT8,
407 'clear' => 0,
408 'ok' => 1,
409 },
410  
411 'file_flags' => +{
412 '_base_type' => FIT_UINT8Z,
413 '_mask' => 1,
414 'read' => 0x02,
415 'write' => 0x04,
416 'erase' => 0x08,
417 },
418  
419 'mesg_count' => +{
420 '_base_type' => FIT_ENUM,
421 'num_per_file' => 0,
422 'max_per_file' => 1,
423 'max_per_file_type' => 2,
424 },
425  
426 'date_time' => +{
427 '_base_type' => FIT_UINT32,
428 'min' => 0x10000000,
429 '_min' => 0x10000000,
430 '_out_of_range' => 'seconds from device power on',
431 '_offset' => -timegm(0, 0, 0, 31, 11, 1989), # 1989-12-31 00:00:00 UTC
432 },
433  
434 'local_date_time' => +{ # same as above, but in local time zone
435 '_base_type' => FIT_UINT32,
436 'min' => 0x10000000,
437 },
438  
439 'message_index' => +{
440 '_base_type' => FIT_UINT16,
441 '_mask' => 1,
442 'selected' => 0x8000,
443 'reserved' => 0x7000,
444 'mask' => 0x0FFF,
445 },
446  
447 'device_index' => +{ # dynamically created, as devices are added
448 '_base_type' => FIT_UINT8,
449 'creator' => 0, # creator of the file is always device index 0
450 'device1' => 1, # local, v6.00, garmin prod. edge520 (2067)
451 'device2' => 2, # local, v3.00, garmin prod. 1619
452 'heart_rate' => 3, # antplus
453 'speed' => 4, # antplus
454 'cadence' => 5, # antplus
455 'device6' => 6, # antplus power?
456 },
457  
458 'gender' => +{
459 '_base_type' => FIT_ENUM,
460 'female' => 0,
461 'male' => 1,
462 },
463  
464 'language' => +{
465 '_base_type' => FIT_ENUM,
466 'english' => 0,
467 'french' => 1,
468 'italian' => 2,
469 'german' => 3,
470 'spanish' => 4,
471 'croatian' => 5,
472 'czech' => 6,
473 'danish' => 7,
474 'dutch' => 8,
475 'finnish' => 9,
476 'greek' => 10,
477 'hungarian' => 11,
478 'norwegian' => 12,
479 'polish' => 13,
480 'portuguese' => 14,
481 'slovakian' => 15,
482 'slovenian' => 16,
483 'swedish' => 17,
484 'russian' => 18,
485 'turkish' => 19,
486 'latvian' => 20,
487 'ukrainian' => 21,
488 'arabic' => 22,
489 'farsi' => 23,
490 'bulgarian' => 24,
491 'romanian' => 25,
492 'chinese' => 26,
493 'japanese' => 27,
494 'korean' => 28,
495 'taiwanese' => 29,
496 'thai' => 30,
497 'hebrew' => 31,
498 'brazilian_portuguese' => 32,
499 'indonesian' => 33,
500 'malaysian' => 34,
501 'vietnamese' => 35,
502 'burmese' => 36,
503 'mongolian' => 37,
504 'custom' => 254,
505 },
506  
507 'language_bits_0' => +{
508 '_base_type' => FIT_UINT8Z,
509 'english' => 0x01,
510 'french' => 0x02,
511 'italian' => 0x04,
512 'german' => 0x08,
513 'spanish' => 0x10,
514 'croatian' => 0x20,
515 'czech' => 0x40,
516 'danish' => 0x80,
517 },
518  
519 'language_bits_1' => +{
520 '_base_type' => FIT_UINT8Z,
521 'dutch' => 0x01,
522 'finnish' => 0x02,
523 'greek' => 0x04,
524 'hungarian' => 0x08,
525 'norwegian' => 0x10,
526 'polish' => 0x20,
527 'portuguese' => 0x40,
528 'slovakian' => 0x80,
529 },
530  
531 'language_bits_2' => +{
532 '_base_type' => FIT_UINT8Z,
533 'slovenian' => 0x01,
534 'swedish' => 0x02,
535 'russian' => 0x04,
536 'turkish' => 0x08,
537 'latvian' => 0x10,
538 'ukrainian' => 0x20,
539 'arabic' => 0x40,
540 'farsi' => 0x80,
541 },
542  
543 'language_bits_3' => +{
544 '_base_type' => FIT_UINT8Z,
545 'bulgarian' => 0x01,
546 'romanian' => 0x02,
547 'chinese' => 0x04,
548 'japanese' => 0x08,
549 'korean' => 0x10,
550 'taiwanese' => 0x20,
551 'thai' => 0x40,
552 'hebrew' => 0x80,
553 },
554  
555 'language_bits_4' => +{
556 '_base_type' => FIT_UINT8Z,
557 'brazilian_portuguese' => 0x01,
558 'indonesian' => 0x02,
559 'malaysian' => 0x04,
560 'vietnamese' => 0x08,
561 'burmese' => 0x10,
562 'mongolian' => 0x20,
563 },
564  
565 'time_zone' => +{
566 '_base_type' => FIT_ENUM,
567 'almaty' => 0,
568 'bangkok' => 1,
569 'bombay' => 2,
570 'brasilia' => 3,
571 'cairo' => 4,
572 'cape_verde_is' => 5,
573 'darwin' => 6,
574 'eniwetok' => 7,
575 'fiji' => 8,
576 'hong_kong' => 9,
577 'islamabad' => 10,
578 'kabul' => 11,
579 'magadan' => 12,
580 'mid_atlantic' => 13,
581 'moscow' => 14,
582 'muscat' => 15,
583 'newfoundland' => 16,
584 'samoa' => 17,
585 'sydney' => 18,
586 'tehran' => 19,
587 'tokyo' => 20,
588 'us_alaska' => 21,
589 'us_atlantic' => 22,
590 'us_central' => 23,
591 'us_eastern' => 24,
592 'us_hawaii' => 25,
593 'us_mountain' => 26,
594 'us_pacific' => 27,
595 'other' => 28,
596 'auckland' => 29,
597 'kathmandu' => 30,
598 'europe_western_wet' => 31,
599 'europe_central_cet' => 32,
600 'europe_eastern_eet' => 33,
601 'jakarta' => 34,
602 'perth' => 35,
603 'adelaide' => 36,
604 'brisbane' => 37,
605 'tasmania' => 38,
606 'iceland' => 39,
607 'amsterdam' => 40,
608 'athens' => 41,
609 'barcelona' => 42,
610 'berlin' => 43,
611 'brussels' => 44,
612 'budapest' => 45,
613 'copenhagen' => 46,
614 'dublin' => 47,
615 'helsinki' => 48,
616 'lisbon' => 49,
617 'london' => 50,
618 'madrid' => 51,
619 'munich' => 52,
620 'oslo' => 53,
621 'paris' => 54,
622 'prague' => 55,
623 'reykjavik' => 56,
624 'rome' => 57,
625 'stockholm' => 58,
626 'vienna' => 59,
627 'warsaw' => 60,
628 'zurich' => 61,
629 'quebec' => 62,
630 'ontario' => 63,
631 'manitoba' => 64,
632 'saskatchewan' => 65,
633 'alberta' => 66,
634 'british_columbia' => 67,
635 'boise' => 68,
636 'boston' => 69,
637 'chicago' => 70,
638 'dallas' => 71,
639 'denver' => 72,
640 'kansas_city' => 73,
641 'las_vegas' => 74,
642 'los_angeles' => 75,
643 'miami' => 76,
644 'minneapolis' => 77,
645 'new_york' => 78,
646 'new_orleans' => 79,
647 'phoenix' => 80,
648 'santa_fe' => 81,
649 'seattle' => 82,
650 'washington_dc' => 83,
651 'us_arizona' => 84,
652 'chita' => 85,
653 'ekaterinburg' => 86,
654 'irkutsk' => 87,
655 'kaliningrad' => 88,
656 'krasnoyarsk' => 89,
657 'novosibirsk' => 90,
658 'petropavlovsk_kamchatskiy' => 91,
659 'samara' => 92,
660 'vladivostok' => 93,
661 'mexico_central' => 94,
662 'mexico_mountain' => 95,
663 'mexico_pacific' => 96,
664 'cape_town' => 97,
665 'winkhoek' => 98,
666 'lagos' => 99,
667 'riyahd' => 100,
668 'venezuela' => 101,
669 'australia_lh' => 102,
670 'santiago' => 103,
671 'manual' => 253,
672 'automatic' => 254,
673 },
674  
675 'display_measure' => +{
676 '_base_type' => FIT_ENUM,
677 'metric' => 0,
678 'statute' => 1,
679 'nautical' => 2,
680 },
681  
682 'display_heart' => +{
683 '_base_type' => FIT_ENUM,
684 'bpm' => 0,
685 'max' => 1,
686 'reserve' => 2,
687 },
688  
689 'display_power' => +{
690 '_base_type' => FIT_ENUM,
691 'watts' => 0,
692 'percent_ftp' => 1,
693 },
694  
695 'display_position' => +{
696 '_base_type' => FIT_ENUM,
697 'degree' => 0,
698 'degree_minute' => 1,
699 'degree_minute_second' => 2,
700 'austrian_grid' => 3,
701 'british_grid' => 4,
702 'dutch_grid' => 5,
703 'hungarian_grid' => 6,
704 'finnish_grid' => 7,
705 'german_grid' => 8,
706 'icelandic_grid' => 9,
707 'indonesian_equatorial' => 10,
708 'indonesian_irian' => 11,
709 'indonesian_southern' => 12,
710 'india_zone_0' => 13,
711 'india_zone_IA' => 14,
712 'india_zone_IB' => 15,
713 'india_zone_IIA' => 16,
714 'india_zone_IIB' => 17,
715 'india_zone_IIIA' => 18,
716 'india_zone_IIIB' => 19,
717 'india_zone_IVA' => 20,
718 'india_zone_IVB' => 21,
719 'irish_transverse' => 22,
720 'irish_grid' => 23,
721 'loran' => 24,
722 'maidenhead_grid' => 25,
723 'mgrs_grid' => 26,
724 'new_zealand_grid' => 27,
725 'new_zealand_transverse' => 28,
726 'qatar_grid' => 29,
727 'modified_swedish_grid' => 30,
728 'swedish_grid' => 31,
729 'south_african_grid' => 32,
730 'swiss_grid' => 33,
731 'taiwan_grid' => 34,
732 'united_states_grid' => 35,
733 'utm_ups_grid' => 36,
734 'west_malayan' => 37,
735 'borneo_rso' => 38,
736 'estonian_grid' => 39,
737 'latvian_grid' => 40,
738 'swedish_ref_99_grid' => 41,
739 },
740  
741 'switch' => +{
742 '_base_type' => FIT_ENUM,
743 'off' => 0,
744 'on' => 1,
745 'auto' => 2,
746 },
747  
748 'sport' => +{
749 '_base_type' => FIT_ENUM,
750 'generic' => 0,
751 'running' => 1,
752 'cycling' => 2,
753 'transition' => 3, # multisport transition
754 'fitness_equipment' => 4,
755 'swimming' => 5,
756 'basketball' => 6,
757 'soccer' => 7,
758 'tennis' => 8,
759 'american_football' => 9,
760 'training' => 10,
761 'walking' => 11,
762 'cross_country_skiing' => 12,
763 'alpine_skiing' => 13,
764 'snowboarding' => 14,
765 'rowing' => 15,
766 'mountaineering' => 16,
767 'hiking' => 17,
768 'multisport' => 18,
769 'paddling' => 19,
770 'flying' => 20,
771 'e_biking' => 21,
772 'motorcycling' => 22,
773 'boating' => 23,
774 'driving' => 24,
775 'golf' => 25,
776 'hang_gliding' => 26,
777 'horseback_riding' => 27,
778 'hunting' => 28,
779 'fishing' => 29,
780 'inline_skating' => 30,
781 'rock_climbing' => 31,
782 'sailing' => 32,
783 'ice_skating' => 33,
784 'sky_diving' => 34,
785 'snowshoeing' => 35,
786 'snowmobiling' => 36,
787 'stand_up_paddleboarding' => 37,
788 'surfing' => 38,
789 'wakeboarding' => 39,
790 'water_skiing' => 40,
791 'kayaking' => 41,
792 'rafting' => 42,
793 'windsurfing' => 43,
794 'kitesurfing' => 44,
795 'tactical' => 45,
796 'jumpmaster' => 46,
797 'boxing' => 47,
798 'floor_climbing' => 48,
799 'diving' => 53,
800 'hiit' => 62,
801 'racket' => 64,
802 'water_tubing' => 76,
803 'wakesurfing' => 77,
804 'all' => 254,
805 },
806  
807 'sport_bits_0' => +{
808 '_base_type' => FIT_UINT8Z,
809 'generic' => 0x01,
810 'running' => 0x02,
811 'cycling' => 0x04,
812 'transition' => 0x08,
813 'fitness_equipment' => 0x10,
814 'swimming' => 0x20,
815 'basketball' => 0x40,
816 'soccer' => 0x80,
817 },
818  
819 'sport_bits_1' => +{
820 '_base_type' => FIT_UINT8Z,
821 'tennis' => 0x01,
822 'american_football' => 0x02,
823 'training' => 0x04,
824 'walking' => 0x08,
825 'cross_country_skiing' => 0x10,
826 'alpine_skiing' => 0x20,
827 'snowboarding' => 0x40,
828 'rowing' => 0x80,
829 },
830  
831 'sport_bits_2' => +{
832 '_base_type' => FIT_UINT8Z,
833 'mountaineering' => 0x01,
834 'hiking' => 0x02,
835 'multisport' => 0x04,
836 'paddling' => 0x08,
837 'flying' => 0x10,
838 'e_biking' => 0x20,
839 'motorcycling' => 0x40,
840 'boating' => 0x80,
841 },
842  
843 'sport_bits_3' => +{
844 '_base_type' => FIT_UINT8Z,
845 'driving' => 0x01,
846 'golf' => 0x02,
847 'hang_gliding' => 0x04,
848 'horseback_riding' => 0x08,
849 'hunting' => 0x10,
850 'fishing' => 0x20,
851 'inline_skating' => 0x40,
852 'rock_climbing' => 0x80,
853 },
854  
855 'sport_bits_4' => +{
856 '_base_type' => FIT_UINT8Z,
857 'sailing' => 0x01,
858 'ice_skating' => 0x02,
859 'sky_diving' => 0x04,
860 'snowshoeing' => 0x08,
861 'snowmobiling' => 0x10,
862 'stand_up_paddleboarding' => 0x20,
863 'surfing' => 0x40,
864 'wakeboarding' => 0x80,
865 },
866  
867 'sport_bits_5' => +{
868 '_base_type' => FIT_UINT8Z,
869 'water_skiing' => 0x01,
870 'kayaking' => 0x02,
871 'rafting' => 0x04,
872 'windsurfing' => 0x08,
873 'kitesurfing' => 0x10,
874 'tactical' => 0x20,
875 'jumpmaster' => 0x40,
876 'boxing' => 0x80,
877 },
878  
879 'sport_bits_6' => +{
880 '_base_type' => FIT_UINT8Z,
881 'floor_climbing' => 0x01,
882 },
883  
884 'sub_sport' => +{
885 '_base_type' => FIT_ENUM,
886 'generic' => 0,
887 'treadmill' => 1, # run/fitness equipment
888 'street' => 2, # run
889 'trail' => 3, # run
890 'track' => 4, # run
891 'spin' => 5, # cycling
892 'indoor_cycling' => 6, # cycling/fitness equipment
893 'road' => 7, # cycling
894 'mountain' => 8, # cycling
895 'downhill' => 9, # cycling
896 'recumbent' => 10, # cycling
897 'cyclocross' => 11, # cycling
898 'hand_cycling' => 12, # cycling
899 'track_cycling' => 13, # cycling
900 'indoor_rowing' => 14, # fitness equipment
901 'elliptical' => 15, # fitness equipment
902 'stair_climbing' => 16, # fitness equipment
903 'lap_swimming' => 17, # swimming
904 'open_water' => 18, # swimming
905 'flexibility_training' => 19, # training
906 'strength_training' => 20, # training
907 'warm_up' => 21, # tennis
908 'match' => 22, # tennis
909 'exercise' => 23, # tennis
910 'challenge' => 24,
911 'indoor_skiing' => 25, # fitness equipment
912 'cardio_training' => 26, # training
913 'indoor_walking' => 27, # walking/fitness equipment
914 'e_bike_fitness' => 28, # e-biking
915 'bmx' => 29, # cycling
916 'casual_walking' => 30, # walking
917 'speed_walking' => 31, # walking
918 'bike_to_run_transition' => 32, # transition
919 'run_to_bike_transition' => 33, # transition
920 'swim_to_bike_transition' => 34, # transition
921 'atv' => 35, # motorcycling
922 'motocross' => 36, # motorcycling
923 'backcountry' => 37, # alpine skiing/snowboarding
924 'resort' => 38, # alpine skiing/snowboarding
925 'rc_drone' => 39, # flying
926 'wingsuit' => 40, # flying
927 'whitewater' => 41, # kayaking/rafting
928 'skate_skiing' => 42, # cross country skiing
929 'yoga' => 43, # training
930 'pilates' => 44, # fitness equipment
931 'indoor_running' => 45, # run/fitness equipment
932 'gravel_cycling' => 46, # cycling
933 'e_bike_mountain' => 47, # cycling
934 'commuting' => 48, # cycling
935 'mixed_surface' => 49, # cycling
936 'navigate' => 50,
937 'track_me' => 51,
938 'map' => 52,
939 'single_gas_diving' => 53, # Diving
940 'multi_gas_diving' => 54, # Diving
941 'gauge_diving' => 55, # Diving
942 'apnea_diving' => 56, # Diving
943 'apnea_hunting' => 57, # Diving
944 'virtual_activity' => 58,
945 'obstacle' => 59, # Used for events where participants run, crawl through mud, climb over walls, etc.
946 'breathing' => 62,
947 'sail_race' => 65, # Sailing
948 'ultra' => 67, # Ultramarathon
949 'indoor_climbing' => 68, # Climbing
950 'bouldering' => 69, # Climbing
951 'hiit' => 70, # High Intensity Interval Training
952 'amrap' => 73, # HIIT
953 'emom' => 74, # HIIT
954 'tabata' => 75, # HIIT
955 'pickleball' => 84, # Racket
956 'padel' => 85, # Racket
957 'all' => 254,
958 },
959  
960 'sport_event' => +{
961 '_base_type' => FIT_ENUM,
962 'uncategorized' => 0,
963 'geocaching' => 1,
964 'fitness' => 2,
965 'recreation' => 3,
966 'race' => 4,
967 'special_event' => 5,
968 'training' => 6,
969 'transportation' => 7,
970 'touring' => 8,
971 },
972  
973 'activity' => +{
974 '_base_type' => FIT_ENUM,
975 'manual' => 0,
976 'auto_multi_sport' => 1,
977 },
978  
979 'intensity' => +{
980 '_base_type' => FIT_ENUM,
981 'active' => 0,
982 'rest' => 1,
983 'warmup' => 2,
984 'cooldown' => 3,
985 },
986  
987 'session_trigger' => +{
988 '_base_type' => FIT_ENUM,
989 'activity_end' => 0,
990 'manual' => 1,
991 'auto_multi_sport' => 2,
992 'fitness_equipment' => 3,
993 },
994  
995 'autolap_trigger' => +{
996 '_base_type' => FIT_ENUM,
997 'time' => 0,
998 'distance' => 1,
999 'position_start' => 2,
1000 'position_lap' => 3,
1001 'position_waypoint' => 4,
1002 'position_marked' => 5,
1003 'off' => 6,
1004 },
1005  
1006 'lap_trigger' => +{
1007 '_base_type' => FIT_ENUM,
1008 'manual' => 0,
1009 'time' => 1,
1010 'distance' => 2,
1011 'position_start' => 3,
1012 'position_lap' => 4,
1013 'position_waypoint' => 5,
1014 'position_marked' => 6,
1015 'session_end' => 7,
1016 'fitness_equipment' => 8,
1017 },
1018  
1019 'time_mode' => +{
1020 '_base_type' => FIT_ENUM,
1021 'hour12' => 0,
1022 'hour24' => 1,
1023 'military' => 2,
1024 'hour_12_with_seconds' => 3,
1025 'hour_24_with_seconds' => 4,
1026 'utc' => 5,
1027 },
1028  
1029 'backlight_mode' => +{
1030 '_base_type' => FIT_ENUM,
1031 'off' => 0,
1032 'manual' => 1,
1033 'key_and_messages' => 2,
1034 'auto_brightness' => 3,
1035 'smart_notifications' => 4,
1036 'key_and_messages_night' => 5,
1037 'key_and_messages_and_smart_notifications' => 6,
1038 },
1039  
1040 'date_mode' => +{
1041 '_base_type' => FIT_ENUM,
1042 'day_month' => 0,
1043 'month_day' => 1,
1044 },
1045  
1046 'backlight_timeout' => +{
1047 '_base_type' => FIT_UINT8,
1048 'infinite' => 0,
1049 },
1050  
1051 'event' => +{
1052 '_base_type' => FIT_ENUM,
1053 'timer' => 0,
1054 'workout' => 3,
1055 'workout_step' => 4,
1056 'power_down' => 5,
1057 'power_up' => 6,
1058 'off_course' => 7,
1059 'session' => 8,
1060 'lap' => 9,
1061 'course_point' => 10,
1062 'battery' => 11,
1063 'virtual_partner_pace' => 12,
1064 'hr_high_alert' => 13,
1065 'hr_low_alert' => 14,
1066 'speed_high_alert' => 15,
1067 'speed_low_alert' => 16,
1068 'cad_high_alert' => 17,
1069 'cad_low_alert' => 18,
1070 'power_high_alert' => 19,
1071 'power_low_alert' => 20,
1072 'recovery_hr' => 21,
1073 'battery_low' => 22,
1074 'time_duration_alert' => 23,
1075 'distance_duration_alert' => 24,
1076 'calorie_duration_alert' => 25,
1077 'activity' => 26,
1078 'fitness_equipment' => 27,
1079 'length' => 28,
1080 'user_marker' => 32,
1081 'sport_point' => 33,
1082 'calibration' => 36,
1083 'front_gear_change' => 42,
1084 'rear_gear_change' => 43,
1085 'rider_position_change' => 44,
1086 'elev_high_alert' => 45,
1087 'elev_low_alert' => 46,
1088 'comm_timeout' => 47,
1089 'dive_alert' => 56, # marker
1090 'dive_gas_switched' => 57, # marker
1091 'tank_pressure_reserve' => 71, # marker
1092 'tank_pressure_critical' => 72, # marker
1093 'tank_lost' => 73, # marker
1094 'radar_threat_alert' => 75, # start/stop/marker
1095 'tank_battery_low' => 76, # marker
1096 'tank_pod_connected' => 81, # marker - tank pod has connected
1097 'tank_pod_disconnected' => 82, # marker - tank pod has lost connection
1098 },
1099  
1100 'event_type' => +{
1101 '_base_type' => FIT_ENUM,
1102 'start' => 0,
1103 'stop' => 1,
1104 'consecutive_depreciated' => 2,
1105 'marker' => 3,
1106 'stop_all' => 4,
1107 'begin_depreciated' => 5,
1108 'end_depreciated' => 6,
1109 'end_all_depreciated' => 7,
1110 'stop_disable' => 8,
1111 'stop_disable_all' => 9,
1112 },
1113  
1114 'timer_trigger' => +{
1115 '_base_type' => FIT_ENUM,
1116 'manual' => 0,
1117 'auto' => 1,
1118 'fitness_equipment' => 2,
1119 },
1120  
1121 'fitness_equipment_state' => +{
1122 '_base_type' => FIT_ENUM,
1123 'ready' => 0,
1124 'in_use' => 1,
1125 'paused' => 2,
1126 'unknown' => 3,
1127 },
1128  
1129 'tone' => +{
1130 '_base_type' => FIT_ENUM,
1131 'off' => 0,
1132 'tone' => 1,
1133 'vibrate' => 2,
1134 'tone_and_vibrate' => 3,
1135 },
1136 'autoscroll' => +{
1137 '_base_type' => FIT_ENUM,
1138 'none' => 0,
1139 'slow' => 1,
1140 'medium' => 2,
1141 'fast' => 3,
1142 },
1143  
1144 'activity_class' => +{
1145 '_base_type' => FIT_ENUM,
1146 '_mask' => 1,
1147 'level' => 0x7f,
1148 'level_max' => 100,
1149 'athlete' => 0x80,
1150 },
1151  
1152 'hr_zone_calc' => +{
1153 '_base_type' => FIT_ENUM,
1154 'custom' => 0,
1155 'percent_max_hr' => 1,
1156 'percent_hrr' => 2,
1157 'percent_lthr' => 3,
1158 },
1159  
1160 'pwr_zone_calc' => +{
1161 '_base_type' => FIT_ENUM,
1162 'custom' => 0,
1163 'percent_ftp' => 1,
1164 },
1165  
1166 'wkt_step_duration' => +{
1167 '_base_type' => FIT_ENUM,
1168 'time' => 0,
1169 'distance' => 1,
1170 'hr_less_than' => 2,
1171 'hr_greater_than' => 3,
1172 'calories' => 4,
1173 'open' => 5,
1174 'repeat_until_steps_cmplt' => 6,
1175 'repeat_until_time' => 7,
1176 'repeat_until_distance' => 8,
1177 'repeat_until_calories' => 9,
1178 'repeat_until_hr_less_than' => 10,
1179 'repeat_until_hr_greater_than' => 11,
1180 'repeat_until_power_less_than' => 12,
1181 'repeat_until_power_greater_than' => 13,
1182 'power_less_than' => 14,
1183 'power_greater_than' => 15,
1184 'training_peaks_tss' => 16,
1185 'repeat_until_power_last_lap_less_than' => 17,
1186 'repeat_until_max_power_last_lap_less_than' => 18,
1187 'power_3s_less_than' => 19,
1188 'power_10s_less_than' => 20,
1189 'power_30s_less_than' => 21,
1190 'power_3s_greater_than' => 22,
1191 'power_10s_greater_than' => 23,
1192 'power_30s_greater_than' => 24,
1193 'power_lap_less_than' => 25,
1194 'power_lap_greater_than' => 26,
1195 'repeat_until_training_peaks_tss' => 27,
1196 'repetition_time' => 28,
1197 'reps' => 29,
1198 'time_only' => 31,
1199 },
1200  
1201 'wkt_step_target' => +{
1202 '_base_type' => FIT_ENUM,
1203 'speed' => 0,
1204 'heart_rate' => 1,
1205 'open' => 2,
1206 'cadence' => 3,
1207 'power' => 4,
1208 'grade' => 5,
1209 'resistance' => 6,
1210 'power_3s' => 7,
1211 'power_10s' => 8,
1212 'power_30s' => 9,
1213 'power_lap' => 10,
1214 'swim_stroke' => 11,
1215 'speed_lap' => 12,
1216 'heart_rate_lap' => 13,
1217 },
1218  
1219 'goal' => +{
1220 '_base_type' => FIT_ENUM,
1221 'time' => 0,
1222 'distance' => 1,
1223 'calories' => 2,
1224 'frequency' => 3,
1225 'steps' => 4,
1226 'ascent' => 5,
1227 'active_minutes' => 6,
1228 },
1229  
1230 'goal_recurrence' => +{
1231 '_base_type' => FIT_ENUM,
1232 'off' => 0,
1233 'daily' => 1,
1234 'weekly' => 2,
1235 'monthly' => 3,
1236 'yearly' => 4,
1237 'custom' => 5,
1238 },
1239  
1240 'goal_source' => +{
1241 '_base_type' => FIT_ENUM,
1242 'auto' => 0,
1243 'community' => 1,
1244 'user' => 2,
1245 },
1246  
1247 'schedule' => +{
1248 '_base_type' => FIT_ENUM,
1249 'workout' => 0,
1250 'course' => 1,
1251 },
1252  
1253 'course_point' => +{
1254 '_base_type' => FIT_ENUM,
1255 'generic' => 0,
1256 'summit' => 1,
1257 'valley' => 2,
1258 'water' => 3,
1259 'food' => 4,
1260 'danger' => 5,
1261 'left' => 6,
1262 'right' => 7,
1263 'straight' => 8,
1264 'first_aid' => 9,
1265 'fourth_category' => 10,
1266 'third_category' => 11,
1267 'second_category' => 12,
1268 'first_category' => 13,
1269 'hors_category' => 14,
1270 'sprint' => 15,
1271 'left_fork' => 16,
1272 'right_fork' => 17,
1273 'middle_fork' => 18,
1274 'slight_left' => 19,
1275 'sharp_left' => 20,
1276 'slight_right' => 21,
1277 'sharp_right' => 22,
1278 'u_turn' => 23,
1279 'segment_start' => 24,
1280 'segment_end' => 25,
1281 },
1282  
1283 'manufacturer' => +{
1284 '_base_type' => FIT_UINT16,
1285 'garmin' => 1,
1286 'garmin_fr405_antfs' => 2,
1287 'zephyr' => 3,
1288 'dayton' => 4,
1289 'idt' => 5,
1290 'srm' => 6,
1291 'quarq' => 7,
1292 'ibike' => 8,
1293 'saris' => 9,
1294 'spark_hk' => 10,
1295 'tanita' => 11,
1296 'echowell' => 12,
1297 'dynastream_oem' => 13,
1298 'nautilus' => 14,
1299 'dynastream' => 15,
1300 'timex' => 16,
1301 'metrigear' => 17,
1302 'xelic' => 18,
1303 'beurer' => 19,
1304 'cardiosport' => 20,
1305 'a_and_d' => 21,
1306 'hmm' => 22,
1307 'suunto' => 23,
1308 'thita_elektronik' => 24,
1309 'gpulse' => 25,
1310 'clean_mobile' => 26,
1311 'pedal_brain' => 27,
1312 'peaksware' => 28,
1313 'saxonar' => 29,
1314 'lemond_fitness' => 30,
1315 'dexcom' => 31,
1316 'wahoo_fitness' => 32,
1317 'octane_fitness' => 33,
1318 'archinoetics' => 34,
1319 'the_hurt_box' => 35,
1320 'citizen_systems' => 36,
1321 'magellan' => 37,
1322 'osynce' => 38,
1323 'holux' => 39,
1324 'concept2' => 40,
1325 'one_giant_leap' => 42,
1326 'ace_sensor' => 43,
1327 'brim_brothers' => 44,
1328 'xplova' => 45,
1329 'perception_digital' => 46,
1330 'bf1systems' => 47,
1331 'pioneer' => 48,
1332 'spantec' => 49,
1333 'metalogics' => 50,
1334 '4iiiis' => 51,
1335 'seiko_epson' => 52,
1336 'seiko_epson_oem' => 53,
1337 'ifor_powell' => 54,
1338 'maxwell_guider' => 55,
1339 'star_trac' => 56,
1340 'breakaway' => 57,
1341 'alatech_technology_ltd' => 58,
1342 'mio_technology_europe' => 59,
1343 'rotor' => 60,
1344 'geonaute' => 61,
1345 'id_bike' => 62,
1346 'specialized' => 63,
1347 'wtek' => 64,
1348 'physical_enterprises' => 65,
1349 'north_pole_engineering' => 66,
1350 'bkool' => 67,
1351 'cateye' => 68,
1352 'stages_cycling' => 69,
1353 'sigmasport' => 70,
1354 'tomtom' => 71,
1355 'peripedal' => 72,
1356 'wattbike' => 73,
1357 'moxy' => 76,
1358 'ciclosport' => 77,
1359 'powerbahn' => 78,
1360 'acorn_projects_aps' => 79,
1361 'lifebeam' => 80,
1362 'bontrager' => 81,
1363 'wellgo' => 82,
1364 'scosche' => 83,
1365 'magura' => 84,
1366 'woodway' => 85,
1367 'elite' => 86,
1368 'nielsen_kellerman' => 87,
1369 'dk_city' => 88,
1370 'tacx' => 89,
1371 'direction_technology' => 90,
1372 'magtonic' => 91,
1373 '1partcarbon' => 92,
1374 'inside_ride_technologies' => 93,
1375 'sound_of_motion' => 94,
1376 'stryd' => 95,
1377 'icg' => 96,
1378 'mipulse' => 97,
1379 'bsx_athletics' => 98,
1380 'look' => 99,
1381 'campagnolo_srl' => 100,
1382 'body_bike_smart' => 101,
1383 'praxisworks' => 102,
1384 'limits_technology' => 103,
1385 'topaction_technology' => 104,
1386 'cosinuss' => 105,
1387 'fitcare' => 106,
1388 'magene' => 107,
1389 'giant_manufacturing_co' => 108,
1390 'tigrasport' => 109,
1391 'salutron' => 110,
1392 'technogym' => 111,
1393 'bryton_sensors' => 112,
1394 'latitude_limited' => 113,
1395 'soaring_technology' => 114,
1396 'igpsport' => 115,
1397 'thinkrider' => 116,
1398 'gopher_sport' => 117,
1399 'waterrower' => 118,
1400 'orangetheory' => 119,
1401 'inpeak' => 120,
1402 'kinetic' => 121,
1403 'johnson_health_tech' => 122,
1404 'polar_electro' => 123,
1405 'seesense' => 124,
1406 'nci_technology' => 125,
1407 'iqsquare' => 126,
1408 'leomo' => 127,
1409 'ifit_com' => 128,
1410 'coros_byte' => 129,
1411 'versa_design' => 130,
1412 'chileaf' => 131,
1413 'cycplus' => 132,
1414 'gravaa_byte' => 133,
1415 'sigeyi' => 134,
1416 'coospo' => 135,
1417 'geoid' => 136,
1418 'bosch' => 137,
1419 'kyto' => 138,
1420 'kinetic_sports' => 139,
1421 'decathlon_byte' => 140,
1422 'tq_systems' => 141,
1423 'tag_heuer' => 142,
1424 'keiser_fitness' => 143,
1425 'zwift_byte' => 144,
1426 'porsche_ep' => 145,
1427 'development' => 255,
1428 'healthandlife' => 257,
1429 'lezyne' => 258,
1430 'scribe_labs' => 259,
1431 'zwift' => 260,
1432 'watteam' => 261,
1433 'recon' => 262,
1434 'favero_electronics' => 263,
1435 'dynovelo' => 264,
1436 'strava' => 265,
1437 'precor' => 266,
1438 'bryton' => 267,
1439 'sram' => 268,
1440 'navman' => 269,
1441 'cobi' => 270,
1442 'spivi' => 271,
1443 'mio_magellan' => 272,
1444 'evesports' => 273,
1445 'sensitivus_gauge' => 274,
1446 'podoon' => 275,
1447 'life_time_fitness' => 276,
1448 'falco_e_motors' => 277,
1449 'minoura' => 278,
1450 'cycliq' => 279,
1451 'luxottica' => 280,
1452 'trainer_road' => 281,
1453 'the_sufferfest' => 282,
1454 'fullspeedahead' => 283,
1455 'virtualtraining' => 284,
1456 'feedbacksports' => 285,
1457 'omata' => 286,
1458 'vdo' => 287,
1459 'magneticdays' => 288,
1460 'hammerhead' => 289,
1461 'kinetic_by_kurt' => 290,
1462 'shapelog' => 291,
1463 'dabuziduo' => 292,
1464 'jetblack' => 293,
1465 'coros' => 294,
1466 'virtugo' => 295,
1467 'velosense' => 296,
1468 'cycligentinc' => 297,
1469 'trailforks' => 298,
1470 'mahle_ebikemotion' => 299,
1471 'nurvv' => 300,
1472 'microprogram' => 301,
1473 'zone5cloud' => 302,
1474 'greenteg' => 303,
1475 'yamaha_motors' => 304,
1476 'whoop' => 305,
1477 'gravaa' => 306,
1478 'onelap' => 307,
1479 'monark_exercise' => 308,
1480 'form' => 309,
1481 'decathlon' => 310,
1482 'syncros' => 311,
1483 'heatup' => 312,
1484 'cannondale' => 313,
1485 'true_fitness' => 314,
1486 'RGT_cycling' => 315,
1487 'vasa' => 316,
1488 'race_republic' => 317,
1489 'fazua' => 318,
1490 'oreka_training' => 319,
1491 'lsec' => 320, # Lishun Electric & Communication
1492 'lululemon_studio' => 321,
1493 'shanyue' => 322,
1494 'actigraphcorp' => 5759,
1495 },
1496  
1497 'garmin_product' => +{
1498 '_base_type' => FIT_UINT16,
1499 'hrm1' => 1,
1500 'axh01' => 2, # AXH01 HRM chipset
1501 'axb01' => 3,
1502 'axb02' => 4,
1503 'hrm2ss' => 5,
1504 'dsi_alf02' => 6,
1505 'hrm3ss' => 7,
1506 'hrm_run_single_byte_product_id' => 8, # hrm_run model for HRM ANT+ messaging
1507 'bsm' => 9, # BSM model for ANT+ messaging
1508 'bcm' => 10, # BCM model for ANT+ messaging
1509 'axs01' => 11, # AXS01 HRM Bike Chipset model for ANT+ messaging
1510 'hrm_tri_single_byte_product_id' => 12, # hrm_tri model for HRM ANT+ messaging
1511 'hrm4_run_single_byte_product_id' => 13, # hrm4 run model for HRM ANT+ messaging
1512 'fr225_single_byte_product_id' => 14, # fr225 model for HRM ANT+ messaging
1513 'gen3_bsm_single_byte_product_id' => 15, # gen3_bsm model for Bike Speed ANT+ messaging
1514 'gen3_bcm_single_byte_product_id' => 16, # gen3_bcm model for Bike Cadence ANT+ messaging
1515 'OHR' => 255, # Garmin Wearable Optical Heart Rate Sensor for ANT+ HR Profile Broadcasting
1516 'fr301_china' => 473,
1517 'fr301_japan' => 474,
1518 'fr301_korea' => 475,
1519 'fr301_taiwan' => 494,
1520 'fr405' => 717, # Forerunner 405
1521 'fr50' => 782, # Forerunner 50
1522 'fr405_japan' => 987,
1523 'fr60' => 988, # Forerunner 60
1524 'dsi_alf01' => 1011,
1525 'fr310xt' => 1018, # Forerunner 310
1526 'edge500' => 1036,
1527 'fr110' => 1124, # Forerunner 110
1528 'edge800' => 1169,
1529 'edge500_taiwan' => 1199,
1530 'edge500_japan' => 1213,
1531 'chirp' => 1253,
1532 'fr110_japan' => 1274,
1533 'edge200' => 1325,
1534 'fr910xt' => 1328,
1535 'edge800_taiwan' => 1333,
1536 'edge800_japan' => 1334,
1537 'alf04' => 1341,
1538 'fr610' => 1345,
1539 'fr210_japan' => 1360,
1540 'vector_ss' => 1380,
1541 'vector_cp' => 1381,
1542 'edge800_china' => 1386,
1543 'edge500_china' => 1387,
1544 'approach_g10' => 1405,
1545 'fr610_japan' => 1410,
1546 'edge500_korea' => 1422,
1547 'fr70' => 1436,
1548 'fr310xt_4t' => 1446,
1549 'amx' => 1461,
1550 'fr10' => 1482,
1551 'edge800_korea' => 1497,
1552 'swim' => 1499,
1553 'fr910xt_china' => 1537,
1554 'fenix' => 1551,
1555 'edge200_taiwan' => 1555,
1556 'edge510' => 1561,
1557 'edge810' => 1567,
1558 'tempe' => 1570,
1559 'fr910xt_japan' => 1600,
1560 'fr620' => 1623,
1561 'fr220' => 1632,
1562 'fr910xt_korea' => 1664,
1563 'fr10_japan' => 1688,
1564 'edge810_japan' => 1721,
1565 'virb_elite' => 1735,
1566 'edge_touring' => 1736, # Also Edge Touring Plus
1567 'edge510_japan' => 1742,
1568 'hrm_tri' => 1743, # Also HRM-Swim
1569 'hrm_run' => 1752,
1570 'fr920xt' => 1765,
1571 'edge510_asia' => 1821,
1572 'edge810_china' => 1822,
1573 'edge810_taiwan' => 1823,
1574 'edge1000' => 1836,
1575 'vivo_fit' => 1837,
1576 'virb_remote' => 1853,
1577 'vivo_ki' => 1885,
1578 'fr15' => 1903,
1579 'vivo_active' => 1907,
1580 'edge510_korea' => 1918,
1581 'fr620_japan' => 1928,
1582 'fr620_china' => 1929,
1583 'fr220_japan' => 1930,
1584 'fr220_china' => 1931,
1585 'approach_s6' => 1936,
1586 'vivo_smart' => 1956,
1587 'fenix2' => 1967,
1588 'epix' => 1988,
1589 'fenix3' => 2050,
1590 'edge1000_taiwan' => 2052,
1591 'edge1000_japan' => 2053,
1592 'fr15_japan' => 2061,
1593 'edge520' => 2067,
1594 'edge1000_china' => 2070,
1595 'fr620_russia' => 2072,
1596 'fr220_russia' => 2073,
1597 'vector_s' => 2079,
1598 'edge1000_korea' => 2100,
1599 'fr920xt_taiwan' => 2130,
1600 'fr920xt_china' => 2131,
1601 'fr920xt_japan' => 2132,
1602 'virbx' => 2134,
1603 'vivo_smart_apac' => 2135,
1604 'etrex_touch' => 2140,
1605 'edge25' => 2147,
1606 'fr25' => 2148,
1607 'vivo_fit2' => 2150,
1608 'fr225' => 2153,
1609 'fr630' => 2156,
1610 'fr230' => 2157,
1611 'fr735xt' => 2158,
1612 'vivo_active_apac' => 2160,
1613 'vector_2' => 2161,
1614 'vector_2s' => 2162,
1615 'virbxe' => 2172,
1616 'fr620_taiwan' => 2173,
1617 'fr220_taiwan' => 2174,
1618 'truswing' => 2175,
1619 'd2airvenu' => 2187,
1620 'fenix3_china' => 2188,
1621 'fenix3_twn' => 2189,
1622 'varia_headlight' => 2192,
1623 'varia_taillight_old' => 2193,
1624 'edge_explore_1000' => 2204,
1625 'fr225_asia' => 2219,
1626 'varia_radar_taillight' => 2225,
1627 'varia_radar_display' => 2226,
1628 'edge20' => 2238,
1629 'edge520_asia' => 2260,
1630 'edge520_japan' => 2261,
1631 'd2_bravo' => 2262,
1632 'approach_s20' => 2266,
1633 'vivo_smart2' => 2271,
1634 'edge1000_thai' => 2274,
1635 'varia_remote' => 2276,
1636 'edge25_asia' => 2288,
1637 'edge25_jpn' => 2289,
1638 'edge20_asia' => 2290,
1639 'approach_x40' => 2292,
1640 'fenix3_japan' => 2293,
1641 'vivo_smart_emea' => 2294,
1642 'fr630_asia' => 2310,
1643 'fr630_jpn' => 2311,
1644 'fr230_jpn' => 2313,
1645 'hrm4_run' => 2327,
1646 'epix_japan' => 2332,
1647 'vivo_active_hr' => 2337,
1648 'vivo_smart_gps_hr' => 2347,
1649 'vivo_smart_hr' => 2348,
1650 'vivo_smart_hr_asia' => 2361,
1651 'vivo_smart_gps_hr_asia' => 2362,
1652 'vivo_move' => 2368,
1653 'varia_taillight' => 2379,
1654 'fr235_asia' => 2396,
1655 'fr235_japan' => 2397,
1656 'varia_vision' => 2398,
1657 'vivo_fit3' => 2406,
1658 'fenix3_korea' => 2407,
1659 'fenix3_sea' => 2408,
1660 'fenix3_hr' => 2413,
1661 'virb_ultra_30' => 2417,
1662 'index_smart_scale' => 2429,
1663 'fr235' => 2431,
1664 'fenix3_chronos' => 2432,
1665 'oregon7xx' => 2441,
1666 'rino7xx' => 2444,
1667 'epix_korea' => 2457,
1668 'fenix3_hr_chn' => 2473,
1669 'fenix3_hr_twn' => 2474,
1670 'fenix3_hr_jpn' => 2475,
1671 'fenix3_hr_sea' => 2476,
1672 'fenix3_hr_kor' => 2477,
1673 'nautix' => 2496,
1674 'vivo_active_hr_apac' => 2497,
1675 'fr35' => 2503,
1676 'oregon7xx_ww' => 2512,
1677 'edge_820' => 2530,
1678 'edge_explore_820' => 2531,
1679 'fr735xt_apac' => 2533,
1680 'fr735xt_japan' => 2534,
1681 'fenix5s' => 2544,
1682 'd2_bravo_titanium' => 2547,
1683 'varia_ut800' => 2567, # Varia UT 800 SW
1684 'running_dynamics_pod' => 2593,
1685 'edge_820_china' => 2599,
1686 'edge_820_japan' => 2600,
1687 'fenix5x' => 2604,
1688 'vivo_fit_jr' => 2606,
1689 'vivo_smart3' => 2622,
1690 'vivo_sport' => 2623,
1691 'edge_820_taiwan' => 2628,
1692 'edge_820_korea' => 2629,
1693 'edge_820_sea' => 2630,
1694 'fr35_hebrew' => 2650,
1695 'approach_s60' => 2656,
1696 'fr35_apac' => 2667,
1697 'fr35_japan' => 2668,
1698 'fenix3_chronos_asia' => 2675,
1699 'virb_360' => 2687,
1700 'fr935' => 2691,
1701 'fenix5' => 2697,
1702 'vivoactive3' => 2700,
1703 'fr235_china_nfc' => 2733,
1704 'foretrex_601_701' => 2769,
1705 'vivo_move_hr' => 2772,
1706 'edge_1030' => 2713,
1707 'fr35_sea' => 2727,
1708 'vector_3' => 2787,
1709 'fenix5_asia' => 2796,
1710 'fenix5s_asia' => 2797,
1711 'fenix5x_asia' => 2798,
1712 'approach_z80' => 2806,
1713 'fr35_korea' => 2814,
1714 'd2charlie' => 2819,
1715 'vivo_smart3_apac' => 2831,
1716 'vivo_sport_apac' => 2832,
1717 'fr935_asia' => 2833,
1718 'descent' => 2859,
1719 'vivo_fit4' => 2878,
1720 'fr645' => 2886,
1721 'fr645m' => 2888,
1722 'fr30' => 2891,
1723 'fenix5s_plus' => 2900,
1724 'Edge_130' => 2909,
1725 'edge_1030_asia' => 2924,
1726 'vivosmart_4' => 2927,
1727 'vivo_move_hr_asia' => 2945,
1728 'approach_x10' => 2962,
1729 'fr30_asia' => 2977,
1730 'vivoactive3m_w' => 2988,
1731 'fr645_asia' => 3003,
1732 'fr645m_asia' => 3004,
1733 'edge_explore' => 3011,
1734 'gpsmap66' => 3028,
1735 'approach_s10' => 3049,
1736 'vivoactive3m_l' => 3066,
1737 'approach_g80' => 3085,
1738 'edge_130_asia' => 3092,
1739 'edge_1030_bontrager' => 3095,
1740 'fenix5_plus' => 3110,
1741 'fenix5x_plus' => 3111,
1742 'edge_520_plus' => 3112,
1743 'fr945' => 3113,
1744 'edge_530' => 3121,
1745 'edge_830' => 3122,
1746 'instinct_esports' => 3126,
1747 'fenix5s_plus_apac' => 3134,
1748 'fenix5x_plus_apac' => 3135,
1749 'edge_520_plus_apac' => 3142,
1750 'fr235l_asia' => 3144,
1751 'fr245_asia' => 3145,
1752 'vivo_active3m_apac' => 3163,
1753 'gen3_bsm' => 3192, # gen3 bike speed sensor
1754 'gen3_bcm' => 3193, # gen3 bike cadence sensor
1755 'vivo_smart4_asia' => 3218,
1756 'vivoactive4_small' => 3224,
1757 'vivoactive4_large' => 3225,
1758 'venu' => 3226,
1759 'marq_driver' => 3246,
1760 'marq_aviator' => 3247,
1761 'marq_captain' => 3248,
1762 'marq_commander' => 3249,
1763 'marq_expedition' => 3250,
1764 'marq_athlete' => 3251,
1765 'descent_mk2' => 3258,
1766 'gpsmap66i' => 3284,
1767 'fenix6S_sport' => 3287,
1768 'fenix6S' => 3288,
1769 'fenix6_sport' => 3289,
1770 'fenix6' => 3290,
1771 'fenix6x' => 3291,
1772 'hrm_dual' => 3299, # HRM-Dual
1773 'hrm_pro' => 3300, # HRM-Pro
1774 'vivo_move3_premium' => 3308,
1775 'approach_s40' => 3314,
1776 'fr245m_asia' => 3321,
1777 'edge_530_apac' => 3349,
1778 'edge_830_apac' => 3350,
1779 'vivo_move3' => 3378,
1780 'vivo_active4_small_asia' => 3387,
1781 'vivo_active4_large_asia' => 3388,
1782 'vivo_active4_oled_asia' => 3389,
1783 'swim2' => 3405,
1784 'marq_driver_asia' => 3420,
1785 'marq_aviator_asia' => 3421,
1786 'vivo_move3_asia' => 3422,
1787 'fr945_asia' => 3441,
1788 'vivo_active3t_chn' => 3446,
1789 'marq_captain_asia' => 3448,
1790 'marq_commander_asia' => 3449,
1791 'marq_expedition_asia' => 3450,
1792 'marq_athlete_asia' => 3451,
1793 'instinct_solar' => 3466,
1794 'fr45_asia' => 3469,
1795 'vivoactive3_daimler' => 3473,
1796 'legacy_rey' => 3498,
1797 'legacy_darth_vader' => 3499,
1798 'legacy_captain_marvel' => 3500,
1799 'legacy_first_avenger' => 3501,
1800 'fenix6s_sport_asia' => 3512,
1801 'fenix6s_asia' => 3513,
1802 'fenix6_sport_asia' => 3514,
1803 'fenix6_asia' => 3515,
1804 'fenix6x_asia' => 3516,
1805 'legacy_captain_marvel_asia' => 3535,
1806 'legacy_first_avenger_asia' => 3536,
1807 'legacy_rey_asia' => 3537,
1808 'legacy_darth_vader_asia' => 3538,
1809 'descent_mk2s' => 3542,
1810 'edge_130_plus' => 3558,
1811 'edge_1030_plus' => 3570,
1812 'rally_200' => 3578, # Rally 100/200 Power Meter Series
1813 'fr745' => 3589,
1814 'venusq' => 3600,
1815 'lily' => 3615,
1816 'marq_adventurer' => 3624,
1817 'enduro' => 3638,
1818 'swim2_apac' => 3639,
1819 'marq_adventurer_asia' => 3648,
1820 'fr945_lte' => 3652,
1821 'descent_mk2_asia' => 3702, # Mk2 and Mk2i
1822 'venu2' => 3703,
1823 'venu2s' => 3704,
1824 'venu_daimler_asia' => 3737,
1825 'marq_golfer' => 3739,
1826 'venu_daimler' => 3740,
1827 'fr745_asia' => 3794,
1828 'lily_asia' => 3809,
1829 'edge_1030_plus_asia' => 3812,
1830 'edge_130_plus_asia' => 3813,
1831 'approach_s12' => 3823,
1832 'enduro_asia' => 3872,
1833 'venusq_asia' => 3837,
1834 'edge_1040' => 3843,
1835 'marq_golfer_asia' => 3850,
1836 'venu2_plus' => 3851,
1837 'fr55' => 3869,
1838 'instinct_2' => 3888,
1839 'fenix7s' => 3905,
1840 'fenix7' => 3906,
1841 'fenix7x' => 3907,
1842 'fenix7s_apac' => 3908,
1843 'fenix7_apac' => 3909,
1844 'fenix7x_apac' => 3910,
1845 'approach_g12' => 3927,
1846 'descent_mk2s_asia' => 3930,
1847 'approach_s42' => 3934,
1848 'epix_gen2' => 3943,
1849 'epix_gen2_apac' => 3944,
1850 'venu2s_asia' => 3949,
1851 'venu2_asia' => 3950,
1852 'fr945_lte_asia' => 3978,
1853 'vivo_move_sport' => 3982,
1854 'vivomove_trend' => 3983,
1855 'approach_S12_asia' => 3986,
1856 'fr255_music' => 3990,
1857 'fr255_small_music' => 3991,
1858 'fr255' => 3992,
1859 'fr255_small' => 3993,
1860 'approach_g12_asia' => 4001,
1861 'approach_s42_asia' => 4002,
1862 'descent_g1' => 4005,
1863 'venu2_plus_asia' => 4017,
1864 'fr955' => 4024,
1865 'fr55_asia' => 4033,
1866 'vivosmart_5' => 4063,
1867 'instinct_2_asia' => 4071,
1868 'marq_gen2' => 4105, # Adventurer, Athlete, Captain, Golfer
1869 'venusq2' => 4115,
1870 'venusq2music' => 4116,
1871 'marq_gen2_aviator' => 4124,
1872 'd2_air_x10' => 4125,
1873 'hrm_pro_plus' => 4130,
1874 'descent_g1_asia' => 4132,
1875 'tactix7' => 4135,
1876 'instinct_crossover' => 4155,
1877 'edge_explore2' => 4169,
1878 'tacx_neo_smart' => 4265, # Neo Smart, Tacx
1879 'tacx_neo2_smart' => 4266, # Neo 2 Smart, Tacx
1880 'tacx_neo2_t_smart' => 4267, # Neo 2T Smart, Tacx
1881 'tacx_neo_smart_bike' => 4268, # Neo Smart Bike, Tacx
1882 'tacx_satori_smart' => 4269, # Satori Smart, Tacx
1883 'tacx_flow_smart' => 4270, # Flow Smart, Tacx
1884 'tacx_vortex_smart' => 4271, # Vortex Smart, Tacx
1885 'tacx_bushido_smart' => 4272, # Bushido Smart, Tacx
1886 'tacx_genius_smart' => 4273, # Genius Smart, Tacx
1887 'tacx_flux_flux_s_smart' => 4274, # Flux/Flux S Smart, Tacx
1888 'tacx_flux2_smart' => 4275, # Flux 2 Smart, Tacx
1889 'tacx_magnum' => 4276, # Magnum, Tacx
1890 'edge_1040_asia' => 4305,
1891 'enduro2' => 4341,
1892 'sdm4' => 10007, # SDM4 footpod
1893 'edge_remote' => 10014,
1894 'tacx_training_app_win' => 20533,
1895 'tacx_training_app_mac' => 20534,
1896 'tacx_training_app_mac_catalyst' => 20565,
1897 'training_center' => 20119,
1898 'tacx_training_app_android' => 30045,
1899 'tacx_training_app_ios' => 30046,
1900 'tacx_training_app_legacy' => 30047,
1901 'connectiq_simulator' => 65531,
1902 'android_antplus_plugin' => 65532,
1903 'connect' => 65534, # Garmin Connect website
1904 },
1905  
1906 'device_type' => +{
1907 '_moved_to' => 'antplus_device_type',
1908 },
1909  
1910 'antplus_device_type' => +{
1911 '_base_type' => FIT_UINT8,
1912 'antfs' => 1,
1913 'bike_power' => 11,
1914 'environment_sensor_legacy' => 12,
1915 'multi_sport_speed_distance' => 15,
1916 'control' => 16,
1917 'fitness_equipment' => 17,
1918 'blood_pressure' => 18,
1919 'geocache_node' => 19,
1920 'light_electric_vehicle' => 20,
1921 'env_sensor' => 25,
1922 'racquet' => 26,
1923 'control_hub' => 27,
1924 'muscle_oxygen' => 31,
1925 'shifting' => 34,
1926 'bike_light_main' => 35,
1927 'bike_light_shared' => 36,
1928 'exd' => 38,
1929 'bike_radar' => 40,
1930 'bike_aero' => 46,
1931 'weight_scale' => 119,
1932 'heart_rate' => 120,
1933 'bike_speed_cadence' => 121,
1934 'bike_cadence' => 122,
1935 'bike_speed' => 123,
1936 'stride_speed_distance' => 124,
1937 },
1938  
1939 'ant_network' => +{
1940 '_base_type' => FIT_ENUM,
1941 'public' => 0,
1942 'antplus' => 1,
1943 'antfs' => 2,
1944 'private' => 3,
1945 },
1946  
1947 'workout_capabilities' => +{
1948 '_base_type' => FIT_UINT32Z,
1949 '_mask' => 1,
1950 'interval' => 0x00000001,
1951 'custom' => 0x00000002,
1952 'fitness_equipment' => 0x00000004,
1953 'firstbeat' => 0x00000008,
1954 'new_leaf' => 0x00000010,
1955 'tcx' => 0x00000020,
1956 'speed' => 0x00000080,
1957 'heart_rate' => 0x00000100,
1958 'distance' => 0x00000200,
1959 'cadence' => 0x00000400,
1960 'power' => 0x00000800,
1961 'grade' => 0x00001000,
1962 'resistance' => 0x00002000,
1963 'protected' => 0x00004000,
1964 },
1965  
1966 'battery_status' => +{
1967 '_base_type' => FIT_UINT8,
1968 'new' => 1,
1969 'good' => 2,
1970 'ok' => 3,
1971 'low' => 4,
1972 'critical' => 5,
1973 'charging' => 6,
1974 'unknown' => 7,
1975 },
1976  
1977 'hr_type' => +{
1978 '_base_type' => FIT_ENUM,
1979 'normal' => 0,
1980 'irregular' => 1,
1981 },
1982  
1983 'course_capabilities' => +{
1984 '_base_type' => FIT_UINT32Z,
1985 '_mask' => 1,
1986 'processed' => 0x00000001,
1987 'valid' => 0x00000002,
1988 'time' => 0x00000004,
1989 'distance' => 0x00000008,
1990 'position' => 0x00000010,
1991 'heart_rate' => 0x00000020,
1992 'power' => 0x00000040,
1993 'cadence' => 0x00000080,
1994 'training' => 0x00000100,
1995 'navigation' => 0x00000200,
1996 'bikeway' => 0x00000400,
1997 'aviation'=> 0x00001000, # Denote course files to be used as flight plans
1998 },
1999  
2000 'weight' => +{
2001 '_base_type' => FIT_UINT16,
2002 'calculating' => 0xFFFE,
2003 },
2004  
2005 'workout_hr' => +{
2006 '_base_type' => FIT_UINT32,
2007 'bpm_offset' => 100,
2008 },
2009  
2010 'workout_power' => +{
2011 '_base_type' => FIT_UINT32,
2012 'watts_offset' => 1000,
2013 },
2014  
2015 'bp_status' => +{
2016 '_base_type' => FIT_ENUM,
2017 'no_error' => 0,
2018 'error_incomplete_data' => 1,
2019 'error_no_measurement' => 2,
2020 'error_data_out_of_range' => 3,
2021 'error_irregular_heart_rate' => 4,
2022 },
2023  
2024 'user_local_id' => +{
2025 '_base_type' => FIT_UINT16,
2026 'local_min' => 0x0001,
2027 'local_max' => 0x000F,
2028 'stationary_min' => 0x0010,
2029 'stationary_max' => 0x00FF,
2030 'portable_min' => 0x0100,
2031 'portable_max' => 0xFFFE,
2032 },
2033  
2034 'swim_stroke' => +{
2035 '_base_type' => FIT_ENUM,
2036 'freestyle' => 0,
2037 'backstroke' => 1,
2038 'breaststroke' => 2,
2039 'butterfly' => 3,
2040 'drill' => 4,
2041 'mixed' => 5,
2042 'im' => 6,
2043 },
2044  
2045 'activity_type' => +{
2046 '_base_type' => FIT_ENUM,
2047 'generic' => 0,
2048 'running' => 1,
2049 'cycling' => 2,
2050 'transition' => 3,
2051 'fitness_equipment' => 4,
2052 'swimming' => 5,
2053 'walking' => 6,
2054 'sedentary' => 8,
2055 'all' => 254,
2056 },
2057  
2058 'activity_subtype' => +{
2059 '_base_type' => FIT_ENUM,
2060 'generic' => 0,
2061 'treadmill' => 1, # run
2062 'street' => 2, # run
2063 'trail' => 3, # run
2064 'track' => 4, # run
2065 'spin' => 5, # cycling
2066 'indoor_cycling' => 6, # cycling
2067 'road' => 7, # cycling
2068 'mountain' => 8, # cycling
2069 'downhill' => 9, # cycling
2070 'recumbent' => 10, # cycling
2071 'cyclocross' => 11, # cycling
2072 'hand_cycling' => 12, # cycling
2073 'track_cycling' => 13, # cycling
2074 'indoor_rowing' => 14, # fitness equipment
2075 'elliptical' => 15, # fitness equipment
2076 'stair_climbing' => 16, # fitness equipment
2077 'lap_swimming' => 17, # swimming
2078 'open_water' => 18, # swimming
2079 'all' => 254,
2080 },
2081  
2082 'activity_level' => +{
2083 '_base_type' => FIT_ENUM,
2084 'low' => 0,
2085 'medium' => 1,
2086 'high' => 2,
2087 },
2088  
2089 'side' => +{
2090 '_base_type' => FIT_ENUM,
2091 'right' => 0,
2092 'left' => 1,
2093 },
2094  
2095 'left_right_balance' => +{
2096 '_base_type' => FIT_UINT8,
2097 'mask' => 0x7F,
2098 'right' => 0x80,
2099 },
2100  
2101 'left_right_balance_100' => +{
2102 '_base_type' => FIT_UINT16,
2103 'mask' => 0x3FFF,
2104 'right' => 0x8000,
2105 },
2106  
2107 'length_type' => +{
2108 '_base_type' => FIT_ENUM,
2109 'idle' => 0,
2110 'active' => 1,
2111 },
2112  
2113 'day_of_week' => +{
2114 '_base_type' => FIT_ENUM,
2115 'sunday' => 0,
2116 'monday' => 1,
2117 'tuesday' => 2,
2118 'wednesday' => 3,
2119 'thursday' => 4,
2120 'friday' => 5,
2121 'saturday' => 6,
2122 },
2123  
2124 'connectivity_capabilities' => +{
2125 '_base_type' => FIT_UINT32Z,
2126 'bluetooth' => 0x00000001,
2127 'bluetooth_le' => 0x00000002,
2128 'ant' => 0x00000004,
2129 'activity_upload' => 0x00000008,
2130 'course_download' => 0x00000010,
2131 'workout_download' => 0x00000020,
2132 'live_track' => 0x00000040,
2133 'weather_conditions' => 0x00000080,
2134 'weather_alerts' => 0x00000100,
2135 'gps_ephemeris_download' => 0x00000200,
2136 'explicit_archive' => 0x00000400,
2137 'setup_incomplete' => 0x00000800,
2138 'continue_sync_after_software_update' => 0x00001000,
2139 'connect_iq_app_download' => 0x00002000,
2140 'golf_course_download' => 0x00004000,
2141 'device_initiates_sync' => 0x00008000,
2142 'connect_iq_watch_app_download' => 0x00010000,
2143 'connect_iq_widget_download' => 0x00020000,
2144 'connect_iq_watch_face_download' => 0x00040000,
2145 'connect_iq_data_field_download' => 0x00080000,
2146 'connect_iq_app_managment' => 0x00100000,
2147 'swing_sensor' => 0x00200000,
2148 'swing_sensor_remote' => 0x00400000,
2149 'incident_detection' => 0x00800000,
2150 'audio_prompts' => 0x01000000,
2151 'wifi_verification' => 0x02000000,
2152 'true_up' => 0x04000000,
2153 'find_my_watch' => 0x08000000,
2154 'remote_manual_sync' => 0x10000000,
2155 'live_track_auto_start' => 0x20000000,
2156 'live_track_messaging' => 0x40000000,
2157 'instant_input' => 0x80000000, # Device supports instant input feature
2158 },
2159  
2160 'weather_report' => +{
2161 '_base_type' => FIT_ENUM,
2162 'current' => 0,
2163 # 'forecast' => 1, # deprecated, use hourly_forecast instead
2164 'hourly_forecast' => 1,
2165 'daily_forecast' => 2,
2166 },
2167  
2168 'weather_status' => +{
2169 '_base_type' => FIT_ENUM,
2170 'clear' => 0,
2171 'partly_cloudy' => 1,
2172 'mostly_cloudy' => 2,
2173 'rain' => 3,
2174 'snow' => 4,
2175 'windy' => 5,
2176 'thunderstorms' => 6,
2177 'wintry_mix' => 7,
2178 'fog' => 8,
2179 'hazy' => 11,
2180 'hail' => 12,
2181 'scattered_showers' => 13,
2182 'scattered_thunderstorms' => 14,
2183 'unknown_precipitation' => 15,
2184 'light_rain' => 16,
2185 'heavy_rain' => 17,
2186 'light_snow' => 18,
2187 'heavy_snow' => 19,
2188 'light_rain_snow' => 20,
2189 'heavy_rain_snow' => 21,
2190 'cloudy' => 22,
2191 },
2192  
2193 'weather_severity' => +{
2194 '_base_type' => FIT_ENUM,
2195 'unknown' => 0,
2196 'warning' => 1,
2197 'watch' => 2,
2198 'advisory' => 3,
2199 'statement' => 4,
2200 },
2201  
2202 'weather_severe_type' => +{
2203 '_base_type' => FIT_ENUM,
2204 'unspecified' => 0,
2205 'tornado' => 1,
2206 'tsunami' => 2,
2207 'hurricane' => 3,
2208 'extreme_wind' => 4,
2209 'typhoon' => 5,
2210 'inland_hurricane' => 6,
2211 'hurricane_force_wind' => 7,
2212 'waterspout' => 8,
2213 'severe_thunderstorm' => 9,
2214 'wreckhouse_winds' => 10,
2215 'les_suetes_wind' => 11,
2216 'avalanche' => 12,
2217 'flash_flood' => 13,
2218 'tropical_storm' => 14,
2219 'inland_tropical_storm' => 15,
2220 'blizzard' => 16,
2221 'ice_storm' => 17,
2222 'freezing_rain' => 18,
2223 'debris_flow' => 19,
2224 'flash_freeze' => 20,
2225 'dust_storm' => 21,
2226 'high_wind' => 22,
2227 'winter_storm' => 23,
2228 'heavy_freezing_spray' => 24,
2229 'extreme_cold' => 25,
2230 'wind_chill' => 26,
2231 'cold_wave' => 27,
2232 'heavy_snow_alert' => 28,
2233 'lake_effect_blowing_snow' => 29,
2234 'snow_squall' => 30,
2235 'lake_effect_snow' => 31,
2236 'winter_weather' => 32,
2237 'sleet' => 33,
2238 'snowfall' => 34,
2239 'snow_and_blowing_snow' => 35,
2240 'blowing_snow' => 36,
2241 'snow_alert' => 37,
2242 'arctic_outflow' => 38,
2243 'freezing_drizzle' => 39,
2244 'storm' => 40,
2245 'storm_surge' => 41,
2246 'rainfall' => 42,
2247 'areal_flood' => 43,
2248 'coastal_flood' => 44,
2249 'lakeshore_flood' => 45,
2250 'excessive_heat' => 46,
2251 'heat' => 47,
2252 'weather' => 48,
2253 'high_heat_and_humidity' => 49,
2254 'humidex_and_health' => 50,
2255 'humidex' => 51,
2256 'gale' => 52,
2257 'freezing_spray' => 53,
2258 'special_marine' => 54,
2259 'squall' => 55,
2260 'strong_wind' => 56,
2261 'lake_wind' => 57,
2262 'marine_weather' => 58,
2263 'wind' => 59,
2264 'small_craft_hazardous_seas' => 60,
2265 'hazardous_seas' => 61,
2266 'small_craft' => 62,
2267 'small_craft_winds' => 63,
2268 'small_craft_rough_bar' => 64,
2269 'high_water_level' => 65,
2270 'ashfall' => 66,
2271 'freezing_fog' => 67,
2272 'dense_fog' => 68,
2273 'dense_smoke' => 69,
2274 'blowing_dust' => 70,
2275 'hard_freeze' => 71,
2276 'freeze' => 72,
2277 'frost' => 73,
2278 'fire_weather' => 74,
2279 'flood' => 75,
2280 'rip_tide' => 76,
2281 'high_surf' => 77,
2282 'smog' => 78,
2283 'air_quality' => 79,
2284 'brisk_wind' => 80,
2285 'air_stagnation' => 81,
2286 'low_water' => 82,
2287 'hydrological' => 83,
2288 'special_weather' => 84,
2289 },
2290  
2291 'time_into_day' => +{ # since 00:00:00 UTC
2292 '_base_type' => FIT_UINT32,
2293 },
2294  
2295 'localtime_into_day' => +{ # same as above, but in local time zone
2296 '_base_type' => FIT_UINT32,
2297 },
2298  
2299 'stroke_type' => +{
2300 '_base_type' => FIT_ENUM,
2301 'no_event' => 0,
2302 'other' => 1,
2303 'serve' => 2,
2304 'forehand' => 3,
2305 'backhand' => 4,
2306 'smash' => 5,
2307 },
2308  
2309 'body_location' => +{
2310 '_base_type' => FIT_ENUM,
2311 'left_leg' => 0,
2312 'left_calf' => 1,
2313 'left_shin' => 2,
2314 'left_hamstring' => 3,
2315 'left_quad' => 4,
2316 'left_glute' => 5,
2317 'right_leg' => 6,
2318 'right_calf' => 7,
2319 'right_shin' => 8,
2320 'right_hamstring' => 9,
2321 'right_quad' => 10,
2322 'right_glute' => 11,
2323 'torso_back' => 12,
2324 'left_lower_back' => 13,
2325 'left_upper_back' => 14,
2326 'right_lower_back' => 15,
2327 'right_upper_back' => 16,
2328 'torso_front' => 17,
2329 'left_abdomen' => 18,
2330 'left_chest' => 19,
2331 'right_abdomen' => 20,
2332 'right_chest' => 21,
2333 'left_arm' => 22,
2334 'left_shoulder' => 23,
2335 'left_bicep' => 24,
2336 'left_tricep' => 25,
2337 'left_brachioradialis' => 26,
2338 'left_forearm_extensors' => 27,
2339 'right_arm' => 28,
2340 'right_shoulder' => 29,
2341 'right_bicep' => 30,
2342 'right_tricep' => 31,
2343 'right_brachioradialis' => 32,
2344 'right_forearm_extensors' => 33,
2345 'neck' => 34,
2346 'throat' => 35,
2347 'waist_mid_back' => 36,
2348 'waist_front' => 37,
2349 'waist_left' => 38,
2350 'waist_right' => 39,
2351 },
2352  
2353 'segment_lap_status' => +{
2354 '_base_type' => FIT_ENUM,
2355 'end' => 0,
2356 'fail' => 1,
2357 },
2358  
2359 'segment_leaderboard_type' => +{
2360 '_base_type' => FIT_ENUM,
2361 'overall' => 0,
2362 'personal_best' => 1,
2363 'connections' => 2,
2364 'group' => 3,
2365 'challenger' => 4,
2366 'kom' => 5,
2367 'qom' => 6,
2368 'pr' => 7,
2369 'goal' => 8,
2370 'rival' => 9,
2371 'club_leader' => 10,
2372 },
2373  
2374 'segment_delete_status' => +{
2375 '_base_type' => FIT_ENUM,
2376 'do_not_delete' => 0,
2377 'delete_one' => 1,
2378 'delete_all' => 2,
2379 },
2380  
2381 'segment_selection_type' => +{
2382 '_base_type' => FIT_ENUM,
2383 'starred' => 0,
2384 'suggested' => 1,
2385 },
2386  
2387 'source_type' => +{
2388 '_base_type' => FIT_ENUM,
2389 'ant' => 0,
2390 'antplus' => 1,
2391 'bluetooth' => 2,
2392 'bluetooth_low_energy' => 3,
2393 'wifi' => 4,
2394 'local' => 5,
2395 },
2396  
2397 'local_device_type' => +{
2398 '_base_type' => FIT_UINT8,
2399 'gps' => 0, # Onboard gps receiver
2400 'glonass' => 1, # Onboard glonass receiver
2401 'gps_glonass' => 2, # Onboard gps glonass receiver
2402 'accelerometer' => 3, # Onboard sensor
2403 'barometer' => 4, # Onboard sensor
2404 'temperature' => 5, # Onboard sensor
2405 'whr' => 10, # Onboard wrist HR sensor
2406 'sensor_hub' => 12, # Onboard software package
2407 },
2408  
2409 'ble_device_type' => +{
2410 '_base_type' => FIT_ENUM,
2411 'connected_gps' => 0, # GPS that is provided over a proprietary bluetooth service
2412 'heart_rate' => 1,
2413 'bike_power' => 2,
2414 'bike_speed_cadence' => 3,
2415 'bike_speed' => 4,
2416 'bike_cadence' => 5,
2417 'footpod' => 6,
2418 'bike_trainer' => 7, # Indoor-Bike FTMS protocol
2419 },
2420  
2421 'ant_channel_id' => +{
2422 '_base_type' => FIT_UINT32Z,
2423 'ant_extended_device_number_upper_nibble' => 0xF0000000,
2424 'ant_transmission_type_lower_nibble' => 0x0F000000,
2425 'ant_device_type' => 0x00FF0000,
2426 'ant_device_number' => 0x0000FFFF,
2427 },
2428  
2429 'display_orientation' => +{
2430 '_base_type' => FIT_ENUM,
2431 'auto' => 0,
2432 'portrait' => 1,
2433 'landscape' => 2,
2434 'portrait_flipped' => 3,
2435 'landscape_flipped' => 4,
2436 },
2437  
2438 'workout_equipment' => +{
2439 '_base_type' => FIT_ENUM,
2440 'none' => 0,
2441 'swim_fins' => 1,
2442 'swim_kickboard' => 2,
2443 'swim_paddles' => 3,
2444 'swim_pull_buoy' => 4,
2445 'swim_snorkel' => 5,
2446 },
2447 'watchface_mode' => +{
2448 '_base_type' => FIT_ENUM,
2449 'digital' => 0,
2450 'analog' => 1,
2451 'connect_iq' => 2,
2452 'disabled' => 3,
2453 },
2454  
2455 'digital_watchface_layout' => +{
2456 '_base_type' => FIT_ENUM,
2457 'traditional' => 0,
2458 'modern' => 1,
2459 'bold' => 2,
2460 },
2461  
2462 'analog_watchface_layout' => +{
2463 '_base_type' => FIT_ENUM,
2464 'minimal' => 0,
2465 'traditional' => 1,
2466 'modern' => 2,
2467 },
2468  
2469 'rider_position_type' => +{
2470 '_base_type' => FIT_ENUM,
2471 'seated' => 0,
2472 'standing' => 1,
2473 'transition_to_seated' => 2,
2474 'transition_to_standing' => 3,
2475 },
2476  
2477 'power_phase_type' => +{
2478 '_base_type' => FIT_ENUM,
2479 'power_phase_start_angle' => 0,
2480 'power_phase_end_angle' => 1,
2481 'power_phase_arc_length' => 2,
2482 'power_phase_center' => 3,
2483 },
2484  
2485 'camera_event_type' => +{
2486 '_base_type' => FIT_ENUM,
2487 'video_start' => 0,
2488 'video_split' => 1,
2489 'video_end' => 2,
2490 'photo_taken' => 3,
2491 'video_second_stream_start' => 4,
2492 'video_second_stream_split' => 5,
2493 'video_second_stream_end' => 6,
2494 'video_split_start' => 7,
2495 'video_second_stream_split_start' => 8,
2496 'video_pause' => 11,
2497 'video_second_stream_pause' => 12,
2498 'video_resume' => 13,
2499 'video_second_stream_resume' => 14,
2500 },
2501  
2502 'sensor_type' => +{
2503 '_base_type' => FIT_ENUM,
2504 'accelerometer' => 0,
2505 'gyroscope' => 1,
2506 'compass' => 2, # Magnetometer
2507 'barometer' => 3,
2508 },
2509  
2510 'bike_light_network_config_type' => +{
2511 '_base_type' => FIT_ENUM,
2512 'auto' => 0,
2513 'individual' => 4,
2514 'high_visibility' => 5,
2515 'trail' => 6,
2516 },
2517  
2518 'comm_timeout_type' => +{
2519 '_base_type' => FIT_UINT16,
2520 'wildcard_pairing_timeout' => 0,
2521 'pairing_timeout' => 1,
2522 'connection_lost' => 2,
2523 'connection_timeout' => 3,
2524 },
2525  
2526 'camera_orientation_type' => +{
2527 '_base_type' => FIT_ENUM,
2528 'camera_orientation_0' => 0,
2529 'camera_orientation_90' => 1,
2530 'camera_orientation_180' => 2,
2531 'camera_orientation_270' => 3,
2532 },
2533  
2534 'attitude_stage' => +{
2535 '_base_type' => FIT_ENUM,
2536 'failed' => 0,
2537 'aligning' => 1,
2538 'degraded' => 2,
2539 'valid' => 3,
2540 },
2541  
2542 'attitude_validity' => +{
2543 '_base_type' => FIT_UINT16,
2544 'track_angle_heading_valid' => 0x0001,
2545 'pitch_valid' => 0x0002,
2546 'roll_valid' => 0x0004,
2547 'lateral_body_accel_valid' => 0x0008,
2548 'normal_body_accel_valid' => 0x0010,
2549 'turn_rate_valid' => 0x0020,
2550 'hw_fail' => 0x0040,
2551 'mag_invalid' => 0x0080,
2552 'no_gps' => 0x0100,
2553 'gps_invalid' => 0x0200,
2554 'solution_coasting' => 0x0400,
2555 'true_track_angle' => 0x0800,
2556 'magnetic_heading' => 0x1000,
2557 },
2558  
2559 'auto_sync_frequency' => +{
2560 '_base_type' => FIT_ENUM,
2561 'never' => 0,
2562 'occasionally' => 1,
2563 'frequent' => 2,
2564 'once_a_day' => 3,
2565 'remote' => 4,
2566 },
2567  
2568 'exd_layout' => +{
2569 '_base_type' => FIT_ENUM,
2570 'full_screen' => 0,
2571 'half_vertical' => 1,
2572 'half_horizontal' => 2,
2573 'half_vertical_right_split' => 3,
2574 'half_horizontal_bottom_split' => 4,
2575 'full_quarter_split' => 5,
2576 'half_vertical_left_split' => 6,
2577 'half_horizontal_top_split' => 7,
2578 'dynamic' => 8, # The EXD may display the configured concepts in any layout it sees fit.
2579 },
2580  
2581 'exd_display_type' => +{
2582 '_base_type' => FIT_ENUM,
2583 'numerical' => 0,
2584 'simple' => 1,
2585 'graph' => 2,
2586 'bar' => 3,
2587 'circle_graph' => 4,
2588 'virtual_partner' => 5,
2589 'balance' => 6,
2590 'string_list' => 7,
2591 'string' => 8,
2592 'simple_dynamic_icon' => 9,
2593 'gauge' => 10,
2594 },
2595  
2596 'exd_data_units' => +{
2597 '_base_type' => FIT_ENUM,
2598 'no_units' => 0,
2599 'laps' => 1,
2600 'miles_per_hour' => 2,
2601 'kilometers_per_hour' => 3,
2602 'feet_per_hour' => 4,
2603 'meters_per_hour' => 5,
2604 'degrees_celsius' => 6,
2605 'degrees_farenheit' => 7,
2606 'zone' => 8,
2607 'gear' => 9,
2608 'rpm' => 10,
2609 'bpm' => 11,
2610 'degrees' => 12,
2611 'millimeters' => 13,
2612 'meters' => 14,
2613 'kilometers' => 15,
2614 'feet' => 16,
2615 'yards' => 17,
2616 'kilofeet' => 18,
2617 'miles' => 19,
2618 'time' => 20,
2619 'enum_turn_type' => 21,
2620 'percent' => 22,
2621 'watts' => 23,
2622 'watts_per_kilogram' => 24,
2623 'enum_battery_status' => 25,
2624 'enum_bike_light_beam_angle_mode' => 26,
2625 'enum_bike_light_battery_status' => 27,
2626 'enum_bike_light_network_config_type' => 28,
2627 'lights' => 29,
2628 'seconds' => 30,
2629 'minutes' => 31,
2630 'hours' => 32,
2631 'calories' => 33,
2632 'kilojoules' => 34,
2633 'milliseconds' => 35,
2634 'second_per_mile' => 36,
2635 'second_per_kilometer' => 37,
2636 'centimeter' => 38,
2637 'enum_course_point' => 39,
2638 'bradians' => 40,
2639 'enum_sport' => 41,
2640 'inches_hg' => 42,
2641 'mm_hg' => 43,
2642 'mbars' => 44,
2643 'hecto_pascals' => 45,
2644 'feet_per_min' => 46,
2645 'meters_per_min' => 47,
2646 'meters_per_sec' => 48,
2647 'eight_cardinal' => 49,
2648 },
2649  
2650 'exd_qualifiers' => +{
2651 '_base_type' => FIT_ENUM,
2652 'no_qualifier' => 0,
2653 'instantaneous' => 1,
2654 'average' => 2,
2655 'lap' => 3,
2656 'maximum' => 4,
2657 'maximum_average' => 5,
2658 'maximum_lap' => 6,
2659 'last_lap' => 7,
2660 'average_lap' => 8,
2661 'to_destination' => 9,
2662 'to_go' => 10,
2663 'to_next' => 11,
2664 'next_course_point' => 12,
2665 'total' => 13,
2666 'three_second_average' => 14,
2667 'ten_second_average' => 15,
2668 'thirty_second_average' => 16,
2669 'percent_maximum' => 17,
2670 'percent_maximum_average' => 18,
2671 'lap_percent_maximum' => 19,
2672 'elapsed' => 20,
2673 'sunrise' => 21,
2674 'sunset' => 22,
2675 'compared_to_virtual_partner' => 23,
2676 'maximum_24h' => 24,
2677 'minimum_24h' => 25,
2678 'minimum' => 26,
2679 'first' => 27,
2680 'second' => 28,
2681 'third' => 29,
2682 'shifter' => 30,
2683 'last_sport' => 31,
2684 'moving' => 32,
2685 'stopped' => 33,
2686 'estimated_total' => 34,
2687 'zone_9' => 242,
2688 'zone_8' => 243,
2689 'zone_7' => 244,
2690 'zone_6' => 245,
2691 'zone_5' => 246,
2692 'zone_4' => 247,
2693 'zone_3' => 248,
2694 'zone_2' => 249,
2695 'zone_1' => 250,
2696 },
2697  
2698 'exd_descriptors' => +{
2699 '_base_type' => FIT_ENUM,
2700 'bike_light_battery_status' => 0,
2701 'beam_angle_status' => 1,
2702 'batery_level' => 2,
2703 'light_network_mode' => 3,
2704 'number_lights_connected' => 4,
2705 'cadence' => 5,
2706 'distance' => 6,
2707 'estimated_time_of_arrival' => 7,
2708 'heading' => 8,
2709 'time' => 9,
2710 'battery_level' => 10,
2711 'trainer_resistance' => 11,
2712 'trainer_target_power' => 12,
2713 'time_seated' => 13,
2714 'time_standing' => 14,
2715 'elevation' => 15,
2716 'grade' => 16,
2717 'ascent' => 17,
2718 'descent' => 18,
2719 'vertical_speed' => 19,
2720 'di2_battery_level' => 20,
2721 'front_gear' => 21,
2722 'rear_gear' => 22,
2723 'gear_ratio' => 23,
2724 'heart_rate' => 24,
2725 'heart_rate_zone' => 25,
2726 'time_in_heart_rate_zone' => 26,
2727 'heart_rate_reserve' => 27,
2728 'calories' => 28,
2729 'gps_accuracy' => 29,
2730 'gps_signal_strength' => 30,
2731 'temperature' => 31,
2732 'time_of_day' => 32,
2733 'balance' => 33,
2734 'pedal_smoothness' => 34,
2735 'power' => 35,
2736 'functional_threshold_power' => 36,
2737 'intensity_factor' => 37,
2738 'work' => 38,
2739 'power_ratio' => 39,
2740 'normalized_power' => 40,
2741 'training_stress_score' => 41,
2742 'time_on_zone' => 42,
2743 'speed' => 43,
2744 'laps' => 44,
2745 'reps' => 45,
2746 'workout_step' => 46,
2747 'course_distance' => 47,
2748 'navigation_distance' => 48,
2749 'course_estimated_time_of_arrival' => 49,
2750 'navigation_estimated_time_of_arrival' => 50,
2751 'course_time' => 51,
2752 'navigation_time' => 52,
2753 'course_heading' => 53,
2754 'navigation_heading' => 54,
2755 'power_zone' => 55,
2756 'torque_effectiveness' => 56,
2757 'timer_time' => 57,
2758 'power_weight_ratio' => 58,
2759 'left_platform_center_offset' => 59,
2760 'right_platform_center_offset' => 60,
2761 'left_power_phase_start_angle' => 61,
2762 'right_power_phase_start_angle' => 62,
2763 'left_power_phase_finish_angle' => 63,
2764 'right_power_phase_finish_angle' => 64,
2765 'gears' => 65,
2766 'pace' => 66,
2767 'training_effect' => 67,
2768 'vertical_oscillation' => 68,
2769 'vertical_ratio' => 69,
2770 'ground_contact_time' => 70,
2771 'left_ground_contact_time_balance' => 71,
2772 'right_ground_contact_time_balance' => 72,
2773 'stride_length' => 73,
2774 'running_cadence' => 74,
2775 'performance_condition' => 75,
2776 'course_type' => 76,
2777 'time_in_power_zone' => 77,
2778 'navigation_turn' => 78,
2779 'course_location' => 79,
2780 'navigation_location' => 80,
2781 'compass' => 81,
2782 'gear_combo' => 82,
2783 'muscle_oxygen' => 83,
2784 'icon' => 84,
2785 'compass_heading' => 85,
2786 'gps_heading' => 86,
2787 'gps_elevation' => 87,
2788 'anaerobic_training_effect' => 88,
2789 'course' => 89,
2790 'off_course' => 90,
2791 'glide_ratio' => 91,
2792 'vertical_distance' => 92,
2793 'vmg' => 93,
2794 'ambient_pressure' => 94,
2795 'pressure' => 95,
2796 'vam' => 96,
2797 },
2798  
2799 'auto_activity_detect' => +{
2800 '_base_type' => FIT_UINT32,
2801 'none' => 0x00000000,
2802 'running' => 0x00000001,
2803 'cycling' => 0x00000002,
2804 'swimming' => 0x00000004,
2805 'walking' => 0x00000008,
2806 'elliptical' => 0x00000020,
2807 'sedentary' => 0x00000400,
2808 },
2809  
2810 'supported_exd_screen_layouts' => +{
2811 '_base_type' => FIT_UINT32Z,
2812 'full_screen' => 0x00000001,
2813 'half_vertical' => 0x00000002,
2814 'half_horizontal' => 0x00000004,
2815 'half_vertical_right_split' => 0x00000008,
2816 'half_horizontal_bottom_split' => 0x00000010,
2817 'full_quarter_split' => 0x00000020,
2818 'half_vertical_left_split' => 0x00000040,
2819 'half_horizontal_top_split' => 0x00000080,
2820 },
2821  
2822 'fit_base_type' => +{
2823 '_base_type' => FIT_UINT8,
2824 'enum' => 0,
2825 'sint8' => 1,
2826 'uint8' => 2,
2827 'sint16' => 131,
2828 'uint16' => 132,
2829 'sint32' => 133,
2830 'uint32' => 134,
2831 'string' => 7,
2832 'float32' => 136,
2833 'float64' => 137,
2834 'uint8z' => 10,
2835 'uint16z' => 139,
2836 'uint32z' => 140,
2837 'byte' => 13,
2838 'sint64' => 142,
2839 'uint64' => 143,
2840 'uint64z' => 144,
2841 },
2842  
2843 'turn_type' => +{
2844 '_base_type' => FIT_ENUM,
2845 'arriving_idx' => 0,
2846 'arriving_left_idx' => 1,
2847 'arriving_right_idx' => 2,
2848 'arriving_via_idx' => 3,
2849 'arriving_via_left_idx' => 4,
2850 'arriving_via_right_idx' => 5,
2851 'bear_keep_left_idx' => 6,
2852 'bear_keep_right_idx' => 7,
2853 'continue_idx' => 8,
2854 'exit_left_idx' => 9,
2855 'exit_right_idx' => 10,
2856 'ferry_idx' => 11,
2857 'roundabout_45_idx' => 12,
2858 'roundabout_90_idx' => 13,
2859 'roundabout_135_idx' => 14,
2860 'roundabout_180_idx' => 15,
2861 'roundabout_225_idx' => 16,
2862 'roundabout_270_idx' => 17,
2863 'roundabout_315_idx' => 18,
2864 'roundabout_360_idx' => 19,
2865 'roundabout_neg_45_idx' => 20,
2866 'roundabout_neg_90_idx' => 21,
2867 'roundabout_neg_135_idx' => 22,
2868 'roundabout_neg_180_idx' => 23,
2869 'roundabout_neg_225_idx' => 24,
2870 'roundabout_neg_270_idx' => 25,
2871 'roundabout_neg_315_idx' => 26,
2872 'roundabout_neg_360_idx' => 27,
2873 'roundabout_generic_idx' => 28,
2874 'roundabout_neg_generic_idx' => 29,
2875 'sharp_turn_left_idx' => 30,
2876 'sharp_turn_right_idx' => 31,
2877 'turn_left_idx' => 32,
2878 'turn_right_idx' => 33,
2879 'uturn_left_idx' => 34,
2880 'uturn_right_idx' => 35,
2881 'icon_inv_idx' => 36,
2882 'icon_idx_cnt' => 37,
2883 },
2884  
2885 'bike_light_beam_angle_mode' => +{
2886 '_base_type' => FIT_ENUM,
2887 'manual' => 0,
2888 'auto' => 1,
2889 },
2890  
2891 'fit_base_unit' => +{
2892 '_base_type' => FIT_UINT16,
2893 'other' => 0,
2894 'kilogram' => 1,
2895 'pound' => 2,
2896 },
2897  
2898 'set_type' => +{
2899 '_base_type' => FIT_UINT8,
2900 'rest' => 0,
2901 'active' => 1,
2902 },
2903  
2904 'exercise_category' => +{
2905 '_base_type' => FIT_UINT16,
2906 'bench_press' => 0,
2907 'calf_raise' => 1,
2908 'cardio' => 2,
2909 'carry' => 3,
2910 'chop' => 4,
2911 'core' => 5,
2912 'crunch' => 6,
2913 'curl' => 7,
2914 'deadlift' => 8,
2915 'flye' => 9,
2916 'hip_raise' => 10,
2917 'hip_stability' => 11,
2918 'hip_swing' => 12,
2919 'hyperextension' => 13,
2920 'lateral_raise' => 14,
2921 'leg_curl' => 15,
2922 'leg_raise' => 16,
2923 'lunge' => 17,
2924 'olympic_lift' => 18,
2925 'plank' => 19,
2926 'plyo' => 20,
2927 'pull_up' => 21,
2928 'push_up' => 22,
2929 'row' => 23,
2930 'shoulder_press' => 24,
2931 'shoulder_stability' => 25,
2932 'shrug' => 26,
2933 'sit_up' => 27,
2934 'squat' => 28,
2935 'total_body' => 29,
2936 'triceps_extension' => 30,
2937 'warm_up' => 31,
2938 'run' => 32,
2939 'unknown' => 65534,
2940 },
2941  
2942 'bench_press_exercise_name' => +{
2943 '_base_type' => FIT_UINT16,
2944 'alternating_dumbbell_chest_press_on_swiss_ball' => 0,
2945 'barbell_bench_press' => 1,
2946 'barbell_board_bench_press' => 2,
2947 'barbell_floor_press' => 3,
2948 'close_grip_barbell_bench_press' => 4,
2949 'decline_dumbbell_bench_press' => 5,
2950 'dumbbell_bench_press' => 6,
2951 'dumbbell_floor_press' => 7,
2952 'incline_barbell_bench_press' => 8,
2953 'incline_dumbbell_bench_press' => 9,
2954 'incline_smith_machine_bench_press' => 10,
2955 'isometric_barbell_bench_press' => 11,
2956 'kettlebell_chest_press' => 12,
2957 'neutral_grip_dumbbell_bench_press' => 13,
2958 'neutral_grip_dumbbell_incline_bench_press' => 14,
2959 'one_arm_floor_press' => 15,
2960 'weighted_one_arm_floor_press' => 16,
2961 'partial_lockout' => 17,
2962 'reverse_grip_barbell_bench_press' => 18,
2963 'reverse_grip_incline_bench_press' => 19,
2964 'single_arm_cable_chest_press' => 20,
2965 'single_arm_dumbbell_bench_press' => 21,
2966 'smith_machine_bench_press' => 22,
2967 'swiss_ball_dumbbell_chest_press' => 23,
2968 'triple_stop_barbell_bench_press' => 24,
2969 'wide_grip_barbell_bench_press' => 25,
2970 'alternating_dumbbell_chest_press' => 26,
2971 },
2972  
2973 'calf_raise_exercise_name' => +{
2974 '_base_type' => FIT_UINT16,
2975 '3_way_calf_raise' => 0,
2976 '3_way_weighted_calf_raise' => 1,
2977 '3_way_single_leg_calf_raise' => 2,
2978 '3_way_weighted_single_leg_calf_raise' => 3,
2979 'donkey_calf_raise' => 4,
2980 'weighted_donkey_calf_raise' => 5,
2981 'seated_calf_raise' => 6,
2982 'weighted_seated_calf_raise' => 7,
2983 'seated_dumbbell_toe_raise' => 8,
2984 'single_leg_bent_knee_calf_raise' => 9,
2985 'weighted_single_leg_bent_knee_calf_raise' => 10,
2986 'single_leg_decline_push_up' => 11,
2987 'single_leg_donkey_calf_raise' => 12,
2988 'weighted_single_leg_donkey_calf_raise' => 13,
2989 'single_leg_hip_raise_with_knee_hold' => 14,
2990 'single_leg_standing_calf_raise' => 15,
2991 'single_leg_standing_dumbbell_calf_raise' => 16,
2992 'standing_barbell_calf_raise' => 17,
2993 'standing_calf_raise' => 18,
2994 'weighted_standing_calf_raise' => 19,
2995 'standing_dumbbell_calf_raise' => 20,
2996 },
2997  
2998 'cardio_exercise_name' => +{
2999 '_base_type' => FIT_UINT16,
3000 'bob_and_weave_circle' => 0,
3001 'weighted_bob_and_weave_circle' => 1,
3002 'cardio_core_crawl' => 2,
3003 'weighted_cardio_core_crawl' => 3,
3004 'double_under' => 4,
3005 'weighted_double_under' => 5,
3006 'jump_rope' => 6,
3007 'weighted_jump_rope' => 7,
3008 'jump_rope_crossover' => 8,
3009 'weighted_jump_rope_crossover' => 9,
3010 'jump_rope_jog' => 10,
3011 'weighted_jump_rope_jog' => 11,
3012 'jumping_jacks' => 12,
3013 'weighted_jumping_jacks' => 13,
3014 'ski_moguls' => 14,
3015 'weighted_ski_moguls' => 15,
3016 'split_jacks' => 16,
3017 'weighted_split_jacks' => 17,
3018 'squat_jacks' => 18,
3019 'weighted_squat_jacks' => 19,
3020 'triple_under' => 20,
3021 'weighted_triple_under' => 21,
3022 },
3023  
3024 'carry_exercise_name' => +{
3025 '_base_type' => FIT_UINT16,
3026 'bar_holds' => 0,
3027 'farmers_walk' => 1,
3028 'farmers_walk_on_toes' => 2,
3029 'hex_dumbbell_hold' => 3,
3030 'overhead_carry' => 4,
3031 },
3032  
3033 'chop_exercise_name' => +{
3034 '_base_type' => FIT_UINT16,
3035 'cable_pull_through' => 0,
3036 'cable_rotational_lift' => 1,
3037 'cable_woodchop' => 2,
3038 'cross_chop_to_knee' => 3,
3039 'weighted_cross_chop_to_knee' => 4,
3040 'dumbbell_chop' => 5,
3041 'half_kneeling_rotation' => 6,
3042 'weighted_half_kneeling_rotation' => 7,
3043 'half_kneeling_rotational_chop' => 8,
3044 'half_kneeling_rotational_reverse_chop' => 9,
3045 'half_kneeling_stability_chop' => 10,
3046 'half_kneeling_stability_reverse_chop' => 11,
3047 'kneeling_rotational_chop' => 12,
3048 'kneeling_rotational_reverse_chop' => 13,
3049 'kneeling_stability_chop' => 14,
3050 'kneeling_woodchopper' => 15,
3051 'medicine_ball_wood_chops' => 16,
3052 'power_squat_chops' => 17,
3053 'weighted_power_squat_chops' => 18,
3054 'standing_rotational_chop' => 19,
3055 'standing_split_rotational_chop' => 20,
3056 'standing_split_rotational_reverse_chop' => 21,
3057 'standing_stability_reverse_chop' => 22,
3058 },
3059  
3060 'core_exercise_name' => +{
3061 '_base_type' => FIT_UINT16,
3062 'abs_jabs' => 0,
3063 'weighted_abs_jabs' => 1,
3064 'alternating_plate_reach' => 2,
3065 'barbell_rollout' => 3,
3066 'weighted_barbell_rollout' => 4,
3067 'body_bar_oblique_twist' => 5,
3068 'cable_core_press' => 6,
3069 'cable_side_bend' => 7,
3070 'side_bend' => 8,
3071 'weighted_side_bend' => 9,
3072 'crescent_circle' => 10,
3073 'weighted_crescent_circle' => 11,
3074 'cycling_russian_twist' => 12,
3075 'weighted_cycling_russian_twist' => 13,
3076 'elevated_feet_russian_twist' => 14,
3077 'weighted_elevated_feet_russian_twist' => 15,
3078 'half_turkish_get_up' => 16,
3079 'kettlebell_windmill' => 17,
3080 'kneeling_ab_wheel' => 18,
3081 'weighted_kneeling_ab_wheel' => 19,
3082 'modified_front_lever' => 20,
3083 'open_knee_tucks' => 21,
3084 'weighted_open_knee_tucks' => 22,
3085 'side_abs_leg_lift' => 23,
3086 'weighted_side_abs_leg_lift' => 24,
3087 'swiss_ball_jackknife' => 25,
3088 'weighted_swiss_ball_jackknife' => 26,
3089 'swiss_ball_pike' => 27,
3090 'weighted_swiss_ball_pike' => 28,
3091 'swiss_ball_rollout' => 29,
3092 'weighted_swiss_ball_rollout' => 30,
3093 'triangle_hip_press' => 31,
3094 'weighted_triangle_hip_press' => 32,
3095 'trx_suspended_jackknife' => 33,
3096 'weighted_trx_suspended_jackknife' => 34,
3097 'u_boat' => 35,
3098 'weighted_u_boat' => 36,
3099 'windmill_switches' => 37,
3100 'weighted_windmill_switches' => 38,
3101 'alternating_slide_out' => 39,
3102 'weighted_alternating_slide_out' => 40,
3103 'ghd_back_extensions' => 41,
3104 'weighted_ghd_back_extensions' => 42,
3105 'overhead_walk' => 43,
3106 'inchworm' => 44,
3107 'weighted_modified_front_lever' => 45,
3108 'russian_twist' => 46,
3109 'abdominal_leg_rotations' => 47, # Deprecated do not use
3110 'arm_and_leg_extension_on_knees' => 48,
3111 'bicycle' => 49,
3112 'bicep_curl_with_leg_extension' => 50,
3113 'cat_cow' => 51,
3114 'corkscrew' => 52,
3115 'criss_cross' => 53,
3116 'criss_cross_with_ball' => 54, # Deprecated do not use
3117 'double_leg_stretch' => 55,
3118 'knee_folds' => 56,
3119 'lower_lift' => 57,
3120 'neck_pull' => 58,
3121 'pelvic_clocks' => 59,
3122 'roll_over' => 60,
3123 'roll_up' => 61,
3124 'rolling' => 62,
3125 'rowing_1' => 63,
3126 'rowing_2' => 64,
3127 'scissors' => 65,
3128 'single_leg_circles' => 66,
3129 'single_leg_stretch' => 67,
3130 'snake_twist_1_and_2' => 68, # Deprecated do not use
3131 'swan' => 69,
3132 'swimming' => 70,
3133 'teaser' => 71,
3134 'the_hundred' => 72,
3135 },
3136  
3137 'crunch_exercise_name' => +{
3138 '_base_type' => FIT_UINT16,
3139 'bicycle_crunch' => 0,
3140 'cable_crunch' => 1,
3141 'circular_arm_crunch' => 2,
3142 'crossed_arms_crunch' => 3,
3143 'weighted_crossed_arms_crunch' => 4,
3144 'cross_leg_reverse_crunch' => 5,
3145 'weighted_cross_leg_reverse_crunch' => 6,
3146 'crunch_chop' => 7,
3147 'weighted_crunch_chop' => 8,
3148 'double_crunch' => 9,
3149 'weighted_double_crunch' => 10,
3150 'elbow_to_knee_crunch' => 11,
3151 'weighted_elbow_to_knee_crunch' => 12,
3152 'flutter_kicks' => 13,
3153 'weighted_flutter_kicks' => 14,
3154 'foam_roller_reverse_crunch_on_bench' => 15,
3155 'weighted_foam_roller_reverse_crunch_on_bench' => 16,
3156 'foam_roller_reverse_crunch_with_dumbbell' => 17,
3157 'foam_roller_reverse_crunch_with_medicine_ball' => 18,
3158 'frog_press' => 19,
3159 'hanging_knee_raise_oblique_crunch' => 20,
3160 'weighted_hanging_knee_raise_oblique_crunch' => 21,
3161 'hip_crossover' => 22,
3162 'weighted_hip_crossover' => 23,
3163 'hollow_rock' => 24,
3164 'weighted_hollow_rock' => 25,
3165 'incline_reverse_crunch' => 26,
3166 'weighted_incline_reverse_crunch' => 27,
3167 'kneeling_cable_crunch' => 28,
3168 'kneeling_cross_crunch' => 29,
3169 'weighted_kneeling_cross_crunch' => 30,
3170 'kneeling_oblique_cable_crunch' => 31,
3171 'knees_to_elbow' => 32,
3172 'leg_extensions' => 33,
3173 'weighted_leg_extensions' => 34,
3174 'leg_levers' => 35,
3175 'mcgill_curl_up' => 36,
3176 'weighted_mcgill_curl_up' => 37,
3177 'modified_pilates_roll_up_with_ball' => 38,
3178 'weighted_modified_pilates_roll_up_with_ball' => 39,
3179 'pilates_crunch' => 40,
3180 'weighted_pilates_crunch' => 41,
3181 'pilates_roll_up_with_ball' => 42,
3182 'weighted_pilates_roll_up_with_ball' => 43,
3183 'raised_legs_crunch' => 44,
3184 'weighted_raised_legs_crunch' => 45,
3185 'reverse_crunch' => 46,
3186 'weighted_reverse_crunch' => 47,
3187 'reverse_crunch_on_a_bench' => 48,
3188 'weighted_reverse_crunch_on_a_bench' => 49,
3189 'reverse_curl_and_lift' => 50,
3190 'weighted_reverse_curl_and_lift' => 51,
3191 'rotational_lift' => 52,
3192 'weighted_rotational_lift' => 53,
3193 'seated_alternating_reverse_crunch' => 54,
3194 'weighted_seated_alternating_reverse_crunch' => 55,
3195 'seated_leg_u' => 56,
3196 'weighted_seated_leg_u' => 57,
3197 'side_to_side_crunch_and_weave' => 58,
3198 'weighted_side_to_side_crunch_and_weave' => 59,
3199 'single_leg_reverse_crunch' => 60,
3200 'weighted_single_leg_reverse_crunch' => 61,
3201 'skater_crunch_cross' => 62,
3202 'weighted_skater_crunch_cross' => 63,
3203 'standing_cable_crunch' => 64,
3204 'standing_side_crunch' => 65,
3205 'step_climb' => 66,
3206 'weighted_step_climb' => 67,
3207 'swiss_ball_crunch' => 68,
3208 'swiss_ball_reverse_crunch' => 69,
3209 'weighted_swiss_ball_reverse_crunch' => 70,
3210 'swiss_ball_russian_twist' => 71,
3211 'weighted_swiss_ball_russian_twist' => 72,
3212 'swiss_ball_side_crunch' => 73,
3213 'weighted_swiss_ball_side_crunch' => 74,
3214 'thoracic_crunches_on_foam_roller' => 75,
3215 'weighted_thoracic_crunches_on_foam_roller' => 76,
3216 'triceps_crunch' => 77,
3217 'weighted_bicycle_crunch' => 78,
3218 'weighted_crunch' => 79,
3219 'weighted_swiss_ball_crunch' => 80,
3220 'toes_to_bar' => 81,
3221 'weighted_toes_to_bar' => 82,
3222 'crunch' => 83,
3223 'straight_leg_crunch_with_ball' => 84,
3224 },
3225  
3226 'curl_exercise_name' => +{
3227 '_base_type' => FIT_UINT16,
3228 'alternating_dumbbell_biceps_curl' => 0,
3229 'alternating_dumbbell_biceps_curl_on_swiss_ball' => 1,
3230 'alternating_incline_dumbbell_biceps_curl' => 2,
3231 'barbell_biceps_curl' => 3,
3232 'barbell_reverse_wrist_curl' => 4,
3233 'barbell_wrist_curl' => 5,
3234 'behind_the_back_barbell_reverse_wrist_curl' => 6,
3235 'behind_the_back_one_arm_cable_curl' => 7,
3236 'cable_biceps_curl' => 8,
3237 'cable_hammer_curl' => 9,
3238 'cheating_barbell_biceps_curl' => 10,
3239 'close_grip_ez_bar_biceps_curl' => 11,
3240 'cross_body_dumbbell_hammer_curl' => 12,
3241 'dead_hang_biceps_curl' => 13,
3242 'decline_hammer_curl' => 14,
3243 'dumbbell_biceps_curl_with_static_hold' => 15,
3244 'dumbbell_hammer_curl' => 16,
3245 'dumbbell_reverse_wrist_curl' => 17,
3246 'dumbbell_wrist_curl' => 18,
3247 'ez_bar_preacher_curl' => 19,
3248 'forward_bend_biceps_curl' => 20,
3249 'hammer_curl_to_press' => 21,
3250 'incline_dumbbell_biceps_curl' => 22,
3251 'incline_offset_thumb_dumbbell_curl' => 23,
3252 'kettlebell_biceps_curl' => 24,
3253 'lying_concentration_cable_curl' => 25,
3254 'one_arm_preacher_curl' => 26,
3255 'plate_pinch_curl' => 27,
3256 'preacher_curl_with_cable' => 28,
3257 'reverse_ez_bar_curl' => 29,
3258 'reverse_grip_wrist_curl' => 30,
3259 'reverse_grip_barbell_biceps_curl' => 31,
3260 'seated_alternating_dumbbell_biceps_curl' => 32,
3261 'seated_dumbbell_biceps_curl' => 33,
3262 'seated_reverse_dumbbell_curl' => 34,
3263 'split_stance_offset_pinky_dumbbell_curl' => 35,
3264 'standing_alternating_dumbbell_curls' => 36,
3265 'standing_dumbbell_biceps_curl' => 37,
3266 'standing_ez_bar_biceps_curl' => 38,
3267 'static_curl' => 39,
3268 'swiss_ball_dumbbell_overhead_triceps_extension' => 40,
3269 'swiss_ball_ez_bar_preacher_curl' => 41,
3270 'twisting_standing_dumbbell_biceps_curl' => 42,
3271 'wide_grip_ez_bar_biceps_curl' => 43,
3272 },
3273  
3274 'deadlift_exercise_name' => +{
3275 '_base_type' => FIT_UINT16,
3276 'barbell_deadlift' => 0,
3277 'barbell_straight_leg_deadlift' => 1,
3278 'dumbbell_deadlift' => 2,
3279 'dumbbell_single_leg_deadlift_to_row' => 3,
3280 'dumbbell_straight_leg_deadlift' => 4,
3281 'kettlebell_floor_to_shelf' => 5,
3282 'one_arm_one_leg_deadlift' => 6,
3283 'rack_pull' => 7,
3284 'rotational_dumbbell_straight_leg_deadlift' => 8,
3285 'single_arm_deadlift' => 9,
3286 'single_leg_barbell_deadlift' => 10,
3287 'single_leg_barbell_straight_leg_deadlift' => 11,
3288 'single_leg_deadlift_with_barbell' => 12,
3289 'single_leg_rdl_circuit' => 13,
3290 'single_leg_romanian_deadlift_with_dumbbell' => 14,
3291 'sumo_deadlift' => 15,
3292 'sumo_deadlift_high_pull' => 16,
3293 'trap_bar_deadlift' => 17,
3294 'wide_grip_barbell_deadlift' => 18,
3295 },
3296  
3297 'flye_exercise_name' => +{
3298 '_base_type' => FIT_UINT16,
3299 'cable_crossover' => 0,
3300 'decline_dumbbell_flye' => 1,
3301 'dumbbell_flye' => 2,
3302 'incline_dumbbell_flye' => 3,
3303 'kettlebell_flye' => 4,
3304 'kneeling_rear_flye' => 5,
3305 'single_arm_standing_cable_reverse_flye' => 6,
3306 'swiss_ball_dumbbell_flye' => 7,
3307 'arm_rotations' => 8,
3308 'hug_a_tree' => 9,
3309 },
3310  
3311 'hip_raise_exercise_name' => +{
3312 '_base_type' => FIT_UINT16,
3313 'barbell_hip_thrust_on_floor' => 0,
3314 'barbell_hip_thrust_with_bench' => 1,
3315 'bent_knee_swiss_ball_reverse_hip_raise' => 2,
3316 'weighted_bent_knee_swiss_ball_reverse_hip_raise' => 3,
3317 'bridge_with_leg_extension' => 4,
3318 'weighted_bridge_with_leg_extension' => 5,
3319 'clam_bridge' => 6,
3320 'front_kick_tabletop' => 7,
3321 'weighted_front_kick_tabletop' => 8,
3322 'hip_extension_and_cross' => 9,
3323 'weighted_hip_extension_and_cross' => 10,
3324 'hip_raise' => 11,
3325 'weighted_hip_raise' => 12,
3326 'hip_raise_with_feet_on_swiss_ball' => 13,
3327 'weighted_hip_raise_with_feet_on_swiss_ball' => 14,
3328 'hip_raise_with_head_on_bosu_ball' => 15,
3329 'weighted_hip_raise_with_head_on_bosu_ball' => 16,
3330 'hip_raise_with_head_on_swiss_ball' => 17,
3331 'weighted_hip_raise_with_head_on_swiss_ball' => 18,
3332 'hip_raise_with_knee_squeeze' => 19,
3333 'weighted_hip_raise_with_knee_squeeze' => 20,
3334 'incline_rear_leg_extension' => 21,
3335 'weighted_incline_rear_leg_extension' => 22,
3336 'kettlebell_swing' => 23,
3337 'marching_hip_raise' => 24,
3338 'weighted_marching_hip_raise' => 25,
3339 'marching_hip_raise_with_feet_on_a_swiss_ball' => 26,
3340 'weighted_marching_hip_raise_with_feet_on_a_swiss_ball' => 27,
3341 'reverse_hip_raise' => 28,
3342 'weighted_reverse_hip_raise' => 29,
3343 'single_leg_hip_raise' => 30,
3344 'weighted_single_leg_hip_raise' => 31,
3345 'single_leg_hip_raise_with_foot_on_bench' => 32,
3346 'weighted_single_leg_hip_raise_with_foot_on_bench' => 33,
3347 'single_leg_hip_raise_with_foot_on_bosu_ball' => 34,
3348 'weighted_single_leg_hip_raise_with_foot_on_bosu_ball' => 35,
3349 'single_leg_hip_raise_with_foot_on_foam_roller' => 36,
3350 'weighted_single_leg_hip_raise_with_foot_on_foam_roller' => 37,
3351 'single_leg_hip_raise_with_foot_on_medicine_ball' => 38,
3352 'weighted_single_leg_hip_raise_with_foot_on_medicine_ball' => 39,
3353 'single_leg_hip_raise_with_head_on_bosu_ball' => 40,
3354 'weighted_single_leg_hip_raise_with_head_on_bosu_ball' => 41,
3355 'weighted_clam_bridge' => 42,
3356 'single_leg_swiss_ball_hip_raise_and_leg_curl' => 43,
3357 'clams' => 44,
3358 'inner_thigh_circles' => 45, # Deprecated do not use
3359 'inner_thigh_side_lift' => 46, # Deprecated do not use
3360 'leg_circles' => 47,
3361 'leg_lift' => 48,
3362 'leg_lift_in_external_rotation' => 49,
3363 },
3364  
3365 'hip_stability_exercise_name' => +{
3366 '_base_type' => FIT_UINT16,
3367 'band_side_lying_leg_raise' => 0,
3368 'dead_bug' => 1,
3369 'weighted_dead_bug' => 2,
3370 'external_hip_raise' => 3,
3371 'weighted_external_hip_raise' => 4,
3372 'fire_hydrant_kicks' => 5,
3373 'weighted_fire_hydrant_kicks' => 6,
3374 'hip_circles' => 7,
3375 'weighted_hip_circles' => 8,
3376 'inner_thigh_lift' => 9,
3377 'weighted_inner_thigh_lift' => 10,
3378 'lateral_walks_with_band_at_ankles' => 11,
3379 'pretzel_side_kick' => 12,
3380 'weighted_pretzel_side_kick' => 13,
3381 'prone_hip_internal_rotation' => 14,
3382 'weighted_prone_hip_internal_rotation' => 15,
3383 'quadruped' => 16,
3384 'quadruped_hip_extension' => 17,
3385 'weighted_quadruped_hip_extension' => 18,
3386 'quadruped_with_leg_lift' => 19,
3387 'weighted_quadruped_with_leg_lift' => 20,
3388 'side_lying_leg_raise' => 21,
3389 'weighted_side_lying_leg_raise' => 22,
3390 'sliding_hip_adduction' => 23,
3391 'weighted_sliding_hip_adduction' => 24,
3392 'standing_adduction' => 25,
3393 'weighted_standing_adduction' => 26,
3394 'standing_cable_hip_abduction' => 27,
3395 'standing_hip_abduction' => 28,
3396 'weighted_standing_hip_abduction' => 29,
3397 'standing_rear_leg_raise' => 30,
3398 'weighted_standing_rear_leg_raise' => 31,
3399 'supine_hip_internal_rotation' => 32,
3400 'weighted_supine_hip_internal_rotation' => 33,
3401 },
3402  
3403 'hip_swing_exercise_name' => +{
3404 '_base_type' => FIT_UINT16,
3405 'single_arm_kettlebell_swing' => 0,
3406 'single_arm_dumbbell_swing' => 1,
3407 'step_out_swing' => 2,
3408 },
3409  
3410 'hyperextension_exercise_name' => +{
3411 '_base_type' => FIT_UINT16,
3412 'back_extension_with_opposite_arm_and_leg_reach' => 0,
3413 'weighted_back_extension_with_opposite_arm_and_leg_reach' => 1,
3414 'base_rotations' => 2,
3415 'weighted_base_rotations' => 3,
3416 'bent_knee_reverse_hyperextension' => 4,
3417 'weighted_bent_knee_reverse_hyperextension' => 5,
3418 'hollow_hold_and_roll' => 6,
3419 'weighted_hollow_hold_and_roll' => 7,
3420 'kicks' => 8,
3421 'weighted_kicks' => 9,
3422 'knee_raises' => 10,
3423 'weighted_knee_raises' => 11,
3424 'kneeling_superman' => 12,
3425 'weighted_kneeling_superman' => 13,
3426 'lat_pull_down_with_row' => 14,
3427 'medicine_ball_deadlift_to_reach' => 15,
3428 'one_arm_one_leg_row' => 16,
3429 'one_arm_row_with_band' => 17,
3430 'overhead_lunge_with_medicine_ball' => 18,
3431 'plank_knee_tucks' => 19,
3432 'weighted_plank_knee_tucks' => 20,
3433 'side_step' => 21,
3434 'weighted_side_step' => 22,
3435 'single_leg_back_extension' => 23,
3436 'weighted_single_leg_back_extension' => 24,
3437 'spine_extension' => 25,
3438 'weighted_spine_extension' => 26,
3439 'static_back_extension' => 27,
3440 'weighted_static_back_extension' => 28,
3441 'superman_from_floor' => 29,
3442 'weighted_superman_from_floor' => 30,
3443 'swiss_ball_back_extension' => 31,
3444 'weighted_swiss_ball_back_extension' => 32,
3445 'swiss_ball_hyperextension' => 33,
3446 'weighted_swiss_ball_hyperextension' => 34,
3447 'swiss_ball_opposite_arm_and_leg_lift' => 35,
3448 'weighted_swiss_ball_opposite_arm_and_leg_lift' => 36,
3449 'superman_on_swiss_ball' => 37,
3450 'cobra' => 38,
3451 'supine_floor_barre' => 39, # Deprecated do not use
3452 },
3453  
3454 'lateral_raise_exercise_name' => +{
3455 '_base_type' => FIT_UINT16,
3456 '45_degree_cable_external_rotation' => 0,
3457 'alternating_lateral_raise_with_static_hold' => 1,
3458 'bar_muscle_up' => 2,
3459 'bent_over_lateral_raise' => 3,
3460 'cable_diagonal_raise' => 4,
3461 'cable_front_raise' => 5,
3462 'calorie_row' => 6,
3463 'combo_shoulder_raise' => 7,
3464 'dumbbell_diagonal_raise' => 8,
3465 'dumbbell_v_raise' => 9,
3466 'front_raise' => 10,
3467 'leaning_dumbbell_lateral_raise' => 11,
3468 'lying_dumbbell_raise' => 12,
3469 'muscle_up' => 13,
3470 'one_arm_cable_lateral_raise' => 14,
3471 'overhand_grip_rear_lateral_raise' => 15,
3472 'plate_raises' => 16,
3473 'ring_dip' => 17,
3474 'weighted_ring_dip' => 18,
3475 'ring_muscle_up' => 19,
3476 'weighted_ring_muscle_up' => 20,
3477 'rope_climb' => 21,
3478 'weighted_rope_climb' => 22,
3479 'scaption' => 23,
3480 'seated_lateral_raise' => 24,
3481 'seated_rear_lateral_raise' => 25,
3482 'side_lying_lateral_raise' => 26,
3483 'standing_lift' => 27,
3484 'suspended_row' => 28,
3485 'underhand_grip_rear_lateral_raise' => 29,
3486 'wall_slide' => 30,
3487 'weighted_wall_slide' => 31,
3488 'arm_circles' => 32,
3489 'shaving_the_head' => 33,
3490 },
3491  
3492 'leg_curl_exercise_name' => +{
3493 '_base_type' => FIT_UINT16,
3494 'leg_curl' => 0,
3495 'weighted_leg_curl' => 1,
3496 'good_morning' => 2,
3497 'seated_barbell_good_morning' => 3,
3498 'single_leg_barbell_good_morning' => 4,
3499 'single_leg_sliding_leg_curl' => 5,
3500 'sliding_leg_curl' => 6,
3501 'split_barbell_good_morning' => 7,
3502 'split_stance_extension' => 8,
3503 'staggered_stance_good_morning' => 9,
3504 'swiss_ball_hip_raise_and_leg_curl' => 10,
3505 'zercher_good_morning' => 11,
3506 },
3507  
3508 'leg_raise_exercise_name' => +{
3509 '_base_type' => FIT_UINT16,
3510 'hanging_knee_raise' => 0,
3511 'hanging_leg_raise' => 1,
3512 'weighted_hanging_leg_raise' => 2,
3513 'hanging_single_leg_raise' => 3,
3514 'weighted_hanging_single_leg_raise' => 4,
3515 'kettlebell_leg_raises' => 5,
3516 'leg_lowering_drill' => 6,
3517 'weighted_leg_lowering_drill' => 7,
3518 'lying_straight_leg_raise' => 8,
3519 'weighted_lying_straight_leg_raise' => 9,
3520 'medicine_ball_leg_drops' => 10,
3521 'quadruped_leg_raise' => 11,
3522 'weighted_quadruped_leg_raise' => 12,
3523 'reverse_leg_raise' => 13,
3524 'weighted_reverse_leg_raise' => 14,
3525 'reverse_leg_raise_on_swiss_ball' => 15,
3526 'weighted_reverse_leg_raise_on_swiss_ball' => 16,
3527 'single_leg_lowering_drill' => 17,
3528 'weighted_single_leg_lowering_drill' => 18,
3529 'weighted_hanging_knee_raise' => 19,
3530 'lateral_stepover' => 20,
3531 'weighted_lateral_stepover' => 21,
3532 },
3533  
3534 'lunge_exercise_name' => +{
3535 '_base_type' => FIT_UINT16,
3536 'overhead_lunge' => 0,
3537 'lunge_matrix' => 1,
3538 'weighted_lunge_matrix' => 2,
3539 'alternating_barbell_forward_lunge' => 3,
3540 'alternating_dumbbell_lunge_with_reach' => 4,
3541 'back_foot_elevated_dumbbell_split_squat' => 5,
3542 'barbell_box_lunge' => 6,
3543 'barbell_bulgarian_split_squat' => 7,
3544 'barbell_crossover_lunge' => 8,
3545 'barbell_front_split_squat' => 9,
3546 'barbell_lunge' => 10,
3547 'barbell_reverse_lunge' => 11,
3548 'barbell_side_lunge' => 12,
3549 'barbell_split_squat' => 13,
3550 'core_control_rear_lunge' => 14,
3551 'diagonal_lunge' => 15,
3552 'drop_lunge' => 16,
3553 'dumbbell_box_lunge' => 17,
3554 'dumbbell_bulgarian_split_squat' => 18,
3555 'dumbbell_crossover_lunge' => 19,
3556 'dumbbell_diagonal_lunge' => 20,
3557 'dumbbell_lunge' => 21,
3558 'dumbbell_lunge_and_rotation' => 22,
3559 'dumbbell_overhead_bulgarian_split_squat' => 23,
3560 'dumbbell_reverse_lunge_to_high_knee_and_press' => 24,
3561 'dumbbell_side_lunge' => 25,
3562 'elevated_front_foot_barbell_split_squat' => 26,
3563 'front_foot_elevated_dumbbell_split_squat' => 27,
3564 'gunslinger_lunge' => 28,
3565 'lawnmower_lunge' => 29,
3566 'low_lunge_with_isometric_adduction' => 30,
3567 'low_side_to_side_lunge' => 31,
3568 'lunge' => 32,
3569 'weighted_lunge' => 33,
3570 'lunge_with_arm_reach' => 34,
3571 'lunge_with_diagonal_reach' => 35,
3572 'lunge_with_side_bend' => 36,
3573 'offset_dumbbell_lunge' => 37,
3574 'offset_dumbbell_reverse_lunge' => 38,
3575 'overhead_bulgarian_split_squat' => 39,
3576 'overhead_dumbbell_reverse_lunge' => 40,
3577 'overhead_dumbbell_split_squat' => 41,
3578 'overhead_lunge_with_rotation' => 42,
3579 'reverse_barbell_box_lunge' => 43,
3580 'reverse_box_lunge' => 44,
3581 'reverse_dumbbell_box_lunge' => 45,
3582 'reverse_dumbbell_crossover_lunge' => 46,
3583 'reverse_dumbbell_diagonal_lunge' => 47,
3584 'reverse_lunge_with_reach_back' => 48,
3585 'weighted_reverse_lunge_with_reach_back' => 49,
3586 'reverse_lunge_with_twist_and_overhead_reach' => 50,
3587 'weighted_reverse_lunge_with_twist_and_overhead_reach' => 51,
3588 'reverse_sliding_box_lunge' => 52,
3589 'weighted_reverse_sliding_box_lunge' => 53,
3590 'reverse_sliding_lunge' => 54,
3591 'weighted_reverse_sliding_lunge' => 55,
3592 'runners_lunge_to_balance' => 56,
3593 'weighted_runners_lunge_to_balance' => 57,
3594 'shifting_side_lunge' => 58,
3595 'side_and_crossover_lunge' => 59,
3596 'weighted_side_and_crossover_lunge' => 60,
3597 'side_lunge' => 61,
3598 'weighted_side_lunge' => 62,
3599 'side_lunge_and_press' => 63,
3600 'side_lunge_jump_off' => 64,
3601 'side_lunge_sweep' => 65,
3602 'weighted_side_lunge_sweep' => 66,
3603 'side_lunge_to_crossover_tap' => 67,
3604 'weighted_side_lunge_to_crossover_tap' => 68,
3605 'side_to_side_lunge_chops' => 69,
3606 'weighted_side_to_side_lunge_chops' => 70,
3607 'siff_jump_lunge' => 71,
3608 'weighted_siff_jump_lunge' => 72,
3609 'single_arm_reverse_lunge_and_press' => 73,
3610 'sliding_lateral_lunge' => 74,
3611 'weighted_sliding_lateral_lunge' => 75,
3612 'walking_barbell_lunge' => 76,
3613 'walking_dumbbell_lunge' => 77,
3614 'walking_lunge' => 78,
3615 'weighted_walking_lunge' => 79,
3616 'wide_grip_overhead_barbell_split_squat' => 80,
3617 },
3618  
3619 'olympic_lift_exercise_name' => +{
3620 '_base_type' => FIT_UINT16,
3621 'barbell_hang_power_clean' => 0,
3622 'barbell_hang_squat_clean' => 1,
3623 'barbell_power_clean' => 2,
3624 'barbell_power_snatch' => 3,
3625 'barbell_squat_clean' => 4,
3626 'clean_and_jerk' => 5,
3627 'barbell_hang_power_snatch' => 6,
3628 'barbell_hang_pull' => 7,
3629 'barbell_high_pull' => 8,
3630 'barbell_snatch' => 9,
3631 'barbell_split_jerk' => 10,
3632 'clean' => 11,
3633 'dumbbell_clean' => 12,
3634 'dumbbell_hang_pull' => 13,
3635 'one_hand_dumbbell_split_snatch' => 14,
3636 'push_jerk' => 15,
3637 'single_arm_dumbbell_snatch' => 16,
3638 'single_arm_hang_snatch' => 17,
3639 'single_arm_kettlebell_snatch' => 18,
3640 'split_jerk' => 19,
3641 'squat_clean_and_jerk' => 20,
3642 },
3643  
3644 'plank_exercise_name' => +{
3645 '_base_type' => FIT_UINT16,
3646 '45_degree_plank' => 0,
3647 'weighted_45_degree_plank' => 1,
3648 '90_degree_static_hold' => 2,
3649 'weighted_90_degree_static_hold' => 3,
3650 'bear_crawl' => 4,
3651 'weighted_bear_crawl' => 5,
3652 'cross_body_mountain_climber' => 6,
3653 'weighted_cross_body_mountain_climber' => 7,
3654 'elbow_plank_pike_jacks' => 8,
3655 'weighted_elbow_plank_pike_jacks' => 9,
3656 'elevated_feet_plank' => 10,
3657 'weighted_elevated_feet_plank' => 11,
3658 'elevator_abs' => 12,
3659 'weighted_elevator_abs' => 13,
3660 'extended_plank' => 14,
3661 'weighted_extended_plank' => 15,
3662 'full_plank_passe_twist' => 16,
3663 'weighted_full_plank_passe_twist' => 17,
3664 'inching_elbow_plank' => 18,
3665 'weighted_inching_elbow_plank' => 19,
3666 'inchworm_to_side_plank' => 20,
3667 'weighted_inchworm_to_side_plank' => 21,
3668 'kneeling_plank' => 22,
3669 'weighted_kneeling_plank' => 23,
3670 'kneeling_side_plank_with_leg_lift' => 24,
3671 'weighted_kneeling_side_plank_with_leg_lift' => 25,
3672 'lateral_roll' => 26,
3673 'weighted_lateral_roll' => 27,
3674 'lying_reverse_plank' => 28,
3675 'weighted_lying_reverse_plank' => 29,
3676 'medicine_ball_mountain_climber' => 30,
3677 'weighted_medicine_ball_mountain_climber' => 31,
3678 'modified_mountain_climber_and_extension' => 32,
3679 'weighted_modified_mountain_climber_and_extension' => 33,
3680 'mountain_climber' => 34,
3681 'weighted_mountain_climber' => 35,
3682 'mountain_climber_on_sliding_discs' => 36,
3683 'weighted_mountain_climber_on_sliding_discs' => 37,
3684 'mountain_climber_with_feet_on_bosu_ball' => 38,
3685 'weighted_mountain_climber_with_feet_on_bosu_ball' => 39,
3686 'mountain_climber_with_hands_on_bench' => 40,
3687 'mountain_climber_with_hands_on_swiss_ball' => 41,
3688 'weighted_mountain_climber_with_hands_on_swiss_ball' => 42,
3689 'plank' => 43,
3690 'plank_jacks_with_feet_on_sliding_discs' => 44,
3691 'weighted_plank_jacks_with_feet_on_sliding_discs' => 45,
3692 'plank_knee_twist' => 46,
3693 'weighted_plank_knee_twist' => 47,
3694 'plank_pike_jumps' => 48,
3695 'weighted_plank_pike_jumps' => 49,
3696 'plank_pikes' => 50,
3697 'weighted_plank_pikes' => 51,
3698 'plank_to_stand_up' => 52,
3699 'weighted_plank_to_stand_up' => 53,
3700 'plank_with_arm_raise' => 54,
3701 'weighted_plank_with_arm_raise' => 55,
3702 'plank_with_knee_to_elbow' => 56,
3703 'weighted_plank_with_knee_to_elbow' => 57,
3704 'plank_with_oblique_crunch' => 58,
3705 'weighted_plank_with_oblique_crunch' => 59,
3706 'plyometric_side_plank' => 60,
3707 'weighted_plyometric_side_plank' => 61,
3708 'rolling_side_plank' => 62,
3709 'weighted_rolling_side_plank' => 63,
3710 'side_kick_plank' => 64,
3711 'weighted_side_kick_plank' => 65,
3712 'side_plank' => 66,
3713 'weighted_side_plank' => 67,
3714 'side_plank_and_row' => 68,
3715 'weighted_side_plank_and_row' => 69,
3716 'side_plank_lift' => 70,
3717 'weighted_side_plank_lift' => 71,
3718 'side_plank_with_elbow_on_bosu_ball' => 72,
3719 'weighted_side_plank_with_elbow_on_bosu_ball' => 73,
3720 'side_plank_with_feet_on_bench' => 74,
3721 'weighted_side_plank_with_feet_on_bench' => 75,
3722 'side_plank_with_knee_circle' => 76,
3723 'weighted_side_plank_with_knee_circle' => 77,
3724 'side_plank_with_knee_tuck' => 78,
3725 'weighted_side_plank_with_knee_tuck' => 79,
3726 'side_plank_with_leg_lift' => 80,
3727 'weighted_side_plank_with_leg_lift' => 81,
3728 'side_plank_with_reach_under' => 82,
3729 'weighted_side_plank_with_reach_under' => 83,
3730 'single_leg_elevated_feet_plank' => 84,
3731 'weighted_single_leg_elevated_feet_plank' => 85,
3732 'single_leg_flex_and_extend' => 86,
3733 'weighted_single_leg_flex_and_extend' => 87,
3734 'single_leg_side_plank' => 88,
3735 'weighted_single_leg_side_plank' => 89,
3736 'spiderman_plank' => 90,
3737 'weighted_spiderman_plank' => 91,
3738 'straight_arm_plank' => 92,
3739 'weighted_straight_arm_plank' => 93,
3740 'straight_arm_plank_with_shoulder_touch' => 94,
3741 'weighted_straight_arm_plank_with_shoulder_touch' => 95,
3742 'swiss_ball_plank' => 96,
3743 'weighted_swiss_ball_plank' => 97,
3744 'swiss_ball_plank_leg_lift' => 98,
3745 'weighted_swiss_ball_plank_leg_lift' => 99,
3746 'swiss_ball_plank_leg_lift_and_hold' => 100,
3747 'swiss_ball_plank_with_feet_on_bench' => 101,
3748 'weighted_swiss_ball_plank_with_feet_on_bench' => 102,
3749 'swiss_ball_prone_jackknife' => 103,
3750 'weighted_swiss_ball_prone_jackknife' => 104,
3751 'swiss_ball_side_plank' => 105,
3752 'weighted_swiss_ball_side_plank' => 106,
3753 'three_way_plank' => 107,
3754 'weighted_three_way_plank' => 108,
3755 'towel_plank_and_knee_in' => 109,
3756 'weighted_towel_plank_and_knee_in' => 110,
3757 't_stabilization' => 111,
3758 'weighted_t_stabilization' => 112,
3759 'turkish_get_up_to_side_plank' => 113,
3760 'weighted_turkish_get_up_to_side_plank' => 114,
3761 'two_point_plank' => 115,
3762 'weighted_two_point_plank' => 116,
3763 'weighted_plank' => 117,
3764 'wide_stance_plank_with_diagonal_arm_lift' => 118,
3765 'weighted_wide_stance_plank_with_diagonal_arm_lift' => 119,
3766 'wide_stance_plank_with_diagonal_leg_lift' => 120,
3767 'weighted_wide_stance_plank_with_diagonal_leg_lift' => 121,
3768 'wide_stance_plank_with_leg_lift' => 122,
3769 'weighted_wide_stance_plank_with_leg_lift' => 123,
3770 'wide_stance_plank_with_opposite_arm_and_leg_lift' => 124,
3771 'weighted_mountain_climber_with_hands_on_bench' => 125,
3772 'weighted_swiss_ball_plank_leg_lift_and_hold' => 126,
3773 'weighted_wide_stance_plank_with_opposite_arm_and_leg_lift' => 127,
3774 'plank_with_feet_on_swiss_ball' => 128,
3775 'side_plank_to_plank_with_reach_under' => 129,
3776 'bridge_with_glute_lower_lift' => 130,
3777 'bridge_one_leg_bridge' => 131,
3778 'plank_with_arm_variations' => 132,
3779 'plank_with_leg_lift' => 133,
3780 'reverse_plank_with_leg_pull' => 134,
3781 },
3782  
3783 'plyo_exercise_name' => +{
3784 '_base_type' => FIT_UINT16,
3785 'alternating_jump_lunge' => 0,
3786 'weighted_alternating_jump_lunge' => 1,
3787 'barbell_jump_squat' => 2,
3788 'body_weight_jump_squat' => 3,
3789 'weighted_jump_squat' => 4,
3790 'cross_knee_strike' => 5,
3791 'weighted_cross_knee_strike' => 6,
3792 'depth_jump' => 7,
3793 'weighted_depth_jump' => 8,
3794 'dumbbell_jump_squat' => 9,
3795 'dumbbell_split_jump' => 10,
3796 'front_knee_strike' => 11,
3797 'weighted_front_knee_strike' => 12,
3798 'high_box_jump' => 13,
3799 'weighted_high_box_jump' => 14,
3800 'isometric_explosive_body_weight_jump_squat' => 15,
3801 'weighted_isometric_explosive_jump_squat' => 16,
3802 'lateral_leap_and_hop' => 17,
3803 'weighted_lateral_leap_and_hop' => 18,
3804 'lateral_plyo_squats' => 19,
3805 'weighted_lateral_plyo_squats' => 20,
3806 'lateral_slide' => 21,
3807 'weighted_lateral_slide' => 22,
3808 'medicine_ball_overhead_throws' => 23,
3809 'medicine_ball_side_throw' => 24,
3810 'medicine_ball_slam' => 25,
3811 'side_to_side_medicine_ball_throws' => 26,
3812 'side_to_side_shuffle_jump' => 27,
3813 'weighted_side_to_side_shuffle_jump' => 28,
3814 'squat_jump_onto_box' => 29,
3815 'weighted_squat_jump_onto_box' => 30,
3816 'squat_jumps_in_and_out' => 31,
3817 'weighted_squat_jumps_in_and_out' => 32,
3818 },
3819  
3820 'pull_up_exercise_name' => +{
3821 '_base_type' => FIT_UINT16,
3822 'banded_pull_ups' => 0,
3823 '30_degree_lat_pulldown' => 1,
3824 'band_assisted_chin_up' => 2,
3825 'close_grip_chin_up' => 3,
3826 'weighted_close_grip_chin_up' => 4,
3827 'close_grip_lat_pulldown' => 5,
3828 'crossover_chin_up' => 6,
3829 'weighted_crossover_chin_up' => 7,
3830 'ez_bar_pullover' => 8,
3831 'hanging_hurdle' => 9,
3832 'weighted_hanging_hurdle' => 10,
3833 'kneeling_lat_pulldown' => 11,
3834 'kneeling_underhand_grip_lat_pulldown' => 12,
3835 'lat_pulldown' => 13,
3836 'mixed_grip_chin_up' => 14,
3837 'weighted_mixed_grip_chin_up' => 15,
3838 'mixed_grip_pull_up' => 16,
3839 'weighted_mixed_grip_pull_up' => 17,
3840 'reverse_grip_pulldown' => 18,
3841 'standing_cable_pullover' => 19,
3842 'straight_arm_pulldown' => 20,
3843 'swiss_ball_ez_bar_pullover' => 21,
3844 'towel_pull_up' => 22,
3845 'weighted_towel_pull_up' => 23,
3846 'weighted_pull_up' => 24,
3847 'wide_grip_lat_pulldown' => 25,
3848 'wide_grip_pull_up' => 26,
3849 'weighted_wide_grip_pull_up' => 27,
3850 'burpee_pull_up' => 28,
3851 'weighted_burpee_pull_up' => 29,
3852 'jumping_pull_ups' => 30,
3853 'weighted_jumping_pull_ups' => 31,
3854 'kipping_pull_up' => 32,
3855 'weighted_kipping_pull_up' => 33,
3856 'l_pull_up' => 34,
3857 'weighted_l_pull_up' => 35,
3858 'suspended_chin_up' => 36,
3859 'weighted_suspended_chin_up' => 37,
3860 'pull_up' => 38,
3861 },
3862  
3863 'push_up_exercise_name' => +{
3864 '_base_type' => FIT_UINT16,
3865 'chest_press_with_band' => 0,
3866 'alternating_staggered_push_up' => 1,
3867 'weighted_alternating_staggered_push_up' => 2,
3868 'alternating_hands_medicine_ball_push_up' => 3,
3869 'weighted_alternating_hands_medicine_ball_push_up' => 4,
3870 'bosu_ball_push_up' => 5,
3871 'weighted_bosu_ball_push_up' => 6,
3872 'clapping_push_up' => 7,
3873 'weighted_clapping_push_up' => 8,
3874 'close_grip_medicine_ball_push_up' => 9,
3875 'weighted_close_grip_medicine_ball_push_up' => 10,
3876 'close_hands_push_up' => 11,
3877 'weighted_close_hands_push_up' => 12,
3878 'decline_push_up' => 13,
3879 'weighted_decline_push_up' => 14,
3880 'diamond_push_up' => 15,
3881 'weighted_diamond_push_up' => 16,
3882 'explosive_crossover_push_up' => 17,
3883 'weighted_explosive_crossover_push_up' => 18,
3884 'explosive_push_up' => 19,
3885 'weighted_explosive_push_up' => 20,
3886 'feet_elevated_side_to_side_push_up' => 21,
3887 'weighted_feet_elevated_side_to_side_push_up' => 22,
3888 'hand_release_push_up' => 23,
3889 'weighted_hand_release_push_up' => 24,
3890 'handstand_push_up' => 25,
3891 'weighted_handstand_push_up' => 26,
3892 'incline_push_up' => 27,
3893 'weighted_incline_push_up' => 28,
3894 'isometric_explosive_push_up' => 29,
3895 'weighted_isometric_explosive_push_up' => 30,
3896 'judo_push_up' => 31,
3897 'weighted_judo_push_up' => 32,
3898 'kneeling_push_up' => 33,
3899 'weighted_kneeling_push_up' => 34,
3900 'medicine_ball_chest_pass' => 35,
3901 'medicine_ball_push_up' => 36,
3902 'weighted_medicine_ball_push_up' => 37,
3903 'one_arm_push_up' => 38,
3904 'weighted_one_arm_push_up' => 39,
3905 'weighted_push_up' => 40,
3906 'push_up_and_row' => 41,
3907 'weighted_push_up_and_row' => 42,
3908 'push_up_plus' => 43,
3909 'weighted_push_up_plus' => 44,
3910 'push_up_with_feet_on_swiss_ball' => 45,
3911 'weighted_push_up_with_feet_on_swiss_ball' => 46,
3912 'push_up_with_one_hand_on_medicine_ball' => 47,
3913 'weighted_push_up_with_one_hand_on_medicine_ball' => 48,
3914 'shoulder_push_up' => 49,
3915 'weighted_shoulder_push_up' => 50,
3916 'single_arm_medicine_ball_push_up' => 51,
3917 'weighted_single_arm_medicine_ball_push_up' => 52,
3918 'spiderman_push_up' => 53,
3919 'weighted_spiderman_push_up' => 54,
3920 'stacked_feet_push_up' => 55,
3921 'weighted_stacked_feet_push_up' => 56,
3922 'staggered_hands_push_up' => 57,
3923 'weighted_staggered_hands_push_up' => 58,
3924 'suspended_push_up' => 59,
3925 'weighted_suspended_push_up' => 60,
3926 'swiss_ball_push_up' => 61,
3927 'weighted_swiss_ball_push_up' => 62,
3928 'swiss_ball_push_up_plus' => 63,
3929 'weighted_swiss_ball_push_up_plus' => 64,
3930 't_push_up' => 65,
3931 'weighted_t_push_up' => 66,
3932 'triple_stop_push_up' => 67,
3933 'weighted_triple_stop_push_up' => 68,
3934 'wide_hands_push_up' => 69,
3935 'weighted_wide_hands_push_up' => 70,
3936 'parallette_handstand_push_up' => 71,
3937 'weighted_parallette_handstand_push_up' => 72,
3938 'ring_handstand_push_up' => 73,
3939 'weighted_ring_handstand_push_up' => 74,
3940 'ring_push_up' => 75,
3941 'weighted_ring_push_up' => 76,
3942 'push_up' => 77,
3943 'pilates_pushup' => 78,
3944 },
3945  
3946 'row_exercise_name' => +{
3947 '_base_type' => FIT_UINT16,
3948 'barbell_straight_leg_deadlift_to_row' => 0,
3949 'cable_row_standing' => 1,
3950 'dumbbell_row' => 2,
3951 'elevated_feet_inverted_row' => 3,
3952 'weighted_elevated_feet_inverted_row' => 4,
3953 'face_pull' => 5,
3954 'face_pull_with_external_rotation' => 6,
3955 'inverted_row_with_feet_on_swiss_ball' => 7,
3956 'weighted_inverted_row_with_feet_on_swiss_ball' => 8,
3957 'kettlebell_row' => 9,
3958 'modified_inverted_row' => 10,
3959 'weighted_modified_inverted_row' => 11,
3960 'neutral_grip_alternating_dumbbell_row' => 12,
3961 'one_arm_bent_over_row' => 13,
3962 'one_legged_dumbbell_row' => 14,
3963 'renegade_row' => 15,
3964 'reverse_grip_barbell_row' => 16,
3965 'rope_handle_cable_row' => 17,
3966 'seated_cable_row' => 18,
3967 'seated_dumbbell_row' => 19,
3968 'single_arm_cable_row' => 20,
3969 'single_arm_cable_row_and_rotation' => 21,
3970 'single_arm_inverted_row' => 22,
3971 'weighted_single_arm_inverted_row' => 23,
3972 'single_arm_neutral_grip_dumbbell_row' => 24,
3973 'single_arm_neutral_grip_dumbbell_row_and_rotation' => 25,
3974 'suspended_inverted_row' => 26,
3975 'weighted_suspended_inverted_row' => 27,
3976 't_bar_row' => 28,
3977 'towel_grip_inverted_row' => 29,
3978 'weighted_towel_grip_inverted_row' => 30,
3979 'underhand_grip_cable_row' => 31,
3980 'v_grip_cable_row' => 32,
3981 'wide_grip_seated_cable_row' => 33,
3982 },
3983  
3984 'shoulder_press_exercise_name' => +{
3985 '_base_type' => FIT_UINT16,
3986 'alternating_dumbbell_shoulder_press' => 0,
3987 'arnold_press' => 1,
3988 'barbell_front_squat_to_push_press' => 2,
3989 'barbell_push_press' => 3,
3990 'barbell_shoulder_press' => 4,
3991 'dead_curl_press' => 5,
3992 'dumbbell_alternating_shoulder_press_and_twist' => 6,
3993 'dumbbell_hammer_curl_to_lunge_to_press' => 7,
3994 'dumbbell_push_press' => 8,
3995 'floor_inverted_shoulder_press' => 9,
3996 'weighted_floor_inverted_shoulder_press' => 10,
3997 'inverted_shoulder_press' => 11,
3998 'weighted_inverted_shoulder_press' => 12,
3999 'one_arm_push_press' => 13,
4000 'overhead_barbell_press' => 14,
4001 'overhead_dumbbell_press' => 15,
4002 'seated_barbell_shoulder_press' => 16,
4003 'seated_dumbbell_shoulder_press' => 17,
4004 'single_arm_dumbbell_shoulder_press' => 18,
4005 'single_arm_step_up_and_press' => 19,
4006 'smith_machine_overhead_press' => 20,
4007 'split_stance_hammer_curl_to_press' => 21,
4008 'swiss_ball_dumbbell_shoulder_press' => 22,
4009 'weight_plate_front_raise' => 23,
4010 },
4011  
4012 'shoulder_stability_exercise_name' => +{
4013 '_base_type' => FIT_UINT16,
4014 '90_degree_cable_external_rotation' => 0,
4015 'band_external_rotation' => 1,
4016 'band_internal_rotation' => 2,
4017 'bent_arm_lateral_raise_and_external_rotation' => 3,
4018 'cable_external_rotation' => 4,
4019 'dumbbell_face_pull_with_external_rotation' => 5,
4020 'floor_i_raise' => 6,
4021 'weighted_floor_i_raise' => 7,
4022 'floor_t_raise' => 8,
4023 'weighted_floor_t_raise' => 9,
4024 'floor_y_raise' => 10,
4025 'weighted_floor_y_raise' => 11,
4026 'incline_i_raise' => 12,
4027 'weighted_incline_i_raise' => 13,
4028 'incline_l_raise' => 14,
4029 'weighted_incline_l_raise' => 15,
4030 'incline_t_raise' => 16,
4031 'weighted_incline_t_raise' => 17,
4032 'incline_w_raise' => 18,
4033 'weighted_incline_w_raise' => 19,
4034 'incline_y_raise' => 20,
4035 'weighted_incline_y_raise' => 21,
4036 'lying_external_rotation' => 22,
4037 'seated_dumbbell_external_rotation' => 23,
4038 'standing_l_raise' => 24,
4039 'swiss_ball_i_raise' => 25,
4040 'weighted_swiss_ball_i_raise' => 26,
4041 'swiss_ball_t_raise' => 27,
4042 'weighted_swiss_ball_t_raise' => 28,
4043 'swiss_ball_w_raise' => 29,
4044 'weighted_swiss_ball_w_raise' => 30,
4045 'swiss_ball_y_raise' => 31,
4046 'weighted_swiss_ball_y_raise' => 32,
4047 },
4048  
4049 'shrug_exercise_name' => +{
4050 '_base_type' => FIT_UINT16,
4051 'barbell_jump_shrug' => 0,
4052 'barbell_shrug' => 1,
4053 'barbell_upright_row' => 2,
4054 'behind_the_back_smith_machine_shrug' => 3,
4055 'dumbbell_jump_shrug' => 4,
4056 'dumbbell_shrug' => 5,
4057 'dumbbell_upright_row' => 6,
4058 'incline_dumbbell_shrug' => 7,
4059 'overhead_barbell_shrug' => 8,
4060 'overhead_dumbbell_shrug' => 9,
4061 'scaption_and_shrug' => 10,
4062 'scapular_retraction' => 11,
4063 'serratus_chair_shrug' => 12,
4064 'weighted_serratus_chair_shrug' => 13,
4065 'serratus_shrug' => 14,
4066 'weighted_serratus_shrug' => 15,
4067 'wide_grip_jump_shrug' => 16,
4068 },
4069  
4070 'sit_up_exercise_name' => +{
4071 '_base_type' => FIT_UINT16,
4072 'alternating_sit_up' => 0,
4073 'weighted_alternating_sit_up' => 1,
4074 'bent_knee_v_up' => 2,
4075 'weighted_bent_knee_v_up' => 3,
4076 'butterfly_sit_up' => 4,
4077 'weighted_butterfly_situp' => 5,
4078 'cross_punch_roll_up' => 6,
4079 'weighted_cross_punch_roll_up' => 7,
4080 'crossed_arms_sit_up' => 8,
4081 'weighted_crossed_arms_sit_up' => 9,
4082 'get_up_sit_up' => 10,
4083 'weighted_get_up_sit_up' => 11,
4084 'hovering_sit_up' => 12,
4085 'weighted_hovering_sit_up' => 13,
4086 'kettlebell_sit_up' => 14,
4087 'medicine_ball_alternating_v_up' => 15,
4088 'medicine_ball_sit_up' => 16,
4089 'medicine_ball_v_up' => 17,
4090 'modified_sit_up' => 18,
4091 'negative_sit_up' => 19,
4092 'one_arm_full_sit_up' => 20,
4093 'reclining_circle' => 21,
4094 'weighted_reclining_circle' => 22,
4095 'reverse_curl_up' => 23,
4096 'weighted_reverse_curl_up' => 24,
4097 'single_leg_swiss_ball_jackknife' => 25,
4098 'weighted_single_leg_swiss_ball_jackknife' => 26,
4099 'the_teaser' => 27,
4100 'the_teaser_weighted' => 28,
4101 'three_part_roll_down' => 29,
4102 'weighted_three_part_roll_down' => 30,
4103 'v_up' => 31,
4104 'weighted_v_up' => 32,
4105 'weighted_russian_twist_on_swiss_ball' => 33,
4106 'weighted_sit_up' => 34,
4107 'x_abs' => 35,
4108 'weighted_x_abs' => 36,
4109 'sit_up' => 37,
4110 },
4111  
4112 'squat_exercise_name' => +{
4113 '_base_type' => FIT_UINT16,
4114 'leg_press' => 0,
4115 'back_squat_with_body_bar' => 1,
4116 'back_squats' => 2,
4117 'weighted_back_squats' => 3,
4118 'balancing_squat' => 4,
4119 'weighted_balancing_squat' => 5,
4120 'barbell_back_squat' => 6,
4121 'barbell_box_squat' => 7,
4122 'barbell_front_squat' => 8,
4123 'barbell_hack_squat' => 9,
4124 'barbell_hang_squat_snatch' => 10,
4125 'barbell_lateral_step_up' => 11,
4126 'barbell_quarter_squat' => 12,
4127 'barbell_siff_squat' => 13,
4128 'barbell_squat_snatch' => 14,
4129 'barbell_squat_with_heels_raised' => 15,
4130 'barbell_stepover' => 16,
4131 'barbell_step_up' => 17,
4132 'bench_squat_with_rotational_chop' => 18,
4133 'weighted_bench_squat_with_rotational_chop' => 19,
4134 'body_weight_wall_squat' => 20,
4135 'weighted_wall_squat' => 21,
4136 'box_step_squat' => 22,
4137 'weighted_box_step_squat' => 23,
4138 'braced_squat' => 24,
4139 'crossed_arm_barbell_front_squat' => 25,
4140 'crossover_dumbbell_step_up' => 26,
4141 'dumbbell_front_squat' => 27,
4142 'dumbbell_split_squat' => 28,
4143 'dumbbell_squat' => 29,
4144 'dumbbell_squat_clean' => 30,
4145 'dumbbell_stepover' => 31,
4146 'dumbbell_step_up' => 32,
4147 'elevated_single_leg_squat' => 33,
4148 'weighted_elevated_single_leg_squat' => 34,
4149 'figure_four_squats' => 35,
4150 'weighted_figure_four_squats' => 36,
4151 'goblet_squat' => 37,
4152 'kettlebell_squat' => 38,
4153 'kettlebell_swing_overhead' => 39,
4154 'kettlebell_swing_with_flip_to_squat' => 40,
4155 'lateral_dumbbell_step_up' => 41,
4156 'one_legged_squat' => 42,
4157 'overhead_dumbbell_squat' => 43,
4158 'overhead_squat' => 44,
4159 'partial_single_leg_squat' => 45,
4160 'weighted_partial_single_leg_squat' => 46,
4161 'pistol_squat' => 47,
4162 'weighted_pistol_squat' => 48,
4163 'plie_slides' => 49,
4164 'weighted_plie_slides' => 50,
4165 'plie_squat' => 51,
4166 'weighted_plie_squat' => 52,
4167 'prisoner_squat' => 53,
4168 'weighted_prisoner_squat' => 54,
4169 'single_leg_bench_get_up' => 55,
4170 'weighted_single_leg_bench_get_up' => 56,
4171 'single_leg_bench_squat' => 57,
4172 'weighted_single_leg_bench_squat' => 58,
4173 'single_leg_squat_on_swiss_ball' => 59,
4174 'weighted_single_leg_squat_on_swiss_ball' => 60,
4175 'squat' => 61,
4176 'weighted_squat' => 62,
4177 'squats_with_band' => 63,
4178 'staggered_squat' => 64,
4179 'weighted_staggered_squat' => 65,
4180 'step_up' => 66,
4181 'weighted_step_up' => 67,
4182 'suitcase_squats' => 68,
4183 'sumo_squat' => 69,
4184 'sumo_squat_slide_in' => 70,
4185 'weighted_sumo_squat_slide_in' => 71,
4186 'sumo_squat_to_high_pull' => 72,
4187 'sumo_squat_to_stand' => 73,
4188 'weighted_sumo_squat_to_stand' => 74,
4189 'sumo_squat_with_rotation' => 75,
4190 'weighted_sumo_squat_with_rotation' => 76,
4191 'swiss_ball_body_weight_wall_squat' => 77,
4192 'weighted_swiss_ball_wall_squat' => 78,
4193 'thrusters' => 79,
4194 'uneven_squat' => 80,
4195 'weighted_uneven_squat' => 81,
4196 'waist_slimming_squat' => 82,
4197 'wall_ball' => 83,
4198 'wide_stance_barbell_squat' => 84,
4199 'wide_stance_goblet_squat' => 85,
4200 'zercher_squat' => 86,
4201 'kbs_overhead' => 87, # Deprecated do not use
4202 'squat_and_side_kick' => 88,
4203 'squat_jumps_in_n_out' => 89,
4204 'pilates_plie_squats_parallel_turned_out_flat_and_heels' => 90,
4205 'releve_straight_leg_and_knee_bent_with_one_leg_variation' => 91,
4206 },
4207  
4208 'total_body_exercise_name' => +{
4209 '_base_type' => FIT_UINT16,
4210 'burpee' => 0,
4211 'weighted_burpee' => 1,
4212 'burpee_box_jump' => 2,
4213 'weighted_burpee_box_jump' => 3,
4214 'high_pull_burpee' => 4,
4215 'man_makers' => 5,
4216 'one_arm_burpee' => 6,
4217 'squat_thrusts' => 7,
4218 'weighted_squat_thrusts' => 8,
4219 'squat_plank_push_up' => 9,
4220 'weighted_squat_plank_push_up' => 10,
4221 'standing_t_rotation_balance' => 11,
4222 'weighted_standing_t_rotation_balance' => 12,
4223 },
4224  
4225 'triceps_extension_exercise_name' => +{
4226 '_base_type' => FIT_UINT16,
4227 'bench_dip' => 0,
4228 'weighted_bench_dip' => 1,
4229 'body_weight_dip' => 2,
4230 'cable_kickback' => 3,
4231 'cable_lying_triceps_extension' => 4,
4232 'cable_overhead_triceps_extension' => 5,
4233 'dumbbell_kickback' => 6,
4234 'dumbbell_lying_triceps_extension' => 7,
4235 'ez_bar_overhead_triceps_extension' => 8,
4236 'incline_dip' => 9,
4237 'weighted_incline_dip' => 10,
4238 'incline_ez_bar_lying_triceps_extension' => 11,
4239 'lying_dumbbell_pullover_to_extension' => 12,
4240 'lying_ez_bar_triceps_extension' => 13,
4241 'lying_triceps_extension_to_close_grip_bench_press' => 14,
4242 'overhead_dumbbell_triceps_extension' => 15,
4243 'reclining_triceps_press' => 16,
4244 'reverse_grip_pressdown' => 17,
4245 'reverse_grip_triceps_pressdown' => 18,
4246 'rope_pressdown' => 19,
4247 'seated_barbell_overhead_triceps_extension' => 20,
4248 'seated_dumbbell_overhead_triceps_extension' => 21,
4249 'seated_ez_bar_overhead_triceps_extension' => 22,
4250 'seated_single_arm_overhead_dumbbell_extension' => 23,
4251 'single_arm_dumbbell_overhead_triceps_extension' => 24,
4252 'single_dumbbell_seated_overhead_triceps_extension' => 25,
4253 'single_leg_bench_dip_and_kick' => 26,
4254 'weighted_single_leg_bench_dip_and_kick' => 27,
4255 'single_leg_dip' => 28,
4256 'weighted_single_leg_dip' => 29,
4257 'static_lying_triceps_extension' => 30,
4258 'suspended_dip' => 31,
4259 'weighted_suspended_dip' => 32,
4260 'swiss_ball_dumbbell_lying_triceps_extension' => 33,
4261 'swiss_ball_ez_bar_lying_triceps_extension' => 34,
4262 'swiss_ball_ez_bar_overhead_triceps_extension' => 35,
4263 'tabletop_dip' => 36,
4264 'weighted_tabletop_dip' => 37,
4265 'triceps_extension_on_floor' => 38,
4266 'triceps_pressdown' => 39,
4267 'weighted_dip' => 40,
4268 },
4269  
4270 'warm_up_exercise_name' => +{
4271 '_base_type' => FIT_UINT16,
4272 'quadruped_rocking' => 0,
4273 'neck_tilts' => 1,
4274 'ankle_circles' => 2,
4275 'ankle_dorsiflexion_with_band' => 3,
4276 'ankle_internal_rotation' => 4,
4277 'arm_circles' => 5,
4278 'bent_over_reach_to_sky' => 6,
4279 'cat_camel' => 7,
4280 'elbow_to_foot_lunge' => 8,
4281 'forward_and_backward_leg_swings' => 9,
4282 'groiners' => 10,
4283 'inverted_hamstring_stretch' => 11,
4284 'lateral_duck_under' => 12,
4285 'neck_rotations' => 13,
4286 'opposite_arm_and_leg_balance' => 14,
4287 'reach_roll_and_lift' => 15,
4288 'scorpion' => 16, # Deprecated do not use
4289 'shoulder_circles' => 17,
4290 'side_to_side_leg_swings' => 18,
4291 'sleeper_stretch' => 19,
4292 'slide_out' => 20,
4293 'swiss_ball_hip_crossover' => 21,
4294 'swiss_ball_reach_roll_and_lift' => 22,
4295 'swiss_ball_windshield_wipers' => 23,
4296 'thoracic_rotation' => 24,
4297 'walking_high_kicks' => 25,
4298 'walking_high_knees' => 26,
4299 'walking_knee_hugs' => 27,
4300 'walking_leg_cradles' => 28,
4301 'walkout' => 29,
4302 'walkout_from_push_up_position' => 30,
4303 },
4304  
4305 'run_exercise_name' => +{
4306 '_base_type' => FIT_UINT16,
4307 'run' => 0,
4308 'walk' => 1,
4309 'jog' => 2,
4310 'sprint' => 3,
4311 },
4312  
4313 'water_type' => +{
4314 '_base_type' => FIT_ENUM,
4315 'fresh' => 0,
4316 'salt' => 1,
4317 'en13319' => 2,
4318 'custom' => 3,
4319 },
4320  
4321 'tissue_model_type' => +{
4322 '_base_type' => FIT_ENUM,
4323 'zhl_16c' => 0, # Buhlmann's decompression algorithm, version C
4324 },
4325  
4326 'dive_gas_status' => +{
4327 '_base_type' => FIT_ENUM,
4328 'disabled' => 0,
4329 'enabled' => 1,
4330 'backup_only' => 2,
4331 },
4332  
4333 'dive_alert' => +{
4334 '_base_type' => FIT_ENUM,
4335 'ndl_reached' => 0,
4336 'gas_switch_prompted' => 1,
4337 'near_surface' => 2,
4338 'approaching_ndl' => 3,
4339 'po2_warn' => 4,
4340 'po2_crit_high' => 5,
4341 'po2_crit_low' => 6,
4342 'time_alert' => 7,
4343 'depth_alert' => 8,
4344 'deco_ceiling_broken' => 9,
4345 'deco_complete' => 10,
4346 'safety_stop_broken' => 11,
4347 'safety_stop_complete' => 12,
4348 'cns_warning' => 13,
4349 'cns_critical' => 14,
4350 'otu_warning' => 15,
4351 'otu_critical' => 16,
4352 'ascent_critical' => 17,
4353 'alert_dismissed_by_key' => 18,
4354 'alert_dismissed_by_timeout' => 19,
4355 'battery_low' => 20,
4356 'battery_critical' => 21,
4357 'safety_stop_started' => 22,
4358 'approaching_first_deco_stop' => 23,
4359 'setpoint_switch_auto_low' => 24,
4360 'setpoint_switch_auto_high' => 25,
4361 'setpoint_switch_manual_low' => 26,
4362 'setpoint_switch_manual_high' => 27,
4363 'auto_setpoint_switch_ignored' => 28,
4364 'switched_to_open_circuit' => 29,
4365 'switched_to_closed_circuit' => 30,
4366 'tank_battery_low' => 32,
4367 'po2_ccr_dil_low' => 33, # ccr diluent has low po2
4368 'deco_stop_cleared' => 34, # a deco stop has been cleared
4369 'apnea_neutral_buoyancy' => 35, # Target Depth Apnea Alarm triggered
4370 'apnea_target_depth' => 36, # Neutral Buoyance Apnea Alarm triggered
4371 'apnea_surface' => 37, # Surface Apnea Alarm triggered
4372 'apnea_high_speed' => 38, # High Speed Apnea Alarm triggered
4373 'apnea_low_speed' => 39, # Low Speed Apnea Alarm triggered
4374 },
4375  
4376 'dive_alarm_type' => +{
4377 '_base_type' => FIT_ENUM,
4378 'depth' => 0,
4379 'time' => 1,
4380 'speed' => 2, # Alarm when a certain ascent or descent rate is exceeded
4381 },
4382  
4383 'dive_backlight_mode' => +{
4384 '_base_type' => FIT_ENUM,
4385 'at_depth' => 0,
4386 'always_on' => 1,
4387 },
4388  
4389 'ccr_setpoint_switch_mode' => +{
4390 '_base_type' => FIT_ENUM,
4391 'manual' => 0, # User switches setpoints manually
4392 'automatic' => 1, # Switch automatically based on depth
4393 },
4394  
4395 'dive_gas_mode' => +{
4396 '_base_type' => FIT_ENUM,
4397 'open_circuit' => 0,
4398 'closed_circuit_diluent' => 1,
4399 },
4400  
4401 'favero_product' => +{
4402 '_base_type' => FIT_UINT16,
4403 'assioma_uno' => 10,
4404 'assioma_duo' => 12,
4405 },
4406  
4407 'split_type' => +{
4408 '_base_type' => FIT_ENUM,
4409 'ascent_split' => 1,
4410 'descent_split' => 2,
4411 'interval_active' => 3,
4412 'interval_rest' => 4,
4413 'interval_warmup' => 5,
4414 'interval_cooldown' => 6,
4415 'interval_recovery' => 7,
4416 'interval_other' => 8,
4417 'climb_active' => 9,
4418 'climb_rest' => 10,
4419 'surf_active' => 11,
4420 'run_active' => 12,
4421 'run_rest' => 13,
4422 'workout_round' => 14,
4423 'rwd_run' => 17, # run/walk detection running
4424 'rwd_walk' => 18, # run/walk detection walking
4425 'windsurf_active' => 21,
4426 'rwd_stand' => 22, # run/walk detection standing
4427 'transition' => 23, # Marks the time going from ascent_split to descent_split/used in backcountry ski
4428 'ski_lift_split' => 28,
4429 'ski_run_split' => 29,
4430 },
4431  
4432 'climb_pro_event' => +{
4433 '_base_type' => FIT_ENUM,
4434 'approach' => 0,
4435 'start' => 1,
4436 'complete' => 2,
4437 },
4438  
4439 'gas_consumption_rate_type' => +{
4440 '_base_type' => FIT_ENUM,
4441 'pressure_sac' => 0, # Pressure-based Surface Air Consumption
4442 'volume_sac' => 1, # Volumetric Surface Air Consumption
4443 'rmv' => 2, # Respiratory Minute Volume
4444 },
4445  
4446 'tap_sensitivity' => +{
4447 '_base_type' => FIT_ENUM,
4448 'high' => 0,
4449 'medium' => 1,
4450 'low' => 2,
4451 },
4452  
4453 'radar_threat_level_type' => +{
4454 '_base_type' => FIT_ENUM,
4455 'threat_unknown' => 0,
4456 'threat_none' => 1,
4457 'threat_approaching' => 2,
4458 'threat_approaching_fast' => 3,
4459 },
4460  
4461 'no_fly_time_mode' => +{
4462 '_base_type' => FIT_ENUM,
4463 'standard' => 0, # Standard Diver Alert Network no-fly guidance
4464 'flat_24_hours' => 1, # Flat 24 hour no-fly guidance
4465 },
4466  
4467 );
4468  
4469 16 for my $typenam (keys %named_type) { # if a type was _moved_to, copy the new href to $named_type{$typenam}
4470 2768 my $typedesc = $named_type{$typenam};
4471 2768 ▶ if (defined $typedesc->{_moved_to} and $typedesc->{_moved_to} ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $typedesc->{"_moved_to"} and $typedesc->{"_moved_to"} ne "") 16 2752 2768
Condition66%2/3
defined $typedesc->{"_moved_to"} and $typedesc->{"_moved_to"} ne ""
!ll&&!rl&&r
2752016
MC/DC50%1/2
defined $typedesc->{"_moved_to"} and $typedesc->{"_moved_to"} ne ""
defined $typedesc->{"_moved_to"} $typedesc->{"_moved_to"} ne ""
Truth table66%2/3
A and B
A= defined $typedesc->{"_moved_to"}B= $typedesc->{"_moved_to"} ne ""
ABresult
0X0
100
111
4472 16 ▶ if ($typenam ne 'device_type') { $DB::single=1 } # want to know if it applies to others
Branch: 1 branch
BranchTrueFalseTotal
if ($typenam ne "device_type") 0 16 16
4473 16 my $to = $named_type{$typedesc->{_moved_to}};
4474 16 ▶ $named_type{$typenam} = {%$to} if ref $to eq 'HASH'
Branch: 1 branch
BranchTrueFalseTotal
if ref $to eq "HASH" 16 0 16
4475 }
4476 }
4477 16 ▶while (my ($typenam, $typedesc) = each %named_type) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %named_type) 2768 16 2784
4478 # copy and flip key/value pairs of all hrefs in %named_type (except _base_type, _mask, …)
4479 2768 for my $name (grep {!/^_/} keys %$typedesc) {
4480 56256 $typedesc->{$typedesc->{$name}} = $name
4481 }
4482 }
4483  
4484 16 my %msgtype_by_name = (
4485 'file_id' => +{ # begins === Common messages === section
4486 0 => +{'name' => 'type', 'type_name' => 'file'},
4487 1 => +{'name' => 'manufacturer', 'type_name' => 'manufacturer'},
4488  
4489 2 => +{
4490 'name' => 'product',
4491  
4492 'switch' => +{
4493 '_by' => 'manufacturer',
4494 'garmin' => +{'name' => 'garmin_product', 'type_name' => 'garmin_product'},
4495 'dynastream' => +{'name' => 'garmin_product', 'type_name' => 'garmin_product'},
4496 'dynastream_oem' => +{'name' => 'garmin_product', 'type_name' => 'garmin_product'},
4497 'favero_electronics' => +{'name' => 'favero_product', 'type_name' => 'favero_product'},
4498 'tacx' => +{'name' => 'garmin_product', 'type_name' => 'garmin_product'},
4499 },
4500 },
4501  
4502 3 => +{'name' => 'serial_number'},
4503 4 => +{'name' => 'time_created', 'type_name' => 'date_time'},
4504 5 => +{'name' => 'number'},
4505 7 => +{'name' => 'unknown7'}, # unknown UINT32
4506 8 => +{'name' => 'product_name'},
4507 },
4508  
4509 'file_creator' => +{
4510 0 => +{'name' => 'software_version'},
4511 1 => +{'name' => 'hardware_version'},
4512 },
4513  
4514 'timestamp_correlation' => +{
4515 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
4516 0 => +{'name' => 'fractional_timestamp', 'scale' => 32768, 'unit' => 's'},
4517 1 => +{'name' => 'system_timestamp', 'type_name' => 'date_time'},
4518 2 => +{'name' => 'fractional_system_timestamp', 'scale' => 32768, 'unit' => 's'},
4519 3 => +{'name' => 'local_timestamp', 'type_name' => 'local_date_time'},
4520 4 => +{'name' => 'timestamp_ms', 'unit' => 'ms'},
4521 5 => +{'name' => 'system_timestamp_ms', 'unit' => 'ms'},
4522 },
4523  
4524 'software' => +{ # begins === Device file messages === section
4525 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
4526 3 => +{'name' => 'version', 'scale' => 100},
4527 5 => +{'name' => 'part_number'},
4528 },
4529  
4530 'slave_device' => +{
4531 0 => +{'name' => 'manufacturer', 'type_name' => 'manufacturer'},
4532  
4533 1 => +{
4534 'name' => 'product',
4535  
4536 'switch' => +{
4537 '_by' => 'manufacturer',
4538 'garmin' => +{'name' => 'garmin_product', 'type_name' => 'garmin_product'},
4539 'dynastream' => +{'name' => 'garmin_product', 'type_name' => 'garmin_product'},
4540 'dynastream_oem' => +{'name' => 'garmin_product', 'type_name' => 'garmin_product'},
4541 'favero_electronics' => +{'name' => 'favero_product', 'type_name' => 'favero_product'},
4542 'tacx' => +{'name' => 'garmin_product', 'type_name' => 'garmin_product'},
4543 },
4544 },
4545 },
4546  
4547 'capabilities' => +{
4548 0 => +{'name' => 'languages'},
4549 1 => +{'name' => 'sports', 'type_name' => 'sport_bits_0'},
4550 21 => +{'name' => 'workouts_supported', 'type_name' => 'workout_capabilities'},
4551 22 => +{'name' => 'unknown22'}, # unknown ENUM
4552 23 => +{'name' => 'connectivity_supported', 'type_name' => 'connectivity_capabilities'},
4553 24 => +{'name' => 'unknown24'}, # unknown ENUM
4554 25 => +{'name' => 'unknown25'}, # unknown UINT32Z
4555 },
4556  
4557 'file_capabilities' => +{
4558 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
4559 0 => +{'name' => 'type', 'type_name' => 'file'},
4560 1 => +{'name' => 'flags', 'type_name' => 'file_flags'},
4561 2 => +{'name' => 'directory'},
4562 3 => +{'name' => 'max_count'},
4563 4 => +{'name' => 'max_size', 'unit' => 'bytes'},
4564 },
4565  
4566 'mesg_capabilities' => +{
4567 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
4568 0 => +{'name' => 'file', 'type_name' => 'file'},
4569 1 => +{'name' => 'mesg_num', 'type_name' => 'mesg_num'},
4570 2 => +{'name' => 'count_type', 'type_name' => 'mesg_count'},
4571  
4572 3 => +{
4573 'name' => 'count',
4574  
4575 'switch' => +{
4576 '_by' => 'count_type',
4577 'num_per_file' => +{'name' => 'num_per_file'},
4578 'max_per_file' => +{'name' => 'max_per_file'},
4579 'max_per_file_type' => +{'name' => 'max_per_file_type'},
4580 },
4581 },
4582 },
4583  
4584 'field_capabilities' => +{
4585 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
4586 0 => +{'name' => 'file', 'type_name' => 'file'},
4587 1 => +{'name' => 'mesg_num', 'type_name' => 'mesg_num'},
4588 2 => +{'name' => 'field_num'},
4589 3 => +{'name' => 'count'},
4590 4 => +{'name' => 'bits'}, # not present? PATJOL: I don't see this one in the profile
4591 },
4592  
4593 'device_settings' => +{ # begins === Settings file messages === section
4594 0 => +{'name' => 'active_time_zone'},
4595 1 => +{'name' => 'utc_offset'},
4596 2 => +{'name' => 'time_offset', 'unit' => 's'},
4597 3 => +{'name' => 'unknown3'}, # unknown ENUM
4598 4 => +{'name' => 'time_mode', 'type_name' => 'time_mode'},
4599 5 => +{'name' => 'time_zone_offset', 'scale' => 4, 'unit' => 'hr'},
4600 10 => +{'name' => 'unknown10'}, # unknown ENUM
4601 11 => +{'name' => 'unknown11'}, # unknown ENUM
4602 12 => +{'name' => 'backlight_mode', 'type_name' => 'backlight_mode'},
4603 13 => +{'name' => 'unknown13'}, # unknown UINT8
4604 14 => +{'name' => 'unknown14'}, # unknown UINT8
4605 15 => +{'name' => 'unknown15'}, # unknown UINT8
4606 16 => +{'name' => 'unknown16'}, # unknown ENUM
4607 17 => +{'name' => 'unknown17'}, # unknown ENUM
4608 18 => +{'name' => 'unknown18'}, # unknown ENUM
4609 21 => +{'name' => 'unknown21'}, # unknown ENUM
4610 22 => +{'name' => 'unknown22'}, # unknown ENUM
4611 26 => +{'name' => 'unknown26'}, # unknown ENUM
4612 27 => +{'name' => 'unknown27'}, # unknown ENUM
4613 29 => +{'name' => 'unknown29'}, # unknown ENUM
4614 33 => +{'name' => 'unknown33'}, # unknown UNIT8
4615 36 => +{'name' => 'activity_tracker_enabled', 'type_name' => 'bool'},
4616 38 => +{'name' => 'unknown38'}, # unknown ENUM
4617 39 => +{'name' => 'clock_time', 'type_name' => 'date_time'},
4618 40 => +{'name' => 'pages_enabled'},
4619 41 => +{'name' => 'unknown41'}, # unknown ENUM
4620 46 => +{'name' => 'move_alert_enabled', 'type_name' => 'bool'},
4621 47 => +{'name' => 'date_mode', 'type_name' => 'date_mode'},
4622 48 => +{'name' => 'unknown48'}, # unknown ENUM
4623 49 => +{'name' => 'unknown49'}, # unknown UINT16
4624 52 => +{'name' => 'unknown52'}, # unknown ENUM
4625 53 => +{'name' => 'unknown53'}, # unknown ENUM
4626 54 => +{'name' => 'unknown54'}, # unknown ENUM
4627 55 => +{'name' => 'display_orientation', 'type_name' => 'display_orientation'},
4628 56 => +{'name' => 'mounting_side', 'type_name' => 'side'},
4629 57 => +{'name' => 'default_page'},
4630 58 => +{'name' => 'autosync_min_steps', 'unit' => 'steps'},
4631 59 => +{'name' => 'autosync_min_time', 'unit' => 'minutes'},
4632 75 => +{'name' => 'unknown75'}, # unknown ENUM
4633 80 => +{'name' => 'lactate_threshold_autodetect_enabled', 'type_name' => 'bool'},
4634 85 => +{'name' => 'unknown85'}, # unknown ENUM
4635 86 => +{'name' => 'ble_auto_upload_enabled', 'type_name' => 'bool'},
4636 89 => +{'name' => 'auto_sync_frequency', 'type_name' => 'auto_sync_frequency'},
4637 90 => +{'name' => 'auto_activity_detect', 'type_name' => 'auto_activity_detect'},
4638 94 => +{'name' => 'number_of_screens'},
4639 95 => +{'name' => 'smart_notification_display_orientation', 'type_name' => 'display_orientation'},
4640 97 => +{'name' => 'unknown97'}, # unknown UINT8Z
4641 98 => +{'name' => 'unknown98'}, # unknown ENUM
4642 103 => +{'name' => 'unknown103'}, # unknown ENUM
4643 134 => +{'name' => 'tap_interface', 'type_name' => 'switch'},
4644 174 => +{'name' => 'tap_sensitivity', 'type_name' => 'tap_sensitivity'},
4645 },
4646  
4647 'user_profile' => +{
4648 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
4649 0 => +{'name' => 'friendly_name'},
4650 1 => +{'name' => 'gender', 'type_name' => 'gender'},
4651 2 => +{'name' => 'age', 'unit' => 'years'},
4652 3 => +{'name' => 'height', scale => 100, 'unit' => 'm'},
4653 4 => +{'name' => 'weight', scale => 10, 'unit' => 'kg'},
4654 5 => +{'name' => 'language', 'type_name' => 'language'},
4655 6 => +{'name' => 'elev_setting', 'type_name' => 'display_measure'},
4656 7 => +{'name' => 'weight_setting', 'type_name' => 'display_measure'},
4657 8 => +{'name' => 'resting_heart_rate', 'unit' => 'bpm'},
4658 9 => +{'name' => 'default_max_running_heart_rate', 'unit' => 'bpm'},
4659 10 => +{'name' => 'default_max_biking_heart_rate', 'unit' => 'bpm'},
4660 11 => +{'name' => 'default_max_heart_rate', 'unit' => 'bpm'},
4661 12 => +{'name' => 'hr_setting', 'type_name' => 'display_heart'},
4662 13 => +{'name' => 'speed_setting', 'type_name' => 'display_measure'},
4663 14 => +{'name' => 'dist_setting', 'type_name' => 'display_measure'},
4664 16 => +{'name' => 'power_setting', 'type_name' => 'display_power'},
4665 17 => +{'name' => 'activity_class', 'type_name' => 'activity_class'},
4666 18 => +{'name' => 'position_setting', 'type_name' => 'display_position'},
4667 21 => +{'name' => 'temperature_setting', 'type_name' => 'display_measure'},
4668 22 => +{'name' => 'local_id', 'type_name' => 'user_local_id'},
4669 23 => +{'name' => 'global_id'},
4670 24 => +{'name' => 'unknown24'}, # unknown UINT8
4671 28 => +{'name' => 'wake_time', 'type_name' => 'localtime_into_day'},
4672 29 => +{'name' => 'sleep_time', 'type_name' => 'localtime_into_day'},
4673 30 => +{'name' => 'height_setting', 'type_name' => 'display_measure'},
4674 31 => +{'name' => 'user_running_step_length', scale => 1000, 'unit' => 'm'},
4675 32 => +{'name' => 'user_walking_step_length', scale => 1000, 'unit' => 'm'},
4676 33 => +{'name' => 'unknown33'}, # unknown UINT16
4677 34 => +{'name' => 'unknown34'}, # unknown UINT16
4678 35 => +{'name' => 'unknown35'}, # unknown UINT32
4679 36 => +{'name' => 'unknown36'}, # unknown UINT8
4680 38 => +{'name' => 'unknown38'}, # unknown UINT16
4681 40 => +{'name' => 'unknown40'}, # unknown FLOAT32
4682 42 => +{'name' => 'unknown42'}, # unknown UINT32
4683 47 => +{'name' => 'depth_setting', 'type_name' => 'display_measure'},
4684 49 => +{'name' => 'dive_count'},
4685 },
4686  
4687 'hrm_profile' => +{
4688 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
4689 0 => +{'name' => 'enabled', 'type_name' => 'bool'},
4690 1 => +{'name' => 'hrm_ant_id'},
4691 2 => +{'name' => 'log_hrv', 'type_name' => 'bool'},
4692 3 => +{'name' => 'hrm_ant_id_trans_type'},
4693 },
4694  
4695 'sdm_profile' => +{
4696 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
4697 0 => +{'name' => 'enabled', 'type_name' => 'bool'},
4698 1 => +{'name' => 'sdm_ant_id'},
4699 2 => +{'name' => 'sdm_cal_factor', 'scale' => 10, 'unit' => '%'},
4700 3 => +{'name' => 'odometer', 'scale' => 100, 'unit' => 'm'},
4701 4 => +{'name' => 'speed_source', 'type_name' => 'bool'},
4702 5 => +{'name' => 'sdm_ant_id_trans_type'},
4703 7 => +{'name' => 'odometer_rollover'},
4704 },
4705  
4706 'bike_profile' => +{
4707 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
4708 0 => +{'name' => 'name'},
4709 1 => +{'name' => 'sport', 'type_name' => 'sport'},
4710 2 => +{'name' => 'sub_sport', 'type_name' => 'sub_sport'},
4711 3 => +{'name' => 'odometer', 'scale' => 100, 'unit' => 'm'},
4712 4 => +{'name' => 'bike_spd_ant_id'},
4713 5 => +{'name' => 'bike_cad_ant_id'},
4714 6 => +{'name' => 'bike_spdcad_ant_id'},
4715 7 => +{'name' => 'bike_power_ant_id'},
4716 8 => +{'name' => 'custom_wheelsize', 'scale' => 1000, 'unit' => 'm'},
4717 9 => +{'name' => 'auto_wheelsize', 'scale' => 1000, 'unit' => 'm'},
4718 10 => +{'name' => 'bike_weight', 'scale' => 10, 'unit' => 'kg'},
4719 11 => +{'name' => 'power_cal_factor', 'scale' => 10, 'unit' => '%'},
4720 12 => +{'name' => 'auto_wheel_cal', 'type_name' => 'bool'},
4721 13 => +{'name' => 'auto_power_zero', 'type_name' => 'bool'},
4722 14 => +{'name' => 'id'},
4723 15 => +{'name' => 'spd_enabled', 'type_name' => 'bool'},
4724 16 => +{'name' => 'cad_enabled', 'type_name' => 'bool'},
4725 17 => +{'name' => 'spdcad_enabled', 'type_name' => 'bool'},
4726 18 => +{'name' => 'power_enabled', 'type_name' => 'bool'},
4727 19 => +{'name' => 'crank_length', 'scale' => 2, 'offset' => -110, 'unit' => 'mm'},
4728 20 => +{'name' => 'enabled', 'type_name' => 'bool'},
4729 21 => +{'name' => 'bike_spd_ant_id_trans_type'},
4730 22 => +{'name' => 'bike_cad_ant_id_trans_type'},
4731 23 => +{'name' => 'bike_spdcad_ant_id_trans_type'},
4732 24 => +{'name' => 'bike_power_ant_id_trans_type'},
4733 35 => +{'name' => 'unknown35'}, # unknown UINT8 (array[3])
4734 36 => +{'name' => 'unknown36'}, # unknown ENUM
4735 37 => +{'name' => 'odometer_rollover'},
4736 38 => +{'name' => 'front_gear_num'},
4737 39 => +{'name' => 'front_gear'},
4738 40 => +{'name' => 'rear_gear_num'},
4739 41 => +{'name' => 'rear_gear'},
4740 44 => +{'name' => 'shimano_di2_enabled'},
4741 },
4742  
4743 'connectivity' => +{
4744 0 => +{'name' => 'bluetooth_enabled', 'type_name' => 'bool'},
4745 1 => +{'name' => 'bluetooth_le_enabled', 'type_name' => 'bool'},
4746 2 => +{'name' => 'ant_enabled', 'type_name' => 'bool'},
4747 3 => +{'name' => 'name'},
4748 4 => +{'name' => 'live_tracking_enabled', 'type_name' => 'bool'},
4749 5 => +{'name' => 'weather_conditions_enabled', 'type_name' => 'bool'},
4750 6 => +{'name' => 'weather_alerts_enabled', 'type_name' => 'bool'},
4751 7 => +{'name' => 'auto_activity_upload_enabled', 'type_name' => 'bool'},
4752 8 => +{'name' => 'course_download_enabled', 'type_name' => 'bool'},
4753 9 => +{'name' => 'workout_download_enabled', 'type_name' => 'bool'},
4754 10 => +{'name' => 'gps_ephemeris_download_enabled', 'type_name' => 'bool'},
4755 11 => +{'name' => 'incident_detection_enabled', 'type_name' => 'bool'},
4756 12 => +{'name' => 'grouptrack_enabled', 'type_name' => 'bool'},
4757 },
4758  
4759 'watchface_settings' => +{
4760 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
4761 0 => +{'name' => 'mode', 'type_name' => 'watchface_mode'},
4762  
4763 1 => +{
4764 'name' => 'layout',
4765  
4766 'switch' => +{
4767 '_by' => 'mode',
4768 'digital' => +{'name' => 'digital_layout', 'type_name' => 'digital_watchface_layout'},
4769 'analog' => +{'name' => 'analog_layout', 'type_name' => 'analog_watchface_layout'},
4770 },
4771 },
4772 },
4773  
4774 'ohr_settings' => +{
4775 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
4776 0 => +{'name' => 'enabled', 'type_name' => 'switch'},
4777 },
4778  
4779 'time_in_zone' => +{
4780 253 => +{ 'name' => 'timestamp', 'type_name' => 'date_time' },
4781 0 => +{ 'name' => 'reference_mesg', 'type_name' => 'mesg_num' },
4782 1 => +{ 'name' => 'reference_index', 'type_name' => 'message_index' },
4783 2 => +{ 'name' => 'time_in_hr_zone', 'scale' => 1000 },
4784 3 => +{ 'name' => 'time_in_speed_zone', 'scale' => 1000 },
4785 4 => +{ 'name' => 'time_in_cadence_zone', 'scale' => 1000 },
4786 5 => +{ 'name' => 'time_in_power_zone', 'scale' => 1000 },
4787 6 => +{ 'name' => 'hr_zone_high_boundary', 'unit' => 'bpm' },
4788 7 => +{ 'name' => 'speed_zone_high_boundary', 'unit' => 'm/s', 'scale' => 1000 },
4789 8 => +{ 'name' => 'cadence_zone_high_boundary', 'unit' => 'rpm' },
4790 9 => +{ 'name' => 'power_zone_high_boundary', 'unit' => 'watts' },
4791 10 => +{ 'name' => 'hr_calc_type', 'type_name' => 'hr_zone_calc' },
4792 11 => +{ 'name' => 'max_heart_rate' },
4793 12 => +{ 'name' => 'resting_heart_rate' },
4794 13 => +{ 'name' => 'threshold_heart_rate' },
4795 14 => +{ 'name' => 'pwr_calc_type', 'type_name' => 'pwr_zone_calc' },
4796 15 => +{ 'name' => 'functional_threshold_power' },
4797 },
4798  
4799 'zones_target' => +{ # begins === Sport settings file messages === section
4800 1 => +{'name' => 'max_heart_rate', 'unit' => 'bpm'},
4801 2 => +{'name' => 'threshold_heart_rate', 'unit' => 'bpm'},
4802 3 => +{'name' => 'functional_threshold_power', 'unit' => 'watts'},
4803 5 => +{'name' => 'hr_calc_type', 'type_name' => 'hr_zone_calc'},
4804 7 => +{'name' => 'pwr_calc_type', 'type_name' => 'power_zone_calc'},
4805 8 => +{'name' => 'unknown8'}, # unknown UINT16
4806 9 => +{'name' => 'unknown9'}, # unknown ENUM
4807 10 => +{'name' => 'unknown10'}, # unknown ENUM
4808 11 => +{'name' => 'unknown11'}, # unknown ENUM
4809 12 => +{'name' => 'unknown12'}, # unknown ENUM
4810 13 => +{'name' => 'unknown13'}, # unknown ENUM
4811 },
4812  
4813 'sport' => +{
4814 0 => +{'name' => 'sport', 'type_name' => 'sport'},
4815 1 => +{'name' => 'sub_sport', 'type_name' => 'sub_sport'},
4816 3 => +{'name' => 'name'},
4817 4 => +{'name' => 'unknown4'}, # unknown UINT16
4818 5 => +{'name' => 'unknown5'}, # unknown ENUM
4819 6 => +{'name' => 'unknown6'}, # unknown ENUM
4820 7 => +{'name' => 'unknown7'}, # unknown UINT8
4821 8 => +{'name' => 'unknown8'}, # unknown UINT8
4822 9 => +{'name' => 'unknown9'}, # unknown UINT8
4823 10 => +{'name' => 'unknown10'}, # unknown UINT8 (array[3])
4824 12 => +{'name' => 'unknown12'}, # unknown UINT8
4825 },
4826  
4827 'hr_zone' => +{
4828 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
4829 1 => +{'name' => 'high_bpm', 'unit' => 'bpm'},
4830 2 => +{'name' => 'name'},
4831 },
4832  
4833 'speed_zone' => +{
4834 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
4835 0 => +{'name' => 'high_value', 'scale' => 1000, 'unit' => 'm/s'},
4836 1 => +{'name' => 'name'},
4837 },
4838  
4839 'cadence_zone' => +{
4840 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
4841 0 => +{'name' => 'high_value', 'unit' => 'rpm'},
4842 1 => +{'name' => 'name'},
4843 },
4844  
4845 'power_zone' => +{
4846 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
4847 1 => +{'name' => 'high_value', 'unit' => 'watts'},
4848 2 => +{'name' => 'name'},
4849 },
4850  
4851 'met_zone' => +{
4852 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
4853 1 => +{'name' => 'high_bpm', 'unit' => 'bpm'},
4854 2 => +{'name' => 'calories', 'scale' => 10, 'unit' => 'kcal/min'},
4855 3 => +{'name' => 'fat_calories', 'scale' => 10, 'unit' => 'kcal/min'},
4856 },
4857  
4858 'dive_settings' => +{
4859 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
4860 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
4861 0 => +{'name' => 'name'},
4862 1 => +{'name' => 'model', 'type_name' => 'tissue_model_type'},
4863 2 => +{'name' => 'gf_low', 'unit' => '%'},
4864 3 => +{'name' => 'gf_high', 'unit' => '%'},
4865 4 => +{'name' => 'water_type', 'type_name' => 'water_type'},
4866 5 => +{'name' => 'water_density', 'unit' => 'kg/m^3'},
4867 6 => +{'name' => 'po2_warn', 'scale' => 100, 'unit' => '%'},
4868 7 => +{'name' => 'po2_critical', 'scale' => 100, 'unit' => '%'},
4869 8 => +{'name' => 'po2_deco', 'scale' => 100, 'unit' => '%'},
4870 9 => +{'name' => 'safety_stop_enabled', 'type_name' => 'bool'},
4871 10 => +{'name' => 'bottom_depth'},
4872 11 => +{'name' => 'bottom_time'},
4873 12 => +{'name' => 'apnea_countdown_enabled', 'type_name' => 'bool'},
4874 13 => +{'name' => 'apnea_countdown_time'},
4875 14 => +{'name' => 'backlight_mode', 'type_name' => 'dive_backlight_mode'},
4876 15 => +{'name' => 'backlight_brightness'},
4877 16 => +{'name' => 'backlight_timeout', 'type_name' => 'backlight_timeout'},
4878 17 => +{'name' => 'repeat_dive_interval', 'unit' => 's'},
4879 18 => +{'name' => 'safety_stop_time', 'unit' => 's'},
4880 19 => +{'name' => 'heart_rate_source_type', 'type_name' => 'source_type'},
4881 20 => +{
4882 'name' => 'heart_rate_source',
4883 'switch' => +{
4884 '_by' => 'heart_rate_source_type',
4885 'antplus' => +{'name' => 'heart_rate_antplus_device_type', 'type_name' => 'antplus_device_type'},
4886 'local' => +{'name' => 'heart_rate_local_device_type', 'type_name' => 'local_device_type'},
4887 },
4888 },
4889 21 => +{ 'name' => 'travel_gas', 'type_name' => 'message_index' }, # Index of travel dive_gas message
4890 22 => +{ 'name' => 'ccr_low_setpoint_switch_mode', 'type_name' => 'ccr_setpoint_switch_mode' }, # If low PO2 should be switched to automatically
4891 23 => +{ 'name' => 'ccr_low_setpoint', 'scale' => 100 }, # Target PO2 when using low setpoint
4892 24 => +{ 'name' => 'ccr_low_setpoint_depth', 'unit' => 'm', 'scale' => 1000 }, # Depth to switch to low setpoint in automatic mode
4893 25 => +{ 'name' => 'ccr_high_setpoint_switch_mode', 'type' => 'ccr_setpoint_switch_mode' }, # If high PO2 should be switched to automatically
4894 26 => +{ 'name' => 'ccr_high_setpoint', 'unit' => '%', 'scale' => 100 }, # Target PO2 when using high setpoint
4895 27 => +{ 'name' => 'ccr_high_setpoint_depth', 'unit' => 'm', 'scale' => 1000 }, # Depth to switch to high setpoint in automatic mode
4896 29 => +{ 'name' => 'gas_consumption_display', 'type_name' => 'gas_consumption_rate_type' }, # Type of gas consumption rate to display. Some values are only valid if tank volume is known.
4897 30 => +{ 'name' => 'up_key_enabled', 'type_name' => 'bool' }, # Indicates whether the up key is enabled during dives
4898 35 => +{ 'name' => 'dive_sounds', 'type_name' => 'tone' }, # Sounds and vibration enabled or disabled in-dive
4899 36 => +{ 'name' => 'last_stop_multiple', 'scale' => 10 }, # Usually 1.0/1.5/2.0 representing 3/4.5/6m or 10/15/20ft
4900 37 => +{ 'name' => 'no_fly_time_mode', 'type_name' => 'no_fly_time_mode' }, # Indicates which guidelines to use for no-fly surface interval.
4901 },
4902  
4903 'dive_alarm' => +{
4904 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
4905 0 => +{'name' => 'depth', 'scale' => 1000, 'unit' => 'm'},
4906 1 => +{'name' => 'time', 'unit' => 's'},
4907 2 => +{'name' => 'enabled', 'type_name' => 'bool'},
4908 3 => +{'name' => 'alarm_type', 'type_name' => 'dive_alarm_type'},
4909 4 => +{'name' => 'sound', 'type_name' => 'tone'},
4910 5 => +{'name' => 'dive_types', 'type_name' => 'sub_sport'},
4911 6 => +{ 'name' => 'id' }, # Alarm ID
4912 7 => +{ 'name' => 'popup_enabled', 'type_name' => 'bool' }, # Show a visible pop-up for this alarm
4913 8 => +{ 'name' => 'trigger_on_descent', 'type_name' => 'bool' }, # Trigger the alarm on descent
4914 9 => +{ 'name' => 'trigger_on_ascent', 'type_name' => 'bool' }, # Trigger the alarm on ascent
4915 10 => +{ 'name' => 'repeating', 'type_name' => 'bool' }, # Repeat alarm each time threshold is crossed?
4916 11 => +{ 'name' => 'speed', 'scale' => 1000 }, # Ascent/descent rate (mps) setting for speed type alarms
4917 },
4918  
4919 'dive_apnea_alarm' => +{
4920 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
4921 0 => +{ 'name' => 'depth', 'unit' => 'm', 'scale' => 1000 }, # Depth setting (m) for depth type alarms
4922 1 => +{ 'name' => 'time', 'unit' => 's' }, # Time setting (s) for time type alarms
4923 2 => +{ 'name' => 'enabled', 'type_name' => 'bool' }, # Enablement flag
4924 3 => +{ 'name' => 'alarm_type', 'type_name' => 'dive_alarm_type' }, # Alarm type setting
4925 4 => +{ 'name' => 'sound', 'type_name' => 'tone' }, # Tone and Vibe setting for the alarm.
4926 5 => +{ 'name' => 'dive_types', 'type_name' => 'sub_sport' }, # Dive types the alarm will trigger on
4927 6 => +{ 'name' => 'id' }, # Alarm ID
4928 7 => +{ 'name' => 'popup_enabled', 'type_name' => 'bool' }, # Show a visible pop-up for this alarm
4929 8 => +{ 'name' => 'trigger_on_descent', 'type_name' => 'bool' }, # Trigger the alarm on descent
4930 9 => +{ 'name' => 'trigger_on_ascent', 'type_name' => 'bool' }, # Trigger the alarm on ascent
4931 10 => +{ 'name' => 'repeating', 'type_name' => 'bool' }, # Repeat alarm each time threshold is crossed?
4932 11 => +{ 'name' => 'speed', 'unit' => 'mps', 'scale' => 1000 }, # Ascent/descent rate (mps) setting for speed type alarms
4933 },
4934  
4935 'dive_gas' => +{
4936 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
4937 0 => +{'name' => 'helium_content', 'unit' => '%'},
4938 1 => +{'name' => 'oxygen_content', 'unit' => '%'},
4939 2 => +{'name' => 'status', 'type_name' => 'dive_gas_status'},
4940 3 => +{'name' => 'mode', 'type_name' => 'dive_gas_mode'},
4941 },
4942  
4943 'goal' => +{ # begins === Goals file messages === section
4944 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
4945 0 => +{'name' => 'sport', 'type_name' => 'sport'},
4946 1 => +{'name' => 'sub_sport', 'type_name' => 'sub_sport'},
4947 2 => +{'name' => 'start_date', 'type_name' => 'date_time'},
4948 3 => +{'name' => 'end_date', 'type_name' => 'date_time'},
4949 4 => +{'name' => 'type', 'type_name' => 'goal'},
4950 5 => +{'name' => 'value'},
4951 6 => +{'name' => 'repeat', 'type_name' => 'bool'},
4952 7 => +{'name' => 'target_value'},
4953 8 => +{'name' => 'recurrence', 'type_name' => 'goal_recurrence'},
4954 9 => +{'name' => 'recurrence_value'},
4955 10 => +{'name' => 'enabled', 'type_name' => 'bool'},
4956 11 => +{'name' => 'source', 'type_name' => 'goal_source'},
4957 },
4958  
4959 'activity' => +{ # begins === Activity file messages === section
4960 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
4961 0 => +{'name' => 'total_timer_time', 'scale' => 1000, 'unit' => 's'},
4962 1 => +{'name' => 'num_sessions'},
4963 2 => +{'name' => 'type', 'type_name' => 'activity'},
4964 3 => +{'name' => 'event', 'type_name' => 'event'},
4965 4 => +{'name' => 'event_type', 'type_name' => 'event_type'},
4966 5 => +{'name' => 'local_timestamp', 'type_name' => 'local_date_time'},
4967 6 => +{'name' => 'event_group'},
4968 },
4969  
4970 'session' => +{
4971 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
4972 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
4973 0 => +{'name' => 'event', 'type_name' => 'event'},
4974 1 => +{'name' => 'event_type', 'type_name' => 'event_type'},
4975 2 => +{'name' => 'start_time', 'type_name' => 'date_time'},
4976 3 => +{'name' => 'start_position_lat', 'unit' => 'semicircles'},
4977 4 => +{'name' => 'start_position_long', 'unit' => 'semicircles'},
4978 5 => +{'name' => 'sport', 'type_name' => 'sport'},
4979 6 => +{'name' => 'sub_sport', 'type_name' => 'sub_sport'},
4980 7 => +{'name' => 'total_elapsed_time', 'scale' => 1000, 'unit' => 's'},
4981 8 => +{'name' => 'total_timer_time', 'scale' => 1000, 'unit' => 's'},
4982 9 => +{'name' => 'total_distance', 'scale' => 100, 'unit' => 'm'},
4983  
4984 10 => +{
4985 'name' => 'total_cycles', 'unit' => 'cycles',
4986  
4987 'switch' => +{
4988 '_by' => 'sport',
4989 'walking' => +{'name' => 'total_steps', 'unit' => 'steps'},
4990 'running' => +{'name' => 'total_strides', 'unit' => 'strides'},
4991 'swimming' => +{'name' => 'total_strokes', 'unit' => 'strokes'},
4992 },
4993 },
4994  
4995 11 => +{'name' => 'total_calories', 'unit' => 'kcal'},
4996 13 => +{'name' => 'total_fat_calories', 'unit' => 'kcal'},
4997 14 => +{'name' => 'avg_speed', 'scale' => 1000, 'unit' => 'm/s'},
4998 15 => +{'name' => 'max_speed', 'scale' => 1000, 'unit' => 'm/s'},
4999 16 => +{'name' => 'avg_heart_rate', 'unit' => 'bpm'},
5000 17 => +{'name' => 'max_heart_rate', 'unit' => 'bpm'},
5001  
5002 18 => +{
5003 'name' => 'avg_cadence', 'unit' => 'rpm',
5004  
5005 'switch' => +{
5006 '_by' => 'sport',
5007 'walking' => +{'name' => 'avg_walking_cadence', 'unit' => 'steps/min'},
5008 'running' => +{'name' => 'avg_running_cadence', 'unit' => 'strides/min'},
5009 'swimming' => +{'name' => 'avg_swimming_cadence', 'unit' => 'strokes/min'},
5010 },
5011 },
5012  
5013 19 => +{
5014 'name' => 'max_cadence', 'unit' => 'rpm',
5015  
5016 'switch' => +{
5017 '_by' => 'sport',
5018 'walking' => +{'name' => 'max_walking_cadence', 'unit' => 'steps/min'},
5019 'running' => +{'name' => 'max_running_cadence', 'unit' => 'strides/min'},
5020 'swimming' => +{'name' => 'max_swimming_cadence', 'unit' => 'strokes/min'},
5021 },
5022 },
5023  
5024 20 => +{'name' => 'avg_power', 'unit' => 'watts'},
5025 21 => +{'name' => 'max_power', 'unit' => 'watts'},
5026 22 => +{'name' => 'total_ascent', 'unit' => 'm'},
5027 23 => +{'name' => 'total_descent', 'unit' => 'm'},
5028 24 => +{'name' => 'total_training_effect', 'scale' => 10},
5029 25 => +{'name' => 'first_lap_index'},
5030 26 => +{'name' => 'num_laps'},
5031 27 => +{'name' => 'event_group'},
5032 28 => +{'name' => 'trigger', 'type_name' => 'session_trigger'},
5033 29 => +{'name' => 'nec_lat', 'unit' => 'semicircles'},
5034 30 => +{'name' => 'nec_long', 'unit' => 'semicircles'},
5035 31 => +{'name' => 'swc_lat', 'unit' => 'semicircles'},
5036 32 => +{'name' => 'swc_long', 'unit' => 'semicircles'},
5037 34 => +{'name' => 'normalized_power', 'unit' => 'watts'},
5038 35 => +{'name' => 'training_stress_score', 'scale' => 10, 'unit' => 'tss'},
5039 36 => +{'name' => 'intensity_factor', 'scale' => 1000, 'unit' => 'if'},
5040 37 => +{'name' => 'left_right_balance', 'type_name' => 'left_right_balance_100'},
5041 41 => +{'name' => 'avg_stroke_count', 'scale' => 10, 'unit' => 'strokes/lap'},
5042 42 => +{'name' => 'avg_stroke_distance', 'scale' => 100, 'unit' => 'm'},
5043 43 => +{'name' => 'swim_stroke', 'type_name' => 'swim_stroke'},
5044 44 => +{'name' => 'pool_length', 'scale' => 100, 'unit' => 'm'},
5045 45 => +{'name' => 'threshold_power', 'unit' => 'watts'},
5046 46 => +{'name' => 'pool_length_unit', 'type_name' => 'display_measure'},
5047 47 => +{'name' => 'num_active_lengths', 'unit' => 'lengths'},
5048 48 => +{'name' => 'total_work', 'unit' => 'J'},
5049 49 => +{'name' => 'avg_altitude', 'scale' => 5, 'offset' => 500, 'unit' => 'm'},
5050 50 => +{'name' => 'max_altitude', 'scale' => 5, 'offset' => 500, 'unit' => 'm'},
5051 51 => +{'name' => 'gps_accuracy', 'unit' => 'm'},
5052 52 => +{'name' => 'avg_grade', 'scale' => 100, 'unit' => '%'},
5053 53 => +{'name' => 'avg_pos_grade', 'scale' => 100, 'unit' => '%'},
5054 54 => +{'name' => 'avg_neg_grade', 'scale' => 100, 'unit' => '%'},
5055 55 => +{'name' => 'max_pos_grade', 'scale' => 100, 'unit' => '%'},
5056 56 => +{'name' => 'max_neg_grade', 'scale' => 100, 'unit' => '%'},
5057 57 => +{'name' => 'avg_temperature', 'unit' => 'deg.C'},
5058 58 => +{'name' => 'max_temperature', 'unit' => 'deg.C'},
5059 59 => +{'name' => 'total_moving_time', 'scale' => 1000, 'unit' => 's'},
5060 60 => +{'name' => 'avg_pos_vertical_speed', 'scale' => 1000, 'unit' => 'm/s'},
5061 61 => +{'name' => 'avg_neg_vertical_speed', 'scale' => 1000, 'unit' => 'm/s'},
5062 62 => +{'name' => 'max_pos_vertical_speed', 'scale' => 1000, 'unit' => 'm/s'},
5063 63 => +{'name' => 'max_neg_vertical_speed', 'scale' => 1000, 'unit' => 'm/s'},
5064 64 => +{'name' => 'min_heart_rate', 'unit' => 'bpm'},
5065 65 => +{'name' => 'time_in_hr_zone', 'scale' => 1000, 'unit' => 's'},
5066 66 => +{'name' => 'time_in_speed_zone', 'scale' => 1000, 'unit' => 's'},
5067 67 => +{'name' => 'time_in_cadence_zone', 'scale' => 1000, 'unit' => 's'},
5068 68 => +{'name' => 'time_in_power_zone', 'scale' => 1000, 'unit' => 's'},
5069 69 => +{'name' => 'avg_lap_time', 'scale' => 1000, 'unit' => 's'},
5070 70 => +{'name' => 'best_lap_index'},
5071 71 => +{'name' => 'min_altitude', 'scale' => 5, 'offset' => 500, 'unit' => 'm'},
5072 78 => +{'name' => 'unknown78'}, # unknown UINT32
5073 81 => +{'name' => 'unknown81'}, # unknown ENUM
5074 82 => +{'name' => 'player_score'},
5075 83 => +{'name' => 'opponent_score'},
5076 84 => +{'name' => 'opponent_name'},
5077 85 => +{'name' => 'stroke_count', 'unit' => 'counts'},
5078 86 => +{'name' => 'zone_count', 'unit' => 'counts'},
5079 87 => +{'name' => 'max_ball_speed', 'scale' => 100, 'unit' => 'm/s'},
5080 88 => +{'name' => 'avg_ball_speed', 'scale' => 100, 'unit' => 'm/s'},
5081 89 => +{'name' => 'avg_vertical_oscillation', 'scale' => 10, 'unit' => 'mm'},
5082 90 => +{'name' => 'avg_stance_time_percent', 'scale' => 100, 'unit' => '%'},
5083 91 => +{'name' => 'avg_stance_time', 'scale' => 10, 'unit' => 'ms'},
5084 92 => +{'name' => 'avg_fractional_cadence', 'scale' => 128, 'unit' => 'rpm'},
5085 93 => +{'name' => 'max_fractional_cadence', 'scale' => 128, 'unit' => 'rpm'},
5086 94 => +{'name' => 'total_fractional_cycles', 'scale' => 128, 'unit' => 'cycles'},
5087 95 => +{'name' => 'avg_total_hemoglobin_conc', 'scale' => 100, 'unit' => 'g/dL'},
5088 96 => +{'name' => 'min_total_hemoglobin_conc', 'scale' => 100, 'unit' => 'g/dL'},
5089 97 => +{'name' => 'max_total_hemoglobin_conc', 'scale' => 100, 'unit' => 'g/dL'},
5090 98 => +{'name' => 'avg_saturated_hemoglobin_percent', 'scale' => 10, 'unit' => '%'},
5091 99 => +{'name' => 'min_saturated_hemoglobin_percent', 'scale' => 10, 'unit' => '%'},
5092 100 => +{'name' => 'max_saturated_hemoglobin_percent', 'scale' => 10, 'unit' => '%'},
5093 101 => +{'name' => 'avg_left_torque_effectiveness', 'scale' => 2, 'unit' => '%'},
5094 102 => +{'name' => 'avg_right_torque_effectiveness', 'scale' => 2, 'unit' => '%'},
5095 103 => +{'name' => 'avg_left_pedal_smoothness', 'scale' => 2, 'unit' => '%'},
5096 104 => +{'name' => 'avg_right_pedal_smoothness', 'scale' => 2, 'unit' => '%'},
5097 105 => +{'name' => 'avg_combined_pedal_smoothness', 'scale' => 2, 'unit' => '%'},
5098 106 => +{'name' => 'unknown106'}, # unknown UINT16
5099 107 => +{'name' => 'unknown107'}, # unknown UINT16
5100 108 => +{'name' => 'unknown108'}, # unknown UINT16
5101 109 => +{'name' => 'unknown109'}, # unknown UINT8
5102 110 => +{'name' => 'unknown110'}, # unknown STRING
5103 111 => +{'name' => 'sport_index'},
5104 112 => +{'name' => 'time_standing', 'scale' => 1000, 'unit' => 's'},
5105 113 => +{'name' => 'stand_count'},
5106 114 => +{'name' => 'avg_left_pco', 'unit' => 'mm'},
5107 115 => +{'name' => 'avg_right_pco', 'unit' => 'mm'},
5108 116 => +{'name' => 'avg_left_power_phase', 'scale' => 0.7111111, 'unit' => 'degrees'},
5109 117 => +{'name' => 'avg_left_power_phase_peak', 'scale' => 0.7111111, 'unit' => 'degrees'},
5110 118 => +{'name' => 'avg_right_power_phase', 'scale' => 0.7111111, 'unit' => 'degrees'},
5111 119 => +{'name' => 'avg_right_power_phase_peak', 'scale' => 0.7111111, 'unit' => 'degrees'},
5112 120 => +{'name' => 'avg_power_position', 'unit' => 'watts'},
5113 121 => +{'name' => 'max_power_position', 'unit' => 'watts'},
5114 122 => +{'name' => 'avg_cadence_position', 'unit' => 'rpm'},
5115 123 => +{'name' => 'max_cadence_position', 'unit' => 'rpm'},
5116 124 => +{'name' => 'enhanced_avg_speed', 'scale' => 1000, 'unit' => 'm/s'},
5117 125 => +{'name' => 'enhanced_max_speed', 'scale' => 1000, 'unit' => 'm/s'},
5118 126 => +{'name' => 'enhanced_avg_altitude', 'scale' => 5, 'offset' => 500, 'unit' => 'm'},
5119 127 => +{'name' => 'enhanced_min_altitude', 'scale' => 5, 'offset' => 500, 'unit' => 'm'},
5120 128 => +{'name' => 'enhanced_max_altitude', 'scale' => 5, 'offset' => 500, 'unit' => 'm'},
5121 129 => +{'name' => 'avg_lev_motor_power', 'unit' => 'watts'},
5122 130 => +{'name' => 'max_lev_motor_power', 'unit' => 'watts'},
5123 131 => +{'name' => 'lev_battery_consumption', 'scale' => 2, 'unit' => '%'},
5124 132 => +{'name' => 'avg_vertical_ratio', 'scale' => 100, 'unit' => '%'},
5125 133 => +{'name' => 'avg_stance_time_balance', 'scale' => 100, 'unit' => '%'},
5126 134 => +{'name' => 'avg_step_length', 'scale' => 10, 'unit' => 'mm'},
5127 137 => +{'name' => 'total_anaerobic_training_effect', 'scale' => 10},
5128 139 => +{'name' => 'avg_vam', 'scale' => 1000, 'unit' => 'm/s'},
5129 140 => +{ 'name' => 'avg_depth', 'unit' => 'm', 'scale' => 1000 }, # 0 if above water
5130 141 => +{ 'name' => 'max_depth', 'unit' => 'm', 'scale' => 1000 }, # 0 if above water
5131 142 => +{ 'name' => 'surface_interval', 'unit' => 's' }, # Time since end of last dive
5132 143 => +{ 'name' => 'start_cns', 'unit' => '%' },
5133 144 => +{ 'name' => 'end_cns', 'unit' => '%' },
5134 145 => +{ 'name' => 'start_n2', 'unit' => '%' },
5135 146 => +{ 'name' => 'end_n2', 'unit' => '%' },
5136 147 => +{ 'name' => 'avg_respiration_rate' },
5137 148 => +{ 'name' => 'max_respiration_rate' },
5138 149 => +{ 'name' => 'min_respiration_rate' },
5139 150 => +{ 'name' => 'min_temperature', 'unit' => 'deg.C' },
5140 155 => +{ 'name' => 'o2_toxicity', 'unit' => 'OTUs' },
5141 156 => +{ 'name' => 'dive_number' },
5142 168 => +{ 'name' => 'training_load_peak', 'scale' => 65536 },
5143 169 => +{ 'name' => 'enhanced_avg_respiration_rate', 'unit' => 'breaths/min', 'scale' => 100 },
5144 170 => +{ 'name' => 'enhanced_max_respiration_rate', 'unit' => 'breaths/min' },
5145 180 => +{ 'name' => 'enhanced_min_respiration_rate', 'scale' => 100 },
5146 181 => +{'name' => 'total_grit', 'unit' => 'kGrit'},
5147 182 => +{'name' => 'total_flow', 'unit' => 'Flow'},
5148 183 => +{'name' => 'jump_count'},
5149 186 => +{'name' => 'avg_grit', 'unit' => 'kGrit'},
5150 187 => +{'name' => 'avg_flow', 'unit' => 'Flow'},
5151 199 => +{'name' => 'total_fractional_ascent', 'unit' => 'm'},
5152 200 => +{'name' => 'total_fractional_descent', 'unit' => 'm'},
5153 208 => +{'name' => 'avg_core_temperature', 'unit' => 'deg.C'},
5154 209 => +{'name' => 'min_core_temperature', 'unit' => 'deg.C'},
5155 210 => +{'name' => 'max_core_temperature', 'unit' => 'deg.C'},
5156 },
5157  
5158 'lap' => +{
5159 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
5160 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
5161 0 => +{'name' => 'event', 'type_name' => 'event'},
5162 1 => +{'name' => 'event_type', 'type_name' => 'event_type'},
5163 2 => +{'name' => 'start_time', 'type_name' => 'date_time'},
5164 3 => +{'name' => 'start_position_lat', 'unit' => 'semicircles'},
5165 4 => +{'name' => 'start_position_long', 'unit' => 'semicircles'},
5166 5 => +{'name' => 'end_position_lat', 'unit' => 'semicircles'},
5167 6 => +{'name' => 'end_position_long', 'unit' => 'semicircles'},
5168 7 => +{'name' => 'total_elapsed_time', 'scale' => 1000, 'unit' => 's'},
5169 8 => +{'name' => 'total_timer_time', 'scale' => 1000, 'unit' => 's'},
5170 9 => +{'name' => 'total_distance', 'scale' => 100, 'unit' => 'm'},
5171  
5172 10 => +{
5173 'name' => 'total_cycles', 'unit' => 'cycles',
5174  
5175 'switch' => +{
5176 '_by' => 'sport',
5177 'walking' => +{'name' => 'total_steps', 'unit' => 'steps'},
5178 'running' => +{'name' => 'total_strides', 'unit' => 'strides'},
5179 'swimming' => +{'name' => 'total_strokes', 'unit' => 'strokes'},
5180 },
5181 },
5182  
5183 11 => +{'name' => 'total_calories', 'unit' => 'kcal'},
5184 12 => +{'name' => 'total_fat_calories', 'unit' => 'kcal'},
5185 13 => +{'name' => 'avg_speed', 'scale' => 1000, 'unit' => 'm/s'},
5186 14 => +{'name' => 'max_speed', 'scale' => 1000, 'unit' => 'm/s'},
5187 15 => +{'name' => 'avg_heart_rate', 'unit' => 'bpm'},
5188 16 => +{'name' => 'max_heart_rate', 'unit' => 'bpm'},
5189  
5190 17 => +{
5191 'name' => 'avg_cadence', 'unit' => 'rpm',
5192  
5193 'switch' => +{
5194 '_by' => 'sport',
5195 'walking' => +{'name' => 'avg_walking_cadence', 'unit' => 'steps/min'},
5196 'running' => +{'name' => 'avg_running_cadence', 'unit' => 'strides/min'},
5197 'swimming' => +{'name' => 'avg_swimming_cadence', 'unit' => 'strokes/min'},
5198 },
5199 },
5200  
5201 18 => +{
5202 'name' => 'max_cadence', 'unit' => 'rpm',
5203  
5204 'switch' => +{
5205 '_by' => 'sport',
5206 'walking' => +{'name' => 'max_walking_cadence', 'unit' => 'steps/min'},
5207 'running' => +{'name' => 'max_running_cadence', 'unit' => 'strides/min'},
5208 'swimming' => +{'name' => 'max_swimming_cadence', 'unit' => 'strokes/min'},
5209 },
5210 },
5211  
5212 19 => +{'name' => 'avg_power', 'unit' => 'watts'},
5213 20 => +{'name' => 'max_power', 'unit' => 'watts'},
5214 21 => +{'name' => 'total_ascent', 'unit' => 'm'},
5215 22 => +{'name' => 'total_descent', 'unit' => 'm'},
5216 23 => +{'name' => 'intensity', 'type_name' => 'intensity'},
5217 24 => +{'name' => 'lap_trigger', 'type_name' => 'lap_trigger'},
5218 25 => +{'name' => 'sport', 'type_name' => 'sport'},
5219 26 => +{'name' => 'event_group'},
5220 27 => +{'name' => 'nec_lat', 'unit' => 'semicircles'}, # not present?
5221 28 => +{'name' => 'nec_long', 'unit' => 'semicircles'}, # not present?
5222 29 => +{'name' => 'swc_lat', 'unit' => 'semicircles'}, # not present?
5223 30 => +{'name' => 'swc_long', 'unit' => 'semicircles'}, # not present?
5224 32 => +{'name' => 'num_lengths', 'unit' => 'lengths'},
5225 33 => +{'name' => 'normalized_power', 'unit' => 'watts'},
5226 34 => +{'name' => 'left_right_balance', 'type_name' => 'left_right_balance_100'},
5227 35 => +{'name' => 'first_length_index'},
5228 37 => +{'name' => 'avg_stroke_distance', 'scale' => 100, 'unit' => 'm'},
5229 38 => +{'name' => 'swim_stroke', 'type_name' => 'swim_stroke'},
5230 39 => +{'name' => 'sub_sport', 'type_name' => 'sub_sport'},
5231 40 => +{'name' => 'num_active_lengths', 'unit' => 'lengths'},
5232 41 => +{'name' => 'total_work', 'unit' => 'J'},
5233 42 => +{'name' => 'avg_altitude', 'scale' => 5, 'offset' => 500, 'unit' => 'm'},
5234 43 => +{'name' => 'max_altitude', 'scale' => 5, 'offset' => 500, 'unit' => 'm'},
5235 44 => +{'name' => 'gps_accuracy', 'unit' => 'm'},
5236 45 => +{'name' => 'avg_grade', 'scale' => 100, 'unit' => '%'},
5237 46 => +{'name' => 'avg_pos_grade', 'scale' => 100, 'unit' => '%'},
5238 47 => +{'name' => 'avg_neg_grade', 'scale' => 100, 'unit' => '%'},
5239 48 => +{'name' => 'max_pos_grade', 'scale' => 100, 'unit' => '%'},
5240 49 => +{'name' => 'max_neg_grade', 'scale' => 100, 'unit' => '%'},
5241 50 => +{'name' => 'avg_temperature', 'unit' => 'deg.C'},
5242 51 => +{'name' => 'max_temperature', 'unit' => 'deg.C'},
5243 52 => +{'name' => 'total_moving_time', 'scale' => 1000, 'unit' => 's'},
5244 53 => +{'name' => 'avg_pos_vertical_speed', 'scale' => 1000, 'unit' => 'm/s'},
5245 54 => +{'name' => 'avg_neg_vertical_speed', 'scale' => 1000, 'unit' => 'm/s'},
5246 55 => +{'name' => 'max_pos_vertical_speed', 'scale' => 1000, 'unit' => 'm/s'},
5247 56 => +{'name' => 'max_neg_vertical_speed', 'scale' => 1000, 'unit' => 'm/s'},
5248 57 => +{'name' => 'time_in_hr_zone', 'scale' => 1000, 'unit' => 's'},
5249 58 => +{'name' => 'time_in_speed_zone', 'scale' => 1000, 'unit' => 's'},
5250 59 => +{'name' => 'time_in_cadence_zone', 'scale' => 1000, 'unit' => 's'},
5251 60 => +{'name' => 'time_in_power_zone', 'scale' => 1000, 'unit' => 's'},
5252 61 => +{'name' => 'repetition_num'},
5253 62 => +{'name' => 'min_altitude', 'scale' => 5, 'offset' => 500, 'unit' => 'm'},
5254 63 => +{'name' => 'min_heart_rate', 'unit' => 'bpm'},
5255 70 => +{'name' => 'unknown70'}, # unknown UINT32
5256 71 => +{'name' => 'wkt_step_index', 'type_name' => 'message_index'},
5257 72 => +{'name' => 'unknown72'}, # unknown ENUM
5258 74 => +{'name' => 'opponent_score'},
5259 75 => +{'name' => 'stroke_count', 'unit' => 'counts'},
5260 76 => +{'name' => 'zone_count', 'unit' => 'counts'},
5261 77 => +{'name' => 'avg_vertical_oscillation', 'scale' => 10, 'unit' => 'mm'},
5262 78 => +{'name' => 'avg_stance_time_percent', 'scale' => 100, 'unit' => '%'},
5263 79 => +{'name' => 'avg_stance_time', 'scale' => 10, 'unit' => 'ms'},
5264 80 => +{'name' => 'avg_fractional_cadence', 'scale' => 128, 'unit' => 'rpm'},
5265 81 => +{'name' => 'max_fractional_cadence', 'scale' => 128, 'unit' => 'rpm'},
5266 82 => +{'name' => 'total_fractional_cycles', 'scale' => 128, 'unit' => 'cycles'},
5267 83 => +{'name' => 'player_score'},
5268 84 => +{'name' => 'avg_total_hemoglobin_conc', 'scale' => 100, 'unit' => 'g/dL'},
5269 85 => +{'name' => 'min_total_hemoglobin_conc', 'scale' => 100, 'unit' => 'g/dL'},
5270 86 => +{'name' => 'max_total_hemoglobin_conc', 'scale' => 100, 'unit' => 'g/dL'},
5271 87 => +{'name' => 'avg_saturated_hemoglobin_percent', 'scale' => 10, 'unit' => '%'},
5272 88 => +{'name' => 'min_saturated_hemoglobin_percent', 'scale' => 10, 'unit' => '%'},
5273 89 => +{'name' => 'max_saturated_hemoglobin_percent', 'scale' => 10, 'unit' => '%'},
5274 91 => +{'name' => 'avg_left_torque_effectiveness', 'scale' => 2, 'unit' => '%'},
5275 92 => +{'name' => 'avg_right_torque_effectiveness', 'scale' => 2, 'unit' => '%'},
5276 93 => +{'name' => 'avg_left_pedal_smoothness', 'scale' => 2, 'unit' => '%'},
5277 94 => +{'name' => 'avg_right_pedal_smoothness', 'scale' => 2, 'unit' => '%'},
5278 95 => +{'name' => 'avg_combined_pedal_smoothness', 'scale' => 2, 'unit' => '%'},
5279 96 => +{'name' => 'unknown96'}, # unknown UINT16
5280 97 => +{'name' => 'unknown97'}, # unknown UINT16
5281 98 => +{'name' => 'time_standing', 'scale' => 1000, 'unit' => 's'},
5282 99 => +{'name' => 'stand_count'},
5283 100 => +{'name' => 'avg_left_pco', 'unit' => 'mm'},
5284 101 => +{'name' => 'avg_right_pco', 'unit' => 'mm'},
5285 102 => +{'name' => 'avg_left_power_phase', 'scale' => 0.7111111, 'unit' => 'degrees'},
5286 103 => +{'name' => 'avg_left_power_phase_peak', 'scale' => 0.7111111, 'unit' => 'degrees'},
5287 104 => +{'name' => 'avg_right_power_phase', 'scale' => 0.7111111, 'unit' => 'degrees'},
5288 105 => +{'name' => 'avg_right_power_phase_peak', 'scale' => 0.7111111, 'unit' => 'degrees'},
5289 106 => +{'name' => 'avg_power_position', 'unit' => 'watts'},
5290 107 => +{'name' => 'max_power_position', 'unit' => 'watts'},
5291 108 => +{'name' => 'avg_cadence_position', 'unit' => 'rpm'},
5292 109 => +{'name' => 'max_cadence_position', 'unit' => 'rpm'},
5293 110 => +{'name' => 'enhanced_avg_speed', 'scale' => 1000, 'unit' => 'm/s'},
5294 111 => +{'name' => 'enhanced_max_speed', 'scale' => 1000, 'unit' => 'm/s'},
5295 112 => +{'name' => 'enhanced_avg_altitude', 'scale' => 5, 'offset' => 500, 'unit' => 'm'},
5296 113 => +{'name' => 'enhanced_min_altitude', 'scale' => 5, 'offset' => 500, 'unit' => 'm'},
5297 114 => +{'name' => 'enhanced_max_altitude', 'scale' => 5, 'offset' => 500, 'unit' => 'm'},
5298 115 => +{'name' => 'avg_lev_motor_power', 'unit' => 'watts'},
5299 116 => +{'name' => 'max_lev_motor_power', 'unit' => 'watts'},
5300 117 => +{'name' => 'lev_battery_consumption', 'scale' => 2, 'unit' => '%'},
5301 118 => +{'name' => 'avg_vertical_ratio', 'scale' => 100, 'unit' => '%'},
5302 119 => +{'name' => 'avg_stance_time_balance', 'scale' => 100, 'unit' => '%'},
5303 120 => +{'name' => 'avg_step_length', 'scale' => 10, 'unit' => 'mm'},
5304 121 => +{'name' => 'avg_vam', 'scale' => 1000, 'unit' => 'm/s'},
5305 122 => +{ 'name' => 'avg_depth', 'unit' => 'm', 'scale' => 1000 }, # 0 if above water
5306 123 => +{ 'name' => 'max_depth', 'unit' => 'm', 'scale' => 1000 }, # 0 if above water
5307 124 => +{ 'name' => 'min_temperature', 'unit' => 'deg.C' },
5308 136 => +{ 'name' => 'enhanced_avg_respiration_rate', 'unit' => 'breaths/min', 'scale' => 100 },
5309 137 => +{ 'name' => 'enhanced_max_respiration_rate', 'unit' => 'breaths/min', 'scale' => 100 },
5310 147 => +{ 'name' => 'avg_respiration_rate' },
5311 148 => +{ 'name' => 'max_respiration_rate' },
5312 149 => +{'name' => 'total_grit', 'unit' => 'kGrit'},
5313 150 => +{'name' => 'total_flow', 'unit' => 'Flow'},
5314 151 => +{'name' => 'jump_count'},
5315 153 => +{'name' => 'avg_grit', 'unit' => 'kGrit'},
5316 154 => +{'name' => 'avg_flow', 'unit' => 'Flow'},
5317 156 => +{'name' => 'total_fractional_ascent', 'unit' => 'm'},
5318 157 => +{'name' => 'total_fractional_descent', 'unit' => 'm'},
5319 158 => +{'name' => 'avg_core_temperature', 'unit' => 'deg.C'},
5320 159 => +{'name' => 'min_core_temperature', 'unit' => 'deg.C'},
5321 160 => +{'name' => 'max_core_temperature', 'unit' => 'deg.C'},
5322 },
5323  
5324 'length' => +{
5325 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
5326 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
5327 0 => +{'name' => 'event', 'type_name' => 'event'},
5328 1 => +{'name' => 'event_type', 'type_name' => 'event_type'},
5329 2 => +{'name' => 'start_time', 'type_name' => 'date_time'},
5330 3 => +{'name' => 'total_elapsed_time', 'scale' => 1000, 'unit' => 's'},
5331 4 => +{'name' => 'total_timer_time', 'scale' => 1000, 'unit' => 's'},
5332 5 => +{'name' => 'total_strokes', 'unit' => 'strokes'},
5333 6 => +{'name' => 'avg_speed', 'scale' => 1000, 'unit' => 'm/s'},
5334 7 => +{'name' => 'swim_stroke', 'type_name' => 'swim_stroke'},
5335 9 => +{'name' => 'avg_swimming_cadence', 'unit' => 'strokes/min'},
5336 10 => +{'name' => 'event_group'},
5337 11 => +{'name' => 'total_calories', 'unit' => 'kcal'},
5338 12 => +{'name' => 'length_type', 'type_name' => 'length_type'},
5339 18 => +{'name' => 'player_score'},
5340 19 => +{'name' => 'opponent_score'},
5341 20 => +{'name' => 'stroke_count', 'unit' => 'counts'},
5342 21 => +{'name' => 'zone_count', 'unit' => 'counts'},
5343 22 => +{ 'name' => 'enhanced_avg_respiration_rate', 'unit' => 'breaths/min', 'scale' => 100 },
5344 23 => +{ 'name' => 'enhanced_max_respiration_rate', 'unit' => 'breaths/min', 'scale' => 100 },
5345 24 => +{ 'name' => 'avg_respiration_rate' },
5346 25 => +{ 'name' => 'max_respiration_rate' },
5347 },
5348  
5349 'record' => +{
5350 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
5351 0 => +{'name' => 'position_lat', 'unit' => 'semicircles'},
5352 1 => +{'name' => 'position_long', 'unit' => 'semicircles'},
5353 2 => +{'name' => 'altitude', 'scale' => 5, 'offset' => 500, 'unit' => 'm'},
5354 3 => +{'name' => 'heart_rate', 'unit' => 'bpm'},
5355 4 => +{'name' => 'cadence', 'unit' => 'rpm'},
5356 5 => +{'name' => 'distance', 'scale' => 100, 'unit' => 'm'},
5357 6 => +{'name' => 'speed', 'scale' => 1000, 'unit' => 'm/s'},
5358 7 => +{'name' => 'power', 'unit' => 'watts'},
5359 8 => +{'name' => 'compressed_speed_distance'}, # complex decoding!
5360 9 => +{'name' => 'grade', 'scale' => 100, 'unit' => '%'},
5361 10 => +{'name' => 'resistance'},
5362 11 => +{'name' => 'time_from_course', 'scale' => 1000, 'unit' => 's'},
5363 12 => +{'name' => 'cycle_length', 'scale' => 100, 'unit' => 'm'},
5364 13 => +{'name' => 'temperature', 'unit' => 'deg.C'},
5365 17 => +{'name' => 'speed_1s', 'scale' => 16, 'unit' => 'm/s'},
5366 18 => +{'name' => 'cycles', 'unit' => 'cycles'},
5367 19 => +{'name' => 'total_cycles', 'unit' => 'cycles'},
5368 28 => +{'name' => 'compressed_accumulated_power', 'unit' => 'watts'},
5369 29 => +{'name' => 'accumulated_power', 'unit' => 'watts'},
5370 30 => +{'name' => 'left_right_balance', 'type_name' => 'left_right_balance'},
5371 31 => +{'name' => 'gps_accuracy', 'unit' => 'm'},
5372 32 => +{'name' => 'vertical_speed', 'scale' => 1000, 'unit' => 'm/s'},
5373 33 => +{'name' => 'calories', 'unit' => 'kcal'},
5374 39 => +{'name' => 'vertical_oscillation', 'scale' => 10, 'unit' => 'mm'},
5375 40 => +{'name' => 'stance_time_percent', 'scale' => 100, 'unit' => '%'},
5376 41 => +{'name' => 'stance_time', 'scale' => 10, 'unit' => 'ms'},
5377 42 => +{'name' => 'activity_type', 'type_name' => 'activity_type'},
5378 43 => +{'name' => 'left_torque_effectiveness', 'scale' => 2, 'unit' => '%'},
5379 44 => +{'name' => 'right_torque_effectiveness', 'scale' => 2, 'unit' => '%'},
5380 45 => +{'name' => 'left_pedal_smoothness', 'scale' => 2, 'unit' => '%'},
5381 46 => +{'name' => 'right_pedal_smoothness', 'scale' => 2, 'unit' => '%'},
5382 47 => +{'name' => 'combined_pedal_smoothness', 'scale' => 2, 'unit' => '%'},
5383 48 => +{'name' => 'time128', 'scale' => 128, 'unit' => 's'},
5384 49 => +{'name' => 'stroke_type', 'type_name' => 'stroke_type'},
5385 50 => +{'name' => 'zone'},
5386 51 => +{'name' => 'ball_speed', 'scale' => 100, 'unit' => 'm/s'},
5387 52 => +{'name' => 'cadence256', 'scale' => 256, 'unit' => 'rpm'},
5388 53 => +{'name' => 'fractional_cadence', 'scale' => 128, 'unit' => 'rpm'},
5389 54 => +{'name' => 'total_hemoglobin_conc', 'scale' => 100, 'unit' => 'g/dL'},
5390 55 => +{'name' => 'total_hemoglobin_conc_min', 'scale' => 100, 'unit' => 'g/dL'},
5391 56 => +{'name' => 'total_hemoglobin_conc_max', 'scale' => 100, 'unit' => 'g/dL'},
5392 57 => +{'name' => 'saturated_hemoglobin_percent', 'scale' => 10, 'unit' => '%'},
5393 58 => +{'name' => 'saturated_hemoglobin_percent_min', 'scale' => 10, 'unit' => '%'},
5394 59 => +{'name' => 'saturated_hemoglobin_percent_max', 'scale' => 10, 'unit' => '%'},
5395 61 => +{'name' => 'unknown61'}, # unknown UINT16
5396 62 => +{'name' => 'device_index', 'type_name' => 'device_index'},
5397 66 => +{'name' => 'unknown66'}, # unknown SINT16
5398 67 => +{'name' => 'left_pco', 'unit' => 'mm'},
5399 68 => +{'name' => 'right_pco', 'unit' => 'mm'},
5400 69 => +{'name' => 'left_power_phase', 'scale' => 0.7111111, 'unit' => 'degrees'},
5401 70 => +{'name' => 'left_power_phase_peak', 'scale' => 0.7111111, 'unit' => 'degrees'},
5402 71 => +{'name' => 'right_power_phase', 'scale' => 0.7111111, 'unit' => 'degrees'},
5403 72 => +{'name' => 'right_power_phase_peak', 'scale' => 0.7111111, 'unit' => 'degrees'},
5404 73 => +{'name' => 'enhanced_speed', 'scale' => 1000, 'unit' => 'm/s'},
5405 78 => +{'name' => 'enhanced_altitude', 'scale' => 5, 'offset' => 500, 'unit' => 'm'},
5406 81 => +{'name' => 'battery_soc', 'scale' => 2, 'unit' => '%'},
5407 82 => +{'name' => 'motor_power', 'unit' => 'watts'},
5408 83 => +{'name' => 'vertical_ratio', 'scale' => 100, 'unit' => '%'},
5409 84 => +{'name' => 'stance_time_balance', 'scale' => 100, 'unit' => '%'},
5410 85 => +{'name' => 'step_length', 'scale' => 10, 'unit' => 'mm'},
5411 91 => +{'name' => 'absolute_pressure', 'unit' => 'Pa'},
5412 92 => +{'name' => 'depth', 'scale' => 1000, 'unit' => 'm'},
5413 93 => +{'name' => 'next_stop_depth', 'scale' => 1000, 'unit' => 'm'},
5414 94 => +{'name' => 'next_stop_time', 'unit' => 's'},
5415 95 => +{'name' => 'time_to_surface', 'unit' => 's'},
5416 96 => +{'name' => 'ndl_time', 'unit' => 's'},
5417 97 => +{'name' => 'cns_load', 'unit' => '%'},
5418 98 => +{'name' => 'n2_load', 'unit' => '%'},
5419 99 => +{ 'name' => 'respiration_rate' },
5420 108 => +{ 'name' => 'enhanced_respiration_rate', 'unit' => 'breaths/min', 'scale' => 100 },
5421 114 => +{'name' => 'grit'},
5422 115 => +{'name' => 'flow'},
5423 117 => +{'name' => 'ebike_travel_range', 'unit' => 'km'},
5424 118 => +{'name' => 'ebike_battery_level', 'unit' => '%'},
5425 119 => +{'name' => 'ebike_assist_mode'},
5426 120 => +{'name' => 'ebike_assist_level_percent', 'unit' => '%'},
5427 123 => +{ 'name' => 'air_time_remaining' },
5428 124 => +{ 'name' => 'pressure_sac', 'unit' => 'bar/min', 'scale' => 100 }, # Pressure-based surface air consumption
5429 125 => +{ 'name' => 'volume_sac', 'unit' => 'l/min', 'scale' => 100 }, # Volumetric surface air consumption
5430 126 => +{ 'name' => 'rmv', 'unit' => 'l/min', 'scale' => 100 }, # Respiratory minute volume
5431 127 => +{ 'name' => 'ascent_rate', 'unit' => 'm/s', 'scale' => 1000 },
5432 129 => +{ 'name' => 'po2', 'unit' => 'percent', 'scale' => 100 }, # Current partial pressure of oxygen
5433 139 => +{'name' => 'core_temperature', 'scale' => 100, 'unit' => 'deg.C'},
5434 },
5435  
5436 'event' => +{
5437 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
5438 0 => +{'name' => 'event', 'type_name' => 'event'},
5439 1 => +{'name' => 'event_type', 'type_name' => 'event_type'},
5440 2 => +{'name' => 'data16'}, # no switch?
5441  
5442 3 => +{
5443 'name' => 'data',
5444  
5445 'switch' => +{
5446 '_by' => 'event',
5447 'timer' => +{'name' => 'timer_trigger', 'type_name' => 'timer_trigger'},
5448 'course_point' => +{'name' => 'course_point_index', 'type_name' => 'message_index'},
5449 'battery' => +{'name' => 'battery_level', 'scale' => 1000, 'unit' => 'V'},
5450 'virtual_partner_pace' => +{'name' => 'virtual_partner_speed', 'scale' => 1000, 'unit' => 'm/s'},
5451 'hr_high_alert' => +{'name' => 'hr_high_alert', 'unit' => 'bpm'},
5452 'hr_low_alert' => +{'name' => 'hr_low_alert', 'unit' => 'bpm'},
5453 'speed_high_alert' => +{'name' => 'speed_high_alert', 'scale' => 1000, 'unit' => 'm/s'},
5454 'speed_low_alert' => +{'name' => 'speed_low_alert', 'scale' => 1000, 'unit' => 'm/s'},
5455 'cad_high_alert' => +{'name' => 'cad_high_alert', 'unit' => 'rpm'},
5456 'cad_low_alert' => +{'name' => 'cad_low_alert', 'unit' => 'rpm'},
5457 'power_high_alert' => +{'name' => 'power_high_alert', 'unit' => 'watts'},
5458 'power_low_alert' => +{'name' => 'power_low_alert', 'unit' => 'watts'},
5459 'time_duration_alert' => +{'name' => 'time_duration_alert', 'scale' => 1000, 'unit' => 's'},
5460 'distance_duration_alert' => +{'name' => 'distance_duration_alert', 'scale' => 100, 'unit' => 'm'},
5461 'calorie_duration_alert' => +{'name' => 'calorie_duration_alert', 'unit' => 'kcal'},
5462 # why is this key not the same as the name?
5463 'fitness_equipment' => +{'name' => 'fitness_equipment_state', 'type_name' => 'fitness_equipment_state'},
5464 'sport_point' => +{'name' => 'sport_point', 'scale' => 11}, # complex decoding!
5465 'front_gear_change' => +{'name' => 'gear_change_data', 'scale' => 1111}, # complex decoding!
5466 'rear_gear_change' => +{'name' => 'gear_change_data', 'scale' => 1111}, # complex decoding!
5467 'rider_position_change' => +{'name' => 'rider_position', 'type_name' => 'rider_position_type'},
5468 'comm_timeout' => +{'name' => 'comm_timeout', 'type_name' => 'comm_timeout_type'},
5469 'dive_alert' => +{ 'name' => 'dive_alert', 'type_name' => 'dive_alert' },
5470 'radar_threat_alert' => +{'name' => 'radar_threat_alert'},
5471 },
5472 },
5473  
5474 4 => +{'name' => 'event_group'},
5475 7 => +{'name' => 'score'},
5476 8 => +{'name' => 'opponent_score'},
5477 9 => +{'name' => 'front_gear_num'},
5478 10 => +{'name' => 'front_gear'},
5479 11 => +{'name' => 'rear_gear_num'},
5480 12 => +{'name' => 'rear_gear'},
5481 13 => +{'name' => 'device_index', 'type_name' => 'device_index'},
5482 21 => +{'name' => 'radar_threat_level_max', 'type_name' => 'radar_threat_level_type'},
5483 22 => +{'name' => 'radar_threat_count'},
5484 23 => +{'name' => 'radar_threat_avg_approach_speed', unit => 'm/s'},
5485 24 => +{'name' => 'radar_threat_max_approach_speed', unit => 'm/s'},
5486 },
5487  
5488 'device_info' => +{
5489 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
5490 0 => +{'name' => 'device_index', 'type_name' => 'device_index'},
5491  
5492 1 => +{
5493 'name' => 'device_type',
5494  
5495 'switch' => +{
5496 '_by' => 'source_type',
5497 'bluetooth_low_energy' => +{ 'name' => 'ble_device_type', 'type_name' => 'ble_device_type' },
5498 'antplus' => +{'name' => 'antplus_device_type', 'type_name' => 'antplus_device_type'},
5499 'ant' => +{'name' => 'ant_device_type'},
5500 'local' => +{'name' => 'local_device_type', 'type_name' => 'local_device_type'},
5501 },
5502 },
5503  
5504 2 => +{'name' => 'manufacturer', 'type_name' => 'manufacturer'},
5505 3 => +{'name' => 'serial_number'},
5506  
5507 4 => +{
5508 'name' => 'product',
5509  
5510 'switch' => +{
5511 '_by' => 'manufacturer',
5512 'garmin' => +{'name' => 'garmin_product', 'type_name' => 'garmin_product'},
5513 'dynastream' => +{'name' => 'garmin_product', 'type_name' => 'garmin_product'},
5514 'dynastream_oem' => +{'name' => 'garmin_product', 'type_name' => 'garmin_product'},
5515 'favero_electronics' => +{'name' => 'favero_product', 'type_name' => 'favero_product'},
5516 'tacx' => +{'name' => 'garmin_product', 'type_name' => 'garmin_product'},
5517 },
5518 },
5519  
5520 5 => +{'name' => 'software_version', 'scale' => 100},
5521 6 => +{'name' => 'hardware_version'},
5522 7 => +{'name' => 'cum_operating_time', 'unit' => 's'},
5523 8 => +{'name' => 'unknown8'}, # unknown UINT32
5524 9 => +{'name' => 'unknown9'}, # unknown UINT8
5525 10 => +{'name' => 'battery_voltage', 'scale' => 256, 'unit' => 'V'},
5526 11 => +{'name' => 'battery_status', 'type_name' => 'battery_status'},
5527 15 => +{'name' => 'unknown15'}, # unknown UINT32
5528 16 => +{'name' => 'unknown16'}, # unknown UINT32
5529 18 => +{'name' => 'sensor_position', 'type_name' => 'body_location'},
5530 19 => +{'name' => 'descriptor'},
5531 20 => +{'name' => 'ant_transmission_type'},
5532 21 => +{'name' => 'ant_device_number'},
5533 22 => +{'name' => 'ant_network', 'type_name' => 'ant_network'},
5534 24 => +{'name' => 'unknown24'}, # unknown UINT32Z
5535 25 => +{'name' => 'source_type', 'type_name' => 'source_type'},
5536 27 => +{'name' => 'product_name'},
5537 32 => +{'name' => 'battery_level', 'unit' => '%'},
5538 },
5539  
5540 'device_aux_battery_info' => +{
5541 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
5542 0 => +{'name' => 'device_index', 'type_name' => 'device_index'},
5543 1 => +{'name' => 'battery_voltage', 'scale' => 256, 'unit' => 'V'},
5544 2 => +{'name' => 'battery_status', 'type_name' => 'battery_status'},
5545 },
5546  
5547 'training_file' => +{
5548 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
5549 0 => +{'name' => 'type', 'type_name' => 'file'},
5550 1 => +{'name' => 'manufacturer', 'type_name' => 'manufacturer'},
5551  
5552 2 => +{
5553 'name' => 'product',
5554  
5555 'switch' => +{
5556 '_by' => 'manufacturer',
5557 'garmin' => +{'name' => 'garmin_product', 'type_name' => 'garmin_product'},
5558 'dynastream' => +{'name' => 'garmin_product', 'type_name' => 'garmin_product'},
5559 'dynastream_oem' => +{'name' => 'garmin_product', 'type_name' => 'garmin_product'},
5560 'favero_electronics' => +{'name' => 'favero_product', 'type_name' => 'favero_product'},
5561 'tacx' => +{'name' => 'garmin_product', 'type_name' => 'garmin_product'},
5562 },
5563 },
5564  
5565 3 => +{'name' => 'serial_number'},
5566 4 => +{'name' => 'time_created', 'type_name' => 'date_time'},
5567 },
5568  
5569 'weather_conditions' => +{
5570 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
5571 0 => +{'name' => 'weather_report', 'type_name' => 'weather_report'},
5572 1 => +{'name' => 'temperature', 'unit' => 'deg.C'},
5573 2 => +{'name' => 'condition', 'type_name' => 'weather_status'},
5574 3 => +{'name' => 'wind_direction', 'unit' => 'degrees'},
5575 4 => +{'name' => 'wind_speed', 'scale' => 1000, 'unit' => 'm/s'},
5576 5 => +{'name' => 'precipitation_probability'},
5577 6 => +{'name' => 'temperature_feels_like', 'unit' => 'deg.C'},
5578 7 => +{'name' => 'relative_humidity', 'unit' => '%'},
5579 8 => +{'name' => 'location'},
5580 9 => +{'name' => 'observed_at_time', 'type_name' => 'date_time'},
5581 10 => +{'name' => 'observed_location_lat', 'unit' => 'semicircles'},
5582 11 => +{'name' => 'observed_location_long', 'unit' => 'semicircles'},
5583 12 => +{'name' => 'day_of_week', 'type_name' => 'day_of_week'},
5584 13 => +{'name' => 'high_temperature', 'unit' => 'deg.C'},
5585 14 => +{'name' => 'low_temperature', 'unit' => 'deg.C'},
5586 },
5587  
5588 'weather_alert' => +{
5589 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
5590 0 => +{'name' => 'report_id'},
5591 1 => +{'name' => 'issue_time', 'type_name' => 'date_time'},
5592 2 => +{'name' => 'expire_time', 'type_name' => 'date_time'},
5593 3 => +{'name' => 'severity', 'type_name' => 'weather_severity'},
5594 4 => +{'name' => 'type', 'type_name' => 'weather_severe_type'},
5595 },
5596  
5597 'gps_metadata' => +{
5598 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
5599 0 => +{'name' => 'timestamp_ms', 'unit' => 'ms'},
5600 1 => +{'name' => 'position_lat', 'unit' => 'semicircles'},
5601 2 => +{'name' => 'position_long', 'unit' => 'semicircles'},
5602 3 => +{'name' => 'enhanced_altitude', 'scale' => 5, 'offset' => 500, 'unit' => 'm'},
5603 4 => +{'name' => 'enhanced_speed', 'scale' => 1000, 'unit' => 'm/s'},
5604 5 => +{'name' => 'heading', 'scale' => 100, 'unit' => 'degrees'},
5605 6 => +{'name' => 'utc_timestamp', 'type_name' => 'date_time'},
5606 7 => +{'name' => 'velocity', 'scale' => 100, 'unit' => 'm/s'},
5607 },
5608  
5609 'camera_event' => +{
5610 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
5611 0 => +{'name' => 'timestamp_ms', 'unit' => 'ms'},
5612 1 => +{'name' => 'camera_event_type', 'type_name' => 'camera_event_type'},
5613 2 => +{'name' => 'camera_file_uuid'},
5614 3 => +{'name' => 'camera_orientation', 'type_name' => 'camera_orientation_type'},
5615 },
5616  
5617 'gyroscope_data' => +{
5618 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
5619 0 => +{'name' => 'timestamp_ms', 'unit' => 'ms'},
5620 1 => +{'name' => 'sample_time_offset', 'unit' => 'ms'},
5621 2 => +{'name' => 'gyro_x', 'unit' => 'counts'},
5622 3 => +{'name' => 'gyro_y', 'unit' => 'counts'},
5623 4 => +{'name' => 'gyro_z', 'unit' => 'counts'},
5624 5 => +{'name' => 'calibrated_gyro_x', 'unit' => 'deg/s'},
5625 6 => +{'name' => 'calibrated_gyro_y', 'unit' => 'deg/s'},
5626 7 => +{'name' => 'calibrated_gyro_z', 'unit' => 'deg/s'},
5627 },
5628  
5629 'accelerometer_data' => +{
5630 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
5631 0 => +{'name' => 'timestamp_ms', 'unit' => 'ms'},
5632 1 => +{'name' => 'sample_time_offset', 'unit' => 'ms'},
5633 2 => +{'name' => 'accel_x', 'unit' => 'counts'},
5634 3 => +{'name' => 'accel_y', 'unit' => 'counts'},
5635 4 => +{'name' => 'accel_z', 'unit' => 'counts'},
5636 5 => +{'name' => 'calibrated_accel_x', 'unit' => 'g'},
5637 6 => +{'name' => 'calibrated_accel_y', 'unit' => 'g'},
5638 7 => +{'name' => 'calibrated_accel_z', 'unit' => 'g'},
5639 8 => +{'name' => 'compressed_calibrated_accel_x', 'unit' => 'mG'},
5640 9 => +{'name' => 'compressed_calibrated_accel_y', 'unit' => 'mG'},
5641 10 => +{'name' => 'compressed_calibrated_accel_z', 'unit' => 'mG'},
5642 },
5643  
5644 'magnetometer_data' => +{
5645 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
5646 0 => +{'name' => 'timestamp_ms', 'unit' => 'ms'},
5647 1 => +{'name' => 'sample_time_offset', 'unit' => 'ms'},
5648 2 => +{'name' => 'mag_x', 'unit' => 'counts'},
5649 3 => +{'name' => 'mag_y', 'unit' => 'counts'},
5650 4 => +{'name' => 'mag_z', 'unit' => 'counts'},
5651 5 => +{'name' => 'calibrated_mag_x', 'unit' => 'G'},
5652 6 => +{'name' => 'calibrated_mag_y', 'unit' => 'G'},
5653 7 => +{'name' => 'calibrated_mag_z', 'unit' => 'G'},
5654 },
5655  
5656 'barometer_data' => +{
5657 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
5658 0 => +{'name' => 'timestamp_ms', 'unit' => 'ms'},
5659 1 => +{'name' => 'sample_time_offset', 'unit' => 'ms'},
5660 2 => +{'name' => 'baro_pres', 'unit' => 'Pa'},
5661 },
5662  
5663 'three_d_sensor_calibration' => +{
5664 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
5665 0 => +{'name' => 'sensor_type', 'type_name' => 'sensor_type'},
5666  
5667 1 => +{
5668 'name' => 'calibration_factor',
5669  
5670 'switch' => +{
5671 '_by' => 'sensor_type',
5672 'accelerometer' => +{'name' => 'accel_cal_factor'},
5673 'gyroscope' => +{'name' => 'gyro_cal_factor'},
5674 },
5675 },
5676  
5677 2 => +{'name' => 'calibration_divisor', 'unit' => 'counts'},
5678 3 => +{'name' => 'level_shift'},
5679 4 => +{'name' => 'offset_cal'},
5680 5 => +{'name' => 'orientation_matrix', 'scale' => 65535},
5681 },
5682  
5683 'one_d_sensor_calibration' => +{
5684 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
5685 0 => +{'name' => 'sensor_type', 'type_name' => 'sensor_type'},
5686  
5687 1 => +{
5688 'name' => 'calibration_factor',
5689  
5690 'switch' => +{
5691 '_by' => 'sensor_type',
5692 'barometer' => +{'name' => 'baro_cal_factor'},
5693 },
5694 },
5695  
5696 2 => +{'name' => 'calibration_divisor', 'unit' => 'counts'},
5697 3 => +{'name' => 'level_shift'},
5698 4 => +{'name' => 'offset_cal'},
5699 },
5700  
5701 'video_frame' => +{
5702 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
5703 0 => +{'name' => 'timestamp_ms', 'unit' => 'ms'},
5704 1 => +{'name' => 'frame_number'},
5705 },
5706  
5707 'obdii_data' => +{
5708 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
5709 0 => +{'name' => 'timestamp_ms', 'unit' => 'ms'},
5710 1 => +{'name' => 'time_offset', 'unit' => 'ms'},
5711 2 => +{'name' => 'pid'},
5712 3 => +{'name' => 'raw_data'},
5713 4 => +{'name' => 'pid_data_size'},
5714 5 => +{'name' => 'system_time'},
5715 6 => +{'name' => 'start_timestamp', 'type_name' => 'date_time'},
5716 7 => +{'name' => 'start_timestamp_ms', 'unit' => 'ms'},
5717 },
5718  
5719 'nmea_sentence' => +{
5720 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
5721 0 => +{'name' => 'timestamp_ms', 'unit' => 'ms'},
5722 1 => +{'name' => 'sentence'},
5723 },
5724  
5725 'aviation_attitude' => +{
5726 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
5727 0 => +{'name' => 'timestamp_ms', 'unit' => 'ms'},
5728 1 => +{'name' => 'system_time', 'unit' => 'ms'},
5729 2 => +{'name' => 'pitch', 'scale' => 10430.38, 'unit' => 'radians'},
5730 3 => +{'name' => 'roll', 'scale' => 10430.38, 'unit' => 'radians'},
5731 4 => +{'name' => 'accel_lateral', 'scale' => 100, 'unit' => 'm/s^2'},
5732 5 => +{'name' => 'accel_normal', 'scale' => 100, 'unit' => 'm/s^2'},
5733 6 => +{'name' => 'turn_rate', 'scale' => 1024, 'unit' => 'radians/second'},
5734 7 => +{'name' => 'stage', 'type_name' => 'attitude_stage'},
5735 8 => +{'name' => 'attitude_stage_complete', 'unit' => '%'},
5736 9 => +{'name' => 'track', 'scale' => 10430.38, 'unit' => 'radians'},
5737 10 => +{'name' => 'validity', 'type_name' => 'attitude_validity'},
5738 },
5739  
5740 'video' => +{
5741 0 => +{'name' => 'url'},
5742 1 => +{'name' => 'hosting_provider'},
5743 2 => +{'name' => 'duration', 'unit' => 'ms'},
5744 },
5745  
5746 'video_title' => +{
5747 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
5748 0 => +{'name' => 'message_count'},
5749 1 => +{'name' => 'text'},
5750 },
5751  
5752 'video_description' => +{
5753 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
5754 0 => +{'name' => 'message_count'},
5755 1 => +{'name' => 'text'},
5756 },
5757  
5758 'video_clip' => +{
5759 0 => +{'name' => 'clip_number'},
5760 1 => +{'name' => 'start_timestamp', 'type_name' => 'date_time'},
5761 2 => +{'name' => 'start_timestamp_ms', 'unit' => 'ms'},
5762 3 => +{'name' => 'end_timestamp', 'type_name' => 'date_time'},
5763 4 => +{'name' => 'end_timestamp_ms', 'unit' => 'ms'},
5764 6 => +{'name' => 'clip_start', 'unit' => 'ms'},
5765 7 => +{'name' => 'clip_end', 'unit' => 'ms'},
5766 },
5767  
5768 'set' => +{
5769 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
5770 0 => +{'name' => 'duration', 'scale' => 1000, 'unit' => 's'},
5771 3 => +{'name' => 'repetitions'},
5772 4 => +{'name' => 'weight', 'scale' => 16, 'unit' => 'kg'},
5773 5 => +{'name' => 'set_type', 'type_name' => 'set_type'},
5774 6 => +{'name' => 'start_time', 'type_name' => 'date_time'},
5775 7 => +{'name' => 'category', 'type_name' => 'exercise_category'},
5776 8 => +{'name' => 'category_subtype'},
5777 9 => +{'name' => 'weight_display_unit', 'type_name' => 'fit_base_unit'},
5778 10 => +{'name' => 'message_index', 'type_name' => 'message_index'},
5779 11 => +{'name' => 'wkt_step_index', 'type_name' => 'message_index'},
5780 },
5781  
5782 'jump' => +{
5783 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
5784 0 => +{'name' => 'distance', 'unit' => 'm'},
5785 1 => +{'name' => 'height', 'unit' => 'm'},
5786 2 => +{'name' => 'rotations'},
5787 3 => +{'name' => 'hang_time', 'unit' => 's'},
5788 4 => +{'name' => 'score'},
5789 5 => +{'name' => 'position_lat', 'unit' => 'semicircles'},
5790 6 => +{'name' => 'position_long', 'unit' => 'semicircles'},
5791 7 => +{'name' => 'speed', 'scale' => 1000, 'unit' => 'm/s'},
5792 8 => +{'name' => 'enhanced_speed', 'scale' => 1000, 'unit' => 'm/s'},
5793 },
5794  
5795 'split' => +{
5796 0 => +{ 'name' => 'split_type', 'type_name' => 'split_type' },
5797 1 => +{ 'name' => 'total_elapsed_time', 'unit' => 's', 'scale' => 1000 },
5798 2 => +{ 'name' => 'total_timer_time', 'unit' => 's', 'scale' => 1000 },
5799 3 => +{ 'name' => 'total_distance', 'unit' => 'm', 'scale' => 100 },
5800 9 => +{ 'name' => 'start_time', 'type_name' => 'date_time' },
5801 },
5802  
5803 'climb_pro' => +{
5804 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
5805 0 => +{'name' => 'position_lat', 'unit' => 'semicircles'},
5806 1 => +{'name' => 'position_long', 'unit' => 'semicircles'},
5807 2 => +{'name' => 'climb_pro_event', 'type_name' => 'climb_pro_event'},
5808 3 => +{'name' => 'climb_number'},
5809 4 => +{'name' => 'climb_category'},
5810 5 => +{'name' => 'current_dist', 'unit' => 'm'},
5811 },
5812  
5813 'field_description' => +{
5814 0 => +{'name' => 'developer_data_index'},
5815 1 => +{'name' => 'field_definition_number'},
5816 2 => +{'name' => 'fit_base_type_id', 'type_name' => 'fit_base_type'},
5817 3 => +{'name' => 'field_name'},
5818 4 => +{'name' => 'array'},
5819 5 => +{'name' => 'components'},
5820 6 => +{'name' => 'scale'},
5821 7 => +{'name' => 'offset'},
5822 8 => +{'name' => 'units'},
5823 9 => +{'name' => 'bits'},
5824 10 => +{'name' => 'accumulate'},
5825 13 => +{'name' => 'fit_base_unit_id', 'type_name' => 'fit_base_unit'},
5826 14 => +{'name' => 'native_mesg_num', 'type_name' => 'mesg_num'},
5827 15 => +{'name' => 'native_field_num'},
5828 },
5829  
5830 'developer_data_id' => +{
5831 0 => +{'name' => 'developer_id'},
5832 1 => +{'name' => 'application_id'},
5833 2 => +{'name' => 'manufacturer_id', 'type_name' => 'manufacturer'},
5834 3 => +{'name' => 'developer_data_index'},
5835 4 => +{'name' => 'application_version'},
5836 },
5837  
5838 'course' => +{ # begins === Course file messages === section
5839 4 => +{'name' => 'sport', 'type_name' => 'sport'},
5840 5 => +{'name' => 'name'},
5841 6 => +{'name' => 'capabilities', 'type_name' => 'course_capabilities'},
5842 7 => +{'name' => 'sub_sport', 'type_name' => 'sub_sport'},
5843 },
5844  
5845 'course_point' => +{
5846 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
5847 1 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
5848 2 => +{'name' => 'position_lat', 'unit' => 'semicircles'},
5849 3 => +{'name' => 'position_long', 'unit' => 'semicircles'},
5850 4 => +{'name' => 'distance', 'scale' => 100, 'unit' => 'm'},
5851 5 => +{'name' => 'type', 'type_name' => 'course_point'},
5852 6 => +{'name' => 'name'},
5853 8 => +{'name' => 'favorite', 'type_name' => 'bool'},
5854 },
5855  
5856 'segment_id' => +{ # begins === Segment file messages === section
5857 0 => +{'name' => 'name'},
5858 1 => +{'name' => 'uuid'},
5859 2 => +{'name' => 'sport', 'type_name' => 'sport'},
5860 3 => +{'name' => 'enabled', 'type_name' => 'bool'},
5861 4 => +{'name' => 'user_profile_primary_key'},
5862 5 => +{'name' => 'device_id'},
5863 6 => +{'name' => 'default_race_leader'},
5864 7 => +{'name' => 'delete_status', 'type_name' => 'segment_delete_status'},
5865 8 => +{'name' => 'selection_type', 'type_name' => 'segment_selection_type'},
5866 },
5867  
5868 'segment_leaderboard_entry' => +{
5869 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
5870 0 => +{'name' => 'name'},
5871 1 => +{'name' => 'type', 'type_name' => 'segment_leaderboard_type'},
5872 2 => +{'name' => 'group_primary_key'},
5873 3 => +{'name' => 'activity_id'},
5874 4 => +{'name' => 'segment_time', 'scale' => 1000, 'unit' => 's'},
5875 5 => +{'name' => 'activity_id_string'},
5876 },
5877  
5878 'segment_point' => +{
5879 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
5880 1 => +{'name' => 'position_lat', 'unit' => 'semicircles'},
5881 2 => +{'name' => 'position_long', 'unit' => 'semicircles'},
5882 3 => +{'name' => 'distance', 'scale' => 100, 'unit' => 'm'},
5883 4 => +{'name' => 'altitude', 'scale' => 5, 'offset' => 500, 'unit' => 'm'},
5884 5 => +{'name' => 'leader_time', 'scale' => 1000, 'unit' => 's'},
5885 6 => +{ 'name' => 'enhanced_altitude', 'unit' => 'm', 'scale' => 5 }, # Accumulated altitude along the segment at the described point
5886 },
5887  
5888 'segment_lap' => +{
5889 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
5890 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
5891 0 => +{'name' => 'event', 'type_name' => 'event'},
5892 1 => +{'name' => 'event_type', 'type_name' => 'event_type'},
5893 2 => +{'name' => 'start_time', 'type_name' => 'date_time'},
5894 3 => +{'name' => 'start_position_lat', 'unit' => 'semicircles'},
5895 4 => +{'name' => 'start_position_long', 'unit' => 'semicircles'},
5896 5 => +{'name' => 'end_position_lat', 'unit' => 'semicircles'},
5897 6 => +{'name' => 'end_position_long', 'unit' => 'semicircles'},
5898 7 => +{'name' => 'total_elapsed_time', 'scale' => 1000, 'unit' => 's'},
5899 8 => +{'name' => 'total_timer_time', 'scale' => 1000, 'unit' => 's'},
5900 9 => +{'name' => 'total_distance', 'scale' => 100, 'unit' => 'm'},
5901  
5902 10 => +{
5903 'name' => 'total_cycles', 'unit' => 'cycles',
5904  
5905 'switch' => +{
5906 '_by' => 'sport',
5907 'walking' => +{'name' => 'total_steps', 'unit' => 'steps'},
5908 'running' => +{'name' => 'total_strides', 'unit' => 'strides'},
5909 'swimming' => +{'name' => 'total_strokes', 'unit' => 'strokes'},
5910 },
5911 },
5912  
5913 11 => +{'name' => 'total_calories', 'unit' => 'kcal'},
5914 12 => +{'name' => 'total_fat_calories', 'unit' => 'kcal'},
5915 13 => +{'name' => 'avg_speed', 'scale' => 1000, 'unit' => 'm/s'},
5916 14 => +{'name' => 'max_speed', 'scale' => 1000, 'unit' => 'm/s'},
5917 15 => +{'name' => 'avg_heart_rate', 'unit' => 'bpm'},
5918 16 => +{'name' => 'max_heart_rate', 'unit' => 'bpm'},
5919 17 => +{'name' => 'avg_cadence', 'unit' => 'rpm'},
5920 18 => +{'name' => 'max_cadence', 'unit' => 'rpm'},
5921 19 => +{'name' => 'avg_power', 'unit' => 'watts'},
5922 20 => +{'name' => 'max_power', 'unit' => 'watts'},
5923 21 => +{'name' => 'total_ascent', 'unit' => 'm'},
5924 22 => +{'name' => 'total_descent', 'unit' => 'm'},
5925 23 => +{'name' => 'sport', 'type_name' => 'sport'},
5926 24 => +{'name' => 'event_group'},
5927 25 => +{'name' => 'nec_lat', 'unit' => 'semicircles'},
5928 26 => +{'name' => 'nec_long', 'unit' => 'semicircles'},
5929 27 => +{'name' => 'swc_lat', 'unit' => 'semicircles'},
5930 28 => +{'name' => 'swc_long', 'unit' => 'semicircles'},
5931 29 => +{'name' => 'name'},
5932 30 => +{'name' => 'normalized_power', 'unit' => 'watts'},
5933 31 => +{'name' => 'left_right_balance', 'type_name' => 'left_right_balance_100'},
5934 32 => +{'name' => 'sub_sport', 'type_name' => 'sub_sport'},
5935 33 => +{'name' => 'total_work', 'unit' => 'J'},
5936 34 => +{'name' => 'avg_altitude', 'scale' => 5, 'offset' => 500, 'unit' => 'm'},
5937 35 => +{'name' => 'max_altitude', 'scale' => 5, 'offset' => 500, 'unit' => 'm'},
5938 36 => +{'name' => 'gps_accuracy', 'unit' => 'm'},
5939 37 => +{'name' => 'avg_grade', 'scale' => 100, 'unit' => '%'},
5940 38 => +{'name' => 'avg_pos_grade', 'scale' => 100, 'unit' => '%'},
5941 39 => +{'name' => 'avg_neg_grade', 'scale' => 100, 'unit' => '%'},
5942 40 => +{'name' => 'max_pos_grade', 'scale' => 100, 'unit' => '%'},
5943 41 => +{'name' => 'max_neg_grade', 'scale' => 100, 'unit' => '%'},
5944 42 => +{'name' => 'avg_temperature', 'unit' => 'deg.C'},
5945 43 => +{'name' => 'max_temperature', 'unit' => 'deg.C'},
5946 44 => +{'name' => 'total_moving_time', 'scale' => 1000, 'unit' => 's'},
5947 45 => +{'name' => 'avg_pos_vertical_speed', 'scale' => 1000, 'unit' => 'm/s'},
5948 46 => +{'name' => 'avg_neg_vertical_speed', 'scale' => 1000, 'unit' => 'm/s'},
5949 47 => +{'name' => 'max_pos_vertical_speed', 'scale' => 1000, 'unit' => 'm/s'},
5950 48 => +{'name' => 'max_neg_vertical_speed', 'scale' => 1000, 'unit' => 'm/s'},
5951 49 => +{'name' => 'time_in_hr_zone', 'scale' => 1000, 'unit' => 's'},
5952 50 => +{'name' => 'time_in_speed_zone', 'scale' => 1000, 'unit' => 's'},
5953 51 => +{'name' => 'time_in_cadence_zone', 'scale' => 1000, 'unit' => 's'},
5954 52 => +{'name' => 'time_in_power_zone', 'scale' => 1000, 'unit' => 's'},
5955 53 => +{'name' => 'repetition_num'},
5956 54 => +{'name' => 'min_altitude', 'scale' => 5, 'offset' => 500, 'unit' => 'm'},
5957 55 => +{'name' => 'min_heart_rate', 'unit' => 'bpm'},
5958 56 => +{'name' => 'active_time', 'scale' => 1000, 'unit' => 's'},
5959 57 => +{'name' => 'wkt_step_index', 'type_name' => 'message_index'},
5960 58 => +{'name' => 'sport_event', 'type_name' => 'sport_event'},
5961 59 => +{'name' => 'avg_left_torque_effectiveness', 'scale' => 2, 'unit' => '%'},
5962 60 => +{'name' => 'avg_right_torque_effectiveness', 'scale' => 2, 'unit' => '%'},
5963 61 => +{'name' => 'avg_left_pedal_smoothness', 'scale' => 2, 'unit' => '%'},
5964 62 => +{'name' => 'avg_right_pedal_smoothness', 'scale' => 2, 'unit' => '%'},
5965 63 => +{'name' => 'avg_combined_pedal_smoothness', 'scale' => 2, 'unit' => '%'},
5966 64 => +{'name' => 'status', 'type_name' => 'segment_lap_status'},
5967 65 => +{'name' => 'uuid'},
5968 66 => +{'name' => 'avg_fractional_cadence', 'scale' => 128, 'unit' => 'rpm'},
5969 67 => +{'name' => 'max_fractional_cadence', 'scale' => 128, 'unit' => 'rpm'},
5970 68 => +{'name' => 'total_fractional_cycles', 'scale' => 128, 'unit' => 'cycles'},
5971 69 => +{'name' => 'front_gear_shift_count'},
5972 70 => +{'name' => 'rear_gear_shift_count'},
5973 71 => +{'name' => 'time_standing', 'scale' => 1000, 'unit' => 's'},
5974 72 => +{'name' => 'stand_count'},
5975 73 => +{'name' => 'avg_left_pco', 'unit' => 'mm'},
5976 74 => +{'name' => 'avg_right_pco', 'unit' => 'mm'},
5977 75 => +{'name' => 'avg_left_power_phase', 'scale' => 0.7111111, 'unit' => 'degrees'},
5978 76 => +{'name' => 'avg_left_power_phase_peak', 'scale' => 0.7111111, 'unit' => 'degrees'},
5979 77 => +{'name' => 'avg_right_power_phase', 'scale' => 0.7111111, 'unit' => 'degrees'},
5980 78 => +{'name' => 'avg_right_power_phase_peak', 'scale' => 0.7111111, 'unit' => 'degrees'},
5981 79 => +{'name' => 'avg_power_position', 'unit' => 'watts'},
5982 80 => +{'name' => 'max_power_position', 'unit' => 'watts'},
5983 81 => +{'name' => 'avg_cadence_position', 'unit' => 'rpm'},
5984 82 => +{'name' => 'max_cadence_position', 'unit' => 'rpm'},
5985 83 => +{'name' => 'manufacturer', 'type_name' => 'manufacturer'},
5986 84 => +{'name' => 'total_grit', 'unit' => 'kGrit'},
5987 85 => +{'name' => 'total_flow', 'unit' => 'Flow'},
5988 86 => +{'name' => 'avg_grit', 'unit' => 'kGrit'},
5989 87 => +{'name' => 'avg_flow', 'unit' => 'Flow'},
5990 89 => +{'name' => 'total_fractional_ascent', 'unit' => 'm'},
5991 90 => +{'name' => 'total_fractional_descent', 'unit' => 'm'},
5992 91 => +{ 'name' => 'enhanced_avg_altitude', 'unit' => 'm', 'scale' => 5 },
5993 92 => +{ 'name' => 'enhanced_max_altitude', 'unit' => 'm', 'scale' => 5 },
5994 93 => +{ 'name' => 'enhanced_min_altitude', 'unit' => 'm', 'scale' => 5 },
5995 },
5996  
5997 'segment_file' => +{ # begins === Segment list file messages === section
5998 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
5999 1 => +{'name' => 'file_uuid'},
6000 3 => +{'name' => 'enabled', 'type_name' => 'bool'},
6001 4 => +{'name' => 'user_profile_primary_key'},
6002 7 => +{'name' => 'leader_type', 'type_name' => 'segment_leaderboard_type'},
6003 8 => +{'name' => 'leader_group_primary_key'},
6004 9 => +{'name' => 'leader_activity_id'},
6005 10 => +{'name' => 'leader_activity_id_string'},
6006 11 => +{'name' => 'default_race_leader'},
6007 },
6008  
6009 'workout' => +{ # begins === Workout file messages === section
6010 4 => +{'name' => 'sport', 'type_name' => 'sport'},
6011 5 => +{'name' => 'capabilities', 'type_name' => 'workout_capabilities'},
6012 6 => +{'name' => 'num_valid_steps'},
6013 7 => +{'name' => 'protection'}, # not present?
6014 8 => +{'name' => 'wkt_name'},
6015 11 => +{'name' => 'sub_sport', 'type_name' => 'sub_sport'},
6016 14 => +{'name' => 'pool_length', 'scale' => 100, 'unit' => 'm'},
6017 15 => +{'name' => 'pool_length_unit', 'type_name' => 'display_measure'},
6018 },
6019  
6020 'workout_session' => +{
6021 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
6022 0 => +{'name' => 'sport', 'type_name' => 'sport'},
6023 1 => +{'name' => 'sub_sport', 'type_name' => 'sub_sport'},
6024 2 => +{'name' => 'num_valid_steps'},
6025 3 => +{'name' => 'first_step_index'},
6026 4 => +{'name' => 'pool_length', 'scale' => 100, 'unit' => 'm'},
6027 5 => +{'name' => 'pool_length_unit', 'type_name' => 'display_measure'},
6028 },
6029  
6030 'workout_step' => +{
6031 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
6032 0 => +{'name' => 'wkt_step_name'},
6033 1 => +{'name' => 'duration_type', 'type_name' => 'wkt_step_duration'},
6034  
6035 2 => +{
6036 'name' => 'duration_value',
6037  
6038 'switch' => +{
6039 '_by' => 'duration_type',
6040 'time' => +{'name' => 'duration_time', 'scale' => 1000, 'unit' => 's'},
6041 'repetition_time' => +{'name' => 'duration_time', 'scale' => 1000, 'unit' => 's'},
6042 'distance' => +{'name' => 'duration_distance', 'scale' => 100, 'unit' => 'm'},
6043 'hr_less_than' => +{'name' => 'duration_hr', 'type_name' => 'workout_hr', 'unit' => 'bpm'},
6044 'hr_greater_than' => +{'name' => 'duration_hr', 'type_name' => 'workout_hr', 'unit' => 'bpm'},
6045 'calories' => +{'name' => 'duration_calories', 'unit' => 'kcal'},
6046 'repeat_until_steps_cmplt' => +{'name' => 'duration_step'},
6047 'repeat_until_time' => +{'name' => 'duration_step'},
6048 'repeat_until_distance' => +{'name' => 'duration_step'},
6049 'repeat_until_calories' => +{'name' => 'duration_step'},
6050 'repeat_until_hr_less_than' => +{'name' => 'duration_step'},
6051 'repeat_until_hr_greater_than' => +{'name' => 'duration_step'},
6052 'repeat_until_power_less_than' => +{'name' => 'duration_step'},
6053 'repeat_until_power_greater_than' => +{'name' => 'duration_step'},
6054 'power_less_than' => +{'name' => 'duration_power', 'type_name' => 'workout_power', 'unit' => 'watts'},
6055 'power_greater_than' => +{'name' => 'duration_power', 'type_name' => 'workout_power', 'unit' => 'watts'},
6056 'reps' => +{'name' => 'duration_reps'},
6057 },
6058 },
6059  
6060 3 => +{'name' => 'target_type', 'type_name' => 'wkt_step_target'},
6061  
6062 4 => +{
6063 'name' => 'target_value',
6064  
6065 'switch' => +{
6066 '_by' => [qw(target_type duration_type)],
6067 'speed' => +{'name' => 'target_speed_zone'},
6068 'heart_rate' => +{'name' => 'target_hr_zone'},
6069 'cadence' => +{'name' => 'target_cadence_zone'},
6070 'power' => +{'name' => 'target_power_zone'},
6071 'repeat_until_steps_cmplt' => +{'name' => 'repeat_steps'},
6072 'repeat_until_time' => +{'name' => 'repeat_time', 'scale' => 1000, 'unit' => 's'},
6073 'repeat_until_distance' => +{'name' => 'repeat_distance', 'scale' => 100, 'unit' => 'm'},
6074 'repeat_until_calories' => +{'name' => 'repeat_calories', 'unit' => 'kcal'},
6075 'repeat_until_hr_less_than' => +{'name' => 'repeat_hr', 'type_name' => 'workout_hr', 'unit' => 'bpm'},
6076 'repeat_until_hr_greater_than' => +{'name' => 'repeat_hr', 'type_name' => 'workout_hr', 'unit' => 'bpm'},
6077 'repeat_until_power_less_than' => +{'name' => 'repeat_power', 'type_name' => 'workout_power', 'unit' => 'watts'},
6078 'repeat_until_power_greater_than' => +{'name' => 'repeat_power', 'type_name' => 'workout_power', 'unit' => 'watts'},
6079 'swim_stroke' => +{'name' => 'target_stroke_type', 'type_name' => 'swim_stroke'},
6080 },
6081 },
6082  
6083 5 => +{
6084 'name' => 'custom_target_value_low',
6085  
6086 'switch' => +{
6087 '_by' => 'target_type',
6088 'speed' => +{'name' => 'custom_target_speed_low', 'scale' => 1000, 'unit' => 'm/s'},
6089 'heart_rate' => +{'name' => 'custom_target_heart_rate_low', 'type_name' => 'workout_hr', 'unit' => 'bpm'},
6090 'cadence' => +{'name' => 'custom_target_cadence_low', 'unit' => 'rpm'},
6091 'power' => +{'name' => 'custom_target_power_low', 'type_name' => 'workout_power', 'unit' => 'watts'},
6092 },
6093 },
6094  
6095 6 => +{
6096 'name' => 'custom_target_value_high',
6097  
6098 'switch' => +{
6099 '_by' => 'target_type',
6100 'speed' => +{'name' => 'custom_target_speed_high', 'scale' => 1000, 'unit' => 'm/s'},
6101 'heart_rate' => +{'name' => 'custom_target_heart_rate_high', 'type_name' => 'workout_hr', 'unit' => 'bpm'},
6102 'cadence' => +{'name' => 'custom_target_cadence_high', 'unit' => 'rpm'},
6103 'power' => +{'name' => 'custom_target_power_high', 'type_name' => 'workout_power', 'unit' => 'watts'},
6104 },
6105 },
6106  
6107 7 => +{'name' => 'intensity', 'type_name' => 'intensity'},
6108 8 => +{'name' => 'notes', 'type_name' => 'string'},
6109 9 => +{'name' => 'equipment', 'type_name' => 'workout_equipment'},
6110 10 => +{'name' => 'exercise_category', 'type_name' => 'exercise_category'},
6111 11 => +{'name' => 'exercise_name'},
6112 12 => +{'name' => 'exercise_weight', 'scale' => 100, 'unit' => 'kg'},
6113 13 => +{'name' => 'weight_display_unit', 'type_name' => 'fit_base_unit'},
6114 19 => +{'name' => 'secondary_target_type', 'type_name' => 'wkt_step_target'},
6115 20 => +{
6116 'name' => 'secondary_target_value',
6117 'switch' => +{
6118 '_by' => 'secondary_target_type',
6119 'speed' => +{'name' => 'secondary_target_speed_zone'},
6120 'heart_rate' => +{'name' => 'secondary_target_hr_zone'},
6121 'cadence' => +{'name' => 'secondary_target_cadence_zone'},
6122 'power' => +{'name' => 'secondary_target_power_zone'},
6123 'swim_stroke' => +{'name' => 'secondary_target_stroke_type', 'type_name' => 'swim_stroke'},
6124 },
6125 },
6126 },
6127  
6128 'exercise_title' => +{
6129 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
6130 0 => +{'name' => 'exercise_category', 'type_name' => 'exercise_category'},
6131 1 => +{'name' => 'exercise_name'},
6132 2 => +{'name' => 'wkt_step_name', 'type_name' => 'string'},
6133 },
6134  
6135 'schedule' => +{ # begins === Schedule file messages === section
6136 0 => +{'name' => 'manufacturer', 'type_name' => 'manufacturer'},
6137  
6138 1 => +{
6139 'name' => 'product',
6140  
6141 'switch' => +{
6142 '_by' => 'manufacturer',
6143 'garmin' => +{'name' => 'garmin_product', 'type_name' => 'garmin_product'},
6144 'dynastream' => +{'name' => 'garmin_product', 'type_name' => 'garmin_product'},
6145 'dynastream_oem' => +{'name' => 'garmin_product', 'type_name' => 'garmin_product'},
6146 'favero_electronics' => +{'name' => 'favero_product', 'type_name' => 'favero_product'},
6147 'tacx' => +{'name' => 'garmin_product', 'type_name' => 'garmin_product'},
6148 },
6149 },
6150  
6151 2 => +{'name' => 'serial_number'},
6152 3 => +{'name' => 'time_created', 'type_name' => 'date_time'},
6153 4 => +{'name' => 'completed', 'type_name' => 'bool'},
6154 5 => +{'name' => 'type', 'type_name' => 'schedule'},
6155 6 => +{'name' => 'schedule_time', 'type_name' => 'local_date_time'},
6156 },
6157  
6158 'totals' => +{ # begins === Totals file messages === section
6159 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
6160 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
6161 0 => +{'name' => 'timer_time', 'unit' => 's'},
6162 1 => +{'name' => 'distance', 'unit' => 'm'},
6163 2 => +{'name' => 'calories', 'unit' => 'kcal'},
6164 3 => +{'name' => 'sport', 'type_name' => 'sport'},
6165 4 => +{'name' => 'elapsed_time', 'unit' => 's'},
6166 5 => +{'name' => 'sessions'},
6167 6 => +{'name' => 'active_time', 'unit' => 's'},
6168 9 => +{'name' => 'sport_index'},
6169 10 => +{'name' => 'profile_name'}, # unknown STRING
6170 },
6171  
6172 'weight_scale' => +{ # begins === Weight scale file messages === section
6173 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
6174 0 => +{'name' => 'weight', 'type_name' => 'weight', 'scale' => 100, 'unit' => 'kg'},
6175 1 => +{'name' => 'percent_fat', 'scale' => 100, 'unit' => '%'},
6176 2 => +{'name' => 'percent_hydration', 'scale' => 100, 'unit' => '%'},
6177 3 => +{'name' => 'visceral_fat_mass', 'scale' => 100, 'unit' => 'kg'},
6178 4 => +{'name' => 'bone_mass', 'scale' => 100, 'unit' => 'kg'},
6179 5 => +{'name' => 'muscle_mass', 'scale' => 100, 'unit' => 'kg'},
6180 7 => +{'name' => 'basal_met', 'scale' => 4, 'unit' => 'kcal/day'},
6181 8 => +{'name' => 'physique_rating'},
6182 9 => +{'name' => 'active_met', 'scale' => 4, 'unit' => 'kcal/day'},
6183 10 => +{'name' => 'metabolic_age', 'unit' => 'years'},
6184 11 => +{'name' => 'visceral_fat_rating'},
6185 12 => +{'name' => 'user_profile_index', 'type_name' => 'message_index'},
6186 },
6187  
6188 'blood_pressure' => +{ # begins === Blood pressure file messages === section
6189 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
6190 0 => +{'name' => 'systolic_pressure', 'unit' => 'mmHg'},
6191 1 => +{'name' => 'diastolic_pressure', 'unit' => 'mmHg'},
6192 2 => +{'name' => 'mean_arterial_pressure', 'unit' => 'mmHg'},
6193 3 => +{'name' => 'map_3_sample_mean', 'unit' => 'mmHg'},
6194 4 => +{'name' => 'map_morning_values', 'unit' => 'mmHg'},
6195 5 => +{'name' => 'map_evening_values', 'unit' => 'mmHg'},
6196 6 => +{'name' => 'heart_rate', 'unit' => 'bpm'},
6197 7 => +{'name' => 'heart_rate_type', 'type_name' => 'hr_type'},
6198 8 => +{'name' => 'status', 'type_name' => 'bp_status'},
6199 9 => +{'name' => 'user_profile_index', 'type_name' => 'message_index'},
6200 },
6201  
6202 'monitoring_info' => +{ # begins === Monitoring file messages === section
6203 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
6204 0 => +{'name' => 'local_timestamp', 'type_name' => 'local_date_time'},
6205 1 => +{'name' => 'activity_type', 'type_name' => 'activity_type'},
6206 3 => +{'name' => 'cycles_to_distance', 'scale' => 5000, 'unit' => 'm/cycle'},
6207 4 => +{'name' => 'cycles_to_calories', 'scale' => 5000, 'unit' => 'kcal/cycle'},
6208 5 => +{'name' => 'resting_metabolic_rate', 'unit' => 'kcal/day'},
6209 },
6210  
6211 'monitoring' => +{
6212 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
6213 0 => +{'name' => 'device_index', 'type_name' => 'device_index'},
6214 1 => +{'name' => 'calories', 'unit' => 'kcal'},
6215 2 => +{'name' => 'distance', 'scale' => 100, 'unit' => 'm'},
6216  
6217 3 => +{
6218 'name' => 'cycles', 'scale' => 2, 'unit' => 'cycles',
6219  
6220 'switch' => +{
6221 '_by' => 'activity_type',
6222 'walking' => +{'name' => 'total_steps', 'scale' => 1, 'unit' => 'steps'},
6223 'running' => +{'name' => 'total_strides', 'scale' => 1, 'unit' => 'strides'},
6224 'cycling' => +{'name' => 'total_strokes', 'scale' => 2, 'unit' => 'strokes'},
6225 'swimming' => +{'name' => 'total_strokes', 'scale' => 2, 'unit' => 'strokes'},
6226 },
6227 },
6228  
6229 4 => +{'name' => 'active_time', 'scale' => 1000, 'unit' => 's'},
6230 5 => +{'name' => 'activity_type', 'type_name' => 'activity_type'},
6231 6 => +{'name' => 'activity_subtype', 'type_name' => 'activity_subtype'},
6232 7 => +{'name' => 'activity_level', 'type_name' => 'activity_level'},
6233 8 => +{'name' => 'distance_16', 'scale' => 100, 'unit' => 'm'},
6234 9 => +{'name' => 'cycles_16', 'scale' => 2, 'unit' => 'cycles'},
6235 10 => +{'name' => 'active_time_16', 'unit' => 's'},
6236 11 => +{'name' => 'local_timestamp', 'type_name' => 'local_date_time'},
6237 12 => +{'name' => 'temperature', 'scale' => 100, 'unit' => 'deg.C'},
6238 14 => +{'name' => 'temperature_min', 'scale' => 100, 'unit' => 'deg.C'},
6239 15 => +{'name' => 'temperature_max', 'scale' => 100, 'unit' => 'deg.C'},
6240 16 => +{'name' => 'activity_time', 'unit' => 'min'},
6241 19 => +{'name' => 'active_calories', 'unit' => 'kcal'},
6242 24 => +{'name' => 'current_activity_type_intensity'}, # complex decoding!
6243 25 => +{'name' => 'timestamp_min_8', 'unit' => 'min'},
6244 26 => +{'name' => 'timestamp_16', 'unit' => 's'},
6245 27 => +{'name' => 'heart_rate', 'unit' => 'bpm'},
6246 28 => +{'name' => 'intensity', 'scale' => 10},
6247 29 => +{'name' => 'duration_min', 'unit' => 'min'},
6248 30 => +{'name' => 'duration', 'unit' => 's'},
6249 31 => +{'name' => 'ascent', 'scale' => 1000, 'unit' => 'm'},
6250 32 => +{'name' => 'descent', 'scale' => 1000, 'unit' => 'm'},
6251 33 => +{'name' => 'moderate_activity_minutes', 'unit' => 'min'},
6252 34 => +{'name' => 'vigorous_activity_minutes', 'unit' => 'min'},
6253 },
6254  
6255 'hr' => +{
6256 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
6257 0 => +{'name' => 'fractional_timestamp', 'scale' => 32768, 'unit' => 's'},
6258 1 => +{'name' => 'time256', 'scale' => 256, 'unit' => 's'},
6259 6 => +{'name' => 'filtered_bpm', 'unit' => 'bpm'},
6260 9 => +{'name' => 'event_timestamp', 'scale' => 1024, 'unit' => 's'},
6261 10 => +{'name' => 'event_timestamp_12', 'scale' => 1024, 'unit' => 's'},
6262 },
6263  
6264 'stress_level' => +{
6265 0 => +{'name' => 'stress_level_value'},
6266 1 => +{'name' => 'stress_level_time', 'type_name' => 'date_time', 'unit' => 's'},
6267 },
6268  
6269 'memo_glob' => +{ # begins === Other messages === section
6270 250 => +{'name' => 'part_index'},
6271 0 => +{'name' => 'memo'},
6272 1 => +{'name' => 'message_number'},
6273 2 => +{'name' => 'message_index', 'type_name' => 'message_index'},
6274 },
6275  
6276 'ant_channel_id' => +{
6277 0 => +{'name' => 'channel_number'},
6278 1 => +{'name' => 'device_type'},
6279 2 => +{'name' => 'device_number'},
6280 3 => +{'name' => 'transmission_type'},
6281 4 => +{'name' => 'device_index', 'type_name' => 'device_index'},
6282 },
6283  
6284 'ant_rx' => +{
6285 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
6286 0 => +{'name' => 'fractional_timestamp', 'scale' => 32768, 'unit' => 's'},
6287 1 => +{'name' => 'mesg_id'},
6288 2 => +{'name' => 'mesg_data'},
6289 3 => +{'name' => 'channel_number'},
6290 4 => +{'name' => 'data'},
6291 },
6292  
6293 'ant_tx' => +{
6294 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
6295 0 => +{'name' => 'fractional_timestamp', 'scale' => 32768, 'unit' => 's'},
6296 1 => +{'name' => 'mesg_id'},
6297 2 => +{'name' => 'mesg_data'},
6298 3 => +{'name' => 'channel_number'},
6299 4 => +{'name' => 'data'},
6300 },
6301  
6302 'exd_screen_configuration' => +{
6303 0 => +{'name' => 'screen_index'},
6304 1 => +{'name' => 'field_count'},
6305 2 => +{'name' => 'layout', 'type_name' => 'exd_layout'},
6306 3 => +{'name' => 'screen_enabled', 'type_name' => 'bool'},
6307 },
6308  
6309 'exd_data_field_configuration' => +{
6310 0 => +{'name' => 'screen_index'},
6311 1 => +{'name' => 'concept_field'}, # complex decoding!
6312 2 => +{'name' => 'field_id'},
6313 3 => +{'name' => 'concept_count'},
6314 4 => +{'name' => 'display_type', 'type_name' => 'exd_display_type'},
6315 5 => +{'name' => 'title'},
6316 },
6317  
6318 'exd_data_concept_configuration' => +{
6319 0 => +{'name' => 'screen_index'},
6320 1 => +{'name' => 'concept_field'}, # complex decoding!
6321 2 => +{'name' => 'field_id'},
6322 3 => +{'name' => 'concept_index'},
6323 4 => +{'name' => 'data_page'},
6324 5 => +{'name' => 'concept_key'},
6325 6 => +{'name' => 'scaling'},
6326 7 => +{'name' => 'unknown7'}, # unknown UINT8
6327 8 => +{'name' => 'data_units', 'type_name' => 'exd_data_units'},
6328 9 => +{'name' => 'qualifier', 'type_name' => 'exd_qualifiers'},
6329 10 => +{'name' => 'descriptor', 'type_name' => 'exd_descriptors'},
6330 11 => +{'name' => 'is_signed', 'type_name' => 'bool'},
6331 },
6332  
6333 'dive_summary' => +{
6334 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
6335 0 => +{'name' => 'reference_mesg', 'type_name' => 'mesg_num'},
6336 1 => +{'name' => 'reference_index', 'type_name' => 'message_index'},
6337 2 => +{'name' => 'avg_depth', 'scale' => 1000, 'unit' => 'm'},
6338 3 => +{'name' => 'max_depth', 'scale' => 1000, 'unit' => 'm'},
6339 4 => +{'name' => 'surface_interval', 'unit' => 's'},
6340 5 => +{'name' => 'start_cns', 'unit' => '%'},
6341 6 => +{'name' => 'end_cns', 'unit' => '%'},
6342 7 => +{'name' => 'start_n2', 'unit' => '%'},
6343 8 => +{'name' => 'end_n2', 'unit' => '%'},
6344 9 => +{'name' => 'o2_toxicity'},
6345 10 => +{'name' => 'dive_number'},
6346 11 => +{'name' => 'bottom_time', 'scale' => 1000, 'unit' => 's'},
6347 12 => +{ 'name' => 'avg_pressure_sac', 'unit' => 'bar/min', 'scale' => 100 },# Average pressure-based surface air consumption
6348 13 => +{ 'name' => 'avg_volume_sac', 'unit' => 'l/min', 'scale' => 100 }, # Average volumetric surface air consumption
6349 14 => +{ 'name' => 'avg_rmv', 'unit' => 'l/min', 'scale' => 100 }, # Average respiratory minute volume
6350 15 => +{ 'name' => 'descent_time', 'unit' => 's', 'scale' => 1000 }, # Time to reach deepest level stop
6351 16 => +{ 'name' => 'ascent_time', 'unit' => 's', 'scale' => 1000 }, # Time after leaving bottom until reaching surface
6352 17 => +{ 'name' => 'avg_ascent_rate', 'unit' => 'm/s', 'scale' => 1000 }, # Average ascent rate, not including descents or stops
6353 22 => +{ 'name' => 'avg_descent_rate', 'unit' => 'm/s', 'scale' => 1000 }, # Average descent rate, not including ascents or stops
6354 23 => +{ 'name' => 'max_ascent_rate', 'unit' => 'm/s', 'scale' => 1000 }, # Maximum ascent rate
6355 24 => +{ 'name' => 'max_descent_rate', 'unit' => 'm/s', 'scale' => 1000 }, # Maximum descent rate
6356 25 => +{ 'name' => 'hang_time', 'unit' => 's', 'scale' => 1000 }, # Time spent neither ascending nor descending
6357 },
6358  
6359 'hrv' => +{ # heart rate variability
6360 0 => +{'name' => 'time', 'scale' => 1000, 'unit' => 's'},
6361 },
6362  
6363 'tank_update' => +{
6364 253 => +{ 'name' => 'timestamp', 'type_name' => 'date_time' },
6365 0 => +{ 'name' => 'sensor', 'type_name' => 'ant_channel_id' },
6366 1 => +{ 'name' => 'pressure', 'unit' => 'bar', 'scale' => 100 },
6367 },
6368  
6369 'tank_summary' => +{
6370 253 => +{ 'name' => 'timestamp', 'type_name' => 'date_time' },
6371 0 => +{ 'name' => 'sensor', 'type_name' => 'ant_channel_id' },
6372 1 => +{ 'name' => 'start_pressure', 'unit' => 'bar', 'scale' => 100 },
6373 2 => +{ 'name' => 'end_pressure', 'unit' => 'bar', 'scale' => 100 },
6374 3 => +{ 'name' => 'volume_used', 'unit' => 'l', 'scale' => 100 },
6375 },
6376  
6377 'pad' => +{
6378 0 => +{'name' => 'pad'},
6379 },
6380  
6381 'source' => +{ # begins === Undocumented messages === section
6382 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
6383 # device_index in device_info
6384 0 => +{'name' => 'unknown0', 'type_name' => 'device_index'}, # unknown UINT8
6385 1 => +{'name' => 'unknown1', 'type_name' => 'device_index'}, # unknown UINT8
6386 2 => +{'name' => 'unknown2', 'type_name' => 'device_index'}, # unknown UINT8
6387 3 => +{'name' => 'unknown3', 'type_name' => 'device_index'}, # unknown UINT8
6388 4 => +{'name' => 'unknown4', 'type_name' => 'device_index'}, # unknown UINT8
6389 5 => +{'name' => 'unknown5'}, # unknown ENUM
6390 6 => +{'name' => 'unknown6'}, # unknown UINT8
6391 7 => +{'name' => 'unknown7'}, # unknown UINT8
6392 8 => +{'name' => 'unknown8'}, # unknown UINT8
6393 9 => +{'name' => 'unknown9'}, # unknown UINT8
6394 },
6395  
6396 'location' => +{
6397 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
6398 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
6399 0 => +{'name' => 'name'}, # unknown STRING
6400 1 => +{'name' => 'position_lat', 'unit' => 'semicircles'}, # unknown SINT32
6401 2 => +{'name' => 'position_long', 'unit' => 'semicircles'}, # unknown SINT32
6402 3 => +{'name' => 'unknown3'}, # unknown UINT16 (elevation?)
6403 4 => +{'name' => 'unknown4'}, # unknown UINT16
6404 5 => +{'name' => 'unknown5'}, # unknown UINT16
6405 6 => +{'name' => 'unknown6'}, # unknown STRING
6406 },
6407  
6408 'battery' => +{
6409 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
6410 0 => +{'name' => 'unknown0'}, # unknown UINT16 (voltage with scale?)
6411 1 => +{'name' => 'unknown1'}, # unknown SINT16
6412 2 => +{'name' => 'charge_level', 'unit' => '%'}, # unknown UINT8
6413 3 => +{'name' => 'temperature', 'unit' => 'deg.C'}, # unknown SINT8
6414 },
6415  
6416 'sensor' => +{
6417 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
6418 0 => +{'name' => 'unknown0'}, # unknown UINT32Z
6419 1 => +{'name' => 'unknown1'}, # unknown UINT8
6420 2 => +{'name' => 'sensor_id'}, # unknown STRING
6421 3 => +{'name' => 'unknown3'}, # unknown ENUM
6422 4 => +{'name' => 'unknown4'}, # unknown ENUM
6423 5 => +{'name' => 'unknown5'}, # unknown ENUM
6424 6 => +{'name' => 'unknown6'}, # unknown ENUM
6425 7 => +{'name' => 'unknown7'}, # unknown ENUM
6426 8 => +{'name' => 'unknown8'}, # unknown ENUM
6427 9 => +{'name' => 'unknown9'}, # unknown UINT8
6428 10 => +{'name' => 'wheel_size', 'unit' => 'mm'}, # unknown UINT16
6429 11 => +{'name' => 'unknown11'}, # unknown UINT16
6430 12 => +{'name' => 'unknown12'}, # unknown UINT8
6431 13 => +{'name' => 'unknown13'}, # unknown UINT32
6432 14 => +{'name' => 'unknown14'}, # unknown UINT8
6433 15 => +{'name' => 'unknown15'}, # unknown UINT8
6434 16 => +{'name' => 'unknown16'}, # unknown UINT8
6435 17 => +{'name' => 'unknown17'}, # unknown UINT8Z
6436 18 => +{'name' => 'unknown18'}, # unknown UINT8Z (array[4])
6437 19 => +{'name' => 'unknown19'}, # unknown UINT8Z
6438 20 => +{'name' => 'unknown20'}, # unknown UINT8Z (array[12])
6439 21 => +{'name' => 'unknown21'}, # unknown UINT16
6440 25 => +{'name' => 'unknown25'}, # unknown UINT16
6441 26 => +{'name' => 'unknown26'}, # unknown UINT16
6442 27 => +{'name' => 'unknown27'}, # unknown UINT8
6443 28 => +{'name' => 'unknown28'}, # unknown UINT8 (array[4])
6444 29 => +{'name' => 'unknown29'}, # unknown UINT8 (array[4])
6445 30 => +{'name' => 'unknown30'}, # unknown UINT8 (array[4])
6446 31 => +{'name' => 'unknown31'}, # unknown UINT8
6447 32 => +{'name' => 'unknown32'}, # unknown UINT16
6448 33 => +{'name' => 'unknown33'}, # unknown UINT16
6449 34 => +{'name' => 'unknown34'}, # unknown UINT16
6450 35 => +{'name' => 'unknown35'}, # unknown UINT16
6451 36 => +{'name' => 'unknown36'}, # unknown ENUM
6452 37 => +{'name' => 'unknown37'}, # unknown ENUM (array[7])
6453 38 => +{'name' => 'unknown38'}, # unknown ENUM (array[7])
6454 39 => +{'name' => 'unknown39'}, # unknown ENUM (array[7])
6455 40 => +{'name' => 'unknown40'}, # unknown UINT16Z
6456 41 => +{'name' => 'unknown41'}, # unknown UINT8 (array[7])
6457 42 => +{'name' => 'unknown42'}, # unknown ENUM
6458 43 => +{'name' => 'unknown43'}, # unknown ENUM
6459 44 => +{'name' => 'unknown44'}, # unknown UINT8Z
6460 47 => +{'name' => 'unknown47'}, # unknown ENUM
6461 48 => +{'name' => 'unknown48'}, # unknown ENUM
6462 },
6463  
6464 );
6465  
6466 16 my %msgtype_by_num = (
6467 13 => +{ # begins === Unknown messages === section
6468 '_number' => 13,
6469 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
6470 1 => +{'name' => 'unknown1'}, # unknown ENUM
6471 2 => +{'name' => 'unknown2'}, # unknown UINT16
6472 3 => +{'name' => 'unknown3'}, # unknown ENUM
6473 4 => +{'name' => 'unknown4'}, # unknown UINT32
6474 5 => +{'name' => 'unknown5'}, # unknown SINT32
6475 6 => +{'name' => 'unknown6'}, # unknown SINT32
6476 7 => +{'name' => 'unknown7'}, # unknown ENUM
6477 8 => +{'name' => 'unknown8'}, # unknown UINT16
6478 9 => +{'name' => 'unknown9'}, # unknown ENUM
6479 10 => +{'name' => 'unknown10'}, # unknown UINT16
6480 11 => +{'name' => 'unknown11'}, # unknown UINT8
6481 12 => +{'name' => 'unknown12'}, # unknown ENUM
6482 13 => +{'name' => 'unknown13'}, # unknown ENUM
6483 14 => +{'name' => 'unknown14'}, # unknown ENUM
6484 15 => +{'name' => 'unknown15'}, # unknown ENUM
6485 16 => +{'name' => 'unknown16'}, # unknown ENUM
6486 17 => +{'name' => 'unknown17'}, # unknown ENUM
6487 18 => +{'name' => 'unknown18'}, # unknown ENUM
6488 19 => +{'name' => 'unknown19'}, # unknown UINT16
6489 25 => +{'name' => 'unknown25'}, # unknown ENUM
6490 27 => +{'name' => 'unknown27'}, # unknown ENUM
6491 30 => +{'name' => 'unknown30'}, # unknown ENUM
6492 31 => +{'name' => 'unknown31'}, # unknown UINT32
6493 32 => +{'name' => 'unknown32'}, # unknown UINT16
6494 33 => +{'name' => 'unknown33'}, # unknown UINT32
6495 34 => +{'name' => 'unknown34'}, # unknown ENUM
6496 50 => +{'name' => 'unknown50'}, # unknown ENUM
6497 51 => +{'name' => 'unknown51'}, # unknown ENUM
6498 52 => +{'name' => 'unknown52'}, # unknown UINT16
6499 53 => +{'name' => 'unknown53'}, # unknown ENUM
6500 56 => +{'name' => 'unknown56'}, # unknown ENUM
6501 },
6502  
6503 14 => +{
6504 '_number' => 14,
6505 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
6506 1 => +{'name' => 'unknown1'}, # unknown ENUM
6507 3 => +{'name' => 'unknown3'}, # unknown UINT8
6508 4 => +{'name' => 'unknown4'}, # unknown UINT8 (array[10])
6509 5 => +{'name' => 'unknown5'}, # unknown ENUM (array[10])
6510 6 => +{'name' => 'unknown6'}, # unknown STRING
6511 7 => +{'name' => 'unknown7'}, # unknown UINT16 (array[10])
6512 },
6513  
6514 16 => +{
6515 '_number' => 16,
6516 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
6517 1 => +{'name' => 'unknown1'}, # unknown ENUM
6518 2 => +{'name' => 'unknown2'}, # unknown UINT32
6519 3 => +{'name' => 'unknown3'}, # unknown ENUM
6520 },
6521  
6522 17 => +{
6523 '_number' => 17,
6524 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
6525 1 => +{'name' => 'unknown1'}, # unknown ENUM
6526 2 => +{'name' => 'unknown2'}, # unknown ENUM
6527 3 => +{'name' => 'unknown3'}, # unknown UINT16
6528 4 => +{'name' => 'unknown4'}, # unknown ENUM
6529 5 => +{'name' => 'unknown5'}, # unknown UINT16
6530 },
6531  
6532 70 => +{
6533 '_number' => 70,
6534 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
6535 0 => +{'name' => 'unknown0'}, # unknown ENUM
6536 1 => +{'name' => 'unknown1'}, # unknown ENUM
6537 2 => +{'name' => 'unknown2'}, # unknown ENUM
6538 3 => +{'name' => 'unknown3'}, # unknown ENUM
6539 4 => +{'name' => 'unknown4'}, # unknown ENUM
6540 5 => +{'name' => 'unknown5'}, # unknown ENUM
6541 6 => +{'name' => 'unknown6'}, # unknown ENUM
6542 7 => +{'name' => 'unknown7'}, # unknown ENUM
6543 8 => +{'name' => 'unknown8'}, # unknown ENUM
6544 9 => +{'name' => 'unknown9'}, # unknown ENUM
6545 10 => +{'name' => 'unknown10'}, # unknown ENUM
6546 11 => +{'name' => 'unknown11'}, # unknown ENUM
6547 12 => +{'name' => 'unknown12'}, # unknown ENUM
6548 13 => +{'name' => 'unknown13'}, # unknown ENUM
6549 14 => +{'name' => 'unknown14'}, # unknown ENUM
6550 15 => +{'name' => 'unknown15'}, # unknown ENUM
6551 },
6552  
6553 71 => +{
6554 '_number' => 71,
6555 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
6556 0 => +{'name' => 'unknown0'}, # unknown ENUM
6557 1 => +{'name' => 'unknown1'}, # unknown ENUM
6558 2 => +{'name' => 'unknown2'}, # unknown ENUM
6559 3 => +{'name' => 'unknown3'}, # unknown UINT16
6560 4 => +{'name' => 'unknown4'}, # unknown ENUM
6561 },
6562  
6563 79 => +{
6564 '_number' => 79,
6565 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
6566 0 => +{'name' => 'unknown0'}, # unknown UINT16
6567 1 => +{'name' => 'unknown1'}, # unknown UINT8
6568 2 => +{'name' => 'unknown2'}, # unknown UINT8
6569 3 => +{'name' => 'unknown3'}, # unknown UINT16
6570 4 => +{'name' => 'unknown4'}, # unknown ENUM
6571 5 => +{'name' => 'unknown5'}, # unknown ENUM
6572 6 => +{'name' => 'unknown6'}, # unknown UINT8
6573 7 => +{'name' => 'unknown7'}, # unknown SINT8
6574 8 => +{'name' => 'unknown8'}, # unknown UINT16
6575 9 => +{'name' => 'unknown9'}, # unknown UINT16
6576 10 => +{'name' => 'unknown10'}, # unknown UINT8
6577 11 => +{'name' => 'unknown11'}, # unknown UINT16
6578 12 => +{'name' => 'unknown12'}, # unknown UINT16
6579 13 => +{'name' => 'unknown13'}, # unknown UINT16
6580 14 => +{'name' => 'unknown14'}, # unknown UINT8
6581 },
6582  
6583 113 => +{
6584 '_number' => 113,
6585 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
6586 0 => +{'name' => 'unknown0'}, # unknown UINT16
6587 1 => +{'name' => 'unknown1'}, # unknown ENUM
6588 2 => +{'name' => 'unknown2'}, # unknown UINT32
6589 3 => +{'name' => 'unknown3'}, # unknown UINT32
6590 4 => +{'name' => 'unknown4'}, # unknown UINT32
6591 5 => +{'name' => 'unknown5'}, # unknown ENUM
6592 },
6593  
6594 114 => +{
6595 '_number' => 114,
6596 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
6597 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
6598 0 => +{'name' => 'unknown0'}, # unknown UINT16
6599 1 => +{'name' => 'unknown1'}, # unknown ENUM
6600 2 => +{'name' => 'unknown2'}, # unknown UINT32
6601 3 => +{'name' => 'unknown3'}, # unknown UINT32
6602 4 => +{'name' => 'unknown4'}, # unknown UINT32
6603 5 => +{'name' => 'unknown5'}, # unknown UINT32
6604 6 => +{'name' => 'unknown6'}, # unknown UINT32Z
6605 7 => +{'name' => 'unknown7'}, # unknown UINT32
6606 },
6607  
6608 139 => +{
6609 '_number' => 139,
6610 254 => +{'name' => 'message_index', 'type_name' => 'message_index'},
6611 0 => +{'name' => 'unknown0'}, # unknown ENUM
6612 1 => +{'name' => 'unknown1'}, # unknown UINT16Z
6613 3 => +{'name' => 'unknown3'}, # unknown UINT8Z
6614 4 => +{'name' => 'unknown4'}, # unknown ENUM
6615 5 => +{'name' => 'unknown5'}, # unknown UINT16
6616 },
6617  
6618 140 => +{
6619 '_number' => 140,
6620 253 => +{'name' => 'timestamp', 'type_name' => 'date_time'},
6621 0 => +{'name' => 'unknown0'}, # unknown UINT8
6622 1 => +{'name' => 'unknown1'}, # unknown UINT8
6623 2 => +{'name' => 'unknown2'}, # unknown SINT32
6624 3 => +{'name' => 'unknown3'}, # unknown SINT32
6625 4 => +{'name' => 'unknown4'}, # unknown UINT8
6626 5 => +{'name' => 'unknown5'}, # unknown SINT32
6627 6 => +{'name' => 'unknown6'}, # unknown SINT32
6628 7 => +{'name' => 'unknown7'}, # unknown SINT32
6629 8 => +{'name' => 'unknown8'}, # unknown UINT8
6630 9 => +{'name' => 'unknown9'}, # unknown UINT16
6631 10 => +{'name' => 'unknown10'}, # unknown UINT16
6632 11 => +{'name' => 'unknown11'}, # unknown ENUM
6633 12 => +{'name' => 'unknown12'}, # unknown ENUM
6634 13 => +{'name' => 'unknown13'}, # unknown UINT8
6635 14 => +{'name' => 'unknown14'}, # unknown UINT16
6636 15 => +{'name' => 'unknown15'}, # unknown UINT16
6637 16 => +{'name' => 'unknown16'}, # unknown UINT16
6638 17 => +{'name' => 'unknown17'}, # unknown SINT8
6639 18 => +{'name' => 'unknown18'}, # unknown UINT8
6640 19 => +{'name' => 'unknown19'}, # unknown UINT8
6641 },
6642  
6643 203 => +{
6644 '_number' => 203,
6645 0 => +{'name' => 'unknown0'}, # unknown ENUM
6646 1 => +{'name' => 'unknown1'}, # unknown ENUM
6647 2 => +{'name' => 'unknown2'}, # unknown ENUM
6648 },
6649  
6650 );
6651  
6652 16 my $mesg_name_vs_num = $named_type{mesg_num};
6653  
6654 16 for my $msgname (keys %msgtype_by_name) {
6655 1568 my $msgtype = $msgtype_by_name{$msgname};
6656  
6657 1568 $msgtype->{_name} = $msgname;
6658 1568 $msgtype->{_number} = $mesg_name_vs_num->{$msgname};
6659 1568 $msgtype_by_num{$msgtype->{_number}} = $msgtype;
6660  
6661 1568 for my $fldnum (grep {/^\d+$/} keys %$msgtype) {
6662 21856 my $flddesc = $msgtype->{$fldnum};
6663  
6664 21856 $flddesc->{number} = $fldnum;
6665 21856 $msgtype->{$flddesc->{name}} = $flddesc;
6666 }
6667 }
6668  
6669 =head2 Constructor Methods
6670  
6671 =over 4
6672  
6673 =item new()
6674  
6675 creates a new object and returns it.
6676  
6677 =back
6678  
6679 =cut
6680  
6681 sub new {
6682 11 ▶ my $class = shift;
Subroutine new: called CC=1 SCAR=0.0
Pod documented
6683 11 my $self = +{};
6684 11 bless $self, $class;
6685 11 $self->initialize(@_);
6686  
6687 # defaults
6688 11 $self->use_gmtime(1);
6689 11 $self->semicircles_to_degree(1);
6690 11 return $self
6691 }
6692  
6693 =over 4
6694  
6695 =item clone()
6696  
6697 Returns a copy of a C<Geo::FIT> instance.
6698  
6699 C<clone()> is experimental and support for it may be removed at any time. Use with caution particularly if there are open filehandles, it which case it is recommended to C<close()> before cloning.
6700  
6701 It also does not return a full deep copy if any callbacks are registered, it creates a reference to them. There is no known way to make deep copies of anonymous subroutines in Perl (if you know of one, please make a pull request).
6702  
6703 The main use for c<clone()> is immediately after C<new()>, and C<file()>, to create a copy for later use.
6704  
6705 =back
6706  
6707 =cut
6708  
6709 sub clone {
6710 1 ▶ my $self = shift;
Subroutine clone: called CC=1 SCAR=0.0
Pod documented
6711 1 my $clone = Clone::clone( $self );
6712 1 return $clone
6713 }
6714  
6715 =head2 Class methods
6716  
6717 =over 4
6718  
6719 =item message_name(I<message spec>)
6720  
6721 returns the message name for I<message spec> or undef.
6722  
6723 =item message_number(I<message spec>)
6724  
6725 returns the message number for I<message spec> or undef.
6726  
6727 =back
6728  
6729 =cut
6730  
6731 sub message_name {
6732 0 ▶ my ($self, $mspec) = @_;
Subroutine message_name: not called CC=3 SCAR=24.8
Pod documented
6733 0 ▶ my $msgtype = $mspec =~ /^\d+$/ ? $msgtype_by_num{$mspec} : $msgtype_by_name{$mspec};
Branch: 1 branch
BranchTrueFalseTotal
$mspec =~ /^\d+$/ ? : 0 0 0
6734  
6735 0 ▶ if (ref $msgtype eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $msgtype eq 'HASH') { } 0 0 0
6736 0 $msgtype->{_name};
6737 } else {
6738 0 undef;
6739 }
6740 }
6741  
6742 sub message_number {
6743 0 ▶ my ($self, $mspec) = @_;
Subroutine message_number: not called CC=3 SCAR=24.8
Pod documented
6744 0 ▶ my $msgtype = $mspec =~ /^\d+$/ ? $msgtype_by_num{$mspec} : $msgtype_by_name{$mspec};
Branch: 1 branch
BranchTrueFalseTotal
$mspec =~ /^\d+$/ ? : 0 0 0
6745  
6746 0 ▶ if (ref $msgtype eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $msgtype eq 'HASH') { } 0 0 0
6747 0 $msgtype->{_number};
6748 } else {
6749 0 undef;
6750 }
6751 }
6752  
6753 =over 4
6754  
6755 =item field_name(I<message spec>, I<field spec>)
6756  
6757 returns the field name for I<field spec> in I<message spec> or undef.
6758  
6759 =item field_number(I<message spec>, I<field spec>)
6760  
6761 returns the field index for I<field spec> in I<message spec> or undef.
6762  
6763 =back
6764  
6765 =cut
6766  
6767 sub field_name {
6768 0 ▶ my ($self, $mspec, $fspec) = @_;
Subroutine field_name: not called CC=4 SCAR=30.0
Pod documented
6769 0 ▶ my $msgtype = $mspec =~ /^\d+$/ ? $msgtype_by_num{$mspec} : $msgtype_by_name{$mspec};
Branch: 1 branch
BranchTrueFalseTotal
$mspec =~ /^\d+$/ ? : 0 0 0
6770  
6771 0 ▶ if (ref $msgtype eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $msgtype eq "HASH") 0 0 0
6772 0 my $flddesc = $msgtype->{$fspec};
6773 ref $flddesc eq 'HASH'
6774 0 ▶ and return $flddesc->{name};
Branch: 1 branch
BranchTrueFalseTotal
ref $flddesc eq "HASH" and return $flddesc->{"name"} 0 0 0
6775 }
6776 0 undef;
6777 }
6778  
6779 sub field_number {
6780 0 ▶ my ($self, $mspec, $fspec) = @_;
Subroutine field_number: not called CC=4 SCAR=30.0
Pod documented
6781 0 ▶ my $msgtype = $mspec =~ /^\d+$/ ? $msgtype_by_num{$mspec} : $msgtype_by_name{$mspec};
Branch: 1 branch
BranchTrueFalseTotal
$mspec =~ /^\d+$/ ? : 0 0 0
6782  
6783 0 ▶ if (ref $msgtype eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $msgtype eq "HASH") 0 0 0
6784 0 my $flddesc = $msgtype->{$fspec};
6785 ref $flddesc eq 'HASH'
6786 0 ▶ and return $flddesc->{number};
Branch: 1 branch
BranchTrueFalseTotal
ref $flddesc eq "HASH" and return $flddesc->{"number"} 0 0 0
6787 }
6788 0 undef;
6789 }
6790  
6791 =over 4
6792  
6793 =item protocol_version_string()
6794  
6795 returns a string representing the .FIT protocol version on which this class based.
6796  
6797 =item profile_version_string()
6798  
6799 returns a string representing the .FIT profile version on which this class based.
6800  
6801 =back
6802  
6803 =cut
6804  
6805 16 my $profile_current = '21.107';
6806 16 my $protocol_current = '2.3'; # is there such a thing as current protocol?
6807  
6808 16 my $protocol_version_major_shift = 4;
6809 16 my $protocol_version_minor_mask = (1 << $protocol_version_major_shift) - 1;
6810 16 my $protocol_version_header_crc_started = _protocol_version_from_string("1.0");
6811 16 my $profile_version_scale = 100;
6812  
6813 sub _protocol_version_from_string {
6814 16 ▶ my $s = shift;
Subroutine _protocol_version_from_string: called CC=2 SCAR=7.0
6815 16 my ($major, $minor) = split /\./, $s, 2;
6816 16 ▶ return ($major + 0, $minor & $protocol_version_minor_mask) if wantarray;
Branch: 1 branch
BranchTrueFalseTotal
if wantarray 0 16 16
6817 16 return ($major << $protocol_version_major_shift) | ($minor & $protocol_version_minor_mask)
6818 }
6819  
6820 sub protocol_version {
6821 3 ▶ my $self = shift;
Subroutine protocol_version: called CC=3 SCAR=11.6
Pod undocumented
6822 3 my $version;
6823 3 ▶ if (@_) { $version = shift }
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 3 0 3
6824 0 else { $version = _protocol_version_from_string($protocol_current) }
6825 3 ▶ return ($version >> $protocol_version_major_shift, $version & $protocol_version_minor_mask) if wantarray;
Branch: 1 branch
BranchTrueFalseTotal
if wantarray 0 3 3
6826 3 return $version
6827 }
6828  
6829 sub _profile_version_from_string {
6830 15 ▶ my $str = shift;
Subroutine _profile_version_from_string: called CC=3 SCAR=11.0
6831 15 ▶ croak '_profile_version_from_string() expects a string as argument' unless $str;
Branch: 1 branch
BranchTrueFalseTotal
unless $str 0 15 15
6832 15 my ($major, $minor) = split /\./, $str, 2;
6833 15 ▶ if ($minor >= 100) { $major += 1 } # kludge to deal with three-digit minor versions
Branch: 1 branch
BranchTrueFalseTotal
if ($minor >= 100) 7 8 15
6834 15 return $major * $profile_version_scale + $minor % $profile_version_scale
6835 }
6836  
6837 sub profile_version {
6838 22 ▶ my $self = shift;
Subroutine profile_version: called CC=5 SCAR=16.1
Pod undocumented
6839 22 my $version;
6840 22 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 19 3 22
6841 19 $version = shift;
6842 19 ▶ $version = _profile_version_from_string($version) if $version =~ /\./
Branch: 1 branch
BranchTrueFalseTotal
if $version =~ /\./ 6 13 19
6843 3 } else { $version = _profile_version_from_string($profile_current) }
6844  
6845 22 ▶ if (wantarray) {
Branch: 1 branch
BranchTrueFalseTotal
if (wantarray) 15 7 22
6846 15 my $major = int($version / $profile_version_scale);
6847 15 my $minor = $version % $profile_version_scale;
6848 15 ▶ if ($version >= 2200) { # kludge to deal with three-digit minor versions
Branch: 1 branch
BranchTrueFalseTotal
if ($version >= 2200) 5 10 15
6849 5 $major -= 1;
6850 5 $minor += 100
6851 }
6852 15 return ($major, $minor)
6853 }
6854 7 return $version
6855 }
6856  
6857 sub profile_version_string {
6858 5 ▶ my $self = shift;
Subroutine profile_version_string: called CC=4 SCAR=14.0
Pod documented
6859 5 my @version;
6860 5 ▶ if (blessed $self) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($self)) { } 1 4 5
6861 1 ▶ croak 'fetch_header() has not been called yet to obtain the version from the header, call fetch_header() first' unless defined $self->{profile_version};
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{"profile_version"} 0 1 1
6862 1 ▶ croak 'object method expects no arguments' if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 1 1
6863 @version = profile_version(undef, $self->{profile_version} )
6864 1 } else {
6865 4 @version = profile_version(undef, @_)
6866 }
6867 5 return sprintf '%u.%03u', @version
6868 }
6869  
6870 1 ▶sub profile_version_major { profile_version( @_) };
Subroutine profile_version_major: called CC=1 SCAR=0.0
Pod undocumented
6871 0 ▶sub protocol_version_string { sprintf '%u.%u', ( protocol_version(@_) ) }
Subroutine protocol_version_string: not called CC=1 SCAR=6.9
Pod documented
6872 0 ▶sub protocol_version_major { protocol_version(@_) };
Subroutine protocol_version_major: not called CC=1 SCAR=6.9
Pod undocumented
6873  
6874 # CRC calculation routine taken from
6875 # Haruhiko Okumura, C gengo ni yoru algorithm dai jiten (1st ed.), GijutsuHyouronsha 1991.
6876  
6877 16 my $crc_poly = 2 ** 16 + 2 ** 15 + 2 ** 2 + 2 ** 0; # CRC-16
6878 16 my ($crc_poly_deg, $crc_poly_rev);
6879 16 my ($x, $y, $i);
6880 16 ▶for ($crc_poly_deg = 0, $x = $crc_poly ; $x >>= 1 ;) {
Branch: 1 branch
BranchTrueFalseTotal
if ($x >>= 1) 256 16 272
6881 256 ++$crc_poly_deg;
6882 }
6883 16 my $crc_octets = int($crc_poly_deg / 8 + 0.5);
6884 16 ▶for ($crc_poly_rev = 0, $y = 1, $x = 2 ** ($crc_poly_deg - 1) ; $x ;) {
Branch: 1 branch
BranchTrueFalseTotal
if ($x) 256 16 272
6885 256 ▶ $crc_poly_rev |= $y if $x & $crc_poly;
Branch: 1 branch
BranchTrueFalseTotal
if $x & $crc_poly 48 208 256
6886 256 $y <<= 1;
6887 256 $x >>= 1;
6888 }
6889 16 my @crc_table = ();
6890 16 ▶for ($i = 0 ; $i < 2 ** 8 ; ++$i) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < 256) 4096 16 4112
6891 4096 my $r = $i;
6892 4096 my $j;
6893 4096 ▶ for ($j = 0 ; $j < 8 ; ++$j) {
Branch: 1 branch
BranchTrueFalseTotal
if ($j < 8) 32768 4096 36864
6894 32768 ▶ if ($r & 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r & 1) { } 16384 16384 32768
6895 16384 $r = ($r >> 1) ^ $crc_poly_rev;
6896 } else {
6897 16384 $r >>= 1;
6898 }
6899 }
6900 4096 $crc_table[$i] = $r;
6901 }
6902  
6903 sub dump {
6904 0 ▶ my ($self, $s, $fh) = @_;
Subroutine dump: not called CC=2 SCAR=17.9
Pod undocumented
6905 0 my ($i, $d);
6906 0 ▶ for ($i = 0 ; $i < length($s) ;) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < length $s) 0 0 0
6907 0 $fh->printf(' %03u', ord(substr($s, $i++, 1)));
6908 }
6909 }
6910  
6911 sub safe_isa {
6912 0 ▶ eval {$_[0]->isa($_[1])};
Subroutine safe_isa: not called CC=1 SCAR=6.9
Pod undocumented
6913 }
6914  
6915 sub file_read {
6916 48 ▶ my $self = shift;
Subroutine file_read: called CC=2 SCAR=6.9
Pod undocumented
6917 48 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 16 32 48
6918 16 $self->{file_read} = $_[0];
6919 } else {
6920 32 $self->{file_read};
6921 }
6922 }
6923  
6924 sub file_size {
6925 1211 ▶ my $self = shift;
Subroutine file_size: called CC=2 SCAR=6.9
Pod undocumented
6926 1211 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 12 1199 1211
6927 12 $self->{file_size} = $_[0];
6928 } else {
6929 1199 $self->{file_size};
6930 }
6931 }
6932  
6933 sub file_processed {
6934 1181 ▶ my $self = shift;
Subroutine file_processed: called CC=2 SCAR=6.9
Pod undocumented
6935 1181 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 10 1171 1181
6936 10 $self->{file_processed} = $_[0];
6937 } else {
6938 1171 $self->{file_processed};
6939 }
6940 }
6941  
6942 sub offset {
6943 6319 ▶ my $self = shift;
Subroutine offset: called CC=2 SCAR=6.9
Pod documented
6944 6319 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 1319 5000 6319
6945 1319 $self->{offset} = $_[0];
6946 } else {
6947 5000 $self->{offset};
6948 }
6949 }
6950  
6951 sub buffer {
6952 4841 ▶ my $self = shift;
Subroutine buffer: called CC=2 SCAR=7.6
Pod undocumented
6953 4841 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 4841 4841
6954 0 $self->{buffer} = $_[0];
6955 } else {
6956 4841 $self->{buffer};
6957 }
6958 }
6959  
6960 sub maybe_chained {
6961 15 ▶ my $self = shift;
Subroutine maybe_chained: called CC=2 SCAR=6.9
Pod undocumented
6962 15 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 3 12 15
6963 3 $self->{maybe_chained} = $_[0];
6964 } else {
6965 12 $self->{maybe_chained};
6966 }
6967 }
6968  
6969 sub clear_buffer {
6970 22 ▶ my $self = shift;
Subroutine clear_buffer: called CC=3 SCAR=11.0
Pod undocumented
6971 22 ▶ if ($self->offset > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->offset > 0) 10 12 22
6972 10 my $buffer = $self->{buffer};
6973 10 ▶ $self->crc_calc(length($$buffer)) if !defined $self->crc;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->crc 0 10 10
6974 10 $self->file_processed($self->file_processed + $self->offset);
6975 10 substr($$buffer, 0, $self->offset) = '';
6976 10 $self->offset(0)
6977 }
6978 22 return 1
6979 }
6980  
6981 =head2 Object methods
6982  
6983 =over 4
6984  
6985 =item file(I<file name>)
6986  
6987 sets the name I<file name> of a .FIT file.
6988  
6989 =back
6990  
6991 =cut
6992  
6993 sub file {
6994 32 ▶ my $self = shift;
Subroutine file: called CC=2 SCAR=6.9
Pod documented
6995 32 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 11 21 32
6996 11 $self->{file} = $_[0];
6997 } else {
6998 21 $self->{file};
6999 }
7000 }
7001  
7002 =over 4
7003  
7004 =item open()
7005  
7006 opens the .FIT file.
7007  
7008 =back
7009  
7010 =cut
7011  
7012 sub open {
7013 12 ▶ my $self = shift;
Subroutine open: called CC=4 SCAR=15.8
Pod documented
7014 12 my $fn = $self->file;
7015  
7016 12 ▶ if ($fn ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($fn ne '') { } 12 0 12
7017 12 my $fh = $self->fh;
7018  
7019 12 ▶ if ($fh->open("< $fn")) {
Branch: 1 branch
BranchTrueFalseTotal
if ($fh->open("< $fn")) { } 12 0 12
7020 12 ▶ if (binmode $fh, ':raw') {
Branch: 1 branch
BranchTrueFalseTotal
if (binmode $fh, ':raw') { } 12 0 12
7021 12 1;
7022 } else {
7023 0 $self->error("binmode \$fh, ':raw': $!");
7024 }
7025 } else {
7026 0 $self->error("\$fh->open(\"< $fn\"): $!");
7027 }
7028 } else {
7029 0 $self->error('no file name given');
7030 }
7031 }
7032  
7033 sub fh {
7034 2402 ▶ my $self = shift;
Subroutine fh: called CC=2 SCAR=7.6
Pod undocumented
7035 2402 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 2402 2402
7036 0 $self->{fh} = $_[0];
7037 } else {
7038 2402 $self->{fh};
7039 }
7040 }
7041  
7042 sub EOF {
7043 8 ▶ my $self = shift;
Subroutine EOF: called CC=2 SCAR=6.9
7044 8 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 6 2 8
7045 6 $self->{EOF} = $_[0];
7046 } else {
7047 2 $self->{EOF};
7048 }
7049 }
7050  
7051 sub end_of_chunk {
7052 7 ▶ my $self = shift;
Subroutine end_of_chunk: called CC=2 SCAR=6.9
Pod undocumented
7053 7 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 6 1 7
7054 6 $self->{end_of_chunk} = $_[0];
7055 } else {
7056 1 $self->{end_of_chunk};
7057 }
7058 }
7059  
7060 sub fill_buffer {
7061 22 ▶ my $self = shift;
Subroutine fill_buffer: called CC=6 SCAR=18.3
Pod undocumented
7062 22 my $buffer = $self->buffer;
7063 22 ▶ croak 'fill_buffer() expects no argument' if @_;
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 22 22
7064  
7065 22 $self->clear_buffer;
7066  
7067 22 my $n = $self->fh->read($$buffer, BUFSIZ, length($$buffer));
7068  
7069 22 ▶ if ($n > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($n > 0) { } 16 6 22
7070 16 $self->file_read($self->file_read + $n);
7071  
7072 16 ▶ if (defined $self->file_size) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->file_size) 4 12 16
7073 4 ▶ if (defined $self->crc) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->crc) { } 4 0 4
7074 4 $self->crc_calc($n);
7075 } else {
7076 0 $self->crc_calc(length($$buffer));
7077 }
7078 }
7079 } else {
7080 6 ▶ if (defined $n) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $n) { } 6 0 6
7081 6 $self->error("unexpected EOF");
7082 6 $self->EOF(1);
7083 } else {
7084 0 $self->error("read(fh): $!");
7085 }
7086 return undef
7087 6 }
7088 16 return 1
7089 }
7090  
7091 sub _buffer_needs_updating {
7092 2470 ▶ my ($self, $bytes_needed) = @_;
Subroutine _buffer_needs_updating: called CC=2 SCAR=6.9
7093 2470 my ($buffer, $offset) = ($self->buffer, $self->offset); # easier to debug with variables
7094 2470 ▶ if ( length($$buffer) - $offset < $bytes_needed ) { return 1 }
Branch: 1 branch
BranchTrueFalseTotal
if (length($$buffer) - $offset < $bytes_needed) { } 22 2448 2470
7095 2448 else { return 0 }
7096 }
7097  
7098 16 my $header_template = 'C C v V V';
7099 16 my $header_length = length(pack($header_template));
7100  
7101 sub FIT_HEADER_LENGTH {
7102 0 ▶ $header_length;
Subroutine FIT_HEADER_LENGTH: not called CC=1 SCAR=6.9
Pod documented
7103 }
7104  
7105 16 my $FIT_signature_string = '.FIT';
7106 16 my $FIT_signature = unpack('V', $FIT_signature_string);
7107  
7108 16 my $header_crc_template = 'v';
7109 16 my $header_crc_length = length(pack($header_crc_template));
7110  
7111 =over 4
7112  
7113 =item fetch_header()
7114  
7115 reads .FIT file header, and returns an array of the file size (excluding the trailing CRC-16), the protocol version, the profile version, extra octets in the header other than documented 4 values, the header CRC-16 recorded in the header, and the calculated header CRC-16.
7116  
7117 =back
7118  
7119 =cut
7120  
7121 sub fetch_header {
7122 12 ▶ my $self = shift;
Subroutine fetch_header: called CC=16 SCAR=35.5
Pod documented
7123 12 ▶ croak 'call the open() method before fetching the header' if $self->fh->tell < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $self->fh->tell < 0 0 12 12
7124 12 ▶ croak '.FIT file header has already been fetched' if $self->fh->tell > 0;
Branch: 1 branch
BranchTrueFalseTotal
if $self->fh->tell > 0 0 12 12
7125  
7126 12 my $buffer = $self->buffer;
7127  
7128 12 ▶ if ( $self->_buffer_needs_updating( $header_length ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_buffer_needs_updating($header_length)) 12 0 12
7129 12 ▶ $self->fill_buffer or return undef
Branch: 1 branch
BranchTrueFalseTotal
$self->fill_buffer or return undef 0 12 12
7130 }
7131 12 my $h_min = substr($$buffer, $self->offset, $header_length);
7132 12 my ($h_len, $proto_ver, $prof_ver, $f_len, $sig) = unpack($header_template, $h_min);
7133 12 my $f_size = $f_len + $h_len;
7134 12 $self->offset($self->offset + $header_length);
7135  
7136 12 my ($extra, $header_extra_bytes, $crc_expected, $crc_calculated);
7137 12 $header_extra_bytes = $h_len - $header_length; # headers are now typically 14 bytes instead of 12
7138  
7139 12 ▶ if ($header_extra_bytes < 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($header_extra_bytes < 0) 0 12 12
7140 0 $self->error("not a .FIT header ($h_len < $header_length)");
7141 return ()
7142 0 }
7143  
7144 12 ▶ if ($header_extra_bytes) {
Branch: 1 branch
BranchTrueFalseTotal
if ($header_extra_bytes) 12 0 12
7145 12 ▶ if ( $self->_buffer_needs_updating( $header_extra_bytes ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_buffer_needs_updating($header_extra_bytes)) 0 12 12
7146 0 ▶ $self->fill_buffer or return undef
Branch: 1 branch
BranchTrueFalseTotal
$self->fill_buffer or return undef 0 0 0
7147 }
7148 12 $extra = substr($$buffer, $self->offset, $header_extra_bytes );
7149 12 $self->offset($self->offset + $header_extra_bytes );
7150 }
7151  
7152 12 ▶ if ($sig != $FIT_signature) {
Branch: 1 branch
BranchTrueFalseTotal
if ($sig != $FIT_signature) 0 12 12
7153 $self->error("not a .FIT header (" .
7154 0 ▶ join('', map {($_ ne "\\" && 0x20 >= ord($_) && ord($_) <= 0x7E) ? $_ : sprintf("\\x%02X", ord($_))} split //, pack('V', $sig))
Branch: 1 branch
BranchTrueFalseTotal
$_ ne '\\' && 32 >= ord $_ && ord $_ <= 126 ? : 0 0 0
Condition0%0/6
$_ ne "\\" and 32 >= ord $_ and ord $_ <= 126
!ll&&!rl&&r
000
$_ ne "\\" and 32 >= ord $_
!ll&&!rl&&r
000
MC/DC0%0/3
$_ ne "\\" and 32 >= ord $_ and ord $_ <= 126
$_ ne "\\" 32 >= ord $_ ord $_ <= 126
Truth table0%0/4
A and B and C
A= $_ ne "\\"B= 32 >= ord $_C= ord $_ <= 126
ABCresult
0XX0
10X0
1100
1111
7155 . " ne '$FIT_signature_string')");
7156 return ()
7157 0 }
7158  
7159 12 ▶ if ($proto_ver >= $protocol_version_header_crc_started && length($extra) >= $header_crc_length) {
Branch: 1 branch
BranchTrueFalseTotal
if ($proto_ver >= $protocol_version_header_crc_started and length $extra >= $header_crc_length) 12 0 12
Condition33%1/3
$proto_ver >= $protocol_version_header_crc_started and length $extra >= $header_crc_length
!ll&&!rl&&r
0012
MC/DC0%0/2
$proto_ver >= $protocol_version_header_crc_started and length $extra >= $header_crc_length
$proto_ver >= $protocol_version_header_crc_started length $extra >= $header_crc_length
Truth table33%1/3
A and B
A= $proto_ver >= $protocol_version_header_crc_startedB= length $extra >= $header_crc_length
ABresult
0X0
100
111
7160 12 $crc_expected = unpack($header_crc_template, substr($extra, -$header_crc_length));
7161 12 substr($extra, -$header_crc_length) = '';
7162 12 $crc_calculated = $self->crc_of_string(0, \$h_min, 0, $header_length);
7163 }
7164  
7165 12 $self->file_size($f_size);
7166 12 ▶ unless (defined $self->crc) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $self->crc) 12 0 12
7167 12 $self->crc(0);
7168 12 $self->crc_calc(length($$buffer));
7169 }
7170  
7171 12 $self->{profile_version} = $prof_ver;
7172 12 return ($f_size, $proto_ver, $prof_ver, $extra, $crc_expected, $crc_calculated)
7173 }
7174  
7175 =over 4
7176  
7177 =item fetch()
7178  
7179 reads a message in the .FIT file, and returns C<1> on success, or C<undef> on failure or EOF. C<fetch_header()> must have been called before the first attempt to C<fetch()> after opening the file.
7180  
7181 If a data message callback is registered, C<fetch()> will return the value returned by the callback. It is therefore important to define explicit return statements and values in any callback (this includes returning true if that is the desired outcome after C<fetch()>).
7182  
7183 =back
7184  
7185 =cut
7186  
7187 sub fetch {
7188 1167 ▶ my $self = shift;
Subroutine fetch: called CC=13 SCAR=26.7
Pod documented
7189 1167 ▶ croak 'call the fetch_header() method before calling fetch()' if $self->fh->tell == 0;
Branch: 1 branch
BranchTrueFalseTotal
if $self->fh->tell == 0 0 1167 1167
7190 1167 ▶ croak 'open() and fetch_header() methods need to be called before calling fetch()' if $self->fh->tell < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $self->fh->tell < 0 0 1167 1167
7191  
7192 1167 my $buffer = $self->buffer;
7193  
7194 1167 ▶ if ( $self->_buffer_needs_updating( $crc_octets ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_buffer_needs_updating($crc_octets)) 6 1161 1167
7195 6 ▶ $self->fill_buffer or return undef
Branch: 1 branch
BranchTrueFalseTotal
$self->fill_buffer or return undef 6 0 6
7196 }
7197 1161 my $i = $self->offset;
7198 1161 my $j = $self->file_processed + $i;
7199  
7200 1161 my $ret_val;
7201  
7202 1161 ▶ if ($j < $self->file_size) {
Branch: 2 branches
BranchTrueFalseTotal
if ($j < $self->file_size) { } 1155 6 1161
elsif (not $self->maybe_chained and $j > $self->file_size) { } 0 6 6
7203 1155 my $record_header = ord(substr($$buffer, $i, 1));
7204 1155 my $local_msg_type;
7205  
7206 1155 ▶ if ($record_header & $rechd_mask_compressed_timestamp_header) {
Branch: 2 branches
BranchTrueFalseTotal
if ($record_header & $rechd_mask_compressed_timestamp_header) { } 0 1155 1155
elsif ($record_header & $rechd_mask_definition_message) { } 125 1030 1155
7207 0 $local_msg_type = ($record_header & $rechd_mask_cth_local_message_type) >> $rechd_offset_cth_local_message_type
7208 } elsif ($record_header & $rechd_mask_definition_message) {
7209 125 $ret_val = $self->fetch_definition_message; # always 1
7210 125 return $ret_val
7211 } else {
7212 1030 $local_msg_type = $record_header & $rechd_mask_local_message_type
7213 }
7214  
7215 1030 my $desc = $self->data_message_descriptor->[$local_msg_type];
7216  
7217 1030 ▶ if (ref $desc eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $desc eq 'HASH') { } 1029 1 1030
7218 1029 $ret_val = $self->fetch_data_message($desc)
7219 } else {
7220 1 $ret_val = $self->error(sprintf("%d at %ld: not defined", $record_header, $j))
7221 }
7222 ▶ } elsif (!$self->maybe_chained && $j > $self->file_size) {
Condition33%1/3
not $self->maybe_chained and $j > $self->file_size
!ll&&!rl&&r
060
MC/DC0%0/2
not $self->maybe_chained and $j > $self->file_size
not $self->maybe_chained $j > $self->file_size
Truth table33%1/3
not(A) and B
A= not $self->maybe_chainedB= $j > $self->file_size
ABresult
0X0
100
111
7223 0 $self->trailing_garbages($self->trailing_garbages + length($$buffer) - $i);
7224 0 $self->offset(length($$buffer));
7225 0 $ret_val = 1
7226 } else {
7227 6 ▶ $self->crc_calc(length($$buffer)) if !defined $self->crc;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->crc 0 6 6
7228  
7229 6 my ($crc_expected, $k);
7230  
7231 6 ▶ for ($crc_expected = 0, $k = $crc_octets ; $k > 0 ;) {
Branch: 1 branch
BranchTrueFalseTotal
if ($k > 0) 12 6 18
7232 12 $crc_expected = ($crc_expected << 8) + ord(substr($$buffer, $i + --$k, 1));
7233 }
7234  
7235 6 $self->crc_expected($crc_expected);
7236 6 $self->offset($i + $crc_octets);
7237 6 $self->end_of_chunk(1);
7238 6 $ret_val = !$self->maybe_chained
7239 }
7240 1036 return $ret_val
7241 }
7242  
7243 sub error_callback { # consider adding POD for error_callback otherwise make it internal (_error_callback)
7244 1 ▶ my $self = shift;
Subroutine error_callback: called CC=4 SCAR=16.6
Pod undocumented
7245 1 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 1 0 1
7246 # if (&safe_isa($_[0], 'CODE')) {
7247 1 ▶ if (ref $_[0] and ref $_[0] eq 'CODE') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_[0] and ref $_[0] eq 'CODE') { } 1 0 1
Condition33%1/3
ref $_[0] and ref $_[0] eq "CODE"
!ll&&!rl&&r
001
MC/DC0%0/2
ref $_[0] and ref $_[0] eq "CODE"
ref $_[0] ref $_[0] eq "CODE"
Truth table33%1/3
A and B
A= ref $_[0]B= ref $_[0] eq "CODE"
ABresult
0X0
100
111
7248 1 $self->{error_callback_argv} = [@_[1 .. $#_]];
7249 1 $self->{error_callback} = $_[0];
7250 } else {
7251 0 undef;
7252 }
7253 } else {
7254 0 $self->{error_callback};
7255 }
7256 }
7257  
7258 =over 4
7259  
7260 =item error()
7261  
7262 returns an error message recorded by a method.
7263  
7264 =back
7265  
7266 =cut
7267  
7268 sub error {
7269 9 ▶ my $self = shift;
Subroutine error: called CC=7 SCAR=24.3
Pod documented
7270 9 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 9 0 9
7271 9 my ($p, $fn, $l, $subr, $fit);
7272  
7273 9 (undef, $fn, $l) = caller(0);
7274 9 ($p, undef, undef, $subr) = caller(1);
7275 9 $fit = $self->file;
7276 9 ▶ $fit .= ': ' if $fit ne '';
Branch: 1 branch
BranchTrueFalseTotal
if $fit ne "" 9 0 9
7277  
7278 9 $self->{error} = "${p}::$subr\#$l\@$fn: $fit$_[0]";
7279  
7280 # if (&safe_isa($self->{error_callback}, 'CODE')) {
7281 # my $argv = &safe_isa($self->{error_callback_argv}, 'ARRAY') ? $self->{error_callback_argv} : [];
7282 9 my $is_cb = $self->{error_callback};
7283 9 my $is_cb_argv = $self->{error_callback_argv};
7284 9 ▶ if (ref $is_cb and ref $is_cb eq 'CODE') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $is_cb and ref $is_cb eq 'CODE') { } 0 9 9
Condition33%1/3
ref $is_cb and ref $is_cb eq "CODE"
!ll&&!rl&&r
900
MC/DC0%0/2
ref $is_cb and ref $is_cb eq "CODE"
ref $is_cb ref $is_cb eq "CODE"
Truth table33%1/3
A and B
A= ref $is_cbB= ref $is_cb eq "CODE"
ABresult
0X0
100
111
7285 0 ▶ my $argv = (ref $is_cb_argv and ref $is_cb_argv eq 'ARRAY') ? $is_cb_argv : [];
Branch: 1 branch
BranchTrueFalseTotal
ref $is_cb_argv && ref $is_cb_argv eq 'ARRAY' ? : 0 0 0
Condition0%0/3
ref $is_cb_argv and ref $is_cb_argv eq "ARRAY"
!ll&&!rl&&r
000
MC/DC0%0/2
ref $is_cb_argv and ref $is_cb_argv eq "ARRAY"
ref $is_cb_argv ref $is_cb_argv eq "ARRAY"
Truth table0%0/3
A and B
A= ref $is_cb_argvB= ref $is_cb_argv eq "ARRAY"
ABresult
0X0
100
111
7286  
7287 0 $self->{error_callback}->($self, @$argv);
7288 } else {
7289 9 undef;
7290 }
7291 } else {
7292 0 $self->{error};
7293 }
7294 }
7295  
7296 =over 4
7297  
7298 =item crc()
7299  
7300 CRC-16 calculated from the contents of a .FIT file.
7301  
7302 =back
7303  
7304 =cut
7305  
7306 sub crc {
7307 77 ▶ my $self = shift;
Subroutine crc: called CC=2 SCAR=6.9
Pod documented
7308 77 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 28 49 77
7309 28 $self->{crc} = $_[0];
7310 } else {
7311 49 $self->{crc};
7312 }
7313 }
7314  
7315 sub crc_of_string {
7316 28 ▶ my ($self, $crc, $p, $b, $n) = @_;
Subroutine crc_of_string: called CC=2 SCAR=6.9
Pod undocumented
7317 28 my $e = $b + $n;
7318 28 ▶ while ($b < $e) {
Branch: 1 branch
BranchTrueFalseTotal
if ($b < $e) 94476 28 94504
7319 94476 $crc = ($crc >> 8) ^ $crc_table[($crc & (2 ** 8 - 1)) ^ ord(substr($$p, $b++, 1))];
7320 }
7321 28 $crc;
7322 }
7323  
7324 sub crc_calc {
7325 16 ▶ my ($self, $m) = @_;
Subroutine crc_calc: called CC=3 SCAR=11.0
Pod undocumented
7326 16 my $over = $self->file_read - $self->file_size;
7327 16 ▶ $over = 0 if $over < 0;
Branch: 1 branch
BranchTrueFalseTotal
if $over < 0 10 6 16
7328  
7329 16 ▶ if ($m > $over) {
Branch: 1 branch
BranchTrueFalseTotal
if ($m > $over) 16 0 16
7330 16 my $buffer = $self->buffer;
7331 16 $self->crc($self->crc_of_string($self->crc, $buffer, length($$buffer) - $m, $m - $over));
7332 }
7333 }
7334  
7335 =over 4
7336  
7337 =item crc_expected()
7338  
7339 CRC-16 attached to the end of a .FIT file. Only available after all contents of the file has been read.
7340  
7341 =back
7342  
7343 =cut
7344  
7345 sub crc_expected {
7346 7 ▶ my $self = shift;
Subroutine crc_expected: called CC=2 SCAR=6.9
Pod documented
7347 7 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 6 1 7
7348 6 $self->{crc_expected} = $_[0];
7349 } else {
7350 1 $self->{crc_expected};
7351 }
7352 }
7353  
7354 =over 4
7355  
7356 =item trailing_garbages()
7357  
7358 number of octets after CRC-16, 0 usually.
7359  
7360 =back
7361  
7362 =cut
7363  
7364 sub trailing_garbages {
7365 1 ▶ my $self = shift;
Subroutine trailing_garbages: called CC=2 SCAR=7.6
Pod documented
7366 1 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 1 1
7367 0 $self->{trailing_garbages} = $_[0];
7368 } else {
7369 1 $self->{trailing_garbages};
7370 }
7371 }
7372  
7373 sub numeric_date_time {
7374 674 ▶ my $self = shift;
Subroutine numeric_date_time: called CC=2 SCAR=6.9
Pod undocumented
7375 674 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 6 668 674
7376 6 $self->{numeric_date_time} = $_[0];
7377 } else {
7378 668 $self->{numeric_date_time};
7379 }
7380 }
7381  
7382 sub date_string {
7383 668 ▶ my ($self, $time) = @_;
Subroutine date_string: called CC=2 SCAR=6.9
Pod undocumented
7384 668 ▶ my ($s, $mi, $h, $d, $mo, $y, $gmt) = $self->use_gmtime ? ((gmtime($time))[0 .. 5], 'Z') : (localtime($time))[0 .. 5];
Branch: 1 branch
BranchTrueFalseTotal
$self->use_gmtime ? : 430 238 668
7385 668 sprintf('%04u-%02u-%02uT%02u:%02u:%02u%s', $y + 1900, $mo + 1, $d, $h, $mi, $s, $gmt);
7386 }
7387  
7388 sub named_type_value {
7389 867 ▶ my ($self, $type_name, $val) = @_;
Subroutine named_type_value: called CC=15 SCAR=34.3
Pod undocumented
7390 867 my $typedesc = $named_type{$type_name};
7391  
7392 867 ▶ if (ref $typedesc ne 'HASH') {
Branch: 3 branches
BranchTrueFalseTotal
if (ref $typedesc ne 'HASH') { } 2 865 867
elsif ($typedesc->{'_mask'}) { } 13 852 865
elsif ($type_name eq 'date_time') { } 668 184 852
7393 2 $self->error("$type_name is not a named type");
7394 } elsif ($typedesc->{_mask}) {
7395 13 ▶ if ($val !~ /^[-+]?\d+$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $val =~ /^[-+]?\d+$/) { } 0 13 13
7396 0 my $num = 0;
7397  
7398 0 for my $expr (split /,/, $val) {
7399 0 $expr =~ s/^.*=//;
7400  
7401 0 ▶ if ($expr =~ s/^0[xX]//) {
Branch: 1 branch
BranchTrueFalseTotal
if ($expr =~ s/^0[xX]//) { } 0 0 0
7402 0 $num |= hex($expr);
7403 } else {
7404 0 $num |= $expr + 0;
7405 }
7406 }
7407  
7408 0 $num;
7409 } else {
7410 13 my $mask = 0;
7411 13 my @key;
7412  
7413 13 for my $key (sort {$typedesc->{$b} <=> $typedesc->{$a}} grep {/^[A-Za-z]/} keys %$typedesc) {
7414 39 push @key, $key . '=' . ($val & $typedesc->{$key});
7415 39 $mask |= $typedesc->{$key};
7416 }
7417  
7418 13 my $rest = $val & ~$mask & ((1 << ($size[$typedesc->{_base_type}] * 8)) - 1);
7419  
7420 13 ▶ if ($rest) {
Branch: 2 branches
BranchTrueFalseTotal
if ($rest) { } 0 13 13
elsif (@key) { } 13 0 13
7421 0 my $width = $size[$typedesc->{_base_type}] * 2;
7422  
7423 0 join(',', @key, sprintf("0x%0${width}X", $rest));
7424 } elsif (@key) {
7425 13 join(',', @key);
7426 } else {
7427 0 0;
7428 }
7429 }
7430 } elsif ($type_name eq 'date_time') {
7431 668 ▶ if ($val !~ /^[-+]?\d+$/) {
Branch: 2 branches
BranchTrueFalseTotal
if (not $val =~ /^[-+]?\d+$/) { } 0 668 668
elsif ($val >= $typedesc->{'_min'} and $val != $invalid[$typedesc->{'_base_type'}]) { } 668 0 668
7432 0 my ($y, $mo, $d, $h, $mi, $s, $gmt) = $val =~ /(\d+)\D+(\d+)\D+(\d+)\D+(\d+)\D+(\d+)\D+(\d+)([zZ]?)/;
7433  
7434 0 ▶ ($gmt ne '' ? timegm($s, $mi, $h, $d, $mo - 1, $y - 1900) : timelocal($s, $mi, $h, $d, $mo - 1, $y - 1900)) + $typedesc->{_offset};
Branch: 1 branch
BranchTrueFalseTotal
$gmt ne '' ? : 0 0 0
7435 ▶ } elsif ($val >= $typedesc->{_min} && $val != $invalid[$typedesc->{_base_type}]) {
Condition33%1/3
$val >= $typedesc->{"_min"} and $val != $invalid[$typedesc->{"_base_type"}]
!ll&&!rl&&r
00668
MC/DC0%0/2
$val >= $typedesc->{"_min"} and $val != $invalid[$typedesc->{"_base_type"}]
$val >= $typedesc->{"_min"} $val != $invalid[$typedesc->{"_base_type"}]
Truth table33%1/3
A and B
A= $val >= $typedesc->{"_min"}B= $val != $invalid[$typedesc->{"_base_type"}]
ABresult
0X0
100
111
7436 668 ▶ if ($self->numeric_date_time) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->numeric_date_time) { } 6 662 668
7437 6 $val - $typedesc->{_offset};
7438 } else {
7439 662 $self->date_string($val - $typedesc->{_offset});
7440 }
7441 } else {
7442 0 undef;
7443 }
7444 } else {
7445 184 $typedesc->{$val};
7446 }
7447 }
7448  
7449 sub data_message_descriptor {
7450 1155 ▶ my $self = shift;
Subroutine data_message_descriptor: called CC=3 SCAR=11.3
Pod undocumented
7451  
7452 1155 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 1155 1155
7453 0 $self->{data_message_descriptor} = $_[0];
7454 } else {
7455 1155 ▶ $self->{data_message_descriptor} = [] if ref $self->{data_message_descriptor} ne 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
if ref $self->{"data_message_descriptor"} ne "ARRAY" 11 1144 1155
7456 1155 $self->{data_message_descriptor};
7457 }
7458 }
7459  
7460 sub data_message_callback {
7461 173 ▶ $_[0]->{data_message_callback};
Subroutine data_message_callback: called CC=1 SCAR=0.0
Pod undocumented
7462 }
7463  
7464 =over 4
7465  
7466 =item data_message_callback_by_num(I<message number>, I<callback function>[, I<callback data>, ...])
7467  
7468 register a function I<callback function> which is called when a data message with the messag number I<message number> is fetched.
7469  
7470 =back
7471  
7472 =cut
7473  
7474 16 my $msgnum_anon = $invalid[FIT_UINT16];
7475 16 my $msgname_anon = '';
7476  
7477 sub data_message_callback_by_num {
7478 0 ▶ my $self = shift;
Subroutine data_message_callback_by_num: not called CC=11 SCAR=48.8
Pod documented
7479 0 my $num = shift;
7480 0 my $cbmap = $self->data_message_callback;
7481 0 my ($msgtype, $name);
7482  
7483 0 ▶ if ($num == $msgnum_anon) {
Branch: 3 branches
BranchTrueFalseTotal
if ($num == $msgnum_anon) { } 0 0 0
elsif (not defined($msgtype = $msgtype_by_num{$num})) { } 0 0 0
elsif (@_) { } 0 0 0
7484 0 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 0 0 0
7485 0 ▶ if (ref $_[0] eq 'CODE') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_[0] eq 'CODE') { } 0 0 0
7486 0 $cbmap->{$msgname_anon} = $cbmap->{$msgnum_anon} = [@_];
7487 } else {
7488 0 $self->error('not a CODE');
7489 }
7490 } else {
7491 0 my %res;
7492 0 foreach $num (keys %msgtype_by_num) {
7493 0 my $cb = $cbmap->{$num};
7494 0 ▶ ref $cb eq 'ARRAY' and $res{$num} = [@$cb];
Branch: 1 branch
BranchTrueFalseTotal
ref $cb eq "ARRAY" and $res{$num} = [@$cb] 0 0 0
7495 }
7496 0 \%res;
7497 }
7498 } elsif (!defined($msgtype = $msgtype_by_num{$num})) {
7499 0 $self->error("$num is not a message type number");
7500 } elsif (@_) {
7501 0 ▶ if (ref $_[0] eq 'CODE') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_[0] eq 'CODE') { } 0 0 0
7502 0 $cbmap->{$num} = [@_];
7503 0 ▶ $msgtype->{_name} ne '' and $cbmap->{$msgtype->{_name}} = $cbmap->{$num};
Branch: 1 branch
BranchTrueFalseTotal
$msgtype->{"_name"} ne "" and $$cbmap{$msgtype->{"_name"}} = $cbmap->{$num} 0 0 0
7504 0 $cbmap->{$num};
7505 } else {
7506 0 $self->error('not a CODE');
7507 }
7508 } else {
7509 0 my $cb = $cbmap->{$num};
7510 0 ▶ ref $cb eq 'ARRAY' ? [@$cb] : [];
Branch: 1 branch
BranchTrueFalseTotal
ref $cb eq 'ARRAY' ? : 0 0 0
7511 }
7512 }
7513  
7514 =over 4
7515  
7516 =item data_message_callback_by_name(I<message name>, I<callback function>[, I<callback data>, ...])
7517  
7518 register a function I<callback function> which is called when a data message with the name I<message name> is fetched.
7519  
7520 =back
7521  
7522 =cut
7523  
7524 sub data_message_callback_by_name {
7525 48 ▶ my $self = shift;
Subroutine data_message_callback_by_name: called CC=10 SCAR=25.5
Pod documented
7526 48 my $name = shift;
7527 48 my $cbmap = $self->data_message_callback;
7528 48 my $msgtype;
7529  
7530 48 ▶ if ($name eq $msgname_anon) {
Branch: 3 branches
BranchTrueFalseTotal
if ($name eq $msgname_anon) { } 6 42 48
elsif (not defined($msgtype = $msgtype_by_name{$name})) { } 0 42 42
elsif (@_) { } 42 0 42
7531 6 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 4 2 6
7532 4 ▶ if (ref $_[0] eq 'CODE') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_[0] eq 'CODE') { } 4 0 4
7533 4 $cbmap->{$msgname_anon} = $cbmap->{$msgnum_anon} = [@_];
7534 } else {
7535 0 $self->error('not a CODE');
7536 }
7537 } else {
7538 2 my %res;
7539 2 foreach $name (keys %msgtype_by_name) {
7540 196 my $cb = $cbmap->{$name};
7541 196 ▶ ref $cb eq 'ARRAY' and $res{$name} = [@$cb];
Branch: 1 branch
BranchTrueFalseTotal
ref $cb eq "ARRAY" and $res{$name} = [@$cb] 4 192 196
7542 }
7543 2 \%res;
7544 }
7545 } elsif (!defined($msgtype = $msgtype_by_name{$name})) {
7546 0 $self->error("$name is not a message type name");
7547 } elsif (@_) {
7548 42 ▶ if (ref $_[0] eq 'CODE') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $_[0] eq 'CODE') { } 42 0 42
7549 42 $cbmap->{$msgtype->{_number}} = $cbmap->{$name} = [@_];
7550 } else {
7551 0 $self->error('not a CODE');
7552 }
7553 } else {
7554 0 my $cb = $cbmap->{$name};
7555 0 ▶ ref $cb eq 'ARRAY' ? [@$cb] : [];
Branch: 1 branch
BranchTrueFalseTotal
ref $cb eq 'ARRAY' ? : 0 0 0
7556 }
7557 }
7558  
7559 sub undocumented_field_name {
7560 685 ▶ my ($self, $index, $size, $type, $i_string) = @_;
Subroutine undocumented_field_name: called CC=1 SCAR=0.0
Pod undocumented
7561 # 'xxx' . $i_string . '_' . $index . '_' . $size . '_' . $type;
7562 685 'xxx' . $index;
7563 }
7564  
7565 sub syscallback_devdata_id {
7566 0 ▶ my ($self, $desc, $v) = @_;
Subroutine syscallback_devdata_id: not called CC=10 SCAR=47.0
Pod undocumented
7567 0 my ($i_id, $T_id, $c_id, $i_index) = @$desc{qw(i_application_id T_application_id c_application_id i_developer_data_index)};
7568 0 my ($emsg, $warn);
7569  
7570 0 ▶ if (!defined $i_id) {
Branch: 3 branches
BranchTrueFalseTotal
if (not defined $i_id) { } 0 0 0
elsif ($T_id != 2 and $T_id != 13) { } 0 0 0
elsif (not defined $i_index) { } 0 0 0
7571 0 $emsg = "no application_id";
7572 0 $warn = 1;
7573 ▶ } elsif ($T_id != FIT_UINT8 && $T_id != FIT_BYTE) {
Condition0%0/3
$T_id != 2 and $T_id != 13
!ll&&!rl&&r
000
MC/DC0%0/2
$T_id != 2 and $T_id != 13
$T_id != 2 $T_id != 13
Truth table0%0/3
A and B
A= $T_id != 2B= $T_id != 13
ABresult
0X0
100
111
7574 0 croak "There is a bug here, this should be resolved soon";
7575 # $type_name has not been declared in this scope need to figure out what it should be
7576 # $emsg = "base type of application_id is $type_name [$T_id] ($T_id)";
7577 } elsif (!defined $i_index) {
7578 0 $emsg = "no developer_data_index";
7579 }
7580  
7581 0 ▶ if ($emsg ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($emsg ne "") 0 0 0
7582 0 ▶ if ($warn) {
Branch: 1 branch
BranchTrueFalseTotal
if ($warn) { } 0 0 0
7583 0 $self->error("suspicious developer data id message ($emsg)");
7584 } else {
7585 0 $self->error("broken developer data id message ($emsg)");
7586 0 return undef;
7587 }
7588 }
7589  
7590 0 my $devdata_by_index = $self->{devdata_by_index};
7591 0 ▶ ref $devdata_by_index eq 'HASH' or $devdata_by_index = $self->{devdata_by_index} = +{};
Branch: 1 branch
BranchTrueFalseTotal
ref $devdata_by_index eq "HASH" or $devdata_by_index = ($self->{"devdata_by_index"} = {}) 0 0 0
7592  
7593 0 my $devdata_by_id = $self->{devdata_by_id};
7594 0 ▶ ref $devdata_by_id eq 'HASH' or $devdata_by_id = $self->{devdata_by_id} = +{};
Branch: 1 branch
BranchTrueFalseTotal
ref $devdata_by_id eq "HASH" or $devdata_by_id = ($self->{"devdata_by_id"} = {}) 0 0 0
7595  
7596 0 my $id;
7597 0 ▶ if ($T_id == FIT_UINT8) {
Branch: 1 branch
BranchTrueFalseTotal
if ($T_id == 2) { } 0 0 0
7598 0 $id = pack('C*', @$v[$i_id .. ($i_id + $c_id - 1)]);
7599 } else {
7600 0 $id = $v->[$i_id];
7601 }
7602  
7603 0 my %devdata = (id => $id, index => $v->[$i_index]);
7604 0 $devdata_by_id->{$devdata{id}} = $devdata_by_index->{$devdata{index}} = \%devdata;
7605 }
7606  
7607 sub syscallback_devdata_field_desc {
7608 0 ▶ my ($self, $desc, $v) = @_;
Subroutine syscallback_devdata_field_desc: not called CC=25 SCAR=64.8
Pod undocumented
7609  
7610 my ($i_index, $I_index, $i_field_num, $I_field_num,
7611 $i_base_type_id, $T_base_type_id, $I_base_type_id,
7612 $i_field_name, $T_field_name, $c_field_name)
7613 0 = @$desc{qw(i_developer_data_index I_developer_data_index i_field_definition_number I_field_definition_number
7614 i_fit_base_type_id T_fit_base_type_id I_fit_base_type_id
7615 i_field_name T_field_name c_field_name)};
7616  
7617 0 my ($emsg, $warn, $o_name);
7618  
7619 0 ▶ if (!defined $i_index) {
Branch: 6 branches
BranchTrueFalseTotal
if (not defined $i_index) { } 0 0 0
elsif (not defined $i_field_num) { } 0 0 0
elsif (not defined $i_base_type_id) { } 0 0 0
elsif ($T_base_type_id != 2) { } 0 0 0
elsif (not defined $i_field_name) { } 0 0 0
elsif ($T_field_name != 7 or $c_field_name <= 0) { } 0 0 0
7620 0 $emsg = 'no developer_data_index';
7621 } elsif (!defined $i_field_num) {
7622 0 $emsg = 'no field_num';
7623 } elsif (!defined $i_base_type_id) {
7624 0 $emsg = 'no base_type_id';
7625 } elsif ($T_base_type_id != FIT_UINT8) {
7626 0 croak "There is a bug here, this should be resolved soon";
7627 # $type_name has not been declared in this scope need to figure out what it should be
7628 # $emsg = "base type of base_type_id is $type_name [$T_base_type_id] ($T_base_type_id)";
7629 } elsif (!defined $i_field_name) {
7630 0 $emsg = 'no field_name';
7631 0 $warn = 1;
7632 ▶ } elsif ($T_field_name != FIT_STRING || $c_field_name <= 0) {
Condition0%0/3
$T_field_name != 7 or $c_field_name <= 0
l!l&&r!l&&!r
000
MC/DC0%0/2
$T_field_name != 7 or $c_field_name <= 0
$T_field_name != 7 $c_field_name <= 0
Truth table0%0/3
A or B
A= $T_field_name != 7B= $c_field_name <= 0
ABresult
1X1
011
000
7633 0 $emsg = "field_name is not a non-empty string";
7634 0 $warn = 1;
7635 } else {
7636 0 $o_name = $self->string_value($v, $i_field_name, $c_field_name);
7637 }
7638  
7639 0 ▶ if ($emsg ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($emsg ne "") 0 0 0
7640 0 ▶ if ($warn) {
Branch: 1 branch
BranchTrueFalseTotal
if ($warn) { } 0 0 0
7641 0 $self->error("suspicious field description message ($emsg)");
7642 } else {
7643 0 $self->error("broken field description message ($emsg)");
7644 0 return undef;
7645 }
7646 }
7647  
7648 0 my $base_type = $v->[$i_base_type_id];
7649  
7650 0 ▶ if ($base_type == $I_base_type_id) {
Branch: 1 branch
BranchTrueFalseTotal
if ($base_type == $I_base_type_id) 0 0 0
7651 0 $self->error("invalid base type ($base_type)");
7652 0 return undef;
7653 }
7654  
7655 0 ▶ if ($base_type < 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($base_type < 0) 0 0 0
7656 0 $self->error("unknown base type ($base_type)");
7657 0 return undef;
7658 }
7659  
7660 0 $base_type &= $deffld_mask_type;
7661  
7662 0 ▶ unless ($base_type <= FIT_BASE_TYPE_MAX) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($base_type <= 16) 0 0 0
7663 0 $self->error("unknown base type ($base_type)");
7664 0 return undef;
7665 }
7666  
7667 0 my $devdata_by_index = $self->{devdata_by_index};
7668  
7669 0 ▶ unless (ref $devdata_by_index eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $devdata_by_index eq "HASH") 0 0 0
7670 0 $self->error('no developer data id message before a field description message');
7671 0 return undef;
7672 }
7673  
7674 0 my $index = $v->[$i_index];
7675  
7676 0 ▶ if ($index == $I_index) {
Branch: 1 branch
BranchTrueFalseTotal
if ($index == $I_index) 0 0 0
7677 0 $self->error("invalid developer data index ($index)");
7678 0 return undef;
7679 }
7680  
7681 0 my $num = $v->[$i_field_num];
7682  
7683 0 ▶ if ($num == $I_field_num) {
Branch: 1 branch
BranchTrueFalseTotal
if ($num == $I_field_num) 0 0 0
7684 0 $self->error("invalid field definition number ($num)");
7685 0 return undef;
7686 }
7687  
7688 0 my $devdata = $devdata_by_index->{$index};
7689  
7690 0 ▶ unless (ref $devdata eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $devdata eq "HASH") 0 0 0
7691 0 $self->error("No developer data id message with the index $index before a field description message");
7692 0 return undef;
7693 }
7694  
7695 0 my $field_desc_by_num = $devdata->{field_desc_by_num};
7696 0 ▶ ref $field_desc_by_num eq 'HASH' or $field_desc_by_num = $devdata->{field_desc_by_num} = +{};
Branch: 1 branch
BranchTrueFalseTotal
ref $field_desc_by_num eq "HASH" or $field_desc_by_num = ($devdata->{"field_desc_by_num"} = {}) 0 0 0
7697  
7698 0 my $field_desc_by_name = $devdata->{field_desc_by_name};
7699 0 ▶ ref $field_desc_by_name eq 'HASH' or $field_desc_by_name = $devdata->{field_desc_by_name} = +{};
Branch: 1 branch
BranchTrueFalseTotal
ref $field_desc_by_name eq "HASH" or $field_desc_by_name = ($devdata->{"field_desc_by_name"} = {}) 0 0 0
7700  
7701 0 my $name = $o_name;
7702  
7703 0 ▶ if (defined $name) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $name) 0 0 0
7704 0 $name =~ s/\s+/_/g;
7705 0 $name =~ s/\W/sprintf('_%02x_', ord($&))/ge;
7706 }
7707  
7708 0 my %fdesc = (
7709 '_index' => $index,
7710 '_num' => $num,
7711 '_name' => $name,
7712 'field_name' => $o_name,
7713 '_type' => $base_type,
7714 );
7715  
7716 0 for my $i_aname (grep {/^i_/} keys %$desc) {
7717 0 ▶ if ($i_aname !~ /^i_(developer_data_index|field_definition_number|fit_base_type_id|field_name)$/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($i_aname =~ /^i_(developer_data_index|field_definition_number|fit_base_type_id|field_name)$/) 0 0 0
7718 0 my $i = $desc->{$i_aname};
7719 0 my $aname = $i_aname;
7720  
7721 0 $aname =~ s/^i_//;
7722  
7723 0 my $I_aname = 'I_' . $aname;
7724 0 my $T_aname = 'T_' . $aname;
7725 0 my $c_aname = 'c_' . $aname;
7726  
7727 0 ▶ if ($desc->{$T_aname} == FIT_STRING) {
Branch: 2 branches
BranchTrueFalseTotal
if ($desc->{$T_aname} == 7) { } 0 0 0
elsif ($v->[$i] != $desc->{$I_aname}) { } 0 0 0
7728 0 $fdesc{$aname} = $self->string_value($v, $i, $desc->{$c_aname});
7729 } elsif ($v->[$i] != $desc->{$I_aname}) {
7730 0 $fdesc{$aname} = $v->[$i];
7731 }
7732 }
7733 }
7734  
7735 0 ▶ defined $name and $field_desc_by_name->{$name} = \%fdesc;
Branch: 1 branch
BranchTrueFalseTotal
defined $name and $field_desc_by_name->{$name} = \%fdesc 0 0 0
7736 0 $field_desc_by_num->{$num} = \%fdesc;
7737 }
7738  
7739 sub add_endian_converter {
7740 2896 ▶ my ($self, $endian, $type, $c, $i_string, $cvt) = @_;
Subroutine add_endian_converter: called CC=5 SCAR=27.1
Pod undocumented
7741  
7742 2896 ▶ if ($endian != $my_endian && $size[$type] > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($endian != $my_endian and $size[$type] > 1) { } 0 2896 2896
Condition33%1/3
$endian != $my_endian and $size[$type] > 1
!ll&&!rl&&r
289600
MC/DC0%0/2
$endian != $my_endian and $size[$type] > 1
$endian != $my_endian $size[$type] > 1
Truth table33%1/3
A and B
A= $endian != $my_endianB= $size[$type] > 1
ABresult
0X0
100
111
7743 0 my ($p, $unp, $n);
7744  
7745 0 ▶ if ($size[$type] == 2) {
Branch: 2 branches
BranchTrueFalseTotal
if ($size[$type] == 2) { } 0 0 0
elsif ($size[$type] == 4) { } 0 0 0
7746 0 ($p, $unp) = (qw(n v));
7747 } elsif ($size[$type] == 4) {
7748 0 ($p, $unp) = (qw(N V));
7749 } else {
7750 0 ($p, $unp, $n) = (qw(N V), 2);
7751 }
7752  
7753 0 push @$cvt, $p . $n, $unp . $n, $i_string, $size[$type], $c;
7754 0 1;
7755 } else {
7756 2896 0;
7757 }
7758 }
7759  
7760 sub fetch_definition_message {
7761 125 ▶ my $self = shift;
Subroutine fetch_definition_message: called CC=37 SCAR=53.1
Pod undocumented
7762 125 my $buffer = $self->buffer;
7763  
7764 125 ▶ if ( $self->_buffer_needs_updating( $defmsg_min_length ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_buffer_needs_updating($defmsg_min_length)) 0 125 125
7765 0 ▶ $self->fill_buffer or return undef
Branch: 1 branch
BranchTrueFalseTotal
$self->fill_buffer or return undef 0 0 0
7766 }
7767 125 my $i = $self->offset;
7768 125 my ($record_header, $reserved, $endian, $msgnum, $nfields) = unpack($defmsg_min_template, substr($$buffer, $i, $defmsg_min_length));
7769  
7770 125 ▶ $endian = $endian ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$endian ? : 0 125 125
7771 125 $self->offset($i + $defmsg_min_length);
7772  
7773 125 my $len = $nfields * $deffld_length;
7774  
7775 125 ▶ if ( $self->_buffer_needs_updating( $len ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_buffer_needs_updating($len)) 0 125 125
7776 0 ▶ $self->fill_buffer or return undef
Branch: 1 branch
BranchTrueFalseTotal
$self->fill_buffer or return undef 0 0 0
7777 }
7778 125 $i = $self->offset;
7779 125 ▶ $msgnum = unpack('n', pack('v', $msgnum)) if $endian != $my_endian;
Branch: 1 branch
BranchTrueFalseTotal
if $endian != $my_endian 0 125 125
7780  
7781 125 my $msgtype = $msgtype_by_num{$msgnum};
7782 125 my $cbmap = $self->data_message_callback;
7783 125 my $e = $i + $len;
7784 125 my ($cb, %desc, $i_array, $i_array_t, $i_string, @cvt, @pi);
7785  
7786 125 $desc{local_message_type} = $record_header & $rechd_mask_local_message_type;
7787 125 $desc{message_number} = $msgnum;
7788 125 ▶ $desc{message_name} = $msgtype->{_name} if ref $msgtype eq 'HASH' && exists $msgtype->{_name};
Branch: 1 branch
BranchTrueFalseTotal
if ref $msgtype eq "HASH" and exists $msgtype->{"_name"} 96 29 125
Condition100%3/3
ref $msgtype eq "HASH" and exists $msgtype->{"_name"}
!ll&&!rl&&r
131696
MC/DC100%2/2
ref $msgtype eq "HASH" and exists $msgtype->{"_name"}
ref $msgtype eq "HASH" exists $msgtype->{"_name"}
Truth table100%3/3
A and B
A= ref $msgtype eq "HASH"B= exists $msgtype->{"_name"}
ABresult
0X0
100
111
7789 125 ▶ $cb = $cbmap->{$msgnum} if ref $cbmap->{$msgnum} eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
if ref $cbmap->{$msgnum} eq "ARRAY" 16 109 125
7790 125 ▶ $cb = $cbmap->{$msgnum_anon} if ref $cb ne 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
if ref $cb ne "ARRAY" 109 16 125
7791 125 ▶ $desc{callback} = $cb if ref $cb eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
if ref $cb eq "ARRAY" 58 67 125
7792 125 $desc{endian} = $endian;
7793 125 $desc{template} = 'C';
7794 125 $self->data_message_descriptor->[$desc{local_message_type}] = \%desc;
7795  
7796 125 ▶ for ($i_array = $i_array_t = $i_string = 1 ; $i + $deffld_length <= $e ; $i += $deffld_length) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i + $deffld_length <= $e) 2896 125 3021
7797 2896 my ($index, $size, $type) = unpack($deffld_template, substr($$buffer, $i, $deffld_length));
7798 2896 my ($name, $tname, %attr, );
7799  
7800 2896 ▶ if (ref $msgtype eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $msgtype eq "HASH") 2812 84 2896
7801 2812 my $fldtype = $msgtype->{$index};
7802  
7803 2812 ▶ if (ref $fldtype eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $fldtype eq "HASH") 2211 601 2812
7804 2211 %attr = %$fldtype;
7805 2211 ($name, $tname) = @attr{qw(name type_name)};
7806 2211 delete $attr{name};
7807 2211 delete $attr{type_name};
7808 }
7809 }
7810  
7811 2896 ▶ $name = $self->undocumented_field_name($index, $size, $type, $i_string) if !defined $name;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $name 685 2211 2896
7812 2896 $desc{$index} = $name;
7813 2896 $type &= $deffld_mask_type;
7814  
7815 2896 my $c = int($size / $size[$type] + 0.5);
7816  
7817 2896 $desc{'i_' . $name} = $i_array;
7818 2896 $desc{'o_' . $name} = $i_string;
7819 2896 $desc{'c_' . $name} = $c;
7820 2896 $desc{'s_' . $name} = $size[$type];
7821 2896 ▶ $desc{'a_' . $name} = \%attr if %attr;
Branch: 1 branch
BranchTrueFalseTotal
if %attr 1863 1033 2896
7822 2896 ▶ $desc{'t_' . $name} = $tname if defined $tname;
Branch: 1 branch
BranchTrueFalseTotal
if defined $tname 402 2494 2896
7823 2896 $desc{'T_' . $name} = $type;
7824 2896 $desc{'N_' . $name} = $index;
7825 2896 $desc{'I_' . $name} = $invalid[$type];
7826  
7827 2896 $self->add_endian_converter($endian, $type, $c, $i_string, \@cvt);
7828  
7829 2896 $i_array += $c;
7830 2896 $i_string += $size;
7831 2896 $desc{template} .= ' ' . $template[$type];
7832  
7833 2896 ▶ if ($packfactor[$type] > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($packfactor[$type] > 1) 0 2896 2896
7834 0 push @pi, $i_array_t, $c, $i_array;
7835 0 $c *= $packfactor[$type];
7836 }
7837  
7838 2896 ▶ $desc{template} .= $c if $c > 1;
Branch: 1 branch
BranchTrueFalseTotal
if $c > 1 188 2708 2896
7839 2896 $i_array_t += $c;
7840 }
7841  
7842 125 $desc{template_without_devdata} = $desc{template};
7843 125 $desc{devdata_first} = $i_array;
7844 125 $desc{devdata_nfields} = 0;
7845  
7846 125 ▶ if ($record_header & $rechd_mask_devdata_message) {
Branch: 1 branch
BranchTrueFalseTotal
if ($record_header & $rechd_mask_devdata_message) 0 125 125
7847 0 $self->offset($e);
7848 0 ▶ if ( $self->_buffer_needs_updating( $devdata_min_length ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_buffer_needs_updating($devdata_min_length)) 0 0 0
7849 0 ▶ $self->fill_buffer or return undef
Branch: 1 branch
BranchTrueFalseTotal
$self->fill_buffer or return undef 0 0 0
7850 }
7851 0 $i = $self->offset;
7852 0 ($nfields) = unpack($devdata_min_template, substr($$buffer, $i, $devdata_min_length));
7853  
7854 0 $self->offset($i + $devdata_min_length);
7855 0 $len = $nfields * $devdata_deffld_length;
7856 0 ▶ if ( $self->_buffer_needs_updating( $len ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_buffer_needs_updating($len)) 0 0 0
7857 0 ▶ $self->fill_buffer or return undef
Branch: 1 branch
BranchTrueFalseTotal
$self->fill_buffer or return undef 0 0 0
7858 }
7859  
7860 0 my $devdata_by_index = $self->{devdata_by_index};
7861 0 my @emsg;
7862  
7863 0 ▶ if (ref $devdata_by_index ne 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $devdata_by_index ne "HASH") 0 0 0
7864 0 push @emsg, 'No developer data id';
7865 0 $devdata_by_index = +{};
7866 }
7867  
7868 0 ▶ for ($i = $self->offset, $e = $i + $len ; $i + $devdata_deffld_length <= $e ; $i += $devdata_deffld_length) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i + $devdata_deffld_length <= $e) 0 0 0
7869 0 my ($fnum, $size, $index) = unpack($devdata_deffld_template, substr($$buffer, $i, $devdata_deffld_length));
7870 0 my $devdata = $devdata_by_index->{$index};
7871 0 my ($fdesc, $name, $type, %attr);
7872  
7873 0 ▶ if (ref $devdata eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $devdata eq 'HASH') { } 0 0 0
7874 0 my $fdesc_by_num = $devdata->{field_desc_by_num};
7875  
7876 0 ▶ if (ref $fdesc_by_num eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $fdesc_by_num eq 'HASH') { } 0 0 0
7877 0 $fdesc = $fdesc_by_num->{$fnum};
7878 } else {
7879 0 push @emsg, "No field description message for developer data with index $index";
7880 }
7881 } else {
7882 0 push @emsg, "No developer data id with index $index";
7883 }
7884  
7885 0 ▶ if (ref $fdesc eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $fdesc eq 'HASH') { } 0 0 0
7886 0 %attr = %$fdesc;
7887 0 ($type, $name) = @attr{qw(_type _name)};
7888 } else {
7889 0 push @emsg, "No field with number $fnum for developer data with index $index";
7890 0 $type = FIT_UINT8;
7891 }
7892  
7893 0 ▶ $name = $self->undocumented_field_name($fnum, $size, $type, $i_string) if !defined $name;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $name 0 0 0
7894 0 $name = "${index}_${fnum}_$name";
7895  
7896 0 my $c = int($size / $size[$type] + 0.5);
7897  
7898 0 $desc{'i_' . $name} = $i_array;
7899 0 $desc{'o_' . $name} = $i_string;
7900 0 $desc{'c_' . $name} = $c;
7901 0 $desc{'s_' . $name} = $size[$type];
7902 0 ▶ $desc{'a_' . $name} = \%attr if %attr;
Branch: 1 branch
BranchTrueFalseTotal
if %attr 0 0 0
7903 0 $desc{'T_' . $name} = $type;
7904 0 $desc{'N_' . $name} = $fnum;
7905 0 $desc{'I_' . $name} = $invalid[$type];
7906  
7907 0 $self->add_endian_converter($endian, $type, $c, $i_string, \@cvt);
7908  
7909 0 $i_array += $c;
7910 0 $i_string += $size;
7911 0 $desc{template} .= ' ' . $template[$type];
7912  
7913 0 ▶ if ($packfactor[$type] > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($packfactor[$type] > 1) 0 0 0
7914 0 push @pi, $type, $i_array_t, $c, $i_array;
7915 0 $c *= $packfactor[$type];
7916 }
7917  
7918 0 ▶ $desc{template} .= $c if $c > 1;
Branch: 1 branch
BranchTrueFalseTotal
if $c > 1 0 0 0
7919 0 $i_array_t += $c;
7920 }
7921  
7922 0 $desc{devdata_nfields} = $nfields;
7923 0 ▶ $self->error(join(' / ', @emsg)) if (@emsg);
Branch: 1 branch
BranchTrueFalseTotal
if @emsg 0 0 0
7924 }
7925  
7926 125 ▶ $desc{endian_converter} = \@cvt if @cvt;
Branch: 1 branch
BranchTrueFalseTotal
if @cvt 0 125 125
7927 125 ▶ $desc{packfilter_index} = \@pi if @pi;
Branch: 1 branch
BranchTrueFalseTotal
if @pi 0 125 125
7928 125 $desc{message_length} = $i_string;
7929 125 $desc{array_length} = $i_array;
7930 125 $self->offset($e);
7931 125 return 1
7932 }
7933  
7934 sub endian_convert {
7935 0 ▶ my ($self, $cvt, $buffer, $i) = @_;
Subroutine endian_convert: not called CC=4 SCAR=30.0
Pod undocumented
7936 0 my $j;
7937  
7938 0 ▶ for ($j = 4 ; $j < @$cvt ; $j += 5) {
Branch: 1 branch
BranchTrueFalseTotal
if ($j < @$cvt) 0 0 0
7939 0 my ($b, $size, $c) = @$cvt[$j - 2, $j - 1, $j];
7940  
7941 0 ▶ for ($b += $i ; $c > 0 ; $b += $size, --$c) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 0) 0 0 0
7942 0 my @v = unpack($cvt->[$j - 3], substr($$buffer, $b, $size));
7943 0 my ($k, $l);
7944  
7945 0 ▶ for ($k = 0, $l = $#v ; $k < $l ; ++$k, --$l) {
Branch: 1 branch
BranchTrueFalseTotal
if ($k < $l) 0 0 0
7946 0 @v[$k, $l] = @v[$l, $k];
7947 }
7948 0 substr($$buffer, $b, $size) = pack($cvt->[$j - 4], @v);
7949 }
7950 }
7951 }
7952  
7953 sub last_timestamp {
7954 233 ▶ my $self = shift;
Subroutine last_timestamp: called CC=2 SCAR=7.6
Pod undocumented
7955 233 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 233 0 233
7956 233 $self->{last_timestamp} = $_[0];
7957 } else {
7958 0 $self->{last_timestamp};
7959 }
7960 }
7961  
7962 sub fetch_data_message {
7963 1029 ▶ my ($self, $desc) = @_;
Subroutine fetch_data_message: called CC=10 SCAR=30.0
Pod undocumented
7964 1029 my $buffer = $self->buffer;
7965  
7966 1029 ▶ if ( $self->_buffer_needs_updating( $desc->{message_length} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_buffer_needs_updating($desc->{"message_length"})) 4 1025 1029
7967 4 ▶ $self->fill_buffer or return undef
Branch: 1 branch
BranchTrueFalseTotal
$self->fill_buffer or return undef 0 4 4
7968 }
7969 1029 ▶ $self->endian_convert($desc->{endian_converter}, $self->buffer, $self->offset) if ref $desc->{endian_converter} eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
if ref $desc->{"endian_converter"} eq "ARRAY" 0 1029 1029
7970  
7971 1029 my $i = $self->offset;
7972 # unpack('f'/'d', ...) unpacks to NaN
7973 1029 my @v = unpack($desc->{template}, substr($$buffer, $i, $desc->{message_length}));
7974  
7975 1029 ▶ if (ref $desc->{packfilter_index} eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $desc->{"packfilter_index"} eq "ARRAY") 0 1029 1029
7976 0 my $piv = $desc->{packfilter_index};
7977 0 my ($i, $j);
7978 0 my @v_t = @v;
7979  
7980 0 @v = ($v_t[0]);
7981  
7982 0 ▶ for ($i = 1, $j = 3 ; $j < @$piv ; $j += 4) {
Branch: 1 branch
BranchTrueFalseTotal
if ($j < @$piv) 0 0 0
7983 0 my ($type, $i_array_t, $c, $i_array) = @$piv[($j - 3) .. $j];
7984 0 my $delta = $packfactor[$type];
7985  
7986 0 ▶ $i < $i_array_t and push @v, @v_t[$i .. ($i_array_t - 1)];
Branch: 1 branch
BranchTrueFalseTotal
$i < $i_array_t and push @v, @v_t[$i .. $i_array_t - 1] 0 0 0
7987 0 $i = $i_array_t + $c * $delta;
7988  
7989 0 ▶ for (; $i_array_t < $i ; $i_array_t += $delta) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i_array_t < $i) 0 0 0
7990 0 push @v, $unpackfilter[$type]->(@v_t[$i_array_t .. ($i_array_t + $delta - 1)]);
7991 }
7992 }
7993 }
7994  
7995 1029 $self->offset($i + $desc->{message_length});
7996  
7997 1029 my $cb = $desc->{callback};
7998  
7999 1029 my $ret_val;
8000 1029 ▶ if (ref $cb eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $cb eq 'ARRAY') { } 725 304 1029
8001 725 ▶ $v[0] & $rechd_mask_compressed_timestamp_header and push @v, $self->last_timestamp + ($v[0] & $rechd_mask_cth_timestamp);
Branch: 1 branch
BranchTrueFalseTotal
$v[0] & $rechd_mask_compressed_timestamp_header and push @v, $self->last_timestamp + ($v[0] & $rechd_mask_cth_timestamp) 0 725 725
8002 725 $ret_val = $cb->[0]->($self, $desc, \@v, @$cb[1 .. $#$cb]);
8003 } else {
8004 304 $ret_val = 1;
8005 }
8006 1029 return $ret_val
8007 }
8008  
8009 sub pack_data_message {
8010 0 ▶ my ($self, $desc, $v) = @_;
Subroutine pack_data_message: not called CC=10 SCAR=47.0
Pod undocumented
8011 0 my $drop_devdata = $self->drop_developer_data;
8012  
8013 0 ▶ if ($drop_devdata && ($desc->{message_name} eq 'developer_data_id' || $desc->{message_name} eq 'field_description')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($drop_devdata and $desc->{'message_name'} eq 'developer_data_id' || $desc->{'message_name'} eq 'field_description') { } 0 0 0
Condition0%0/6
$drop_devdata and $desc->{"message_name"} eq "developer_data_id" || $desc->{"message_name"} eq "field_description"
!ll&&!rl&&r
000
$desc->{"message_name"} eq "developer_data_id" or $desc->{"message_name"} eq "field_description"
l!l&&r!l&&!r
000
MC/DC0%0/3
$drop_devdata and $desc->{"message_name"} eq "developer_data_id" || $desc->{"message_name"} eq "field_description"
$drop_devdata $desc->{"message_name"} eq "developer_data_id" $desc->{"message_name"} eq "field_description"
Truth table0%0/4
A and B or C
A= $drop_devdataB= $desc->{"message_name"} eq "developer_data_id"C= $desc->{"message_name"} eq "field_description"
ABCresult
0XX0
1000
11X1
1011
8014 0 '';
8015 } else {
8016 0 my $rv = $v;
8017  
8018 0 ▶ if (ref $desc->{packfilter_index} eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $desc->{"packfilter_index"} eq "ARRAY") 0 0 0
8019 0 my @v = ($v->[0]);
8020 0 my $piv = $desc->{packfilter_index};
8021 0 my ($i, $j);
8022  
8023 0 ▶ for ($i = 1, $j = 3 ; $j < @$piv ; $j += 4) {
Branch: 1 branch
BranchTrueFalseTotal
if ($j < @$piv) 0 0 0
8024 0 my ($type, $i_array_t, $c, $i_array) = @$piv[($j - 3) .. $j];
8025  
8026 0 ▶ $i < $i_array and push @v, @$v[$i .. ($i_array - 1)];
Branch: 1 branch
BranchTrueFalseTotal
$i < $i_array and push @v, @$v[$i .. $i_array - 1] 0 0 0
8027 0 $i = $i_array + $c;
8028  
8029 0 ▶ for (; $i_array < $i ; ++$i_array) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i_array < $i) 0 0 0
8030 0 push @v, $packfilter[$type]->($v->[$i_array]);
8031 }
8032 }
8033 0 $rv = \@v;
8034 }
8035  
8036 0 ▶ if ($drop_devdata) {
Branch: 1 branch
BranchTrueFalseTotal
if ($drop_devdata) { } 0 0 0
8037 0 ▶ if ($desc->{devdata_first} > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($desc->{'devdata_first'} > 0) { } 0 0 0
8038 0 pack($desc->{template_without_devdata}, @$rv[0 .. ($desc->{devdata_first} - 1)]);
8039 } else {
8040 0 '';
8041 }
8042 } else {
8043 0 pack($desc->{template}, @$rv);
8044 }
8045 }
8046 }
8047  
8048 =over 4
8049  
8050 =item switched(I<data message descriptor>, I<array of values>, I<data type table>)
8051  
8052 returns real data type attributes for a C's union like field.
8053  
8054 =back
8055  
8056 =cut
8057  
8058 sub switched {
8059 40 ▶ my ($self, $desc, $v, $sw) = @_;
Subroutine switched: called CC=8 SCAR=21.0
Pod documented
8060 40 my ($keyv, $key, $attr);
8061  
8062 40 ▶ if (ref $sw->{_by} eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $sw->{'_by'} eq 'ARRAY') { } 0 40 40
8063 0 $keyv = $sw->{_by};
8064 } else {
8065 40 $keyv = [$sw->{_by}];
8066 }
8067  
8068 40 for $key (@$keyv) {
8069 40 my $i_name = 'i_' . $key;
8070 40 my $val;
8071  
8072 40 ▶ if (defined $desc->{$i_name} && ($val = $v->[$desc->{$i_name}]) != $desc->{'I_' . $key}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $desc->{$i_name} and ($val = $$v[$desc->{$i_name}]) != $$desc{'I_' . $key}) 38 2 40
Condition66%2/3
defined $desc->{$i_name} and ($val = $$v[$desc->{$i_name}]) != $$desc{'I_' . $key}
!ll&&!rl&&r
0238
MC/DC50%1/2
defined $desc->{$i_name} and ($val = $$v[$desc->{$i_name}]) != $$desc{'I_' . $key}
defined $desc->{$i_name} ($val = $$v[$desc->{$i_name}]) != $$desc{'I_' . $key}
Truth table66%2/3
A and B
A= defined $desc->{$i_name}B= ($val = $$v[$desc->{$i_name}]) != $$desc{'I_' . $key}
ABresult
0X0
100
111
8073 38 my $key_tn = $desc->{'t_' . $key};
8074  
8075 38 ▶ if (defined $key_tn) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $key_tn) 38 0 38
8076 38 my $t_val = $self->named_type_value($key_tn, $val);
8077  
8078 38 ▶ $val = $t_val if defined $t_val;
Branch: 1 branch
BranchTrueFalseTotal
if defined $t_val 37 1 38
8079 }
8080  
8081 38 ▶ if (ref $sw->{$val} eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $sw->{$val} eq "HASH") 25 13 38
8082 25 $attr = $sw->{$val};
8083 25 last;
8084 }
8085 }
8086 }
8087 40 $attr;
8088 }
8089  
8090 =over 4
8091  
8092 =item string_value(I<array of values>, I<offset in the array>, I<counts>)
8093  
8094 converts an array of character codes to a Perl string.
8095  
8096 =back
8097  
8098 =cut
8099  
8100 sub string_value {
8101 11 ▶ my ($self, $v, $i, $n) = @_;
Subroutine string_value: called CC=3 SCAR=11.0
Pod documented
8102 11 my $j;
8103  
8104 11 ▶ for ($j = 0 ; $j < $n ; ++$j) {
Branch: 1 branch
BranchTrueFalseTotal
if ($j < $n) 104 0 104
8105 104 ▶ $v->[$i + $j] == 0 && last;
Branch: 1 branch
BranchTrueFalseTotal
$$v[$i + $j] == 0 and last 11 93 104
8106 }
8107 11 pack('C*', @{$v}[$i .. ($i + $j - 1)]);
8108 }
8109  
8110 sub value_processed {
8111 4572 ▶ my ($self, $num, $attr) = @_;
Subroutine value_processed: called CC=15 SCAR=27.7
Pod undocumented
8112  
8113 4572 ▶ if (ref $attr eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $attr eq 'HASH') { } 4572 0 4572
8114 4572 my ($unit, $offset, $scale) = @{$attr}{qw(unit offset scale)};
8115  
8116 4572 ▶ $num /= $scale if defined $scale and $scale > 0;
Branch: 1 branch
BranchTrueFalseTotal
if defined $scale and $scale > 0 1934 2638 4572
Condition66%2/3
defined $scale and $scale > 0
!ll&&!rl&&r
263801934
MC/DC50%1/2
defined $scale and $scale > 0
defined $scale $scale > 0
Truth table66%2/3
A and B
A= defined $scaleB= $scale > 0
ABresult
0X0
100
111
8117 4572 ▶ $num -= $offset if $offset;
Branch: 1 branch
BranchTrueFalseTotal
if $offset 623 3949 4572
8118  
8119 4572 ▶ if (defined $unit) {
Branch: 2 branches
BranchTrueFalseTotal
if (defined $unit) { } 3469 1103 4572
elsif (defined $scale and $scale > 0) { } 14 1089 1103
8120 3469 my $unit_tab = $self->unit_table($unit);
8121  
8122 3469 ▶ if (ref $unit_tab eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $unit_tab eq "HASH") 1506 1963 3469
8123 1506 my ($unit1, $offset1, $scale1) = @{$unit_tab}{qw(unit offset scale)};
8124  
8125 1506 ▶ if ($scale1 > 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($scale1 > 0) 1506 0 1506
8126 1506 $num /= $scale1;
8127 1506 $scale += $scale1;
8128 }
8129 1506 ▶ $num -= $offset1 if $offset1;
Branch: 1 branch
BranchTrueFalseTotal
if $offset1 0 1506 1506
8130 1506 ▶ $unit = $unit1 if $unit1 ne '';
Branch: 1 branch
BranchTrueFalseTotal
if $unit1 ne "" 1506 0 1506
8131 }
8132  
8133 3469 ▶ if ($scale > 0) {
Branch: 2 branches
BranchTrueFalseTotal
if ($scale > 0) { } 3208 261 3469
elsif ($self->without_unit) { } 0 261 261
8134 3208 my $below_pt = int(log($scale + 9) / log(10));
8135  
8136 3208 ▶ if ($self->without_unit) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->without_unit) { } 2116 1092 3208
8137 2116 sprintf("%.${below_pt}f", $num);
8138 } else {
8139 1092 sprintf("%.${below_pt}f %s", $num, $unit);
8140 }
8141 } elsif ($self->without_unit) {
8142 0 $num;
8143 } else {
8144 261 $num . " " . $unit;
8145 }
8146 ▶ } elsif (defined $scale and $scale > 0) {
Condition66%2/3
defined $scale and $scale > 0
!ll&&!rl&&r
1089014
MC/DC50%1/2
defined $scale and $scale > 0
defined $scale $scale > 0
Truth table66%2/3
A and B
A= defined $scaleB= $scale > 0
ABresult
0X0
100
111
8147 14 my $below_pt = int(log($scale + 9) / log(10));
8148 14 sprintf("%.${below_pt}f", $num);
8149 } else {
8150 1089 $num;
8151 }
8152 } else {
8153 0 $num;
8154 }
8155 }
8156  
8157 sub value_unprocessed {
8158 0 ▶ my ($self, $str, $attr) = @_;
Subroutine value_unprocessed: not called CC=11 SCAR=48.8
Pod undocumented
8159  
8160 0 ▶ if (ref $attr eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $attr eq 'HASH') { } 0 0 0
8161 0 my ($unit, $offset, $scale) = @{$attr}{qw(unit offset scale)};
8162 0 my $num = $str;
8163  
8164 0 ▶ if ($unit ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($unit ne "") 0 0 0
8165 0 my $unit_tab = $self->unit_table($unit);
8166  
8167 0 ▶ if (ref $unit_tab eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $unit_tab eq "HASH") 0 0 0
8168 0 my ($unit1, $offset1, $scale1) = @{$unit_tab}{qw(unit offset scale)};
8169  
8170 0 ▶ $scale += $scale1 if $scale1 > 0;
Branch: 1 branch
BranchTrueFalseTotal
if $scale1 > 0 0 0 0
8171 0 ▶ $offset += $offset1 if $offset1;
Branch: 1 branch
BranchTrueFalseTotal
if $offset1 0 0 0
8172 0 ▶ $unit = $unit1 if $unit1 ne '';
Branch: 1 branch
BranchTrueFalseTotal
if $unit1 ne "" 0 0 0
8173 }
8174  
8175 0 ▶ length($num) >= length($unit) && substr($num, -length($unit)) eq $unit
Branch: 1 branch
BranchTrueFalseTotal
length $num >= length $unit and substr($num, -length($unit)) eq $unit and substr($num, -length($unit)) = "" 0 0 0
Condition0%0/3
length $num >= length $unit and substr($num, -length($unit)) eq $unit
!ll&&!rl&&r
000
MC/DC0%0/2
length $num >= length $unit and substr($num, -length($unit)) eq $unit
length $num >= length $unit substr($num, -length($unit)) eq $unit
Truth table0%0/3
A and B
A= length $num >= length $unitB= substr($num, -length($unit)) eq $unit
ABresult
0X0
100
111
8176 and substr($num, -length($unit)) = '';
8177 }
8178  
8179 0 ▶ $num += $offset if $offset;
Branch: 1 branch
BranchTrueFalseTotal
if $offset 0 0 0
8180 0 ▶ $num *= $scale if $scale > 0;
Branch: 1 branch
BranchTrueFalseTotal
if $scale > 0 0 0 0
8181 0 $num;
8182 } else {
8183 0 $str;
8184 }
8185 }
8186  
8187 =over 4
8188  
8189 =item field_list( I<$descriptor> )
8190  
8191 Given a data message descriptor, returns the list of fields described in it.
8192  
8193 =back
8194  
8195 =cut
8196  
8197 sub field_list {
8198 1 ▶ my ($self, $desc) = @_;
Subroutine field_list: called CC=3 SCAR=11.0
Pod documented
8199 1 ▶ croak "argument to field_list() does not look like a data descriptor hash" if ref $desc ne 'HASH';
Branch: 1 branch
BranchTrueFalseTotal
if ref $desc ne "HASH" 0 1 1
8200  
8201 1 my (@fields, @fields_sorted, @keys);
8202 1 @keys = grep /^\d+/, keys %$desc;
8203 1 @fields = @$desc{ @keys };
8204  
8205 1 for my $field (@fields) { # sort for easy comparison with values aref passed to callbacks
8206 7 my $index = $desc->{'i_' . $field} - 1;
8207 7 $fields_sorted[$index ] = $field
8208 }
8209 return @fields_sorted
8210 1 }
8211  
8212 =over 4
8213  
8214 =item field_value( I<$field>, I<$descriptor>, I<$values> )
8215  
8216 Returns the value the field named I<$field> (a string).
8217  
8218 The other arguments consist of the data message descriptor (I<$descriptor>, a hash reference) and the values fetched from a data message (I<$values>, an array reference). These are simply the references passed to data message callbacks by C<fetch()>, if any are registered, and are simply to be passed on to this method (please do not modifiy them).
8219  
8220 For example, we can define and register a callback for C<file_id> data messages and get the name of the manufacturer of the device that recorded the FIT file:
8221  
8222 my $file_id_callback = sub {
8223 my ($self, $descriptor, $values) = @_;
8224 my $value = $self->field_value( 'manufacturer', $descriptor, $values );
8225  
8226 print "The manufacturer is: ", $value, "\n"
8227 };
8228  
8229 $fit->data_message_callback_by_name('file_id', $file_id_callback ) or die $fit->error;
8230  
8231 1 while ( $fit->fetch );
8232  
8233 =back
8234  
8235 =cut
8236  
8237 sub field_value {
8238 4 ▶ my ($self, $field_name, $descriptor, $values) = @_;
Subroutine field_value: called CC=5 SCAR=16.3
Pod documented
8239  
8240 4 my @keys = map $_ . $field_name, qw( t_ a_ I_ );
8241 my ($type_name, $attr, $invalid, $val) =
8242 4 ( @{$descriptor}{ @keys }, $values->[ $descriptor->{'i_' . $field_name} ] );
8243  
8244 4 my $value = $val;
8245 4 ▶ if ($val != $invalid) {
Branch: 1 branch
BranchTrueFalseTotal
if ($val != $invalid) 4 0 4
8246 4 ▶ if (defined $type_name) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $type_name) 2 2 4
8247 2 $value = $self->named_type_value($type_name, $val);
8248 2 ▶ return $value if defined $value
Branch: 1 branch
BranchTrueFalseTotal
if defined $value 2 0 2
8249 }
8250  
8251 2 ▶ if (ref $attr eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $attr eq "HASH") 2 0 2
8252 2 $value = $self->value_processed($val, $attr)
8253 }
8254 }
8255 2 return $value
8256 }
8257  
8258 =over 4
8259  
8260 =item field_value_as_read( I<$field>, I<$descriptor>, I<$value> [, $type ] )
8261  
8262 Convert the value parsed and returned by C<field_value()> back to what it was when read from the FIT file and returns it.
8263  
8264 This method is mostly for developers or if there is a particular need to inspect the data more closely, it should be seldomly used. Arguments are similar to C<field_value()>, except for the last one, which should be a single value (not a reference) corresponding to the value the former method has or would return.
8265  
8266 If I<$value> was obtained from a call to C<named_type_value()> after having provided an explicit named type derived from C<switch()>, that named type needs to be provided as a fourth argument.
8267  
8268 As an example, we can obtain the actual value recorded in the FIT file for the manufacturer by adding these to the callback defined above:
8269  
8270 my $as_read = $self->field_value_as_read( 'manufacturer', $descriptor, $value );
8271 print "The manufacturer's value as recorded in the FIT file is: ", $as_read, "\n"
8272  
8273 =back
8274  
8275 =cut
8276  
8277 sub field_value_as_read {
8278 2 ▶ my ($self, $field_name, $descriptor, $val, $type_name_switched) = @_;
Subroutine field_value_as_read: called CC=6 SCAR=20.2
Pod documented
8279  
8280 2 my @keys = map $_ . $field_name, qw( t_ a_ I_ );
8281 2 my ($type_name, $attr, $invalid) = ( @{$descriptor}{ @keys } );
8282 2 ▶ $type_name = $type_name_switched if defined $type_name_switched;
Branch: 1 branch
BranchTrueFalseTotal
if defined $type_name_switched 1 1 2
8283  
8284 2 my $value = $val;
8285 2 ▶ if ($val !~ /^[-+]?\d+$/) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($val =~ /^[-+]?\d+$/) 2 0 2
8286 2 ▶ if ($type_name ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($type_name ne "") 2 0 2
8287 2 my $value = $self->named_type_value($type_name, $val);
8288 2 ▶ return $value if defined $value
Branch: 1 branch
BranchTrueFalseTotal
if defined $value 2 0 2
8289 }
8290  
8291 0 ▶ if (ref $attr eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $attr eq "HASH") 0 0 0
8292 0 $value = $self->value_unprocessed($val, $attr)
8293 }
8294 }
8295 0 return $value
8296 }
8297  
8298 =over 4
8299  
8300 =item value_cooked(I<type name>, I<field attributes table>, I<invalid>, I<value>)
8301  
8302 This method is now deprecated and is no longer supported. Please use C<field_value()> instead.
8303  
8304 converts I<value> to a (hopefully) human readable form.
8305  
8306 =back
8307  
8308 =cut
8309  
8310 sub value_cooked {
8311 3619 ▶ my ($self, $tname, $attr, $invalid, $val) = @_;
Subroutine value_cooked: called CC=5 SCAR=16.2
Pod documented
8312  
8313 3619 ▶ if ($val == $invalid) {
Branch: 1 branch
BranchTrueFalseTotal
if ($val == $invalid) { } 781 2838 3619
8314 781 $val;
8315 } else {
8316 2838 ▶ if (defined $tname) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $tname) 384 2454 2838
8317 384 my $vname = $self->named_type_value($tname, $val);
8318  
8319 384 ▶ defined $vname && return $vname;
Branch: 1 branch
BranchTrueFalseTotal
defined $vname and return $vname 372 12 384
8320 }
8321  
8322 2466 ▶ if (ref $attr eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $attr eq 'HASH') { } 2466 0 2466
8323 2466 $self->value_processed($val, $attr);
8324 } else {
8325 0 $val;
8326 }
8327 }
8328 }
8329  
8330 =over 4
8331  
8332 =item value_uncooked(I<type name>, I<field attributes table>, I<invalid>, I<value representation>)
8333  
8334 This method is now deprecated and is no longer supported. Please use C<field_value_as_read()> instead.
8335  
8336 converts a human readable representation of a datum to an original form.
8337  
8338 =back
8339  
8340 =cut
8341  
8342 sub value_uncooked {
8343 0 ▶ my ($self, $tname, $attr, $invalid, $val) = @_;
Subroutine value_uncooked: not called CC=5 SCAR=34.0
Pod documented
8344  
8345 0 ▶ if ($val !~ /^[-+]?\d+$/) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $val =~ /^[-+]?\d+$/) { } 0 0 0
8346 0 ▶ if ($tname ne '') {
Branch: 1 branch
BranchTrueFalseTotal
if ($tname ne "") 0 0 0
8347 0 my $vnum = $self->named_type_value($tname, $val);
8348  
8349 0 ▶ defined $vnum && return $vnum;
Branch: 1 branch
BranchTrueFalseTotal
defined $vnum and return $vnum 0 0 0
8350 }
8351  
8352 0 ▶ if (ref $attr eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $attr eq 'HASH') { } 0 0 0
8353 0 $self->value_unprocessed($val, $attr);
8354 } else {
8355 0 $val;
8356 }
8357 } else {
8358 0 $val;
8359 }
8360 }
8361  
8362 sub seconds_to_hms {
8363 0 ▶ my ($self, $s) = @_;
Subroutine seconds_to_hms: not called CC=4 SCAR=30.0
Pod undocumented
8364 0 my $sign = 1;
8365  
8366 0 ▶ if ($s < 0) {
Branch: 1 branch
BranchTrueFalseTotal
if ($s < 0) 0 0 0
8367 0 $sign = -1;
8368 0 $s = -$s;
8369 }
8370  
8371 0 my $h = int($s / 3600);
8372 0 my $m = int(($s - $h * 3600) / 60);
8373  
8374 0 $s -= $h * 3600 + $m * 60;
8375  
8376 0 ▶ my $hms = sprintf('%s%uh%um%g', $sign < 0 ? '-' : '', $h, $m, $s);
Branch: 1 branch
BranchTrueFalseTotal
$sign < 0 ? : 0 0 0
8377  
8378 0 ▶ $hms =~ s/\./s/ or $hms .= 's';
Branch: 1 branch
BranchTrueFalseTotal
$hms =~ s/\./s/ or $hms .= 's' 0 0 0
8379 0 $hms;
8380 }
8381  
8382 sub drop_developer_data {
8383 2 ▶ my $self = shift;
Subroutine drop_developer_data: called CC=2 SCAR=7.6
Pod undocumented
8384 2 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 2 0 2
8385 2 $self->{drop_developer_data} = $_[0];
8386 } else {
8387 0 $self->{drop_developer_data};
8388 }
8389 }
8390  
8391 sub initialize {
8392 11 ▶ my $self = shift;
Subroutine initialize: called CC=1 SCAR=0.0
Pod undocumented
8393 11 my $buffer = '';
8394  
8395 11 %$self = (
8396 'error' => undef,
8397 'file_read' => 0,
8398 'file_processed' => 0,
8399 'offset' => 0,
8400 'buffer' => \$buffer,
8401 'fh' => new FileHandle,
8402 'data_message_callback' => +{},
8403 'unit_table' => +{},
8404 'drop_developer_data' => 0,
8405 );
8406  
8407 11 $self->data_message_callback_by_name(developer_data_id => \&syscallback_devdata_id);
8408 11 $self->data_message_callback_by_name(field_description => \&syscallback_devdata_field_desc);
8409 11 $self;
8410 }
8411  
8412 # undocumented (used by fitdump.pl is chained files)
8413 sub reset {
8414 0 ▶ my $self = shift;
Subroutine reset: not called CC=1 SCAR=6.9
Pod undocumented
8415 0 $self->clear_buffer;
8416  
8417 0 %$self = map {($_ => $self->{$_})} qw(error buffer fh data_message_callback unit_table profile_version
8418 EOF use_gmtime numeric_date_time without_unit maybe_chained);
8419  
8420 0 my $buffer = $self->buffer;
8421 0 $self->file_read(length($$buffer));
8422 0 $self->file_processed(0);
8423 0 $self;
8424 }
8425  
8426 16 my @type_name = ();
8427  
8428 16 $type_name[FIT_ENUM] = 'ENUM';
8429 16 $type_name[FIT_SINT8] = 'SINT8';
8430 16 $type_name[FIT_UINT8] = 'UINT8';
8431 16 $type_name[FIT_SINT16] = 'SINT16';
8432 16 $type_name[FIT_UINT16] = 'UINT16';
8433 16 $type_name[FIT_SINT32] = 'SINT32';
8434 16 $type_name[FIT_UINT32] = 'UINT32';
8435 16 $type_name[FIT_STRING] = 'STRING';
8436 16 $type_name[FIT_FLOAT32] = 'FLOAT32';
8437 16 $type_name[FIT_FLOAT64] = 'FLOAT64';
8438 16 $type_name[FIT_UINT8Z] = 'UINT8Z';
8439 16 $type_name[FIT_UINT16Z] = 'UINT16Z';
8440 16 $type_name[FIT_UINT32Z] = 'UINT32Z';
8441 16 $type_name[FIT_BYTE] = 'BYTE';
8442  
8443 sub isnan {
8444 3948 ▶ my $ret_val;
Subroutine isnan: called CC=1 SCAR=0.0
Pod undocumented
8445 16 ▶ do { no warnings 'numeric'; $ret_val = !defined( $_[0] <=> 9**9**9 ) };
Subroutine BEGIN: called CC=1 SCAR=0.0
8446 3948 return $ret_val
8447 }
8448  
8449 sub print_all_fields {
8450 243 ▶ my ($self, $desc, $v, %opt) = @_;
Subroutine print_all_fields: called CC=23 SCAR=31.4
Pod undocumented
8451 243 my ($indent, $fh, $skip_invalid) = @opt{qw(indent fh skip_invalid)};
8452  
8453 243 ▶ $fh = \*STDOUT if !defined $fh;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $fh 243 0 243
8454 243 ▶ $fh->print($indent, 'compressed_timestamp: ', $self->named_type_value('date_time', $v->[$#$v]), "\n") if $desc->{array_length} == $#$v;
Branch: 1 branch
BranchTrueFalseTotal
if $desc->{"array_length"} == $v->$#* 0 243 243
8455  
8456 243 for my $i_name (sort {$desc->{$a} <=> $desc->{$b}} grep {/^i_/} keys %$desc) {
8457 3366 my $name = $i_name;
8458 3366 $name =~ s/^i_//;
8459  
8460 3366 my $attr = $desc->{'a_' . $name};
8461 3366 my $tname = $desc->{'t_' . $name};
8462 3366 my $pname = $name;
8463  
8464 3366 ▶ if (ref $attr->{switch} eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $attr->{"switch"} eq "HASH") 32 3334 3366
8465 32 my $t_attr = $self->switched($desc, $v, $attr->{switch});
8466  
8467 32 ▶ if (ref $t_attr eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $t_attr eq "HASH") 17 15 32
8468 17 $attr = $t_attr;
8469 17 $tname = $attr->{type_name};
8470 17 $pname = $attr->{name};
8471 }
8472 }
8473  
8474 3366 my $i = $desc->{$i_name};
8475 3366 my $c = $desc->{'c_' . $name};
8476 3366 my $type = $desc->{'T_' . $name};
8477 3366 my $invalid = $desc->{'I_' . $name};
8478 3366 my $j;
8479  
8480 3366 ▶ for ($j = 0 ; $j < $c ; ++$j) {
Branch: 1 branch
BranchTrueFalseTotal
if ($j < $c) 3542 620 4162
8481 3542 ▶ isnan($v->[$i + $j]) && next;
Branch: 1 branch
BranchTrueFalseTotal
isnan($$v[$i + $j]) and next 1 3541 3542
8482 3541 ▶ $v->[$i + $j] != $invalid && last;
Branch: 1 branch
BranchTrueFalseTotal
$$v[$i + $j] != $invalid and last 2746 795 3541
8483 }
8484  
8485 3366 ▶ if ($j < $c || !$skip_invalid) {
Branch: 1 branch
BranchTrueFalseTotal
if ($j < $c or not $skip_invalid) 3366 0 3366
Condition66%2/3
$j < $c or not $skip_invalid
l!l&&r!l&&!r
27466200
MC/DC0%0/2
$j < $c or not $skip_invalid
$j < $c not $skip_invalid
Truth table66%2/3
A or not(B)
A= $j < $cB= not $skip_invalid
ABresult
1X1
011
000
8486 3366 ▶ $self->last_timestamp($v->[$i]) if $type == FIT_UINT32 && $tname eq 'date_time' && $pname eq 'timestamp';
Branch: 1 branch
BranchTrueFalseTotal
if $type == 6 and $tname eq "date_time" and $pname eq "timestamp" 233 3133 3366
Condition100%6/6
$type == 6 and $tname eq "date_time" and $pname eq "timestamp"
!ll&&!rl&&r
31285233
$type == 6 and $tname eq "date_time"
!ll&&!rl&&r
2829299238
MC/DC100%3/3
$type == 6 and $tname eq "date_time" and $pname eq "timestamp"
$type == 6 $tname eq "date_time" $pname eq "timestamp"
Truth table100%4/4
A and B and C
A= $type == 6B= $tname eq "date_time"C= $pname eq "timestamp"
ABCresult
0XX0
10X0
1100
1111
8487 3366 ▶ $fh->print($indent, $pname, ' (', $desc->{'N_' . $name}, '-', $c, '-', $type_name[$type] ne '' ? $type_name[$type] : $type);
Branch: 1 branch
BranchTrueFalseTotal
$type_name[$type] ne '' ? : 3366 0 3366
8488 3366 ▶ $fh->print(', original name: ', $name) if $name ne $pname;
Branch: 1 branch
BranchTrueFalseTotal
if $name ne $pname 17 3349 3366
8489 3366 ▶ $fh->print(', INVALID') if $j >= $c;
Branch: 1 branch
BranchTrueFalseTotal
if $j >= $c 620 2746 3366
8490 3366 $fh->print('): ');
8491  
8492 3366 ▶ if ($type == FIT_STRING) {
Branch: 1 branch
BranchTrueFalseTotal
if ($type == 7) { } 5 3361 3366
8493 5 $fh->print("\"", $self->string_value($v, $i, $c), "\"\n");
8494 } else {
8495 3361 ▶ $fh->print('{') if $c > 1;
Branch: 1 branch
BranchTrueFalseTotal
if $c > 1 54 3307 3361
8496  
8497 3361 my $pval = $self->value_cooked($tname, $attr, $invalid, $v->[$i]);
8498  
8499 3361 $fh->print($pval);
8500 3361 ▶ $fh->print(' (', $v->[$i], ')') if $v->[$i] ne $pval;
Branch: 1 branch
BranchTrueFalseTotal
if $v->[$i] ne $pval 1690 1671 3361
8501  
8502 3361 ▶ if ($c > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 1) 54 3307 3361
8503 54 my ($j, $k);
8504  
8505 54 ▶ for ($j = $i + 1, $k = $i + $c ; $j < $k ; ++$j) {
Branch: 1 branch
BranchTrueFalseTotal
if ($j < $k) 174 54 228
8506 174 $pval = $self->value_cooked($tname, $attr, $invalid, $v->[$j]);
8507 174 $fh->print(', ', $pval);
8508 174 ▶ $fh->print(' (', $v->[$j], ')') if $v->[$j] ne $pval;
Branch: 1 branch
BranchTrueFalseTotal
if $v->[$j] ne $pval 0 174 174
8509 }
8510 54 $fh->print('}');
8511 }
8512 3361 $fh->print("\n");
8513 }
8514 }
8515 }
8516 243 1;
8517 }
8518  
8519 sub print_all_json {
8520 0 ▶ my ($self, $desc, $v, %opt) = @_;
Subroutine print_all_json: not called CC=21 SCAR=61.4
Pod undocumented
8521 0 my ($indent, $fh, $skip_invalid) = @opt{qw(indent fh skip_invalid)};
8522  
8523 0 my $out = 0;
8524  
8525 0 ▶ $fh = \*STDOUT if !defined $fh;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $fh 0 0 0
8526 0 ▶ if ($desc->{array_length} == $#$v) {
Branch: 1 branch
BranchTrueFalseTotal
if ($desc->{"array_length"} == $v->$#*) 0 0 0
8527 0 $fh->print($indent, '"compressed_timestamp": "', $self->named_type_value('date_time', $v->[$#$v]), '"');
8528 0 $out = $out + 1;
8529 }
8530  
8531 0 for my $i_name (sort {$desc->{$a} <=> $desc->{$b}} grep {/^i_/} keys %$desc) {
8532 0 my $name = $i_name;
8533 0 $name =~ s/^i_//;
8534  
8535 0 my $attr = $desc->{'a_' . $name};
8536 0 my $tname = $desc->{'t_' . $name};
8537 0 my $pname = $name;
8538  
8539 0 ▶ if (ref $attr->{switch} eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $attr->{"switch"} eq "HASH") 0 0 0
8540 0 my $t_attr = $self->switched($desc, $v, $attr->{switch});
8541  
8542 0 ▶ if (ref $t_attr eq 'HASH') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $t_attr eq "HASH") 0 0 0
8543 0 $attr = $t_attr;
8544 0 $tname = $attr->{type_name};
8545 0 $pname = $attr->{name};
8546 }
8547 }
8548  
8549 0 my $i = $desc->{$i_name};
8550 0 my $c = $desc->{'c_' . $name};
8551 0 my $type = $desc->{'T_' . $name};
8552 0 my $invalid = $desc->{'I_' . $name};
8553 0 my $j;
8554  
8555 0 ▶ for ($j = 0 ; $j < $c ; ++$j) {
Branch: 1 branch
BranchTrueFalseTotal
if ($j < $c) 0 0 0
8556 0 ▶ isnan($v->[$i + $j]) && next;
Branch: 1 branch
BranchTrueFalseTotal
isnan($$v[$i + $j]) and next 0 0 0
8557 0 ▶ $v->[$i + $j] != $invalid && last;
Branch: 1 branch
BranchTrueFalseTotal
$$v[$i + $j] != $invalid and last 0 0 0
8558 }
8559  
8560 0 ▶ if ($j < $c || !$skip_invalid) {
Branch: 1 branch
BranchTrueFalseTotal
if ($j < $c or not $skip_invalid) 0 0 0
Condition0%0/3
$j < $c or not $skip_invalid
l!l&&r!l&&!r
000
MC/DC0%0/2
$j < $c or not $skip_invalid
$j < $c not $skip_invalid
Truth table0%0/3
A or not(B)
A= $j < $cB= not $skip_invalid
ABresult
1X1
011
000
8561 0 ▶ $self->last_timestamp($v->[$i]) if $type == FIT_UINT32 && $tname eq 'date_time' && $pname eq 'timestamp';
Branch: 1 branch
BranchTrueFalseTotal
if $type == 6 and $tname eq "date_time" and $pname eq "timestamp" 0 0 0
Condition0%0/6
$type == 6 and $tname eq "date_time" and $pname eq "timestamp"
!ll&&!rl&&r
000
$type == 6 and $tname eq "date_time"
!ll&&!rl&&r
000
MC/DC0%0/3
$type == 6 and $tname eq "date_time" and $pname eq "timestamp"
$type == 6 $tname eq "date_time" $pname eq "timestamp"
Truth table0%0/4
A and B and C
A= $type == 6B= $tname eq "date_time"C= $pname eq "timestamp"
ABCresult
0XX0
10X0
1100
1111
8562 0 ▶ $fh->print(",\n") if $out;
Branch: 1 branch
BranchTrueFalseTotal
if $out 0 0 0
8563 0 $fh->print($indent, '"', $pname, '": ');
8564  
8565 0 ▶ if ($type == FIT_STRING) {
Branch: 1 branch
BranchTrueFalseTotal
if ($type == 7) { } 0 0 0
8566 0 $fh->print("\"", $self->string_value($v, $i, $c), "\"");
8567 } else {
8568 0 ▶ $fh->print('[') if $c > 1;
Branch: 1 branch
BranchTrueFalseTotal
if $c > 1 0 0 0
8569  
8570 0 my $pval = $self->value_cooked($tname, $attr, $invalid, $v->[$i]);
8571  
8572 0 ▶ if (looks_like_number($pval)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&looks_like_number($pval)) { } 0 0 0
8573 0 $fh->print($pval);
8574 } else {
8575 0 $fh->print("\"$pval\"");
8576 }
8577  
8578 0 ▶ if ($c > 1) {
Branch: 1 branch
BranchTrueFalseTotal
if ($c > 1) 0 0 0
8579 0 my ($j, $k);
8580  
8581 0 ▶ for ($j = $i + 1, $k = $i + $c ; $j < $k ; ++$j) {
Branch: 1 branch
BranchTrueFalseTotal
if ($j < $k) 0 0 0
8582 0 $pval = $self->value_cooked($tname, $attr, $invalid, $v->[$j]);
8583 0 $fh->print(', ');
8584 0 ▶ if (looks_like_number($pval)) {
Branch: 1 branch
BranchTrueFalseTotal
if (&looks_like_number($pval)) { } 0 0 0
8585 0 $fh->print($pval);
8586 } else {
8587 0 $fh->print("\"$pval\"");
8588 }
8589 }
8590  
8591 0 $fh->print(']');
8592 }
8593 }
8594 0 $out = $out + 1;
8595 }
8596 }
8597 0 1;
8598 }
8599  
8600 =over 4
8601  
8602 =item use_gmtime(I<boolean>)
8603  
8604 sets the flag which of GMT or local timezone is used for C<date_time> type value conversion. Defaults to true.
8605  
8606 =back
8607  
8608 =cut
8609  
8610 16 my $use_gmtime = 0;
8611  
8612 sub use_gmtime {
8613 686 ▶ my $self = shift;
Subroutine use_gmtime: called CC=4 SCAR=15.0
Pod documented
8614  
8615 686 ▶ if (@_) {
Branch: 2 branches
BranchTrueFalseTotal
if (@_) { } 18 668 686
elsif (ref $self eq '') { } 0 668 668
8616 18 ▶ if (ref $self eq '') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $self eq '') { } 0 18 18
8617 0 $use_gmtime = $_[0];
8618 } else {
8619 18 $self->{use_gmtime} = $_[0];
8620 }
8621 } elsif (ref $self eq '') {
8622 0 $use_gmtime;
8623 } else {
8624 668 $self->{use_gmtime};
8625 }
8626 }
8627  
8628 =over 4
8629  
8630 =item unit_table(I<unit> => I<unit conversion table>)
8631  
8632 sets I<unit conversion table> for I<unit>.
8633  
8634 =back
8635  
8636 =cut
8637  
8638 sub unit_table {
8639 3494 ▶ my $self = shift;
Subroutine unit_table: called CC=2 SCAR=6.9
Pod documented
8640 3494 my $unit = shift;
8641  
8642 3494 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 25 3469 3494
8643 25 $self->{unit_table}->{$unit} = $_[0];
8644 } else {
8645 3469 $self->{unit_table}->{$unit};
8646 }
8647 }
8648  
8649 sub without_unit {
8650 3475 ▶ my $self = shift;
Subroutine without_unit: called CC=2 SCAR=6.9
Pod undocumented
8651 3475 ▶ if (@_) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) { } 6 3469 3475
8652 6 $self->{without_unit} = $_[0];
8653 } else {
8654 3469 $self->{without_unit};
8655 }
8656 }
8657  
8658 =over 4
8659  
8660 =item semicircles_to_degree(I<boolean>)
8661  
8662 =item mps_to_kph(I<boolean>)
8663  
8664 wrapper methods of C<unit_table()> method. C<semicircle_to_deg()> defaults to true.
8665  
8666 =back
8667  
8668 =cut
8669  
8670 sub semicircles_to_degree {
8671 18 ▶ my ($self, $on) = @_;
Subroutine semicircles_to_degree: called CC=2 SCAR=7.2
Pod documented
8672 18 ▶ $self->unit_table('semicircles' => $on ? +{'unit' => 'deg', 'scale' => 2 ** 31 / 180} : undef);
Branch: 1 branch
BranchTrueFalseTotal
$on ? : 18 0 18
8673 }
8674  
8675 sub mps_to_kph {
8676 7 ▶ my ($self, $on) = @_;
Subroutine mps_to_kph: called CC=2 SCAR=6.9
Pod documented
8677 7 ▶ $self->unit_table('m/s' => $on ? +{'unit' => 'km/h', 'scale' => 1 / 3.6} : undef);
Branch: 1 branch
BranchTrueFalseTotal
$on ? : 3 4 7
8678 }
8679  
8680 =over 4
8681  
8682 =item close()
8683  
8684 closes opened file handles.
8685  
8686 =back
8687  
8688 =cut
8689  
8690 sub close {
8691 10 ▶ my $self = shift;
Subroutine close: called CC=2 SCAR=7.1
Pod documented
8692 10 my $fh = $self->fh;
8693 10 ▶ $fh->close if $fh->opened;
Branch: 1 branch
BranchTrueFalseTotal
if $fh->opened 10 0 10
8694 }
8695  
8696 =over 4
8697  
8698 =item profile_version_string()
8699  
8700 Returns a string representation of the profile version used by the device or application that created the FIT file opened in the instance.
8701  
8702 C<< fetch_header() >> must have been called at least once for this method to be able to return a value, will raise an exception otherwise.
8703  
8704 =back
8705  
8706 =head2 Constants
8707  
8708 Following constants are exported: C<FIT_ENUM>, C<FIT_SINT8>, C<FIT_UINT8>, C<FIT_SINT16>, C<FIT_UINT16>, C<FIT_SINT32>, C<FIT_UINT32>, C<FIT_SINT64>, C<FIT_UINT64>, C<FIT_STRING>, C<FIT_FLOAT16>, C<FIT_FLOAT32>, C<FIT_UINT8Z>, C<FIT_UINT16Z>, C<FIT_UINT32Z>, C<FIT_UINT64Z>.
8709  
8710 Also exported are:
8711  
8712 =over 4
8713  
8714 =item FIT_BYTE
8715  
8716 numbers representing base types of field values in data messages.
8717  
8718 =item FIT_BASE_TYPE_MAX
8719  
8720 the maximal number representing base types of field values in data messages.
8721  
8722 =item FIT_HEADER_LENGTH
8723  
8724 length of a .FIT file header.
8725  
8726 =back
8727  
8728 =head2 Data message descriptor
8729  
8730 When C<fetch> method meets a definition message, it creates a hash which includes various information about the corresponding data message. We call the hash a data message descriptor. It includes the following key value pairs.
8731  
8732 =over 4
8733  
8734 =item I<field index> => I<field name>
8735  
8736 in a global .FIT profile.
8737  
8738 =item C<local_message_type> => I<local message type>
8739  
8740 necessarily.
8741  
8742 =item C<message_number> => I<message number>
8743  
8744 necessarily.
8745  
8746 =item C<message_name> => I<message name>
8747  
8748 only if the message is documented.
8749  
8750 =item C<callback> => I<reference to an array>
8751  
8752 of a callback function and callback data, only if a C<callback> is registered.
8753  
8754 =item C<endian> => I<endian>
8755  
8756 of multi-octets data in this message, where 0 for littel-endian and 1 for big-endian.
8757  
8758 =item C<template> => I<template for unpack>
8759  
8760 used to convert the binary data to an array of Perl representations.
8761  
8762 =item C<i_>I<field name> => I<offset in data array>
8763  
8764 of the value(s) of the field named I<field name>.
8765  
8766 =item C<o_>I<field_name> => I<offset in binary data>
8767  
8768 of the value(s) of the field named I<field name>.
8769  
8770 =item C<c_>I<field_name> => I<the number of values>
8771  
8772 of the field named I<field name>.
8773  
8774 =item C<s_>I<field_name> => I<size in octets>
8775  
8776 of whole the field named I<field name> in binary data.
8777  
8778 =item C<a_>I<field name> => I<reference to a hash>
8779  
8780 of attributes of the field named I<field name>.
8781  
8782 =item C<t_>I<field name> => I<type name>
8783  
8784 only if the type of the value of the field named I<field name> has a name.
8785  
8786 =item C<T_>I<field name> => I<a number>
8787  
8788 representing base type of the value of the field named I<field name>.
8789  
8790 =item C<N_>I<field name> => I<a number>
8791  
8792 representing index of the filed named I<field name> in the global .FIT profile.
8793  
8794 =item C<I_>I<field name> => I<a number>
8795  
8796 representing the invalid value of the field named I<field name>, that is, if the value of the field in a binary datum equals to this number, the field must be treated as though it does not exist in the datum.
8797  
8798 =item C<endian_converter> => I<reference to an array>
8799  
8800 used for endian conversion.
8801  
8802 =item C<message_length> => I<length of binary data>
8803  
8804 in octets.
8805  
8806 =item C<array_length> => I<length of data array>
8807  
8808 of Perl representations.
8809  
8810 =back
8811  
8812 =head2 Callback function
8813  
8814 When C<fetch> method meets a data message, it calls a I<callback function> registered with C<data_message_callback_by_name> or C<data_message_callback_by_num>,
8815 in the form
8816  
8817 =over 4
8818  
8819 =item I<callback function>-E<gt>(I<object>, I<data message descriptor>, I<array of field values>, I<callback data>, ...).
8820  
8821 The return value of the function becomes the return value of C<fetch>. It is expected to be C<1> on success, or C<undef> on failure status.
8822  
8823 =back
8824  
8825 =head2 Developer data
8826  
8827 Fields in devloper data are given names of the form I<developer data index>C<_>I<field definition number>C<_>I<converted field name>, and related informations are included I<data message descriptors> in the same way as the fields defined in the global .FIT profile.
8828  
8829 Each I<converted field name> is made from the value of C<field_name> field in the corresponding I<field description message>, after the following conversion rules:
8830  
8831 =over 4
8832  
8833 =item (1) Each sequence of space characters is converted to single C<_>.
8834  
8835 =item (2) Each of remaining non-word-constituend characters is converted to C<_> + 2 column hex representation of C<ord()> of the character + C<_>.
8836  
8837 =back
8838  
8839 =head2 64bit data
8840  
8841 If your perl lacks 64bit integer support, you need the module C<Math::BigInt>.
8842  
8843 =head1 DEPENDENCIES
8844  
8845 Nothing in particular so far.
8846  
8847 =head1 SEE ALSO
8848  
8849 L<fit2tcx.pl>, L<fitdump.pl>, L<locations2gpx.pl>, L<Geo::TCX>, L<Geo::Gpx>.
8850  
8851 =head1 BUGS AND LIMITATIONS
8852  
8853 No bugs have been reported.
8854  
8855 Please report any bugs or feature requests to C<bug-geo-gpx@rt.cpan.org>, or through the web interface at L<http://rt.cpan.org>.
8856  
8857 =head1 AUTHOR
8858  
8859 Originally written by Kiyokazu Suto C<< suto@ks-and-ks.ne.jp >> with contributions by Matjaz Rihtar.
8860  
8861 This version is maintained by Patrick Joly C<< <patjol@cpan.org> >>.
8862  
8863 Please visit the project page at: L<https://github.com/patjoly/geo-fit>.
8864  
8865 =head1 VERSION
8866  
8867 1.08
8868  
8869 =head1 LICENSE AND COPYRIGHT
8870  
8871 Copyright 2022, Patrick Joly C<< patjol@cpan.org >>. All rights reserved.
8872  
8873 Copyright 2016-2022, Kiyokazu Suto C<< suto@ks-and-ks.ne.jp >>. All rights reserved.
8874  
8875 This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See L<perlartistic>.
8876  
8877 =head1 DISCLAIMER OF WARRANTY
8878  
8879 BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
8880  
8881 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
8882  
8883 =cut
8884  
8885 16 1;
8886  
« blib/script/fit2tcx.pl ↑ Summary blib/script/locations2gpx.pl »