diff options
author | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-12-22 16:36:18 +0100 |
---|---|---|
committer | Matthias P. Braendli <matthias.braendli@mpb.li> | 2018-12-22 16:36:18 +0100 |
commit | 5506c7bc287e23836b953d732829b48c997b878a (patch) | |
tree | 1648c3a1fde0519692315c33baefb4105bb8a120 /python/lib/zmqrc.py | |
parent | 00b2423a298887fefc77c24e8067e621878cc108 (diff) | |
download | dabmod-5506c7bc287e23836b953d732829b48c997b878a.tar.gz dabmod-5506c7bc287e23836b953d732829b48c997b878a.tar.bz2 dabmod-5506c7bc287e23836b953d732829b48c997b878a.zip |
GUI: Update Adapt to use zmqrc lib
Diffstat (limited to 'python/lib/zmqrc.py')
-rw-r--r-- | python/lib/zmqrc.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/python/lib/zmqrc.py b/python/lib/zmqrc.py index 2d82b3e..423f91d 100644 --- a/python/lib/zmqrc.py +++ b/python/lib/zmqrc.py @@ -22,15 +22,16 @@ # along with ODR-DabMod. If not, see <http://www.gnu.org/licenses/>. import zmq import json +from typing import List -class ModRemoteControl(object): +class ModRemoteControl: """Interact with ODR-DabMod using the ZMQ RC""" def __init__(self, mod_host, mod_port=9400): self._host = mod_host self._port = mod_port self._ctx = zmq.Context() - def _read(self, message_parts): + def _read(self, message_parts: List[str]): sock = zmq.Socket(self._ctx, zmq.REQ) sock.setsockopt(zmq.LINGER, 0) sock.connect("tcp://{}:{}".format(self._host, self._port)) @@ -70,14 +71,14 @@ class ModRemoteControl(object): return modules - def get_param_value(self, module, param): + def get_param_value(self, module: str, param: str) -> str: value = self._read(['get', module, param]) if value[0] == 'fail': raise ValueError("Error getting param: {}".format(value[1])) else: return value[0] - def set_param_value(self, module, param, value): + def set_param_value(self, module: str, param: str, value: str) -> None: ret = self._read(['set', module, param, value]) if ret[0] == 'fail': raise ValueError("Error setting param: {}".format(ret[1])) |