All Projects → stadelmanma → fitparse-rs

stadelmanma / fitparse-rs

Licence: MIT license
Rust library to parse FIT formatted files

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to fitparse-rs

Accord
Data validation library for Rust
Stars: ✭ 72 (+260%)
Mutual labels:  crates, serde
FITfileR
R package for reading data from FIT files using only native R code, rather than relying on external libraries.
Stars: ✭ 33 (+65%)
Mutual labels:  garmin, fit
FitFileParser
This provide a swift package to parse Fit File and have access to the information in swift.
Stars: ✭ 21 (+5%)
Mutual labels:  garmin, fit
Garmin-FIT
Perl code for reading and conversion of Garmin FIT binary files
Stars: ✭ 66 (+230%)
Mutual labels:  garmin, fit
peloton-to-garmin
Convert workout data from Peloton into JSON/TCX/FIT files that can be uploaded to Garmin Connect
Stars: ✭ 121 (+505%)
Mutual labels:  garmin, fit
fit-parser
Parse your FIT files easily, directly from JS (Garmin, Polar, Suunto)
Stars: ✭ 43 (+115%)
Mutual labels:  garmin, fit
garmin-connect-export
Downloads gpx, tcx or original fit files from your Garmin Connect Account.
Stars: ✭ 42 (+110%)
Mutual labels:  garmin, fit
serde with
This crate provides custom de/serialization helpers to use in combination with serde's `with`-annotation and with the improved `serde_as`-annotation.
Stars: ✭ 392 (+1860%)
Mutual labels:  crates, serde
flyway-ant
Flyway Ant tasks
Stars: ✭ 14 (-30%)
Mutual labels:  ant
weedle
A WebIDL Parser
Stars: ✭ 37 (+85%)
Mutual labels:  nom
jreleaser
🚀 Release projects quickly and easily with JReleaser
Stars: ✭ 736 (+3580%)
Mutual labels:  ant
rust-python-parser
A Python parser written in Rust using nom
Stars: ✭ 56 (+180%)
Mutual labels:  nom
naersk
Build rust crates in Nix. No configuration, no code generation, no IFD. Sandbox friendly. [maintainer: @Patryk27]
Stars: ✭ 440 (+2100%)
Mutual labels:  crates
leetcode-cli
May the code be with you 👻
Stars: ✭ 177 (+785%)
Mutual labels:  crates
magnet
A JSON/BSON schema generator
Stars: ✭ 16 (-20%)
Mutual labels:  crates
toml-f
TOML parser implementation for data serialization and deserialization in Fortran
Stars: ✭ 69 (+245%)
Mutual labels:  serde
Meditate
Meditation app for Garmin smartwatches
Stars: ✭ 42 (+110%)
Mutual labels:  garmin
har-rs
A HTTP Archive format (HAR) serialization & deserialization library, written in Rust.
Stars: ✭ 25 (+25%)
Mutual labels:  serde
serde
🚝 (unmaintained) A framework for defining, serializing, deserializing, and validating data structures
Stars: ✭ 49 (+145%)
Mutual labels:  serde
elm-parser
A parser for the Elm language written in Rust using the nom library
Stars: ✭ 16 (-20%)
Mutual labels:  nom

Fitparser

LICENSE Crates.io Version Docs.rs Build Status

Overview

Parses FIT formatted files and exports their contents using Serde. This code was heavily inspired by the python-fitparse module and uses the specifications defined by the Fit File SDK which is maintained by ANT.

The goal of this crate is to parse valid FIT files according to the defined FIT profile and export their data into a more usable format. To that end we leverage the Serde framework which allows end users to export the data in whatever format suits their needs. This library provides a fit_to_json example executable to serve as a template for any other serialization format implemented using Serde.

Notes:

  • This library does not support writing FIT files at this time.
  • Files with Developer Data fields can be parsed but the developer fields are dropped.
  • The FIT SDK is regularly updated by Garmin/Ant this library may not be up to date; check the src/profile/messages.rs for the packaged version. Submit an issue and I will gladly bump it!

Usage

See library documentation at docs.rs/fitparser for full usage information. Below is a basic example of calling the parser on a FIT file.

use fitparser;
use std::fs::File;
use std::io::prelude::*;

println!("Parsing FIT files using Profile version: {}", fitparser::profile::VERSION);
let mut fp = File::open("tests/fixtures/Activity.fit")?;
for data in fitparser::from_reader(&mut fp)? {
    // print the data in FIT file
    println!("{:#?}", data);
}

For lower level control of the deserialization process, such as reading from a streaming data source you can use the de::FitStreamProcessor struct. See the streaming.rs example file for basic usage and manual processing of FitObject variants.

Updating the FIT profile

All FIT files are generated based on a customizable profile. The profile used here is pulled from ANT's official SDK which can be accessed here. The cargo build command expects the environment variable FIT_PROFILE to be set to the path of the desired Profile.xlsx file and the FIT_PROFILE_VERSION variable to the appropriate version. To make updating simpler a script is provided ./bin/update_profile.sh that accepts the profile path the as first argument and optionally a profile version as the second. The version can be omitted if the path to the Profile.xlsx file contains FitSDKRelease_XX.YY.ZZ.

./bin/update_profile.sh ~/Downloads/FitSDKRelease_21.40.00/Profile.xlsx

A profile file is not required for building the library as the files generated are committed to the repository. The profile only needs updated to support custom extensions or when ANT releases an updated version.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].