def __init__(self, *args: Any, **kwargs: Any) -> None: """ Initializes simulator.""" # Initialize parent class super().__init__(*args, **kwargs) self.registers: Dict = {} # Initialize write and response bytes TEMPERATURE_WRITE_BYTES = bytes([0x52, 0x00]) TEMPERATURE_RESPONSE_BYTES = bytes( [ 0x01, 0x32, 0x32, 0x2E, 0x39, 0x37, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ] ) self.writes[byte_str(TEMPERATURE_WRITE_BYTES)] = TEMPERATURE_RESPONSE_BYTES # Set temperature scale celcius SET_TEMPERATURE_SCALE_CELCIUS_WRITE_BYTES = bytes([0x53, 0x2C, 0x63, 0x00]) SET_TEMPERATURE_SCALE_CELCIUS_RESPONSE_BYTES = ATLAS_SUCCESS_31 self.writes[ byte_str(SET_TEMPERATURE_SCALE_CELCIUS_WRITE_BYTES) ] = SET_TEMPERATURE_SCALE_CELCIUS_RESPONSE_BYTES # Disable data logger DISABLE_DATA_LOGGER_WRITE_BYTES = bytes([0x44, 0x2C, 0x30, 0x00]) DISABLE_DATA_LOGGER_RESPONSE_BYTES = ATLAS_SUCCESS_31 self.writes[ byte_str(DISABLE_DATA_LOGGER_WRITE_BYTES) ] = DISABLE_DATA_LOGGER_RESPONSE_BYTES
def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) self.registers: Dict = {} CO2_WRITE_BYTES = bytes([0x04, 0x13, 0x8B, 0x00, 0x01]) CO2_RESPONSE_BYTES = bytes([0x04, 0x02, 0x02, 0x22]) STATUS_WRITE_BYTES = bytes([0x04, 0x13, 0x8A, 0x00, 0x01]) STATUS_RESPONSE_BYTES = bytes([]) ENABLE_ABC_LOGIC_WRITE_BYTES = bytes([0x05, 0x03, 0xEE, 0xFF, 0x00]) ENABLE_ABC_LOGIC_RESPONSE_BYTES = bytes([]) DISABLE_ABC_LOGIC_WRITE_BYTES = bytes([0x05, 0x03, 0xEE, 0x00, 0x00]) DISABLE_ABC_LOGIC_RESPONSE_BYTES = bytes([]) self.writes = { byte_str(CO2_WRITE_BYTES): CO2_RESPONSE_BYTES, byte_str(STATUS_WRITE_BYTES): STATUS_RESPONSE_BYTES, byte_str(ENABLE_ABC_LOGIC_WRITE_BYTES): ENABLE_ABC_LOGIC_RESPONSE_BYTES, byte_str(DISABLE_ABC_LOGIC_WRITE_BYTES): DISABLE_ABC_LOGIC_RESPONSE_BYTES, }
def __init__(self, *args: Any, **kwargs: Any) -> None: """ Initializes simulator.""" # Initialize parent class super().__init__(*args, **kwargs) self.registers: Dict = {} # Initialize write and response bytes PH_WRITE_BYTES = bytes([0x52, 0x00]) PH_RESPONSE_BYTES = bytes([ 0x01, 0x34, 0x2E, 0x30, 0x30, 0x31, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]) self.writes[byte_str(PH_WRITE_BYTES)] = PH_RESPONSE_BYTES PH_TEMP_COMPENSATION_WRITE_BYTES = bytes( [0x54, 0x2C, 0x32, 0x32, 0x2E, 0x39, 0x37, 0x00]) PH_TEMP_COMPENSATION_RESPONSE_BYTES = ATLAS_SUCCESS_31 self.writes[byte_str(PH_TEMP_COMPENSATION_WRITE_BYTES )] = PH_TEMP_COMPENSATION_RESPONSE_BYTES
def read(self, device_addr: int, num_bytes: int) -> bytes: """Reads bytes from buffer. Returns 0x00 if buffer is empty.""" msg = "Reading {} bytes, buffer: {}".format(num_bytes, byte_str(self.buffer)) self.logger.debug(msg) # Check device address matches if device_addr != self.device_addr: message = "Address not found: 0x{:02X}".format(device_addr) raise ReadError(message) # Pop bytes from buffer and return bytes_ = [] while num_bytes > 0: # Check for empty buffer or pop byte from buffer if len(self.buffer) == 0: bytes_.append(0x00) else: bytes_.append(self.buffer.pop()) # Decrement num bytes to read num_bytes = num_bytes - 1 # Successfully read bytes return bytes(bytes_)
def write(self, address: int, bytes_: bytes) -> None: """Writes bytes to buffer.""" # Check if writing to mux if address == self.mux_address: # Check if mux command valid if len(bytes_) > 1: raise MuxError( "Unable to set mux, only 1 command byte is allowed") # Set mux to channel self.mux_simulator.set(self.mux_address, bytes_[0]) # type: ignore # Check if writing to device elif address == self.device_addr: # Verify mux connection if self.mux_address != None: self.mux_simulator.verify( # type: ignore self.mux_address, self.mux_channel) # Get response bytes response_bytes = self.writes.get(byte_str(bytes_), None) # Verify known write bytes if response_bytes == None: raise WriteError("Unknown write bytes: {}".format( byte_str(bytes_))) # TODO: This is over simplified, what is setting compensation temperature? # Write response bytes to buffer self.logger.debug("Response bytes: {}".format( byte_str(response_bytes))) for byte in response_bytes: # type: ignore self.buffer.insert(0, byte) self.logger.debug("Buffer: {}".format(byte_str(self.buffer))) # Check for invalid address else: message = "Address not found: 0x{:02X}".format(address) raise WriteError(message)
def write(self, bytes_: bytes, retry: bool = True, disable_mux: bool = False) -> None: """Writes byte list to device. Converts byte list to byte array then sends bytes. Returns error message.""" with self.i2c_lock: self.manage_mux("write bytes", disable_mux) self.logger.debug("Writing bytes: {}".format(byte_str(bytes_))) self.io.write(self.address, bytes_)
def write(self, address: int, bytes_: bytes) -> None: """Writes bytes to buffer.""" # Check if writing to mux if address == self.mux_address: # Check if mux command valid if len(bytes_) > 1: raise MuxError( "Unable to set mux, only 1 command byte is allowed") # Set mux to channel self.mux_simulator.set(self.mux_address, bytes_[0]) # type: ignore # Check if writing to device elif address == self.device_addr: # Verify mux connection if self.mux_address != None: address = self.mux_address # type: ignore channel = self.mux_channel self.mux_simulator.verify(address, channel) # type: ignore # Get response bytes response_bytes = self.get_write_response_bytes(bytes_) # Verify known write bytes if response_bytes == None: raise WriteError("Unknown write bytes: {}".format( byte_str(bytes_))) # Write response bytes to buffer response_byte_string = byte_str(response_bytes) # type: ignore #self.logger.debug("Response bytes: {}".format(response_byte_string)) for byte in response_bytes: # type: ignore self.buffer.insert(0, byte) #self.logger.debug("Buffer: {}".format(byte_str(self.buffer))) # Check for invalid address else: message = "Address not found: 0x{:02X}".format(address) raise WriteError(message)
def read(self, num_bytes: int, retry: bool = True, disable_mux: bool = False) -> bytes: """Reads num bytes from device. Returns byte array.""" with self.i2c_lock: self.manage_mux("read bytes", disable_mux) self.logger.debug("Reading {} bytes".format(num_bytes)) bytes_ = bytes(self.io.read(self.address, num_bytes)) self.logger.debug("Read bytes: {}".format(byte_str(bytes_))) return bytes_
def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) self.registers = {0xE7: 0x00} # user register TEMPERATURE_WRITE_BYTES = bytes([0xF3]) TEMPERATURE_RESPONSE_BYTES = bytes([0x67, 0x30]) HUMIDITY_WRITE_BYTES = bytes([0xF5]) HUMIDITY_RESPONSE_BYTES = bytes([0x9A, 0xA2]) RESET_WRITE_BYTES = bytes([0xFE]) RESET_RESPONSE_BYTES = bytes([]) self.writes = { byte_str(TEMPERATURE_WRITE_BYTES): TEMPERATURE_RESPONSE_BYTES, byte_str(HUMIDITY_WRITE_BYTES): HUMIDITY_RESPONSE_BYTES, byte_str(RESET_WRITE_BYTES): RESET_RESPONSE_BYTES, }
def read(self, device_addr: int, num_bytes: int) -> bytes: """Reads bytes from buffer. Returns 0x00 if buffer is empty.""" msg = "Reading {} bytes, buffer: {}".format(num_bytes, byte_str(self.buffer)) self.logger.debug(msg) # Check device address matches if device_addr != self.device_addr: message = "Address not found: 0x{:02X}".format(device_addr) raise ReadError(message) return self.get_read_response_bytes(num_bytes)
def __init__(self, *args: Any, **kwargs: Any) -> None: """Initializes simulator.""" # Intialize parent class super().__init__(*args, **kwargs) self.registers: Dict = {} POWER_REGISTER_WRITE_BYTES = bytes([0x40]) POWER_REGISTER_RESPONSE_BYTES = bytes([0x00, 0x00]) self.writes = { byte_str(POWER_REGISTER_WRITE_BYTES): POWER_REGISTER_RESPONSE_BYTES } # Add all possible dac outputs to writes dict for channel in range(0x30, 0x37 + 1): for output in range(0x00, 0xFF + 1): OUTPUT_WRITE_BYTES = bytes([channel, output, 0x00]) OUTPUT_RESPONSE_BYTES = bytes([]) # TODO self.writes[byte_str(OUTPUT_WRITE_BYTES)] = OUTPUT_RESPONSE_BYTES
def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) # First byte is a base, 0x00 is the Status Base # 0x0F is the Capacitive Touch Base TEMPERATURE_WRITE_BYTES = bytes([0x00, 0x04]) TEMPERATURE_RESPONSE_BYTES = bytes([0x00, 0x18, 0x00, 0x00]) # 24.0 HW_ID_WRITE_BYTES = bytes([0x00, 0x01]) HW_ID_RESPONSE_BYTES = bytes([0x0F, 0xBA]) # 4026 RESET_WRITE_BYTES = bytes([0x00, 0x7F]) RESET_RESPONSE_BYTES = bytes([]) MOISTURE_WRITE_BYTES = bytes([0x0F, 0x10]) MOISTURE_RESPONSE_BYTES = bytes([0x03, 0xE8]) # 1000 self.writes = { byte_str(TEMPERATURE_WRITE_BYTES): TEMPERATURE_RESPONSE_BYTES, byte_str(HW_ID_WRITE_BYTES): HW_ID_RESPONSE_BYTES, byte_str(RESET_WRITE_BYTES): RESET_RESPONSE_BYTES, byte_str(MOISTURE_WRITE_BYTES): MOISTURE_RESPONSE_BYTES, }
def __init__(self, *args: Any, **kwargs: Any) -> None: """ Initializes simulator.""" # Initialize parent class super().__init__(*args, **kwargs) self.registers: Dict = {} # Initialize write and response bytes TEMPERATURE_WRITE_BYTES = bytes([0x52, 0x00]) TEMPERATURE_RESPONSE_BYTES = bytes([ 0x01, 0x32, 0x32, 0x2E, 0x39, 0x37, 0x32, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]) self.writes[byte_str( TEMPERATURE_WRITE_BYTES)] = TEMPERATURE_RESPONSE_BYTES
def __init__(self, *args: Any, **kwargs: Any) -> None: super().__init__(*args, **kwargs) self.registers: Dict = {} INFO_WRITE_BYTES = bytes([0x69, 0x00]) INFO_RESPONSE_BYTES = bytes([ 0x01, 0x3F, 0x49, 0x2C, 0x45, 0x43, 0x2C, 0x31, 0x2E, 0x39, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]) STATUS_WRITE_BYTES = bytes([0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x00]) STATUS_RESPONSE_BYTES = bytes([ 0x01, 0x3F, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x2C, 0x50, 0x2C, 0x33, 0x2E, 0x36, 0x35, 0x35, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]) ENABLE_PLOCK_WRITE_BYTES = bytes( [0x50, 0x6C, 0x6F, 0x63, 0x6B, 0x2C, 0x31, 0x00]) ENABLE_PLOCK_RESPONSE_BYTES = ATLAS_SUCCESS_31 DISABLE_PLOCK_WRITE_BYTES = bytes( [0x50, 0x6C, 0x6F, 0x63, 0x6B, 0x2C, 0x30, 0x00]) DISABLE_PLOCK_RESPONSE_BYTES = ATLAS_SUCCESS_31 ENABLE_LED_WRITE_BYTES = bytes([0x4C, 0x2C, 0x31, 0x00]) ENABLE_LED_RESPONSE_BYTES = ATLAS_SUCCESS_31 DISABLE_LED_WRITE_BYTES = bytes([0x4C, 0x2C, 0x30, 0x00]) DISABLE_LED_RESPONSE_BYTES = ATLAS_SUCCESS_31 ENABLE_SLEEP_WRITE_BYTES = bytes([0x53, 0x6C, 0x65, 0x65, 0x70, 0x00]) ENABLE_SLEEP_RESPONSE_BYTES = bytes([]) SET_TEMP_26_WRITE_BYTES = bytes( [0x54, 0x2C, 0x32, 0x36, 0x2E, 0x30, 0x00]) SET_TEMP_26_RESPONSE_BYTES = ATLAS_SUCCESS_31 CALIBRATE_LOW_4_WRITE_BYTES = bytes([ 0x43, 0x61, 0x6C, 0x2C, 0x6C, 0x6F, 0x77, 0x2C, 0x34, 0x2E, 0x30, 0x00 ]) CALIBRATE_LOW_4_RESPONSE_BYTES = ATLAS_SUCCESS_31 CALIBRATE_MID_7_WRITE_BYTES = bytes([ 0x43, 0x61, 0x6C, 0x2C, 0x6D, 0x69, 0x64, 0x2C, 0x37, 0x2E, 0x30, 0x00 ]) CALIBRATE_MID_7_RESPONSE_BYTES = ATLAS_SUCCESS_31 CALIBRATE_HIGH_10_WRITE_BYTES = bytes([ 0x43, 0x61, 0x6C, 0x2C, 0x68, 0x69, 0x67, 0x68, 0x2C, 0x31, 0x30, 0x2E, 0x30, 0x00, ]) CALIBRATE_HIGH_10_RESPONSE_BYTES = ATLAS_SUCCESS_31 CLEAR_CALIBRATION_WRITE_BYTES = bytes( [0x43, 0x61, 0x6C, 0x2C, 0x63, 0x6C, 0x65, 0x61, 0x72, 0x00]) CLEAR_CALIBRATION_RESPONSE_BYTES = ATLAS_SUCCESS_31 FACTORY_RESET_WRITE_BYTES = bytes( [0x46, 0x61, 0x63, 0x74, 0x6F, 0x72, 0x79, 0x00]) FACTORY_RESET_RESPONSE_BYTES = bytes([]) self.writes = { byte_str(INFO_WRITE_BYTES): INFO_RESPONSE_BYTES, byte_str(STATUS_WRITE_BYTES): STATUS_RESPONSE_BYTES, byte_str(ENABLE_PLOCK_WRITE_BYTES): ENABLE_PLOCK_RESPONSE_BYTES, byte_str(DISABLE_PLOCK_WRITE_BYTES): DISABLE_PLOCK_RESPONSE_BYTES, byte_str(ENABLE_LED_WRITE_BYTES): ENABLE_LED_RESPONSE_BYTES, byte_str(DISABLE_LED_WRITE_BYTES): DISABLE_LED_RESPONSE_BYTES, byte_str(ENABLE_SLEEP_WRITE_BYTES): ENABLE_SLEEP_RESPONSE_BYTES, byte_str(SET_TEMP_26_WRITE_BYTES): SET_TEMP_26_RESPONSE_BYTES, byte_str(CALIBRATE_LOW_4_WRITE_BYTES): CALIBRATE_LOW_4_RESPONSE_BYTES, byte_str(CALIBRATE_MID_7_WRITE_BYTES): CALIBRATE_MID_7_RESPONSE_BYTES, byte_str(CALIBRATE_HIGH_10_WRITE_BYTES): CALIBRATE_HIGH_10_RESPONSE_BYTES, byte_str(CLEAR_CALIBRATION_WRITE_BYTES): CLEAR_CALIBRATION_RESPONSE_BYTES, byte_str(FACTORY_RESET_WRITE_BYTES): FACTORY_RESET_RESPONSE_BYTES, }
def __init__(self, *args: Any, **kwargs: Any) -> None: """ Initializes simulator.""" # Initialize parent class super().__init__(*args, **kwargs) self.registers: Dict = {} # Initialize write and response bytes CO2_WRITE_BYTES = bytes([0x52, 0x00]) CO2_RESPONSE_BYTES = bytes([ 0x01, 0x35, 0x30, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]) self.writes[byte_str(CO2_WRITE_BYTES)] = CO2_RESPONSE_BYTES # Read internal temperature READ_TEMP_WRITE_BYTES = bytes([0x52, 0x00]) READ_TEMP_RESPONSE_BYTES = bytes([ 0x01, 0x34, 0x39, 0x30, 0x2C, 0x32, 0x37, 0x2E, 0x35, 0x36, 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]) self.writes[byte_str(READ_TEMP_WRITE_BYTES)] = READ_TEMP_RESPONSE_BYTES # Sensor info INFO_WRITE_BYTES = bytes([0x69, 0x00]) INFO_RESPONSE_BYTES = bytes([ 0x01, 0x3F, 0x49, 0x2C, 0x43, 0x4F, 0x32, 0x2C, 0x31, 0x2E, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]) self.writes[byte_str(INFO_WRITE_BYTES)] = INFO_RESPONSE_BYTES # Enable internal temperature ENABLE_TEMP_WRITE_BYTES = bytes([0x4F, 0x2C, 0x74, 0x2C, 0x31, 0x00]) ENABLE_TEMP_RESPONSE_BYTES = ATLAS_SUCCESS_31 self.writes[byte_str( ENABLE_TEMP_WRITE_BYTES)] = ENABLE_TEMP_RESPONSE_BYTES # Disable internal temperature DISABLE_TEMP_WRITE_BYTES = bytes([0x4F, 0x2C, 0x74, 0x2C, 0x30, 0x00]) DISABLE_TEMP_RESPONSE_BYTES = ATLAS_SUCCESS_31 self.writes[byte_str( DISABLE_TEMP_WRITE_BYTES)] = DISABLE_TEMP_RESPONSE_BYTES # Disable alarm DISABLE_ALARM_WRITE_BYTES = bytes( [0x41, 0x6C, 0x61, 0x72, 0x6D, 0x2C, 0x65, 0x6E, 0x2C, 0x30, 0x00]) DISABLE_ALARM_RESPONSE_BYTES = ATLAS_SUCCESS_31 self.writes[byte_str( DISABLE_ALARM_WRITE_BYTES)] = DISABLE_ALARM_RESPONSE_BYTES
def __init__(self, *args: Any, **kwargs: Any) -> None: """Initializes simulator.""" # Intialize parent class super().__init__(*args, **kwargs) # No I2C registers used for this device self.registers: Dict = {} # LCD commands WRITE_BYTES = bytes( [driver.GroveRGBLCDDriver.CMD, driver.GroveRGBLCDDriver.CLEAR]) RESPONSE_BYTES = bytes([0x00, 0x00]) self.writes = {byte_str(WRITE_BYTES): RESPONSE_BYTES} WRITE_BYTES = bytes([ driver.GroveRGBLCDDriver.CMD, driver.GroveRGBLCDDriver.DISPLAY_ON_NO_CURSOR, ]) self.writes[byte_str(WRITE_BYTES)] = RESPONSE_BYTES WRITE_BYTES = bytes( [driver.GroveRGBLCDDriver.CMD, driver.GroveRGBLCDDriver.TWO_LINES]) self.writes[byte_str(WRITE_BYTES)] = RESPONSE_BYTES WRITE_BYTES = bytes( [driver.GroveRGBLCDDriver.CMD, driver.GroveRGBLCDDriver.NEWLINE]) self.writes[byte_str(WRITE_BYTES)] = RESPONSE_BYTES # RGB commands WRITE_BYTES = bytes([0, 0]) self.writes[byte_str(WRITE_BYTES)] = RESPONSE_BYTES WRITE_BYTES = bytes([1, 0]) self.writes[byte_str(WRITE_BYTES)] = RESPONSE_BYTES WRITE_BYTES = bytes([0x08, 0xAA]) self.writes[byte_str(WRITE_BYTES)] = RESPONSE_BYTES WRITE_BYTES = bytes([4, 0]) self.writes[byte_str(WRITE_BYTES)] = RESPONSE_BYTES WRITE_BYTES = bytes([4, 0xFF]) self.writes[byte_str(WRITE_BYTES)] = RESPONSE_BYTES WRITE_BYTES = bytes([3, 0]) self.writes[byte_str(WRITE_BYTES)] = RESPONSE_BYTES WRITE_BYTES = bytes([3, 0xFF]) self.writes[byte_str(WRITE_BYTES)] = RESPONSE_BYTES WRITE_BYTES = bytes([2, 0]) self.writes[byte_str(WRITE_BYTES)] = RESPONSE_BYTES WRITE_BYTES = bytes([2, 0xFF]) self.writes[byte_str(WRITE_BYTES)] = RESPONSE_BYTES
def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.writes = {byte_str(bytes([0x01])): bytes([0x02])}
def get_write_response_bytes(self, write_bytes: bytes) -> Optional[bytes]: """Gets response byte for write command. Handles state based writes.""" return self.writes.get(byte_str(write_bytes), None)
def __init__(self, *args: Any, **kwargs: Any) -> None: """ Initializes simulator.""" # Initialize parent class super().__init__(*args, **kwargs) self.registers: Dict = {} # TODO: Simulator should take into account which outputs are enabled # Requires overwriting simulator read / write functions to add state EC_WRITE_BYTES = bytes([0x52, 0x00]) EC_RESPONSE_BYTES = bytes([ 0x01, 0x30, 0x2E, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]) ENABLE_EC_WRITE_BYTES = bytes( [0x4F, 0x2C, 0x45, 0x43, 0x2C, 0x31, 0x00]) ENABLE_EC_RESPONSE_BYTES = ATLAS_SUCCESS_31 DISABLE_EC_WRITE_BYTES = bytes( [0x4F, 0x2C, 0x45, 0x43, 0x2C, 0x30, 0x00]) DISABLE_EC_RESPONSE_BYTES = ATLAS_SUCCESS_31 ENABLE_TDS_WRITE_BYTES = bytes( [0x4F, 0x2C, 0x54, 0x44, 0x53, 0x2C, 0x31, 0x00]) ENABLE_TDS_RESPONSE_BYTES = ATLAS_SUCCESS_31 DISABLE_TDS_WRITE_BYTES = bytes( [0x4F, 0x2C, 0x54, 0x44, 0x53, 0x2C, 0x30, 0x00]) DISABLE_TDS_RESPONSE_BYTES = ATLAS_SUCCESS_31 ENABLE_SALINITY_WRITE_BYTES = bytes( [0x4F, 0x2C, 0x53, 0x2C, 0x31, 0x00]) ENABLE_SALINITY_RESPONSE_BYTES = ATLAS_SUCCESS_31 DISABLE_SALINITY_WRITE_BYTES = bytes( [0x4F, 0x2C, 0x53, 0x2C, 0x30, 0x00]) DISABLE_SALINITY_RESPONSE_BYTES = ATLAS_SUCCESS_31 ENABLE_SG_WRITE_BYTES = bytes( [0x4F, 0x2C, 0x53, 0x47, 0x2C, 0x31, 0x00]) ENABLE_SG_RESPONSE_BYTES = ATLAS_SUCCESS_31 DISABLE_SG_WRITE_BYTES = bytes( [0x4F, 0x2C, 0x53, 0x47, 0x2C, 0x30, 0x00]) DISABLE_SG_RESPONSE_BYTES = ATLAS_SUCCESS_31 SET_PROBE_1_WRITE_BYTES = bytes([0x4B, 0x2C, 0x31, 0x2E, 0x30, 0x00]) SET_PROBE_1_RESPONSE_BYTES = ATLAS_SUCCESS_31 CALIBRATE_DRY_WRITE_BYTES = bytes( [0x43, 0x61, 0x6C, 0x2C, 0x64, 0x72, 0x79, 0x00]) CALIBRATE_DRY_RESPONSE_BYTES = ATLAS_SUCCESS_31 self.writes.update({ byte_str(EC_WRITE_BYTES): EC_RESPONSE_BYTES, byte_str(ENABLE_EC_WRITE_BYTES): ENABLE_EC_RESPONSE_BYTES, byte_str(DISABLE_EC_WRITE_BYTES): DISABLE_EC_RESPONSE_BYTES, byte_str(ENABLE_TDS_WRITE_BYTES): ENABLE_TDS_RESPONSE_BYTES, byte_str(DISABLE_TDS_WRITE_BYTES): DISABLE_TDS_RESPONSE_BYTES, byte_str(ENABLE_SALINITY_WRITE_BYTES): ENABLE_SALINITY_RESPONSE_BYTES, byte_str(DISABLE_SALINITY_WRITE_BYTES): DISABLE_SALINITY_RESPONSE_BYTES, byte_str(ENABLE_SG_WRITE_BYTES): ENABLE_SG_RESPONSE_BYTES, byte_str(DISABLE_SG_WRITE_BYTES): DISABLE_SG_RESPONSE_BYTES, byte_str(SET_PROBE_1_WRITE_BYTES): SET_PROBE_1_RESPONSE_BYTES, byte_str(CALIBRATE_DRY_WRITE_BYTES): CALIBRATE_DRY_RESPONSE_BYTES, })