@@ -30,14 +30,14 @@ def data(self):
30
30
class Dexcom (object ):
31
31
@staticmethod
32
32
def FindDevice ():
33
- return util .find_usbserial (constants .DEXCOM_G4_USB_VENDOR ,
34
- constants .DEXCOM_G4_USB_PRODUCT )
33
+ return util .find_usbserial (constants .DEXCOM_USB_VENDOR ,
34
+ constants .DEXCOM_USB_PRODUCT )
35
35
36
36
@classmethod
37
37
def LocateAndDownload (cls ):
38
38
device = cls .FindDevice ()
39
39
if not device :
40
- sys .stderr .write ('Could not find Dexcom G4 Receiver!\n ' )
40
+ sys .stderr .write ('Could not find Dexcom Receiver!\n ' )
41
41
sys .exit (1 )
42
42
else :
43
43
dex = cls (device )
@@ -270,15 +270,21 @@ def GenericRecordYielder(self, header, data, record_type):
270
270
'USER_EVENT_DATA' : database_records .EventRecord ,
271
271
'METER_DATA' : database_records .MeterRecord ,
272
272
'CAL_SET' : database_records .Calibration ,
273
- # 'CAL_SET': database_records.Calibration,
274
273
'INSERTION_TIME' : database_records .InsertionRecord ,
275
274
'EGV_DATA' : database_records .EGVRecord ,
276
275
'SENSOR_DATA' : database_records .SensorRecord ,
277
276
}
277
+
278
278
def ParsePage (self , header , data ):
279
279
record_type = constants .RECORD_TYPES [ord (header [2 ])]
280
280
revision = int (header [3 ])
281
281
generic_parser_map = self .PARSER_MAP
282
+ if revision > 4 and record_type == 'EGV_DATA' :
283
+ generic_parser_map .update (EGV_DATA = database_records .G6EGVRecord )
284
+ if revision > 1 and record_type == 'INSERTION_TIME' :
285
+ generic_parser_map .update (INSERTION_TIME = database_records .G5InsertionRecord )
286
+ if revision > 2 and record_type == 'METER_DATA' :
287
+ generic_parser_map .update (METER_DATA = database_records .G5MeterRecord )
282
288
if revision < 2 and record_type == 'CAL_SET' :
283
289
generic_parser_map .update (CAL_SET = database_records .LegacyCalibration )
284
290
xml_parsed = ['PC_SOFTWARE_PARAMETER' , 'MANUFACTURING_DATA' ]
@@ -324,9 +330,21 @@ class DexcomG5 (Dexcom):
324
330
'SENSOR_DATA' : database_records .SensorRecord ,
325
331
}
326
332
327
- def GetDevice (port , G5 = False ):
333
+ class DexcomG6 (Dexcom ):
334
+ PARSER_MAP = {
335
+ 'USER_EVENT_DATA' : database_records .EventRecord ,
336
+ 'METER_DATA' : database_records .G5MeterRecord ,
337
+ 'CAL_SET' : database_records .Calibration ,
338
+ 'INSERTION_TIME' : database_records .G5InsertionRecord ,
339
+ 'EGV_DATA' : database_records .G6EGVRecord ,
340
+ 'SENSOR_DATA' : database_records .SensorRecord ,
341
+ }
342
+
343
+ def GetDevice (port , G5 = False , G6 = False ):
328
344
if G5 :
329
345
return DexcomG5 (port )
346
+ if G6 :
347
+ return DexcomG6 (port )
330
348
return Dexcom (port )
331
349
332
350
if __name__ == '__main__' :
0 commit comments