class Fit4Ruby::FitHeader
Public Instance Methods
dump()
click to toggle source
# File lib/fit4ruby/FitHeader.rb, line 54 def dump puts <<"EOT" Fit File Header Header Size: #{header_size.snapshot} Protocol Version: #{protocol_version.snapshot} Profile Version: #{profile_version.snapshot} Data Size: #{data_size.snapshot} EOT end
end_pos()
click to toggle source
# File lib/fit4ruby/FitHeader.rb, line 68 def end_pos header_size.snapshot + data_size.snapshot end
has_crc?()
click to toggle source
# File lib/fit4ruby/FitHeader.rb, line 64 def has_crc? header_size.snapshot == 14 end
read(io)
click to toggle source
Calls superclass method
# File lib/fit4ruby/FitHeader.rb, line 33 def read(io) super unless header_size.snapshot == 12 || header_size.snapshot == 14 Log.fatal "Unsupported header size #{header_size.snapshot}" end unless data_type.snapshot == '.FIT' Log.fatal "Unknown file type #{data_type.snapshot}" end if crc.snapshot != 0 && compute_crc(io, 0, header_size.snapshot - 2) != crc.snapshot Log.fatal "CRC mismatch in header." end end
write(io)
click to toggle source
Calls superclass method
# File lib/fit4ruby/FitHeader.rb, line 48 def write(io) super write_crc(io, 0, header_size.snapshot - 2) end