/** * Every .FIT file starts of with a file header which is parsed here. * @return string[] The file header */ protected function readFileHeader() { $this->file_header = array('header_size' => $this->reader->readUInt8(), 'protocol_version' => $this->reader->readUInt8(), 'profile_version' => $this->reader->readUInt16(), 'data_size' => $this->reader->readUInt32LE(), 'data_type' => $this->reader->readString8(4)); //when not found, the profile will be the default $this->profile->setProtocolAndProfile($this->file_header['protocol_version'], $this->file_header['profile_version']); if ($this->file_header['header_size'] > 12) { $this->file_header += array('crc' => $this->reader->readUInt16LE()); } //make sure we are at start of first record $this->reader->setOffset($this->file_header['header_size']); return $this->file_header; }