summaryrefslogtreecommitdiffstats
path: root/glucometerutils/support/lifescan_binary_protocol.py
diff options
context:
space:
mode:
Diffstat (limited to 'glucometerutils/support/lifescan_binary_protocol.py')
-rw-r--r--glucometerutils/support/lifescan_binary_protocol.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/glucometerutils/support/lifescan_binary_protocol.py b/glucometerutils/support/lifescan_binary_protocol.py
index 68b030d..0143cd4 100644
--- a/glucometerutils/support/lifescan_binary_protocol.py
+++ b/glucometerutils/support/lifescan_binary_protocol.py
@@ -14,6 +14,7 @@ __license__ = 'MIT'
import construct
+from glucometerutils import common
from glucometerutils.support import construct_extras
from glucometerutils.support import lifescan
@@ -50,3 +51,11 @@ PACKET = construct.Struct(
VERIO_TIMESTAMP = construct_extras.Timestamp(
construct.Int32ul, epoch=946684800) # 2010-01-01 00:00
+
+_GLUCOSE_UNIT_MAPPING_TABLE = {
+ common.Unit.MG_DL: 0x00,
+ common.Unit.MMOL_L: 0x01,
+}
+
+GLUCOSE_UNIT = construct.SymmetricMapping(
+ construct.Byte, _GLUCOSE_UNIT_MAPPING_TABLE)