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 enums
from ....... import repcap
# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
class BitCls:
"""
| Commands in total: 1
| Subgroups: 0
| Direct child commands: 1
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("bit", core, parent)
[docs]
def set(self, search: str, bit_state: enums.BusBitCondition, busFrameNull=repcap.BusFrameNull.Default, busFieldNull=repcap.BusFieldNull.Default) -> None:
"""
``SEARch:TRIGger:USBPd:FRAMe<*>:FLD<*>:BIT`` \n
Snippet: ``driver.search.trigger.usbPd.frame.fld.bit.set(search = 'abc', bit_state = enums.BusBitCondition.DC, busFrameNull = repcap.BusFrameNull.Default, busFieldNull = repcap.BusFieldNull.Default)`` \n
Sets the bit state of a field to be searched that only consists of one bit.
:param search: String with the name of the search.
:param bit_state: ONE | ZERO | DC \n
- ONE: 1
- ZERO: 0
- DC: 'Don't care' = X
:param busFrameNull: optional repeated capability selector. Default value: Nr0 (settable in the interface 'Frame')
:param busFieldNull: optional repeated capability selector. Default value: Nr0 (settable in the interface 'Fld')
"""
param = ArgSingleList().compose_cmd_string(ArgSingle('search', search, DataType.String), ArgSingle('bit_state', bit_state, DataType.Enum, enums.BusBitCondition))
busFrameNull_cmd_val = self._cmd_group.get_repcap_cmd_value(busFrameNull, repcap.BusFrameNull)
busFieldNull_cmd_val = self._cmd_group.get_repcap_cmd_value(busFieldNull, repcap.BusFieldNull)
self._core.io.write(f'SEARch:TRIGger:USBPd:FRAMe{busFrameNull_cmd_val}:FLD{busFieldNull_cmd_val}:BIT {param}'.rstrip())
# noinspection PyTypeChecker
[docs]
def get(self, search: str, busFrameNull=repcap.BusFrameNull.Default, busFieldNull=repcap.BusFieldNull.Default) -> enums.BusBitCondition:
"""
``SEARch:TRIGger:USBPd:FRAMe<*>:FLD<*>:BIT`` \n
Snippet: ``value: enums.BusBitCondition = driver.search.trigger.usbPd.frame.fld.bit.get(search = 'abc', busFrameNull = repcap.BusFrameNull.Default, busFieldNull = repcap.BusFieldNull.Default)`` \n
Sets the bit state of a field to be searched that only consists of one bit.
:param search: String with the name of the search.
:param busFrameNull: optional repeated capability selector. Default value: Nr0 (settable in the interface 'Frame')
:param busFieldNull: optional repeated capability selector. Default value: Nr0 (settable in the interface 'Fld')
:return: bit_state: ONE | ZERO | DC \n
- ONE: 1
- ZERO: 0
- DC: 'Don't care' = X
"""
param = Conversions.value_to_quoted_str(search)
busFrameNull_cmd_val = self._cmd_group.get_repcap_cmd_value(busFrameNull, repcap.BusFrameNull)
busFieldNull_cmd_val = self._cmd_group.get_repcap_cmd_value(busFieldNull, repcap.BusFieldNull)
response = self._core.io.query_str(f'SEARch:TRIGger:USBPd:FRAMe{busFrameNull_cmd_val}:FLD{busFieldNull_cmd_val}:BIT? {param}')
return Conversions.str_to_scalar_enum(response, enums.BusBitCondition)