diff options
Diffstat (limited to 'glucometerutils/support/lifescan_binary_protocol.py')
-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) |