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
# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
class SpecCls:
"""
| Commands in total: 1
| Subgroups: 0
| Direct child commands: 1
"""
def __init__(self, core: Core, parent):
self._core = core
self._cmd_group = CommandsGroup("spec", core, parent)
[docs]
def set(self, search: str, usb_special_type: enums.BusUsbSpecialType) -> None:
"""
``SEARch:TRIGger:USB:SPEC`` \n
Snippet: ``driver.search.trigger.usb.spec.set(search = 'abc', usb_special_type = enums.BusUsbSpecialType.ANY)`` \n
Defines, which special PID packet type is searched for: PREamble, ERR, SPLit, PING, or Any special PID packet.
:param usb_special_type: ANY | PREamble | ERR | SPLit | PING \n
- ANY: Searches for any of the special PID packet types listed below
- PREamble: Searches for any host-issued preamble token (enables downstream bus traffic to low speed USB devices)
- ERR: Searches for any SPLIT transaction error handshake token (re-uses PRE value)
- SPLit: Searches for any high speed SPLIT transaction token
- PING: Searches for any high speed flow control probe for a bulk/control endpoint
"""
param = ArgSingleList().compose_cmd_string(ArgSingle('search', search, DataType.String), ArgSingle('usb_special_type', usb_special_type, DataType.Enum, enums.BusUsbSpecialType))
self._core.io.write(f'SEARch:TRIGger:USB:SPEC {param}'.rstrip())
# noinspection PyTypeChecker
[docs]
def get(self, search: str) -> enums.BusUsbSpecialType:
"""
``SEARch:TRIGger:USB:SPEC`` \n
Snippet: ``value: enums.BusUsbSpecialType = driver.search.trigger.usb.spec.get(search = 'abc')`` \n
Defines, which special PID packet type is searched for: PREamble, ERR, SPLit, PING, or Any special PID packet.
:return: usb_special_type: ANY | PREamble | ERR | SPLit | PING \n
- ANY: Searches for any of the special PID packet types listed below
- PREamble: Searches for any host-issued preamble token (enables downstream bus traffic to low speed USB devices)
- ERR: Searches for any SPLIT transaction error handshake token (re-uses PRE value)
- SPLit: Searches for any high speed SPLIT transaction token
- PING: Searches for any high speed flow control probe for a bulk/control endpoint
"""
param = Conversions.value_to_quoted_str(search)
response = self._core.io.query_str(f'SEARch:TRIGger:USB:SPEC? {param}')
return Conversions.str_to_scalar_enum(response, enums.BusUsbSpecialType)