summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@flameeyes.eu>2016-02-15 21:39:55 +0100
committerDiego Elio Pettenò <flameeyes@flameeyes.eu>2016-02-15 21:40:31 +0100
commitaf96a07010d53babfecdb516733f4419ed893699 (patch)
tree22218f2f99995bfe22c80db73013cec7ea097427
parentotverio2015: new driver for OneTouch Verio (2015) and similar devices. (diff)
downloadglucometerutils-af96a07010d53babfecdb516733f4419ed893699.tar
glucometerutils-af96a07010d53babfecdb516733f4419ed893699.tar.gz
glucometerutils-af96a07010d53babfecdb516733f4419ed893699.tar.bz2
glucometerutils-af96a07010d53babfecdb516733f4419ed893699.tar.lz
glucometerutils-af96a07010d53babfecdb516733f4419ed893699.tar.xz
glucometerutils-af96a07010d53babfecdb516733f4419ed893699.tar.zst
glucometerutils-af96a07010d53babfecdb516733f4419ed893699.zip
-rw-r--r--glucometerutils/common.py7
-rw-r--r--glucometerutils/drivers/otultra2.py6
2 files changed, 9 insertions, 4 deletions
diff --git a/glucometerutils/common.py b/glucometerutils/common.py
index a9968c2..32402a6 100644
--- a/glucometerutils/common.py
+++ b/glucometerutils/common.py
@@ -16,6 +16,11 @@ UNIT_MMOLL = 'mmol/L'
VALID_UNITS = [UNIT_MGDL, UNIT_MMOLL]
+# Constants for meal information
+NO_MEAL = ''
+BEFORE_MEAL = 'Before Meal'
+AFTER_MEAL = 'After Meal'
+
# Constants for date format
DATETIME_12HR = '12 hours'
DATETIME_24HR = '24 hours'
@@ -54,7 +59,7 @@ _ReadingBase = collections.namedtuple(
'_ReadingBase', ['timestamp', 'value', 'meal', 'comment'])
class Reading(_ReadingBase):
- def __new__(cls, timestamp, value, meal='', comment=''):
+ def __new__(cls, timestamp, value, meal=NO_MEAL, comment=''):
"""Constructor for the reading object.
Args:
diff --git a/glucometerutils/drivers/otultra2.py b/glucometerutils/drivers/otultra2.py
index f44450a..b72c4eb 100644
--- a/glucometerutils/drivers/otultra2.py
+++ b/glucometerutils/drivers/otultra2.py
@@ -17,9 +17,9 @@ from glucometerutils.drivers import lifescan_common
# The following two hashes are taken directly from LifeScan's documentation
_MEAL_CODES = {
- 'N': '',
- 'B': 'Before Meal',
- 'A': 'After Meal',
+ 'N': common.NO_MEAL,
+ 'B': common.BEFORE_MEAL,
+ 'A': common.AFTER_MEAL,
}
_COMMENT_CODES = {