summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--glucometerutils/drivers/otverio2015.py22
1 files changed, 15 insertions, 7 deletions
diff --git a/glucometerutils/drivers/otverio2015.py b/glucometerutils/drivers/otverio2015.py
index 632192f..56870c2 100644
--- a/glucometerutils/drivers/otverio2015.py
+++ b/glucometerutils/drivers/otverio2015.py
@@ -1,11 +1,10 @@
# -*- coding: utf-8 -*-
-"""Driver for LifeScan OneTouch Verio 2015 devices.
+"""Driver for LifeScan OneTouch Verio (2015) and Select Plus devices.
-For Verio devices with microUSB connector. Also supports OneTouch Select Plus
-devices.
+Verio 2015 devices can be recognized by microUSB connectors.
Supported features:
- - get readings;
+ - get readings, including pre-/post-meal notes †;
- use the glucose unit preset on the device by default;
- get and set date and time;
- get serial number and software version;
@@ -13,6 +12,8 @@ Supported features:
Expected device path: /dev/sdb or similar USB block device.
+† Pre-/post-meal notes are only supported on Select Plus devices.
+
Further information on the device protocol can be found at
https://flameeyes.github.io/glucometer-protocols/lifescan/onetouch-verio-2015
@@ -74,6 +75,12 @@ _READ_RECORD_REQUEST_SUFFIX = b'\x00'
_MEMORY_ERASE_REQUEST = b'\x04\x1a'
+_MEAL_CODES = {
+ b'\x00': common.NO_MEAL,
+ b'\x01': common.BEFORE_MEAL,
+ b'\x02': common.AFTER_MEAL,
+}
+
def _extract_message(register):
"""Parse the message preamble and verify checksums."""
stx, length = _STRUCT_PREAMBLE.unpack_from(register)
@@ -253,11 +260,12 @@ class Device(object):
response[0], response[1]))
(unused_const1, unused_const2, unused_counter, unused_const3,
- unused_counter2, timestamp, value, unused_meal, unused_const4,
- unused_flags, unused_const5, unused_const6) = _STRUCT_RECORD.unpack(
+ unused_counter2, timestamp, value, meal_flag, unused_const4, unused_flags,
+ unused_const5, unused_const6) = _STRUCT_RECORD.unpack(
response)
- return common.Reading(_convert_timestamp(timestamp), float(value))
+ return common.Reading(
+ _convert_timestamp(timestamp), float(value), meal=_MEAL_CODES[meal_flag])
def get_readings(self):
record_count = self._get_reading_count()