Ejemplo n.º 1
0
 def get_measurement_value(self):
     """
     Query current pressure measurement
     :return: pressure_measurement
     """
     pack = ThyrCommPackage(self._address)
     pack.cmd = CMD.Measurement_Value
     pressure_measurement = float(self._read_data_transaction(pack))
     log.info(f'Measurement is: {pressure_measurement} {Units.MBAR}')
     return pressure_measurement
Ejemplo n.º 2
0
 def get_firmware_version(self):
     """
     Query of the device’s firmware version
     :return: firmware_version
     """
     pack = ThyrCommPackage(self._address)
     pack.cmd = CMD.Version_Firmware
     firmware_version = self._read_data_transaction(pack)
     log.info(f'Firmware version: {firmware_version}')
     return firmware_version
Ejemplo n.º 3
0
 def get_product_name(self):
     """
     Query of product name (article number)
     :return: product_name
     """
     pack = ThyrCommPackage(self._address)
     pack.cmd = CMD.Product_Name
     product_name = self._read_data_transaction(pack)
     log.info(f'Product name: {product_name}')
     return product_name
Ejemplo n.º 4
0
 def restart_device(self):
     """
     Makes device restart
     :return: None
     """
     pack = ThyrCommPackage(self._address)
     pack.cmd = CMD.Device_Restart
     pack.data = 0
     log.info(f'Restarting device')
     self._write_data_transaction(pack)
Ejemplo n.º 5
0
 def get_device_type(self):
     """
     Query of device type, e.g. VSR205
     :return: device_type
     """
     pack = ThyrCommPackage(self._address)
     pack.cmd = CMD.Type_Device
     device_type = self._read_data_transaction(pack)
     log.info(f'Device type: {device_type}')
     return device_type
Ejemplo n.º 6
0
 def get_serial_number_head(self):
     """
     Query of sensor head serial number
     :return: sensor_head_serial_number
     """
     pack = ThyrCommPackage(self._address)
     pack.cmd = CMD.Serial_Number_Head
     sensor_head_serial_number = self._read_data_transaction(pack)
     log.info(f'Head serial number: {sensor_head_serial_number}')
     return sensor_head_serial_number
Ejemplo n.º 7
0
 def get_device_version(self):
     """
     Query of the device’s hardware version
     :return: device_version
     """
     pack = ThyrCommPackage(self._address)
     pack.cmd = CMD.Version_Device
     device_version = float(self._read_data_transaction(pack))
     log.info(f'Device version: {device_version}')
     return device_version
Ejemplo n.º 8
0
 def get_operating_hours(self):
     """
     Query the device's operating hours
     :return: operating_hours
     """
     pack = ThyrCommPackage(self._address)
     pack.cmd = CMD.Operating_Hours
     operating_hours = float(self._read_data_transaction(pack)) / 4.0
     log.info(f"Device's been operating for {operating_hours}h")
     return operating_hours
Ejemplo n.º 9
0
 def get_display_unit(self):
     """
     Query the display unit in the device's display
     :return: display_unit
     """
     pack = ThyrCommPackage(self._address)
     pack.cmd = CMD.Display_Unit
     display_unit = self._read_data_transaction(pack)
     log.info(f'Display units: {display_unit}')
     return display_unit
Ejemplo n.º 10
0
 def get_serial_number_device(self):
     """
     Query of device serial number
     :return: device_serial_number
     """
     pack = ThyrCommPackage(self._address)
     pack.cmd = CMD.Serial_Number_Device
     device_serial_number = self._read_data_transaction(pack)
     log.info(f'Device serial number: {device_serial_number}')
     return device_serial_number
Ejemplo n.º 11
0
 def get_bootloader_version(self):
     """
     Query of the device’s bootloader version
     :return: bootloader_version
     """
     pack = ThyrCommPackage(self._address)
     pack.cmd = CMD.Version_Bootloader
     bootloader_version = float(self._read_data_transaction(pack))
     log.info(f'Bootloader version: {bootloader_version}')
     return bootloader_version
Ejemplo n.º 12
0
 def set_relay_2_status(self, relay_status):
     """
     Set Relay 2 Status
     :return: relay_2_status
     :param relay_status: Not defined in discrete values yet, a string with the appropriate format has to used
     """
     pack = ThyrCommPackage(self._address)
     pack.cmd = CMD.Relay_2
     pack.relay_status = relay_status
     log.info(f'Setting Relay 2 status: {relay_status}')
     self._write_data_transaction(pack)
Ejemplo n.º 13
0
 def set_response_delay(self, response_delay):
     """
     Set the time delay between receiving a telegram and sending the answer.
     :param response_delay: Value range: 1 ... 99999 μs (default 5500 μs)
     :return:
     """
     pack = ThyrCommPackage(self._address)
     pack.cmd = CMD.Response_Delay
     pack.data = response_delay
     log.info(f'Setting response delay to: {response_delay}')
     self._write_data_transaction(pack)
Ejemplo n.º 14
0
 def set_baud_rate(self, baud_rate):
     """
     Set the baud rate for data transmission
     :param baud_rate: Value possibilities: 9600, 14400, 19200, 28800, 38400, 57600, 115200 Bd
     :return:None
     """
     pack = ThyrCommPackage(self._address)
     pack.cmd = CMD.Baud_Rate
     pack.data = baud_rate
     log.info(f'Setting baud rate to {baud_rate}')
     self._write_data_transaction(pack)
Ejemplo n.º 15
0
 def set_display_orientation(self, display_orientation):
     """
     Set the display orientation of the device NORMAL or ROTATED
     :param display_orientation: Selectable amongst Orientation.NORMAL and Orientation.ROTATED
     :return:
     """
     pack = ThyrCommPackage(self._address)
     pack.cmd = CMD.Display_Orientation
     pack.data = display_orientation
     log.info(f'Setting display orientation to {display_orientation}')
     self._write_data_transaction(pack)
Ejemplo n.º 16
0
 def set_display_unit(self, display_unit):
     """
     Set the display unit in the device's display
     :param display_unit: Selectable amongst :Units.MBAR, Units.TORR and Units.HPA
     :return:
     """
     pack = ThyrCommPackage(self._address)
     pack.cmd = CMD.Display_Unit
     pack.data = display_unit
     log.info(f"Setting display units to: {display_unit}")
     self._write_data_transaction(pack)
Ejemplo n.º 17
0
 def get_response_delay(self):
     """
     Query the time delay between receiving a telegram and sending the answer.
     Value range: 1 ... 99999 μs (default 5500 μs)
     :return: response_delay
     """
     pack = ThyrCommPackage(self._address)
     pack.cmd = CMD.Response_Delay
     response_delay = float(self._read_data_transaction(pack))
     log.info(f'Response delay: {response_delay}')
     return response_delay
Ejemplo n.º 18
0
 def get_display_orientation(self):
     """
     Get the display orientation of the device NORMAL or ROTATED
     :return: display_orientation
     """
     pack = ThyrCommPackage(self._address)
     pack.cmd = CMD.Display_Orientation
     display_orientation = self._read_data_transaction(pack)
     display_orientation_name = 'NORMAL'
     if int(display_orientation) != int(Orientation.NORMAL):
         display_orientation_name = 'ROTATED'
     log.info(f'Display orientation: {display_orientation_name}')
     return display_orientation
Ejemplo n.º 19
0
 def get_relay_2_status(self):
     """
     Get Relay 2 Status
     :return: relay_2_status
     """
     pack = ThyrCommPackage(self._address)
     pack.cmd = CMD.Relay_2
     relay_2_status = self._read_data_transaction(pack)
     pattern1 = "T(.*?)F"
     t_value = float(re.search(pattern1, relay_2_status).group(1))
     f_value = float(str(relay_2_status).split("F", 1)[1])
     log.info(f'Relay 2 status: T{t_value} and F{f_value}')
     return t_value, f_value
Ejemplo n.º 20
0
 def get_measurement_range(self):
     """
     Query measurement range of the gauge
     :return: measurement_range_lo, measurement_range_hi
     """
     pack = ThyrCommPackage(self._address)
     pack.cmd = CMD.Measurement_Range
     data = self._read_data_transaction(pack)
     measurement_range_lo = float(data[1:6])
     measurement_range_hi = float(data[7:11])
     log.info(
         f'Measurement range is: {measurement_range_lo, measurement_range_hi} {Units.MBAR}'
     )
     return measurement_range_lo, measurement_range_hi