7 releases (4 breaking)
0.5.0 | Nov 21, 2019 |
---|---|
0.4.2 | Jul 9, 2019 |
0.3.0 | Mar 31, 2019 |
0.2.1 | Feb 16, 2019 |
0.1.0 | Jan 2, 2019 |
#8 in #garmin
29 downloads per month
4.5MB
924 lines
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.
The API currently is extremely basic with essentially just one method which produces an iterator which yields a stream of Message
structs.
Installation
[dependencies]
fit = "0.4"
Usage
extern crate fit;
use std::path::PathBuf;
use fit::Fit;
fn main() {
let filepath = PathBuf::from("fits/2913547417.fit");
let f = Fit::new(&filepath);
for m in f {
println!("Read a message of type {}", m.kind);
}
}
A typical Message
will look something like this:
Message {
kind: Record,
values: [
DataField { field_num: 253, value: Time(1480856114) },
DataField { field_num: 0, value: F32(57.710945) },
DataField { field_num: 1, value: F32(11.9945755) },
DataField { field_num: 5, value: U32(1151) },
DataField { field_num: 29, value: U32(0) },
DataField { field_num: 2, value: U16(2394) },
DataField { field_num: 6, value: U16(0) },
DataField { field_num: 7, value: U16(0) },
DataField { field_num: 61, value: U16(2234) },
DataField { field_num: 66, value: I16(442) },
DataField { field_num: 3, value: U8(113) },
DataField { field_num: 13, value: I8(21) }
],
dev_values: None
}
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.