summaryrefslogtreecommitdiffstats
path: root/glucometerutils/support/driver_base.py
diff options
context:
space:
mode:
authorBen <b-schaefer@posteo.de>2020-02-18 18:14:56 +0100
committerDiego Elio Pettenò <flameeyes@flameeyes.com>2020-02-18 19:53:22 +0100
commit649a12b906f8310b46f0e0d88374446abd1632e1 (patch)
treec1b48bd3cc32ba64f982956f914506b3dda16245 /glucometerutils/support/driver_base.py
parentBugfix: get current time within the function (diff)
downloadglucometerutils-649a12b906f8310b46f0e0d88374446abd1632e1.tar
glucometerutils-649a12b906f8310b46f0e0d88374446abd1632e1.tar.gz
glucometerutils-649a12b906f8310b46f0e0d88374446abd1632e1.tar.bz2
glucometerutils-649a12b906f8310b46f0e0d88374446abd1632e1.tar.lz
glucometerutils-649a12b906f8310b46f0e0d88374446abd1632e1.tar.xz
glucometerutils-649a12b906f8310b46f0e0d88374446abd1632e1.tar.zst
glucometerutils-649a12b906f8310b46f0e0d88374446abd1632e1.zip
Diffstat (limited to 'glucometerutils/support/driver_base.py')
-rw-r--r--glucometerutils/support/driver_base.py55
1 files changed, 55 insertions, 0 deletions
diff --git a/glucometerutils/support/driver_base.py b/glucometerutils/support/driver_base.py
new file mode 100644
index 0000000..b7b3d0f
--- /dev/null
+++ b/glucometerutils/support/driver_base.py
@@ -0,0 +1,55 @@
+from abc import ABC, abstractmethod
+from datetime import datetime
+
+
+class GlucometerDriver(ABC):
+
+ def connect(self):
+ pass
+
+ def disconnect(self):
+ pass
+
+ @abstractmethod
+ def get_meter_info(self):
+ """Return the device information in structured form."""
+ pass
+
+ @abstractmethod
+ def get_serial_number(self):
+ pass
+
+ @abstractmethod
+ def get_glucose_unit(self):
+ """Returns the glucose unit of the device."""
+ pass
+
+ @abstractmethod
+ def get_datetime(self):
+ pass
+
+ def set_datetime(self, date=None):
+ """Sets the date and time of the glucometer.
+
+ Args:
+ date: The value to set the date/time of the glucometer to. If none is
+ given, the current date and time of the computer is used.
+
+ Returns:
+ A datetime object built according to the returned response.
+ """
+ if not date:
+ date = datetime.now()
+ return self._set_device_datetime(date)
+
+ @abstractmethod
+ def _set_device_datetime(self, date):
+ pass
+
+ @abstractmethod
+ def zero_log(self):
+ pass
+
+ @abstractmethod
+ def get_readings(self):
+ pass