From ea9d852533facf323f251196821c7346e743074c Mon Sep 17 00:00:00 2001 From: Ben West Date: Sat, 28 May 2016 12:30:03 -0700 Subject: attempt unifying G5 support, legacy cals Try throwing in compatibility layer, if a bit hacky, for everything. --- dexcom_reader/database_records.py | 26 ++++++++++++++++++++++---- dexcom_reader/readdata.py | 26 ++++++++++++++++++++++---- 2 files changed, 44 insertions(+), 8 deletions(-) (limited to 'dexcom_reader') diff --git a/dexcom_reader/database_records.py b/dexcom_reader/database_records.py index 3812573..9274d24 100644 --- a/dexcom_reader/database_records.py +++ b/dexcom_reader/database_records.py @@ -91,7 +91,7 @@ class GenericXMLRecord(GenericTimestampedRecord): class InsertionRecord(GenericTimestampedRecord): FIELDS = ['insertion_time', 'session_state'] - FORMAT = '<3Ic10BH' + FORMAT = '<3IcH' @property def insertion_time(self): @@ -111,6 +111,8 @@ class InsertionRecord(GenericTimestampedRecord): def __repr__(self): return '%s: state=%s' % (self.display_time, self.session_state) +class G5InsertionRecord (InsertionRecord): + FORMAT = '<3Ic10BH' class Calibration(GenericTimestampedRecord): FORMAT = '<2Iddd3cdb' @@ -184,6 +186,12 @@ class Calibration(GenericTimestampedRecord): def crc(self): return struct.unpack('H', self.raw_data[-2:])[0] +class LegacyCalibration (Calibration): + @classmethod + def _ClassSize(cls): + + return cls.LEGACY_SIZE + class SubCal (GenericTimestampedRecord): FORMAT = '