from ...Internal.Core import Core
from ...Internal.CommandsGroup import CommandsGroup
from ...Internal import Conversions
from ...Internal.Utilities import trim_str_response
# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
class RstCls:
"""
| Commands in total: 4
| Subgroups: 0
| Direct child commands: 4
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("rst", core, parent)
[docs]
def get_enable(self) -> bool:
"""
``USRDefined:RST[:ENABle]`` \n
Snippet: ``value: bool = driver.usrDefined.rst.get_enable()`` \n
If ON, the settings from a previously defined preset file are restored when the Preset key is pressed. The preset file is
defined with method ``RsRtx.usrDefined.rst.name()`` . If OFF, Preset sets the instrument to the factory defaults.
"""
response = self._core.io.query_str('USRDefined:RST:ENABle?')
return Conversions.str_to_bool(response)
[docs]
def set_enable(self, enab_usr_defined_preset: bool) -> None:
"""
``USRDefined:RST[:ENABle]`` \n
Snippet: ``driver.usrDefined.rst.set_enable(enab_usr_defined_preset = False)`` \n
If ON, the settings from a previously defined preset file are restored when the Preset key is pressed. The preset file is
defined with method ``RsRtx.usrDefined.rst.name()`` . If OFF, Preset sets the instrument to the factory defaults.
:param enab_usr_defined_preset: OFF | ON
"""
param = Conversions.bool_to_str(enab_usr_defined_preset)
self._core.io.write(f'USRDefined:RST:ENABle {param}')
[docs]
def get_name(self) -> str:
"""
``USRDefined:RST:NAME`` \n
Snippet: ``value: str = driver.usrDefined.rst.get_name()`` \n
Sets the path and file name of a user-defined preset file.
"""
response = self._core.io.query_str('USRDefined:RST:NAME?')
return trim_str_response(response)
[docs]
def set_name(self, usr_defined_preset_path: str) -> None:
"""
``USRDefined:RST:NAME`` \n
Snippet: ``driver.usrDefined.rst.set_name(usr_defined_preset_path = 'abc')`` \n
Sets the path and file name of a user-defined preset file.
:param usr_defined_preset_path: String parameter
"""
param = Conversions.value_to_quoted_str(usr_defined_preset_path)
self._core.io.write(f'USRDefined:RST:NAME {param}')
[docs]
def open(self) -> None:
"""
``USRDefined:RST:OPEN`` \n
Snippet: ``driver.usrDefined.rst.open()`` \n
opens and loads a user-defined preset file. Name and path of the preset file are defined with method
``RsRtx.usrDefined.rst.name()`` .
"""
self._core.io.write(f'USRDefined:RST:OPEN')
[docs]
def open_and_wait(self, opc_timeout_ms: int = -1) -> None:
"""
``USRDefined:RST:OPEN`` \n
Snippet: ``driver.usrDefined.rst.open_and_wait()`` \n
opens and loads a user-defined preset file. Name and path of the preset file are defined with method
``RsRtx.usrDefined.rst.name()`` .
Same as open, but waits for the operation to complete before continuing further. Use the RsRtx.utilities.opc_timeout_set() to set the timeout value.
:param opc_timeout_ms: Maximum time to wait in milliseconds, valid only for this call.
"""
self._core.io.write_with_opc(f'USRDefined:RST:OPEN', opc_timeout_ms)
[docs]
def save(self) -> None:
"""
``USRDefined:RST:SAVE`` \n
Snippet: ``driver.usrDefined.rst.save()`` \n
Saves the current instrument settings to a user-defined preset file. Name and path of the preset file are defined with
method ``RsRtx.usrDefined.rst.name()`` .
"""
self._core.io.write(f'USRDefined:RST:SAVE')
[docs]
def save_and_wait(self, opc_timeout_ms: int = -1) -> None:
"""
``USRDefined:RST:SAVE`` \n
Snippet: ``driver.usrDefined.rst.save_and_wait()`` \n
Saves the current instrument settings to a user-defined preset file. Name and path of the preset file are defined with
method ``RsRtx.usrDefined.rst.name()`` .
Same as save, but waits for the operation to complete before continuing further. Use the RsRtx.utilities.opc_timeout_set() to set the timeout value.
:param opc_timeout_ms: Maximum time to wait in milliseconds, valid only for this call.
"""
self._core.io.write_with_opc(f'USRDefined:RST:SAVE', opc_timeout_ms)