Class: FileHeader

Inherits:
FitObject show all
Defined in:
lib/fitreader/file_header.rb

Constant Summary

Constants included from Unpack

Unpack::MASKS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from FitObject

#to_h

Methods included from Unpack

#read_bit, #read_bits, #read_multiple, #readbytes

Constructor Details

#initialize(io) ⇒ FileHeader

Returns a new instance of FileHeader.



4
5
6
7
8
9
10
11
# File 'lib/fitreader/file_header.rb', line 4

def initialize(io)
  @header_size = io.readbyte
  @protocol_version = io.readbyte
  @profile_version = readbytes(io, 'v', 2)
  @num_record_bytes = readbytes(io, 'V', 4)
  @valid_file = io.read(4) == '.FIT'
  @crc = readbytes(io, 'v', 2)
end

Instance Attribute Details

#crcObject

Returns the value of attribute crc.



2
3
4
# File 'lib/fitreader/file_header.rb', line 2

def crc
  @crc
end

#header_sizeObject

Returns the value of attribute header_size.



2
3
4
# File 'lib/fitreader/file_header.rb', line 2

def header_size
  @header_size
end

#num_record_bytesObject

Returns the value of attribute num_record_bytes.



2
3
4
# File 'lib/fitreader/file_header.rb', line 2

def num_record_bytes
  @num_record_bytes
end

#profile_versionObject

Returns the value of attribute profile_version.



2
3
4
# File 'lib/fitreader/file_header.rb', line 2

def profile_version
  @profile_version
end

#protocol_versionObject

Returns the value of attribute protocol_version.



2
3
4
# File 'lib/fitreader/file_header.rb', line 2

def protocol_version
  @protocol_version
end

#valid_fileObject

Returns the value of attribute valid_file.



2
3
4
# File 'lib/fitreader/file_header.rb', line 2

def valid_file
  @valid_file
end