Source code for device_client.client_trap_hvsupply
from device_client import DeviceClient
from device.trap_hv_supply import TrapHighVoltageSupply
description = """
*No description.*
"""
[docs]
def connect(name, password, server, serial):
client = DeviceClient(name, password,
title="Trap: HV Supply", description=description)
hw = TrapHighVoltageSupply(
bus=serial,
log_callback=client.emit_log,
)
# client.register_command(hw.stop, "Stop") # TODO implement safestate
client.register_command(hw.set_current, "Set current", group="Set",
inputs=[{"unit": "mA"}])
client.register_command(hw.set_voltage, "Set voltage", group="Set",
inputs=[{"unit": "V"}])
# client.register_command(hw.set_polarity, "Set polarity", group="Set",
# inputs=[{"type": "select", "options": ["+", "-"]}])
client.register_command(hw.switch_output_on, "Output ON")
client.register_command(hw.switch_output_off, "Output OFF")
client.register_background_task(hw.update_frontend)
client.keep_server_updated(
check_readiness=hw.is_ready,
check_readiness_interval=1.0,
server_address=server,
retry_on_error=True
)