Sha256: 4475b7db9cef02740d2a02981b2fc1633aaa03649b6af0bc0c6eae676eb36096

Contents?: true

Size: 966 Bytes

Versions: 3

Compression:

Stored size: 966 Bytes

Contents

#!/usr/bin/env ruby -w
# encoding: UTF-8
#
# = FitDeveloperDataFieldDefinition.rb -- Fit4Ruby - FIT file processing library for Ruby
#
# Copyright (c) 2017 by Chris Schlaeger <cs@taskjuggler.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of version 2 of the GNU General Public License as
# published by the Free Software Foundation.
#

require 'bindata'
require 'fit4ruby/FitDefinitionFieldBase'

module Fit4Ruby

  class FitDeveloperDataFieldDefinition < BinData::Record

    include FitDefinitionFieldBase

    uint8 :field_number
    uint8 :size_in_bytes
    uint8 :developer_data_index

    def name
      "developer_field_#{developer_data_index.snapshot}_" +
        "#{field_number.snapshot}"
    end

    def bindata_type
      fit_definition = parent.parent
      if (entry = @@TypeDefs.find { |e| e[3] == size_in_bytes.snapshot })
        entry[1]
      else
        'uint8'
      end
    end

  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fit4ruby-2.0.0 lib/fit4ruby/FitDeveloperDataFieldDefinition.rb
fit4ruby-1.7.0 lib/fit4ruby/FitDeveloperDataFieldDefinition.rb
fit4ruby-1.6.2 lib/fit4ruby/FitDeveloperDataFieldDefinition.rb