diff options
author | Diego Elio Pettenò <flameeyes@flameeyes.eu> | 2018-11-16 00:16:24 +0100 |
---|---|---|
committer | Diego Elio Pettenò <flameeyes@flameeyes.eu> | 2018-11-16 00:16:24 +0100 |
commit | 9fb8076c5f19a71f911395ae2d6a76f2ee163841 (patch) | |
tree | 05f903c14da49a8a42dc64d5642ae9217912220f /glucometerutils/support/lifescan_binary_protocol.py | |
parent | test-requirements: add some minimum version specifications. (diff) | |
download | glucometerutils-9fb8076c5f19a71f911395ae2d6a76f2ee163841.tar glucometerutils-9fb8076c5f19a71f911395ae2d6a76f2ee163841.tar.gz glucometerutils-9fb8076c5f19a71f911395ae2d6a76f2ee163841.tar.bz2 glucometerutils-9fb8076c5f19a71f911395ae2d6a76f2ee163841.tar.lz glucometerutils-9fb8076c5f19a71f911395ae2d6a76f2ee163841.tar.xz glucometerutils-9fb8076c5f19a71f911395ae2d6a76f2ee163841.tar.zst glucometerutils-9fb8076c5f19a71f911395ae2d6a76f2ee163841.zip |
Diffstat (limited to '')
-rw-r--r-- | glucometerutils/support/lifescan_binary_protocol.py | 11 |
1 files changed, 3 insertions, 8 deletions
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) |