from ....Internal.Core import Core
from ....Internal.CommandsGroup import CommandsGroup
from ....Internal import Conversions
from .... import repcap
# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
class ValueCls:
"""
| Commands in total: 1
| Subgroups: 0
| Direct child commands: 1
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("value", core, parent)
[docs]
def set(self, level: float, trigger=repcap.Trigger.Default, triggerLevel=repcap.TriggerLevel.Default) -> None:
"""
``TRIGger<*>:LEVel<*>[:VALue]`` \n
Snippet: ``driver.trigger.level.value.set(level = 1.0, trigger = repcap.Trigger.Default, triggerLevel = repcap.TriggerLevel.Default)`` \n
Sets the trigger level for the specified event and source. If the trigger source is serial bus, the trigger level is set
by the thresholds in the protocol configuration.
:param level: Voltage for the trigger level.
:param trigger: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Trigger')
:param triggerLevel: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Level')
"""
param = Conversions.decimal_value_to_str(level)
trigger_cmd_val = self._cmd_group.get_repcap_cmd_value(trigger, repcap.Trigger)
triggerLevel_cmd_val = self._cmd_group.get_repcap_cmd_value(triggerLevel, repcap.TriggerLevel)
self._core.io.write_with_opc(f'TRIGger{trigger_cmd_val}:LEVel{triggerLevel_cmd_val}:VALue {param}')
[docs]
def get(self, trigger=repcap.Trigger.Default, triggerLevel=repcap.TriggerLevel.Default) -> float:
"""
``TRIGger<*>:LEVel<*>[:VALue]`` \n
Snippet: ``value: float = driver.trigger.level.value.get(trigger = repcap.Trigger.Default, triggerLevel = repcap.TriggerLevel.Default)`` \n
Sets the trigger level for the specified event and source. If the trigger source is serial bus, the trigger level is set
by the thresholds in the protocol configuration.
:param trigger: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Trigger')
:param triggerLevel: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Level')
:return: level: Voltage for the trigger level.
"""
trigger_cmd_val = self._cmd_group.get_repcap_cmd_value(trigger, repcap.Trigger)
triggerLevel_cmd_val = self._cmd_group.get_repcap_cmd_value(triggerLevel, repcap.TriggerLevel)
response = self._core.io.query_str_with_opc(f'TRIGger{trigger_cmd_val}:LEVel{triggerLevel_cmd_val}:VALue?')
return Conversions.str_to_float(response)