from ...Internal.Core import Core
from ...Internal.CommandsGroup import CommandsGroup
from ...Internal import Conversions
from ...Internal.Types import DataType
from ...Internal.ArgSingleList import ArgSingleList
from ...Internal.ArgSingle import ArgSingle
# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
class StateCls:
"""
| Commands in total: 1
| Subgroups: 0
| Direct child commands: 1
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("state", core, parent)
[docs]
def set(self, mask_test: str, state: bool) -> None:
"""
``MTESt[:STATe]`` \n
Snippet: ``driver.mtest.state.set(mask_test = 'abc', state = False)`` \n
Activates and deactivates the mask test. If the acquisition is running, the test starts immediately. Otherwise, the test
starts when acquisition is started. The testing is stopped when acquisition is stopped, also due to the method
``RsRtx.mtest.onViolation.stop.set()`` command, or if MASK[:STATe] is set to OFF. The coommand needs ``*OPC`` command
synchronisation.
:param mask_test: String with the name of the mask test
:param state: OFF | ON
"""
param = ArgSingleList().compose_cmd_string(ArgSingle('mask_test', mask_test, DataType.String), ArgSingle('state', state, DataType.Boolean))
self._core.io.write_with_opc(f'MTESt:STATe {param}'.rstrip())
[docs]
def get(self, mask_test: str) -> bool:
"""
``MTESt[:STATe]`` \n
Snippet: ``value: bool = driver.mtest.state.get(mask_test = 'abc')`` \n
Activates and deactivates the mask test. If the acquisition is running, the test starts immediately. Otherwise, the test
starts when acquisition is started. The testing is stopped when acquisition is stopped, also due to the method
``RsRtx.mtest.onViolation.stop.set()`` command, or if MASK[:STATe] is set to OFF. The coommand needs ``*OPC`` command
synchronisation.
:param mask_test: String with the name of the mask test
:return: state: OFF | ON
"""
param = Conversions.value_to_quoted_str(mask_test)
response = self._core.io.query_str_with_opc(f'MTESt:STATe? {param}')
return Conversions.str_to_bool(response)