From 9fb8076c5f19a71f911395ae2d6a76f2ee163841 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20Elio=20Petten=C3=B2?= Date: Thu, 15 Nov 2018 23:16:24 +0000 Subject: Don't fold the command prefix into the LifeScanPacket. For the otultraeasy, there is no prefix provided in the acks at all, so the previous change broke the otultraeasy. Partial revert of b5784bb35b9968bf977d1319c3301958d671f45c. --- glucometerutils/support/lifescan_binary_protocol.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) (limited to 'glucometerutils/support') diff --git a/glucometerutils/support/lifescan_binary_protocol.py b/glucometerutils/support/lifescan_binary_protocol.py index 4632a94..610b5ea 100644 --- a/glucometerutils/support/lifescan_binary_protocol.py +++ b/glucometerutils/support/lifescan_binary_protocol.py @@ -27,24 +27,21 @@ _LINK_CONTROL = construct.BitStruct( 'sequence_number' / construct.Default(construct.Flag, False), ) -def LifeScanPacket(command_prefix, include_link_control): +def LifeScanPacket(include_link_control): if include_link_control: link_control_construct = _LINK_CONTROL else: link_control_construct = construct.Const(b'\x00') - command_prefix_construct = construct.Const(command_prefix, construct.Byte) - return construct.Struct( 'data' / construct.RawCopy( construct.Struct( construct.Const(b'\x02'), # stx 'length' / construct.Rebuild( - construct.Byte, lambda this: len(this.message) + 7), + construct.Byte, lambda this: len(this.message) + 6), 'link_control' / link_control_construct, - 'command_prefix' / command_prefix_construct, 'message' / construct.Bytes( - lambda this: this.length - 7), + lambda this: this.length - 6), construct.Const(b'\x03'), # etx ), ), @@ -52,8 +49,6 @@ def LifeScanPacket(command_prefix, include_link_control): construct.Int16ul, lifescan.crc_ccitt, construct.this.data.data), ) -COMMAND_SUCCESS = construct.Const(b'\x06') - VERIO_TIMESTAMP = construct_extras.Timestamp( construct.Int32ul, epoch=946684800) # 2000-01-01 (not 2010) -- cgit v1.2.3