diff options
author | Arkadiusz Bulski <arek.bulski@gmail.com> | 2018-02-16 08:24:25 +0100 |
---|---|---|
committer | Diego Elio Pettenò <flameeyes@flameeyes.eu> | 2018-03-17 14:41:40 +0100 |
commit | 4819131ff81532c06c5eccc4c70135e72ca3f7c9 (patch) | |
tree | 2f401c51f90afee69939fb74f20c9542686cb5a9 /glucometerutils/drivers | |
parent | construct: the construct API is significantly unstable, fix to 2.8.22 only. (diff) | |
download | glucometerutils-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/drivers')
-rw-r--r-- | glucometerutils/drivers/sdcodefree.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/glucometerutils/drivers/sdcodefree.py b/glucometerutils/drivers/sdcodefree.py index 2d145cc..55c0bf1 100644 --- a/glucometerutils/drivers/sdcodefree.py +++ b/glucometerutils/drivers/sdcodefree.py @@ -40,7 +40,7 @@ class Direction(enum.Enum): Out = 0x10 _PACKET = construct.Struct( - 'stx' / construct.Const(construct.Byte, 0x53), + 'stx' / construct.Const(0x53, construct.Byte), 'direction' / construct.SymmetricMapping( construct.Byte, {e: e.value for e in Direction}), @@ -49,13 +49,14 @@ _PACKET = construct.Struct( 'message' / construct.Bytes(length=lambda ctx: ctx.length - 2), 'checksum' / construct.Checksum( construct.Byte, xor_checksum, construct.this.message), - 'etx' / construct.Const(construct.Byte, 0xAA) + 'etx' / construct.Const(0xAA, construct.Byte) ) _FIRST_MESSAGE = construct.Struct( - construct.Const(construct.Byte, 0x30), + construct.Const(0x30, construct.Byte), 'count' / construct.Int16ub, - construct.Const(construct.Byte, 0xAA)[19]) + construct.Const(0xAA, construct.Byte)[19], +) _CHALLENGE_PACKET_FULL = b'\x53\x20\x04\x10\x30\x20\xAA' _RESPONSE_MESSAGE = b'\x10\x40' |