Source code for rsrtx.Implementations.Search.Trigger.Usb.Data

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 DataCls:
	"""
	| Commands in total: 1
	| Subgroups: 0
	| Direct child commands: 1
	"""

	def __init__(self, core: Core, parent):
		self._core = core
		self._cmd_group = CommandsGroup("data", core, parent)

[docs] def set(self, search: str, usb_data_type: enums.BusUsbDataType) -> None: """ ``SEARch:TRIGger:USB:DATA`` \n Snippet: ``driver.search.trigger.usb.data.set(search = 'abc', usb_data_type = enums.BusUsbDataType.ANY)`` \n Defines, which data packet type is searched for: DATA0, DATA1, DATA2, or MDATA, as well as Any data packet. :param usb_data_type: ANY | D0 | D1 | D2 | MD \n - ANY: Searches for any of the data packet types listed below - D0: Searches for a DATA0 packet (even PID) - D1: Searches for a DATA1 packet (odd PID) - D2: Searches for a DATA2 packet (high-speed data packet for high bandwidth isochronous transaction in a microframe) - MD: Searches for an MDATA packet (high-speed data packet for split and high bandwidth isochronous transactions) """ param = ArgSingleList().compose_cmd_string(ArgSingle('search', search, DataType.String), ArgSingle('usb_data_type', usb_data_type, DataType.Enum, enums.BusUsbDataType)) self._core.io.write(f'SEARch:TRIGger:USB:DATA {param}'.rstrip())
# noinspection PyTypeChecker
[docs] def get(self, search: str) -> enums.BusUsbDataType: """ ``SEARch:TRIGger:USB:DATA`` \n Snippet: ``value: enums.BusUsbDataType = driver.search.trigger.usb.data.get(search = 'abc')`` \n Defines, which data packet type is searched for: DATA0, DATA1, DATA2, or MDATA, as well as Any data packet. :return: usb_data_type: ANY | D0 | D1 | D2 | MD \n - ANY: Searches for any of the data packet types listed below - D0: Searches for a DATA0 packet (even PID) - D1: Searches for a DATA1 packet (odd PID) - D2: Searches for a DATA2 packet (high-speed data packet for high bandwidth isochronous transaction in a microframe) - MD: Searches for an MDATA packet (high-speed data packet for split and high bandwidth isochronous transactions) """ param = Conversions.value_to_quoted_str(search) response = self._core.io.query_str(f'SEARch:TRIGger:USB:DATA? {param}') return Conversions.str_to_scalar_enum(response, enums.BusUsbDataType)