Ergebnis für URL: http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml * [1]NAME
* [2]SYNOPSIS
* [3]DESCRIPTION
* [4]Constants
* [5]Class methods
* [6]Object methods
* [7]Data message descriptor
* [8]Callback function
* [9]Developer data
* [10]64bit data
[11]AUTHOR
[12]DISCLAIMER etc.
[13]ACKNOWLEDGEMENT
[14]CHANGES
* [15]0.27 -> 0.28
* [16]0.26 -> 0.27
* [17]0.23 -> 0.24
* [18]0.22 -> 0.23
* [19]0.21 -> 0.22
* [20]0.20 -> 0.21
* [21]0.14 -> 0.15
* [22]0.13 -> 0.14
* [23]0.12 -> 0.13
* [24]0.11 -> 0.12
* [25]0.10 -> 0.11
* [26]0.09 -> 0.10
* [27]0.08 -> 0.09
* [28]0.07 -> 0.08
* [29]0.06 -> 0.07
* [30]0.05 -> 0.06
* [31]0.04 -> 0.05
* [32]0.03 -> 0.04
* [33]0.02 -> 0.03
* [34]0.01 -> 0.02
____________________________________________________________________________
NAME
Garmin::FIT - A Perl class to decode Garmin .FIT files
____________________________________________________________________________
SYNOPSIS
use Garmin::FIT;
Garmin::FIT->version_string;
$fit = new Garmin::FIT;
$fit->unit_table( => );
$fit->semicircles_to_degree();
$fit->mps_to_kph();
$fit->use_gmtime();
$fit->file()
$fit->open;
$fit->fetch_header;
$fit->fetch;
$fit->protocol_version_string;
$fit->protocol_version_string();
$fit->profile_version_string;
$fit->profile_version_string();
$fit->data_message_callback_by_name(, [, , ...]);
$fit->data_message_callback_by_num(, [, , ...]);
$fit->switched(, , );
$fit->string_value(, , );
$fit->value_cooked(, , , );
$fit->error;
$fit->crc_expected;
$fit->crc;
$fit->trailing_garbages;
$fit->close;
...
____________________________________________________________________________
DESCRIPTION
Garmin::FIT is a Perl class to provide interfaces to decode Garmin .FIT files.
The latest version is obtained via
[35]GarminFIT-0.28.tar.gz (41KB, 2017-08-22 19:08:19).
There are three applications
[36]
fitdump,
[37]
fitsed,
and
[38]
fit2tcx
using this class.
Constants
Following constants are automatically exported.
FIT_ENUM
FIT_SINT8
FIT_UINT8
FIT_SINT16
FIT_UINT16
FIT_SINT32
FIT_UINT32
FIT_SINT64
FIT_UINT64
FIT_STRING
FIT_FLOAT16
FIT_FLOAT32
FIT_UINT8Z
FIT_UINT16Z
FIT_UINT32Z
FIT_UINT64Z
FIT_BYTE
numbers representing base types of field values in data messages.
FIT_BASE_TYPE_MAX
the maximal number representing base types of field values in data
messages.
FIT_HEADER_LENGTH
length of a .FIT file header.
Class methods
Garmin::FIT->version_string
returns a string representing the version of this class.
new Garmin::FIT
creates a new object and returns it.
Garmin::FIT->message_name()
returns the message name for or undef.
Garmin::FIT->message_number()
returns the message number for or undef.
Garmin::FIT->field_name(, )
returns the field name for in or undef.
Garmin::FIT->field_number(, )
returns the field index for in or undef.
Garmin::FIT->cat_header(, , [,
])
composes the binary form of a .FIT file header, concatenates the scalar
and it, and returns the reference to the scalar. If the 4th argument is
omitted, it returns the reference to the binary form. is
assumed not to include the file header and trailing CRC.
Garmin::FIT->crc_of_string(, , , )
calculate CRC-16 of the specified part of the scalar.
Garmin::FIT->my_endian
returns the endian (0 for little endian and 1 for big endian) of the
machine on which this program is running.
Object methods
->unit_table( => )
sets for .
->semicircles_to_degree()
a wrapper method of [39]unit_table() method.
->mps_to_kph()
ditto.
->use_gmtime()
sets the flag which of GMT or local timezone is used for date_time type
value conversion.
->file()
sets the name of a .FIT file.
->open
opens the .FIT file.
->fetch_header
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.
->fetch
reads a message in the .FIT file, and returns 1 on success, or undef on
failure or EOF.
->protocol_version_string
returns a string representing the .FIT protocol version on which this
class based.
->protocol_version_string()
returns a string representing the .FIT protocol version .
->profile_version_string
returns a string representing the .FIT protocol version on which this
class based.
->profile_version_string()
returns a string representing the .FIT profile version .
->data_message_callback_by_name(, [,
, ...])
register a function which is called when a data
message with the name is fetched.
->data_message_callback_by_num(, [,
, ...])
register a function which is called when a data
message with the messag number is fetched.
->switched(, , )
returns real data type attributes for a C's union like field.
->string_value(, , )
converts an array of character codes to a Perl string.
->value_cooked(, , , )
converts to a (hopefully) human readable form.
->value_uncooked(, , , )
converts a human readable representation of a datum to an original form.
->error
returns an error message recorded by a method.
->crc_expected
CRC-16 attached to the end of a .FIT file. Only available after all
contents of the file has been read.
->crc
CRC-16 calculated from the contents of a .FIT file.
->trailing_garbages
number of octets after CRC-16, 0 usually.
->close
closes opened file handles.
->cat_definition_message([, ])
composes the binary form of a definition message after , concatenates the scalar and it, and returns the reference to
the scalar. If the 2nd argument is omitted, returns the reference to the
binary form.
->endian_convert(, , )
apply to the specified part of the scalar.
Data message descriptor
When [40]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.
=>
in a global .FIT profile.
local_message_type =>
necessarily.
[41]message_number =>
necessarily.
[42]message_name =>
only if the message is documented.
callback =>
of a callback function and callback data, only if a callback is
registered.
endian =>
of multi-octets data in this message, where 0 for littel-endian and 1 for
big-endian.
template =>
used to convert the binary data to an array of Perl representations.
i_ =>
of the value(s) of the field named .
o_ =>
of the value(s) of the field named .
c_ =>
of the field named .
s_ =>
of whole the field named in binary data.
a_ =>
of attributes of the field named .
t_ =>
only if the type of the value of the field named has a name.
T_ =>
representing base type of the value of the field named .
N_ =>
representing index of the filed named in the global .FIT
profile.
I_ =>
representing the invalid value of the field named , 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.
[43]endian_converter =>
used for endian conversion.
message_length =>
in octets.
array_length =>
of Perl representations.
Callback function
When [44]fetch method meets a data message, it calls a
registered with [45]data_message_callback_by_name or
[46]data_message_callback_by_num, in the form
->(, , , , ...).
The return value of the function becomes the return value of [47]fetch. It is
expected to be 1 on success, or undef on failure status.
Developer data
Fields in devloper data are given names of the form __, and related informations are included
in the same way as the fields defined in the global
.FIT profile.
Each is made from the value of [48]field_name field in the
corresponding field description message, after the following conversion rules:
(1) Each sequence of space characters is converted to single _.
(2) Each of remaining non-word-constituend characters is converted to _ + 2
column hex representation of ord() of the character + _.
64bit data
If your perl lacks 64bit integer support, you need the module Math::BigInt.
____________________________________________________________________________
AUTHOR
Kiyokazu SUTO
____________________________________________________________________________
DISCLAIMER etc.
This program is distributed with ABSOLUTELY NO WARRANTY.
Anyone can use, modify, and re-distibute this program without any restriction if
version 0.15
fetch_header()
should do initial setup of CRC explicitly.
fetch()
code clean-up.
0.13 --> 0.14
protocol_version
protocol_version_header_crc_started
were wrong.
cat_definition_message()
should take care of endianness of message number.
0.12 --> 0.13
profile_version
%named_type
%msgtype_by_name
follow global profile version 16.10.
fetch_data_message()
file positions of undefined local message numbers are included in error
messages.
0.11 --> 0.12
safe_isa()
New subroutine to avoid importing isa method from UNIVERSAL class. Thanks
to Blaine Schmidt who kindly informed that such importation is deprecated.
xxx45_ftp
The field numbered 45 in a session message seems FTP.
0.10 --> 0.11
profile_version
%named_type
%msgtype_by_name
follow global profile version 4.10.
0.09 --> 0.10
profile_version
%named_type
%msgtype_by_name
follow global profile version 2.00.
0.08 --> 0.09
profile_version
was calculated from wrong string expression.
profile_version_from_string()
should use profile_version_scale instead of profile_version_major_shift.
fetch_header()
calculate and return header CRCs only for proper protocol version.
cat_header()
support header CRCs and extra data in a file header.
msgtype_by_name->{session}->{35}
scale attribute was missing.
msgtype_by_name->{session}->{36}
ditto.
0.07 --> 0.08
protocol_version
profile_version
fetch_header()
%named_type
%msgtype_by_name
%msgtype_by_num
follow protocol version 1.2 and global profile version 1.50.
0.06 --> 0.07
profile_version
major and minor parts should be computed by division with scale 100, not
bit shift.
error()
.FIT file name is included in each error message.
fetch_header()
header length of .FIT files of newer profile version, may differ from 12.
Thanks to report from Nils Knieling.
0.05 --> 0.06
initialize()
the member buffer of an object must be initialzied with a reference to a
scalar, not the scalar itself. Thanks to report from Nils Knieling.
0.04 --> 0.05
$version
$version_major_scale
@version
$my_endian
$protocol_version_major_shift
$protocol_version_minor_mask
$protocol_version
@protocol_version
$profile_version_major_shift
$profile_version_minor_mask
$profile_version
@profile_version
@crc_table
$header_template
$header_length
$FIT_signature_string
$FIT_signature
$rechd_offset_compressed_timestamp_header
$rechd_mask_compressed_timestamp_header
$rechd_offset_cth_local_message_type
$rechd_length_cth_local_message_type
$rechd_mask_cth_local_message_type
$rechd_length_cth_timestamp
$rechd_mask_cth_timestamp
$rechd_offset_definition_message
$rechd_mask_definition_message
$rechd_length_local_message_type
$rechd_mask_local_message_type
$cthd_offset_local_message_type
$cthd_length_local_message_type
$cthd_mask_local_message_type
$cthd_length_time_offset
$cthd_mask_time_offset
$defmsg_min_template
$defmsg_min_length
$deffld_template
$deffld_length
$deffld_mask_endian_p
$deffld_mask_type
@invalid
@size
@template
%named_type
$use_gmtime
%msgtype_by_name
$mesg_name_vs_num
%msgtype_by_num
$msgnum_anon
$msgname_anon
@type_name
must be global scope, otherwise they can be collected as garbages after
long time run. Thanks to reports and tests by Nils Knieling.
fetch_header()
backslashs in error messages should be quoted.
0.03 --> 0.04
use_gmtime()
works as a class method too.
msgtype_by_name->{file_id}->{2}
new member [58]type_name with value garmin_product.
msgtype_by_name->{device_info}->{4}
ditto.
msgtype_by_name->{schedule}->{1}
ditto.
msgtype_by_name->{event}->{data16}->{2}->{switch}->{course_point}
fix wrong member name when --> name.
msgtype_by_name->{event}->{data}->{2}->{switch}->{course_point}
ditto.
data_message_callback_by_num()
save callback data in the form of new array reference instead of reference
to @_.
data_message_callback_by_name()
ditto.
open()
make $FH binary mode. Thanks to reports and tests on Windows platform by
Nils Knieling.
0.02 --> 0.03
@EXPORT
fix wrong name ([59]FIT_FLOAT16 --> FIT_FLOAT64).
my_endian()
new method.
crc_initialize()
removed. CRC table initialized at top level instead.
error()
error message tag is simplified.
crc_of_string()
new method.
crc_calc()
use [60]crc_of_string().
fill_buffer()
CRC was not calculated.
cat_header()
new method.
named_type->{mesg_num}
members undocumented_message_6 and undocumented_message_22 are removed.
date_string()
new method.
named_type_value()
change presentation of mask type type.
support reverse-conversion of 'date_time' type.
msgtype_by_name
members undocumented_message_6 and undocumented_message_22 are removed.
msgtype_by_num
undocumented message types are included only in this hash.
message_name()
new method.
message_number()
new method.
field_name()
new method.
field_number()
new method.
undocumented_field_name()
new method.
fetch_definition_message()
usage of offset() method was wrong.
use [61]undocumented_field_name().
new key-value pairs of the form $index => $name in %desc.
new key-value pair array_length => $i_array in %desc.
cat_definition_message()
new method.
endian_convert()
require more arguments ($buffer and $i).
last_timestamp
new method.
fetch_data_message()
add support for compressed timestamp headers.
switched()
add support for multi-switching keys.
value_processed()
change format of scaled value without unit.
value_unprocessed()
new method.
value_cooked()
new method.
value_uncooked()
new method.
fetch()
add support for compressed timestamp headers.
type_name
array of names of types.
print_all_fields()
add support for compressed timestamp headers.
change output format.
use single method [62]value_cooked() instead of methods
[63]named_type_value() and [64]value_processed().
0.01 --> 0.02
EOF
new method.
fill_buffer()
calls clear_buffer method and [65]EOF method.
FIT_HEADER_LENGTH()
new constant automatically exported.
numeric_date_time()
new method.
named_type_value()
sprintf format string was wrong.
calls [66]numeric_date_time method.
message_type_by_name->{lap}
fix typo (totoal_distnace --> total_distance).
message_type_by_name->{session}
ditto.
data_message_callback_by_name()
fix wrong member name of $msgtype (num --> _number).
unit_table()
accept non hash value.
without_unit()
new method.
value_processed()
check whether or not $attr is a hash.
calls [67]without_unit method.
initialize()
no user defined options.
member [68]crc should not be initialized.
print_all_fields()
semicircles_to_degree()
mps_to_kph()
close
new methods.
References
1. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#name
2. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#synopsis
3. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#description
4. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#constants
5. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#class methods
6. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#object methods
7. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#data message descriptor
8. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#callback function
9. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#developer data
10. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#64bit data
11. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#author
12. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#disclaimer etc.
13. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#acknowledgement
14. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#changes
15. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#0.27 > 0.28
16. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#0.26 > 0.27
17. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#0.23 > 0.24
18. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#0.22 > 0.23
19. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#0.21 > 0.22
20. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#0.20 > 0.21
21. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#0.14 > 0.15
22. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#0.13 > 0.14
23. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#0.12 > 0.13
24. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#0.11 > 0.12
25. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#0.10 > 0.11
26. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#0.09 > 0.10
27. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#0.08 > 0.09
28. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#0.07 > 0.08
29. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#0.06 > 0.07
30. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#0.05 > 0.06
31. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#0.04 > 0.05
32. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#0.03 > 0.04
33. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#0.02 > 0.03
34. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#0.01 > 0.02
35. http://pub.ks-and-ks.ne.jp/cycling/pub/GarminFIT-0.28.tar.gz
36. http://pub.ks-and-ks.ne.jp/cycling/fitdump.shtml
37. http://pub.ks-and-ks.ne.jp/cycling/fitsed.shtml
38. http://pub.ks-and-ks.ne.jp/cycling/fit2tcx.shtml
39. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#item_unit_table
40. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#item_fetch
41. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#item_message_number
42. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#item_message_name
43. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#item_endian_converter
44. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#item_fetch
45. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#item_data_message_callback_by_name
46. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#item_data_message_callback_by_num
47. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#item_fetch
48. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#item_field_name
49. mailto:suto@ks-and-ks.ne.jp
50. https://github.com/mrihtar/Garmin-FIT
51. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#item_field_name
52. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#item_drop_developer_data
53. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#item_drop_developer_data
54. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#item_maybe_chained
55. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#item_end_of_chunk
56. https://github.com/mrihtar/Garmin-FIT/issues/1
57. https://github.com/mrihtar/Garmin-FIT
58. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#item_type_name
59. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#item_FIT_FLOAT16
60. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#item_crc_of_string
61. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#item_undocumented_field_name
62. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#item_value_cooked
63. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#item_named_type_value
64. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#item_value_processed
65. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#item_EOF
66. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#item_numeric_date_time
67. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#item_without_unit
68. http://pub.ks-and-ks.ne.jp/cycling/GarminFIT.shtml#item_crc
Usage: http://www.kk-software.de/kklynxview/get/URL
e.g. http://www.kk-software.de/kklynxview/get/http://www.kk-software.de
Errormessages are in German, sorry ;-)