Source code for device_client.client_interfer_oscope
from device_client import DeviceClient
from device.oscope_mso5000 import Oscope_MSO5000
# Oscilloscope IP and settings at: Utility > IO Setting > LAN Conf.
IP_ADDRESS = "192.168.0.178"
description = """
A four-channel digital oscilloscope.
"""
[docs]
def connect(name, password, server):
client = DeviceClient(name, password,
title="Oscilloscope RIGOL MSO5000", description=description)
hw = Oscope_MSO5000(IP_ADDRESS, log_callback=client.emit_log) # debug_spam=True, testrun=True
# TODO Add client.register_property to avoid using __setattr__
# client.register_command(lambda channel: hw.__setattr__("active_ch", channel), "Select channel")
client.register_command(hw.set_timeaxis, "Signal x [s]")
client.register_command(hw.set_channelaxis, "Signal y [V]")
# client.register_command(hw.set_freqaxis, "FFT x [Hz]")
# client.register_command(hw.set_amplitaxis, "FFT y [dBV]")
client.register_command(hw.fetch_data, "Fetch data")
def save_data():
filepath = str(hw.save_data())
client.emit_datafile(filepath, filepath.split("/")[-1])
client.register_command(save_data, "Save data")
client.register_background_task(hw.update_frontend)
client.keep_server_updated(
check_readiness=hw.is_ready,
check_readiness_interval=1,
server_address=server,
retry_on_error=True
)