summaryrefslogtreecommitdiffstats
path: root/glucometerutils/support
diff options
context:
space:
mode:
authorDiego Elio Pettenò <flameeyes@flameeyes.eu>2018-01-06 22:10:11 +0100
committerDiego Elio Pettenò <flameeyes@flameeyes.eu>2018-01-06 22:10:11 +0100
commit349b1c794b68fe2dcaad4cd9cf28d09a1d56ee17 (patch)
tree7716b39a0979eb897ab15738fbac3a7609ad1c64 /glucometerutils/support
parentlifescan_binary_protocol: create a new module to support LifeScan drivers. (diff)
downloadglucometerutils-349b1c794b68fe2dcaad4cd9cf28d09a1d56ee17.tar
glucometerutils-349b1c794b68fe2dcaad4cd9cf28d09a1d56ee17.tar.gz
glucometerutils-349b1c794b68fe2dcaad4cd9cf28d09a1d56ee17.tar.bz2
glucometerutils-349b1c794b68fe2dcaad4cd9cf28d09a1d56ee17.tar.lz
glucometerutils-349b1c794b68fe2dcaad4cd9cf28d09a1d56ee17.tar.xz
glucometerutils-349b1c794b68fe2dcaad4cd9cf28d09a1d56ee17.tar.zst
glucometerutils-349b1c794b68fe2dcaad4cd9cf28d09a1d56ee17.zip
Diffstat (limited to 'glucometerutils/support')
-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)