from .....Internal.Core import Core
from .....Internal.CommandsGroup import CommandsGroup
from .....Internal import Conversions
from ..... import repcap
# 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, is_enabled: bool, lane=repcap.Lane.Default, component=repcap.Component.Default) -> None:
"""
``LANE<*>:EMBedding:COMPonent<*>[:STATe]`` \n
Snippet: ``driver.lane.embedding.component.state.set(is_enabled = False, lane = repcap.Lane.Default, component = repcap.Component.Default)`` \n
Enables or disables the indicated component for embedding. The first and the last component are always enabled and cannot
be disabled.
:param is_enabled: OFF | ON
:param lane: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Lane')
:param component: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Component')
"""
param = Conversions.bool_to_str(is_enabled)
lane_cmd_val = self._cmd_group.get_repcap_cmd_value(lane, repcap.Lane)
component_cmd_val = self._cmd_group.get_repcap_cmd_value(component, repcap.Component)
self._core.io.write_with_opc(f'LANE{lane_cmd_val}:EMBedding:COMPonent{component_cmd_val}:STATe {param}')
[docs]
def get(self, lane=repcap.Lane.Default, component=repcap.Component.Default) -> bool:
"""
``LANE<*>:EMBedding:COMPonent<*>[:STATe]`` \n
Snippet: ``value: bool = driver.lane.embedding.component.state.get(lane = repcap.Lane.Default, component = repcap.Component.Default)`` \n
Enables or disables the indicated component for embedding. The first and the last component are always enabled and cannot
be disabled.
:param lane: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Lane')
:param component: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Component')
:return: is_enabled: OFF | ON
"""
lane_cmd_val = self._cmd_group.get_repcap_cmd_value(lane, repcap.Lane)
component_cmd_val = self._cmd_group.get_repcap_cmd_value(component, repcap.Component)
response = self._core.io.query_str_with_opc(f'LANE{lane_cmd_val}:EMBedding:COMPonent{component_cmd_val}:STATe?')
return Conversions.str_to_bool(response)