Source code for RsAreg800.Implementations.System.Protect.State

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
from .... import repcap


# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
[docs] class StateCls: """State commands group definition. 1 total commands, 0 Subgroups, 1 group commands""" def __init__(self, core: Core, parent): self._core = core self._cmd_group = CommandsGroup("state", core, parent)
[docs] def set(self, state: bool, key: int = None, level=repcap.Level.Default) -> None: """SCPI: SYSTem:PROTect<CH>:[STATe] \n Snippet: driver.system.protect.state.set(state = False, key = 1, level = repcap.Level.Default) \n Activates and deactivates the specified protection level. \n :param state: No help available :param key: No help available :param level: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Protect') """ param = ArgSingleList().compose_cmd_string(ArgSingle('state', state, DataType.Boolean), ArgSingle('key', key, DataType.Integer, None, is_optional=True)) level_cmd_val = self._cmd_group.get_repcap_cmd_value(level, repcap.Level) self._core.io.write(f'SYSTem:PROTect{level_cmd_val}:STATe {param}'.rstrip())
[docs] def get(self, level=repcap.Level.Default) -> bool: """SCPI: SYSTem:PROTect<CH>:[STATe] \n Snippet: value: bool = driver.system.protect.state.get(level = repcap.Level.Default) \n Activates and deactivates the specified protection level. \n :param level: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Protect') :return: state: No help available""" level_cmd_val = self._cmd_group.get_repcap_cmd_value(level, repcap.Level) response = self._core.io.query_str(f'SYSTem:PROTect{level_cmd_val}:STATe?') return Conversions.str_to_bool(response)