Fit
Fit is a small crate used for reading and decoding FIT files generated by various sports devices. Currently it has only been designed specifically to read files produced by Garmin Edges 1000 and 520, and a Wahoo Elemnt. It will probably mostly work out of the box with other file sources, but will probably not work 100% perfectly unless it's a Garmin cycling computer.
It currently does not support FIT files using custom developer fields.
Installation
[]
= "0.2"
Usage
extern crate env_logger;
extern crate fit;
use PathBuf;
After reading a FIT file, a digest of message types can be inspected by calling
println!;
which will return a list similar to the following, showing respectively the name of the record type (as defined in the FIT SDK), and the number of records parsed
Armed with this information, we can call
f.messages.filter.for_each
which will fetch the "Record" messages, for example
The messages are trait objects of the form Box<dyn DefinedMessageType>
. These respond to a few useful methods: primarily #name()
, #value(u16)
, and #field_name_and_value(u16)
. To get all values at the same time there is also a #all_values()
method. FieldNameAndValue
structs contain two fields: a name, and a Value
.
A Value
enum is a simple wrapper around most rust primitive types, such as u16 or i64 or f32.
Some things to watch out for:
- speed is recorded as m/s, rather than kph.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/richardbrodie/fit-rs.
License
The gem is available as open source under the terms of the MIT License.