コード例 #1
0
ファイル: base.py プロジェクト: dlenski/python-fitparse
 def _read_and_assert_crc(self, allow_zero=False):
     # CRC Calculation is little endian from SDK
     crc_computed, crc_read = self._crc.value, self._read_struct(Crc.FMT)
     if not self.check_crc:
         return
     if crc_computed == crc_read or (allow_zero and crc_read == 0):
         return
     raise FitCRCError('CRC Mismatch [computed: %s, read: %s]' %
                       (Crc.format(crc_computed), Crc.format(crc_read)))
コード例 #2
0
ファイル: base.py プロジェクト: dtcooper/python-fitparse
 def _read_and_assert_crc(self, allow_zero=False):
     # CRC Calculation is little endian from SDK
     crc_computed, crc_read = self._crc.value, self._read_struct(Crc.FMT)
     if not self.check_crc:
         return
     if crc_computed == crc_read or (allow_zero and crc_read == 0):
         return
     raise FitCRCError('CRC Mismatch [computed: %s, read: %s]' % (
         Crc.format(crc_computed), Crc.format(crc_read)))
コード例 #3
0
ファイル: base.py プロジェクト: wthomare/python-fitparse
 def _read_and_assert_crc(self, allow_zero=False):
     # CRC Calculation is little endian from SDK
     # TODO - How to handle the case of unterminated file? Error out and have user retry with check_crc=false?
     crc_computed, crc_read = self._crc.value, self._read_struct(Crc.FMT)
     if not self.check_crc:
         return
     if crc_computed == crc_read or (allow_zero and crc_read == 0):
         return
     raise FitCRCError('CRC Mismatch [computed: %s, read: %s]' % (
         Crc.format(crc_computed), Crc.format(crc_read)))
コード例 #4
0
ファイル: test_records.py プロジェクト: dwut/fit
 def test_crc_format(self):
     self.assertEqual('0x0000', Crc.format(0))
     self.assertEqual('0x12AB', Crc.format(0x12AB))