Merging development
This commit is contained in:
@@ -151,7 +151,7 @@ class StdDaqClient:
|
||||
return None
|
||||
return status
|
||||
|
||||
def get_config(self, timeout: float = 2) -> dict:
|
||||
def get_config(self, timeout: float = 2, cached=False) -> dict:
|
||||
"""Get the current configuration of the StdDAQ.
|
||||
|
||||
Args:
|
||||
@@ -159,6 +159,9 @@ class StdDaqClient:
|
||||
Returns:
|
||||
config (dict): configuration of the StdDAQ
|
||||
"""
|
||||
if cached:
|
||||
return self._config
|
||||
|
||||
response = requests.get(
|
||||
self.rest_url + "/api/config/get", params={"user": "ioc"}, timeout=timeout
|
||||
)
|
||||
@@ -166,7 +169,9 @@ class StdDaqClient:
|
||||
self._config = response.json()
|
||||
return self._config
|
||||
|
||||
def set_config(self, config: dict, timeout: float = 2, update: bool = True, force: bool=True) -> None:
|
||||
def set_config(
|
||||
self, config: dict, timeout: float = 2, update: bool = True, force: bool = True
|
||||
) -> None:
|
||||
"""
|
||||
Set the configuration of the StdDAQ. This will overwrite the current configuration.
|
||||
|
||||
@@ -193,7 +198,10 @@ class StdDaqClient:
|
||||
# new_jason = json.dumps(new_config)
|
||||
logger.warning(new_config)
|
||||
response = requests.post(
|
||||
self.rest_url + "/api/config/set", params={"user": "ioc"}, json=new_config, timeout=timeout
|
||||
self.rest_url + "/api/config/set",
|
||||
params={"user": "ioc"},
|
||||
json=new_config,
|
||||
timeout=timeout,
|
||||
)
|
||||
response.raise_for_status()
|
||||
|
||||
@@ -282,7 +290,6 @@ class StdDaqClient:
|
||||
self._ws_client = None
|
||||
logger.warning("Shutdown complete")
|
||||
|
||||
|
||||
def _wait_for_server_running(self):
|
||||
"""
|
||||
Wait for the StdDAQ to be running. If the StdDaq is not running, the
|
||||
@@ -349,14 +356,14 @@ class StdDaqClient:
|
||||
self._status_callbacks.pop(id(cb))
|
||||
|
||||
|
||||
|
||||
# Automatically connect to microXAS testbench if directly invoked
|
||||
if __name__ == "__main__":
|
||||
# pylint: disable=disallowed-name,too-few-public-methods
|
||||
class foo:
|
||||
"""Dummy"""
|
||||
name="bar"
|
||||
|
||||
name = "bar"
|
||||
|
||||
daq = StdDaqClient(
|
||||
parent=foo(), ws_url='ws://129.129.95.111:8080', rest_url='http://129.129.95.111:5000'
|
||||
parent=foo(), ws_url="ws://129.129.95.111:8080", rest_url="http://129.129.95.111:5000"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user