GithubHelp home page GithubHelp logo

rubyfit's Introduction

rubyfit is here to help your sanity when working with FIT files.

This project contains the FIT SDK version 1.2, so pay your respects: This is Ant

Anyone familiar with stream based XML processing should find using this library intuitive.

  1. Create a callbacks class that responds to the callback events, and handle the events as needed. Use the example fit_callbacks.rb file as a guide - Our callbacks class on ridewithgps is more complex, as it needs states to properly process laps, etc.
  2. Pass in your callback class instance to the RubyFit::FitParser initializer.
  3. Call parse() on your parser instance.

Example:

raw = IO.read("myfitfile.fit")
callbacks = FitCallbacks.new()
parser = RubyFit::FitParser.new(callbacks)
parser.parse(raw)
activities = callbacks.activities #assumes you have some sort of getter/attr_reader on your custom callbacks class

When I get more time I'll document the messages, but for now you can look in ext/rubyfit/rubyfit.c to see what fields are being passed.

To build and test the gem, run:

bundle install
rake

rubyfit's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rubyfit's Issues

Is this still maintained?

Just wondering if this is still maintained? I see the FIT SDK version is now version 21.

I would like to contribute or fork this as a starting point.

Don't get all attributes for fenix 6x pro files

Hi,

I try to parse fit files from a Garmin Fenix 6x Pro device and don't get all the properties.
The most important is the speed property.

There are some properties missing (also for other devices) for running economy like vertical movement. Is it possible to extend that?

I can't get it running on my machine to make some changes in the C code...

garmin_connect_api_download__40564936886.zip

{
"timestamp": "2019-09-13T15:48:16.000Z",
"position_lat": 47.46284484863281,
"position_long": 8.713469505310059,
"distance": 22.4,
"heart_rate": 103,
"cadence": 83,
"temperature": 30
}

Would you mind adding a license?

It would be great if we could use this library, but then it needs to have a license. Would you mind adding that? I can create a PR to add it for you (I'd suggest something like MIT or BSD, but others are fine of course).

undefined method `print_msg`

Hey there!

I am playing around with this gem to see if it might replace the current fit_parser gem we're using as its using Ruby's bindata gem behind the scenes which is rather slow and memory hungry.

However, I tried parsing a file as described in the README and immediately ran into an undefined method print_msg error. I found this line

rb_funcall(handler, rb_intern("print_msg"), 1, rb_str_new2(msg));
trying to call this ruby method which obviously doesn't exist in Ruby's standard lib.

I was able to get around this issue by quickly adding this method inside the Object class which is certainly not right, but helped me continue playing around more.

I am confused about the print_msg call though and I'd like to ask what is the intention behind it and how is it supposed to be handled?

EDIT:

I came back to it later today and understood the print_msg is called on the handler which is the Callback class, so the method needs to be implemented on an instance level, takes the message as an argument and is supposed to simply print out its input. Right?

Thanks
Robin

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.