From d00330fdf0cd12e71aaff53783c6f1b302840dc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Sat, 7 Dec 2013 23:25:12 +0000 Subject: otultra2: implement a zero log command to clear a device's memory. --- glucometerutils/drivers/otultra2.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'glucometerutils/drivers') diff --git a/glucometerutils/drivers/otultra2.py b/glucometerutils/drivers/otultra2.py index 1a29d36..d4db307 100644 --- a/glucometerutils/drivers/otultra2.py +++ b/glucometerutils/drivers/otultra2.py @@ -176,7 +176,18 @@ class Device(object): return self._parse_datetime(response[2:]) + def zero_log(self): + """Zeros out the data log of the device. + + This function will clear the memory of the device deleting all the readings + in an irrecoverable way. + """ + response = self._send_oneliner_command('DMZ') + if response != 'Z': + raise exceptions.InvalidResponse(response) + def _parse_glucose_unit(self, unit): + """Parses the value of a OneTouch Ultra Glucose unit definition. Args: @@ -265,7 +276,6 @@ class Device(object): yield common.Reading(date, int(line_data['value']), common.UNIT_MGDL, comment=comment) - # The following two hashes are taken directly from LifeScan's documentation _MEAL_CODES = { 'N': '', -- cgit v1.2.3