diff options
Diffstat (limited to 'glucometerutils/drivers/otverio2015.py')
-rw-r--r-- | glucometerutils/drivers/otverio2015.py | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/glucometerutils/drivers/otverio2015.py b/glucometerutils/drivers/otverio2015.py index a7cadf5..107da34 100644 --- a/glucometerutils/drivers/otverio2015.py +++ b/glucometerutils/drivers/otverio2015.py @@ -43,10 +43,12 @@ _REGISTER_SIZE = 512 _PACKET = construct.Padded( _REGISTER_SIZE, - lifescan_binary_protocol.LifeScanPacket(0x03, False)) + lifescan_binary_protocol.LifeScanPacket(False)) + +_COMMAND_SUCCESS = construct.Const(b'\x03\x06') _QUERY_REQUEST = construct.Struct( - construct.Const(b'\xe6\x02'), + construct.Const(b'\x03\xe6\x02'), 'selector' / construct.Enum( construct.Byte, serial=0x00, model=0x01, software=0x02), ) @@ -57,39 +59,40 @@ _QUERY_RESPONSE = construct.Struct( ) _READ_PARAMETER_REQUEST = construct.Struct( + construct.Const(b'\x03'), 'selector' / construct.Enum( construct.Byte, unit=0x04), ) _READ_UNIT_RESPONSE = construct.Struct( - lifescan_binary_protocol.COMMAND_SUCCESS, + _COMMAND_SUCCESS, 'unit' / lifescan_binary_protocol.GLUCOSE_UNIT, construct.Padding(3), ) -_READ_RTC_REQUEST = construct.Const(b'\x20\x02') +_READ_RTC_REQUEST = construct.Const(b'\x03\x20\x02') _READ_RTC_RESPONSE = construct.Struct( - lifescan_binary_protocol.COMMAND_SUCCESS, + _COMMAND_SUCCESS, 'timestamp' / lifescan_binary_protocol.VERIO_TIMESTAMP, ) _WRITE_RTC_REQUEST = construct.Struct( - construct.Const(b'\x20\x01'), + construct.Const(b'\x03\x20\x01'), 'timestamp' / lifescan_binary_protocol.VERIO_TIMESTAMP, ) -_MEMORY_ERASE_REQUEST = construct.Const(b'\x1a') +_MEMORY_ERASE_REQUEST = construct.Const(b'\x03\x1a') -_READ_RECORD_COUNT_REQUEST = construct.Const(b'\x27\x00') +_READ_RECORD_COUNT_REQUEST = construct.Const(b'\x03\x27\x00') _READ_RECORD_COUNT_RESPONSE = construct.Struct( - lifescan_binary_protocol.COMMAND_SUCCESS, + _COMMAND_SUCCESS, 'count' / construct.Int16ul, ) _READ_RECORD_REQUEST = construct.Struct( - construct.Const(b'\x31\x02'), + construct.Const(b'\x03\x31\x02'), 'record_id' / construct.Int16ul, construct.Const(b'\x00'), ) @@ -101,7 +104,7 @@ _MEAL_FLAG = { } _READ_RECORD_RESPONSE = construct.Struct( - lifescan_binary_protocol.COMMAND_SUCCESS, + _COMMAND_SUCCESS, 'inverse_counter' / construct.Int16ul, construct.Padding(1), 'lifetime_counter' / construct.Int16ul, @@ -207,7 +210,7 @@ class Device(object): def set_datetime(self, date=datetime.datetime.now()): self._send_request( 3, _WRITE_RTC_REQUEST, {'timestamp': date}, - lifescan_binary_protocol.COMMAND_SUCCESS) + _COMMAND_SUCCESS) # The device does not return the new datetime, so confirm by calling # READ RTC again. @@ -216,7 +219,7 @@ class Device(object): def zero_log(self): self._send_request( 3, _MEMORY_ERASE_REQUEST, None, - lifescan_binary_protocol.COMMAND_SUCCESS) + _COMMAND_SUCCESS) def get_glucose_unit(self): response = self._send_request( |