from ....Internal.Core import Core
from ....Internal.CommandsGroup import CommandsGroup
from ....Internal import Conversions
from .... import repcap
# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
class PatternCls:
"""
| Commands in total: 1
| Subgroups: 0
| Direct child commands: 1
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("pattern", core, parent)
[docs]
def set(self, pattern: int, trigger=repcap.Trigger.Default) -> None:
"""
``TRIGger<*>:SPATtern:PATTern`` \n
Snippet: ``driver.trigger.spattern.pattern.set(pattern = 1, trigger = repcap.Trigger.Default)`` \n
The pattern contains the bits of the serial data to be found in the data stream. The maximum length of the pattern is 128
bit.
:param pattern: Numeric or string pattern, see 'Bit pattern parameter'. The string parameter accepts the bit value X (don't care) .
:param trigger: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Trigger')
"""
param = Conversions.decimal_value_to_str(pattern)
trigger_cmd_val = self._cmd_group.get_repcap_cmd_value(trigger, repcap.Trigger)
self._core.io.write_with_opc(f'TRIGger{trigger_cmd_val}:SPATtern:PATTern {param}')
[docs]
def get(self, trigger=repcap.Trigger.Default) -> int:
"""
``TRIGger<*>:SPATtern:PATTern`` \n
Snippet: ``value: int = driver.trigger.spattern.pattern.get(trigger = repcap.Trigger.Default)`` \n
The pattern contains the bits of the serial data to be found in the data stream. The maximum length of the pattern is 128
bit.
:param trigger: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Trigger')
:return: pattern: Numeric or string pattern, see 'Bit pattern parameter'. The string parameter accepts the bit value X (don't care) .
"""
trigger_cmd_val = self._cmd_group.get_repcap_cmd_value(trigger, repcap.Trigger)
response = self._core.io.query_str_with_opc(f'TRIGger{trigger_cmd_val}:SPATtern:PATTern?')
return Conversions.str_to_int(response)