summaryrefslogtreecommitdiffstats
path: root/glucometerutils/support
diff options
context:
space:
mode:
authorArkadiusz Bulski <arek.bulski@gmail.com>2018-02-16 08:24:25 +0100
committerDiego Elio Pettenò <flameeyes@flameeyes.eu>2018-03-17 14:41:40 +0100
commit4819131ff81532c06c5eccc4c70135e72ca3f7c9 (patch)
tree2f401c51f90afee69939fb74f20c9542686cb5a9 /glucometerutils/support
parentconstruct: the construct API is significantly unstable, fix to 2.8.22 only. (diff)
downloadglucometerutils-4819131ff81532c06c5eccc4c70135e72ca3f7c9.tar
glucometerutils-4819131ff81532c06c5eccc4c70135e72ca3f7c9.tar.gz
glucometerutils-4819131ff81532c06c5eccc4c70135e72ca3f7c9.tar.bz2
glucometerutils-4819131ff81532c06c5eccc4c70135e72ca3f7c9.tar.lz
glucometerutils-4819131ff81532c06c5eccc4c70135e72ca3f7c9.tar.xz
glucometerutils-4819131ff81532c06c5eccc4c70135e72ca3f7c9.tar.zst
glucometerutils-4819131ff81532c06c5eccc4c70135e72ca3f7c9.zip
Diffstat (limited to 'glucometerutils/support')
-rw-r--r--glucometerutils/support/construct_extras.py4
-rw-r--r--glucometerutils/support/freestyle.py2
-rw-r--r--glucometerutils/support/lifescan_binary_protocol.py2
3 files changed, 4 insertions, 4 deletions
diff --git a/glucometerutils/support/construct_extras.py b/glucometerutils/support/construct_extras.py
index cb42105..6d4e302 100644
--- a/glucometerutils/support/construct_extras.py
+++ b/glucometerutils/support/construct_extras.py
@@ -23,11 +23,11 @@ class Timestamp(construct.Adapter):
super(Timestamp, self).__init__(subcon)
self.epoch = epoch
- def _encode(self, obj, context):
+ def _encode(self, obj, context, path):
assert isinstance(obj, datetime.datetime)
epoch_date = datetime.datetime.utcfromtimestamp(self.epoch)
delta = obj - epoch_date
return int(delta.total_seconds())
- def _decode(self, obj, context):
+ def _decode(self, obj, context, path):
return datetime.datetime.utcfromtimestamp(obj + self.epoch)
diff --git a/glucometerutils/support/freestyle.py b/glucometerutils/support/freestyle.py
index 50f5319..9b7d72e 100644
--- a/glucometerutils/support/freestyle.py
+++ b/glucometerutils/support/freestyle.py
@@ -26,7 +26,7 @@ from glucometerutils.support import hiddevice
_INIT_SEQUENCE = (0x04, 0x05, 0x15, 0x01)
_FREESTYLE_MESSAGE = construct.Struct(
- 'hid_report' / construct.Const(construct.Byte, 0),
+ 'hid_report' / construct.Const(0, construct.Byte),
'message_type' / construct.Byte,
'command' / construct.Padded(
63, # command can only be up to 62 bytes, but one is used for length.
diff --git a/glucometerutils/support/lifescan_binary_protocol.py b/glucometerutils/support/lifescan_binary_protocol.py
index caa9b63..6579ab0 100644
--- a/glucometerutils/support/lifescan_binary_protocol.py
+++ b/glucometerutils/support/lifescan_binary_protocol.py
@@ -33,7 +33,7 @@ def LifeScanPacket(command_prefix, include_link_control):
else:
link_control_construct = construct.Const(b'\x00')
- command_prefix_construct = construct.Const(construct.Byte, command_prefix)
+ command_prefix_construct = construct.Const(command_prefix, construct.Byte)
return construct.Struct(
construct.RawCopy(