from ....Internal.Core import Core
from ....Internal.CommandsGroup import CommandsGroup
from ....Internal import Conversions
from .... import enums
from .... import repcap
# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
class PresetCls:
"""
| Commands in total: 1
| Subgroups: 0
| Direct child commands: 1
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("preset", core, parent)
[docs]
def set(self, thres_preset: enums.BusEthernetThresPreset, bus=repcap.Bus.Default) -> None:
"""
``BUS<*>:ETHernet:PRESet`` \n
Snippet: ``driver.bus.ethernet.preset.set(thres_preset = enums.BusEthernetThresPreset.MANual, bus = repcap.Bus.Default)`` \n
Sets the thresholds to predefined or individually definable voltage levels.
:param thres_preset: T0 | T100 | TX0 | TX100 | MANual \n
- T0: Sets the thresholds to the default values for 10BASE-T (0 meters) : upper threshold to 1.25 V, lower threshold to -1.25 V
- T100: Sets the thresholds to the default values for 10BASE-T (100 meters) : upper threshold to 0.75 V, lower threshold to -0.75 V
- TX0: Sets the thresholds to the default values for 100BASE-TX (0 meters) : upper threshold to 0.5 V, lower threshold to -0.5 V
- TX100: Sets the thresholds to the default values for 100BASE-TX (100 meters) : upper threshold to 0.35 V, lower threshold to -0.35 V
- MANual: Allows to set individual threshold voltage levels
:param bus: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Bus')
"""
param = Conversions.enum_scalar_to_str(thres_preset, enums.BusEthernetThresPreset)
bus_cmd_val = self._cmd_group.get_repcap_cmd_value(bus, repcap.Bus)
self._core.io.write(f'BUS{bus_cmd_val}:ETHernet:PRESet {param}')
# noinspection PyTypeChecker
[docs]
def get(self, bus=repcap.Bus.Default) -> enums.BusEthernetThresPreset:
"""
``BUS<*>:ETHernet:PRESet`` \n
Snippet: ``value: enums.BusEthernetThresPreset = driver.bus.ethernet.preset.get(bus = repcap.Bus.Default)`` \n
Sets the thresholds to predefined or individually definable voltage levels.
:param bus: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Bus')
:return: thres_preset: T0 | T100 | TX0 | TX100 | MANual \n
- T0: Sets the thresholds to the default values for 10BASE-T (0 meters) : upper threshold to 1.25 V, lower threshold to -1.25 V
- T100: Sets the thresholds to the default values for 10BASE-T (100 meters) : upper threshold to 0.75 V, lower threshold to -0.75 V
- TX0: Sets the thresholds to the default values for 100BASE-TX (0 meters) : upper threshold to 0.5 V, lower threshold to -0.5 V
- TX100: Sets the thresholds to the default values for 100BASE-TX (100 meters) : upper threshold to 0.35 V, lower threshold to -0.35 V
- MANual: Allows to set individual threshold voltage levels
"""
bus_cmd_val = self._cmd_group.get_repcap_cmd_value(bus, repcap.Bus)
response = self._core.io.query_str(f'BUS{bus_cmd_val}:ETHernet:PRESet?')
return Conversions.str_to_scalar_enum(response, enums.BusEthernetThresPreset)