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, assigned_this_bus: bool, bus=repcap.Bus.Default, bitNull=repcap.BitNull.Default) -> None:
"""
``BUS<*>:PARallel:BIT<*>[:STATe]`` \n
Snippet: ``driver.bus.parallel.bit.state.set(assigned_this_bus = False, bus = repcap.Bus.Default, bitNull = repcap.BitNull.Default)`` \n
Assigns the selected digital channel to the indicated bus, displays it, and enables the bus if the bus was disabled. That
is, method ``RsRtx.bus.parallel.display.shdi.set()`` and method ``RsRtx.bus.parallel.state.set()`` are set to ON
automatically. If another active bus already uses the selected digital channel, the instrument disables the other bus to
avoid conflicts. For parallel bus 1, the method ``RsRtx.bus.parallel.bit.state.set()`` command has the same effect as
method ``RsRtx.digital.display.set()`` .
:param assigned_this_bus: OFF | ON
:param bus: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Bus')
:param bitNull: optional repeated capability selector. Default value: Nr0 (settable in the interface 'Bit')
"""
param = Conversions.bool_to_str(assigned_this_bus)
bus_cmd_val = self._cmd_group.get_repcap_cmd_value(bus, repcap.Bus)
bitNull_cmd_val = self._cmd_group.get_repcap_cmd_value(bitNull, repcap.BitNull)
self._core.io.write(f'BUS{bus_cmd_val}:PARallel:BIT{bitNull_cmd_val}:STATe {param}')
[docs]
def get(self, bus=repcap.Bus.Default, bitNull=repcap.BitNull.Default) -> bool:
"""
``BUS<*>:PARallel:BIT<*>[:STATe]`` \n
Snippet: ``value: bool = driver.bus.parallel.bit.state.get(bus = repcap.Bus.Default, bitNull = repcap.BitNull.Default)`` \n
Assigns the selected digital channel to the indicated bus, displays it, and enables the bus if the bus was disabled. That
is, method ``RsRtx.bus.parallel.display.shdi.set()`` and method ``RsRtx.bus.parallel.state.set()`` are set to ON
automatically. If another active bus already uses the selected digital channel, the instrument disables the other bus to
avoid conflicts. For parallel bus 1, the method ``RsRtx.bus.parallel.bit.state.set()`` command has the same effect as
method ``RsRtx.digital.display.set()`` .
:param bus: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Bus')
:param bitNull: optional repeated capability selector. Default value: Nr0 (settable in the interface 'Bit')
"""
bus_cmd_val = self._cmd_group.get_repcap_cmd_value(bus, repcap.Bus)
bitNull_cmd_val = self._cmd_group.get_repcap_cmd_value(bitNull, repcap.BitNull)
response = self._core.io.query_str(f'BUS{bus_cmd_val}:PARallel:BIT{bitNull_cmd_val}:STATe?')
return Conversions.str_to_bool(response)