diff options
author | Andrej Rode <andrej.rode@ettus.com> | 2016-10-19 16:41:59 -0700 |
---|---|---|
committer | Martin Braun <martin.braun@ettus.com> | 2017-05-26 16:01:37 -0700 |
commit | 4b7b35570c13766ed575f69d79bf1ded954b6886 (patch) | |
tree | a07e385db0e3e6adca71a2b3c817993e0b2c8422 /tools/gr-usrptest/python/labview_control/lv_control.py | |
parent | 76e9e6393fe1d5a0ccc9e05deb431694921850ec (diff) | |
download | uhd-4b7b35570c13766ed575f69d79bf1ded954b6886.tar.gz uhd-4b7b35570c13766ed575f69d79bf1ded954b6886.tar.bz2 uhd-4b7b35570c13766ed575f69d79bf1ded954b6886.zip |
gr-usrptest: add LabVIEW remote control capability
- require modules labview_automation and hoplite for RTS python module
- new python module: labview_control
Diffstat (limited to 'tools/gr-usrptest/python/labview_control/lv_control.py')
-rw-r--r-- | tools/gr-usrptest/python/labview_control/lv_control.py | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/tools/gr-usrptest/python/labview_control/lv_control.py b/tools/gr-usrptest/python/labview_control/lv_control.py new file mode 100644 index 000000000..27407a07c --- /dev/null +++ b/tools/gr-usrptest/python/labview_control/lv_control.py @@ -0,0 +1,87 @@ +#!/usr/bin/env python +from labview_automation.client import LabVIEWClient + +class vst_siggen: + def __init__(self,host,vi_base_path,rio_device): + self._host = host + self._path = vi_base_path + self._rio = rio_device + self._caller = lv_caller(host,2552,vi_base_path) + + def __del__(self): + self.disconnect() + + def set_freq(self, freq): + self._caller.vst_set_freq(self._rio,freq) + + def disconnect(self): + try: + self._caller.vst_disconnect(self._rio) + except: + pass + + +class executive_switch: + def __init__(self,host,vi_base_path,device_name): + self._host = host + self._path = vi_base_path + self._device = device_name + self._caller = lv_caller(host,2552,vi_base_path) + + def __del__(self): + self.disconnect_all() + + def connect_ports(self, port0, port1): + self._caller.switch_connect_ports(self._device,port0,port1) + + def disconnect_all(self): + try: + self._caller.switch_disconnect_all(self._device) + except: + pass + + + +class lv_caller: + def __init__(self, host, port, vi_base_path): + self._host = host + self._port = port + self._client = LabVIEWClient(host, port) + self._path = vi_base_path + + def vst_disconnect(self, rio_device): + with self._client as c: + control_values = { + "rio_device": rio_device, + } + result = c.run_vi_synchronous("".join([self._path,"vst_disconnect.vi"]),control_values) + return result + + def vst_set_freq(self, rio_device, freq): + with self._client as c: + control_values = { + "rio_device": rio_device, + "cw_freq": freq, + "power": 0, + } + result = c.run_vi_synchronous("".join([self._path,"vst_set_freq.vi"]),control_values) + return result + + def switch_connect_ports(self, switch_device, port0, port1): + with self._client as c: + control_values = { + "virtual_switch": switch_device, + "chan0": port0, + "chan1": port1, + } + result = c.run_vi_synchronous("".join([self._path,"switch_connect_ports.vi"]),control_values) + return result + + + def switch_disconnect_all(self, switch_device): + with self._client as c: + control_values = { + "virtual_switch": switch_device, + } + result = c.run_vi_synchronous("".join([self._path,"switch_disconnect.vi"]),control_values) + return result |