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 TypePyCls:
"""
| Commands in total: 1
| Subgroups: 0
| Direct child commands: 1
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("typePy", core, parent)
[docs]
def set(self, type_py: enums.BusType, bus=repcap.Bus.Default) -> None:
"""
``BUS<*>:TYPE`` \n
Snippet: ``driver.bus.typePy.set(type_py = enums.BusType.ARIN429, bus = repcap.Bus.Default)`` \n
Defines the bus or protocol type for analysis. The type of available buses depends on the installed options.
:param type_py: MILS1553 = MILStd1553: specification MIL-STD-1553 ARIN429 = ARINc429: specification ARINC 429 HBTO: Ethernet 100BASE-T1 TBTO: Ethernet 1000BASE-T1 TNOS: automotive Ethernet 10BASE-T1S CMSB: custom decode serial bus EBTB: 8b/10b general decoding SWIRe: SpaceWire
:param bus: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Bus')
"""
param = Conversions.enum_scalar_to_str(type_py, enums.BusType)
bus_cmd_val = self._cmd_group.get_repcap_cmd_value(bus, repcap.Bus)
self._core.io.write_with_opc(f'BUS{bus_cmd_val}:TYPE {param}')
# noinspection PyTypeChecker
[docs]
def get(self, bus=repcap.Bus.Default) -> enums.BusType:
"""
``BUS<*>:TYPE`` \n
Snippet: ``value: enums.BusType = driver.bus.typePy.get(bus = repcap.Bus.Default)`` \n
Defines the bus or protocol type for analysis. The type of available buses depends on the installed options.
:param bus: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Bus')
:return: type_py: MILS1553 = MILStd1553: specification MIL-STD-1553 ARIN429 = ARINc429: specification ARINC 429 HBTO: Ethernet 100BASE-T1 TBTO: Ethernet 1000BASE-T1 TNOS: automotive Ethernet 10BASE-T1S CMSB: custom decode serial bus EBTB: 8b/10b general decoding SWIRe: SpaceWire
"""
bus_cmd_val = self._cmd_group.get_repcap_cmd_value(bus, repcap.Bus)
response = self._core.io.query_str_with_opc(f'BUS{bus_cmd_val}:TYPE?')
return Conversions.str_to_scalar_enum(response, enums.BusType)