hvl_ccb.dev.tiepie.base
- class TiePieDeviceConfig(serial_number: int, require_block_measurement_support: bool = True, n_max_try_get_device: int = 10, wait_sec_retry_get_device: int | float = 1.0, is_data_ready_polling_interval_sec: int | float = 0.01)[source]
Bases:
object
Configuration dataclass for TiePie
- force_value(fieldname, value)
Forces a value to a dataclass field despite the class being frozen.
NOTE: you can define post_force_value method with same signature as this method to do extra processing after value has been forced on fieldname.
- Parameters:
fieldname – name of the field
value – value to assign
- is_configdataclass = True
- is_data_ready_polling_interval_sec: int | float = 0.01
- classmethod keys() Sequence[str]
Returns a list of all configdataclass fields key-names.
- Returns:
a list of strings containing all keys.
- n_max_try_get_device: int = 10
- classmethod optional_defaults() dict[str, object]
Returns a list of all configdataclass fields, that have a default value assigned and may be optionally specified on instantiation.
- Returns:
a list of strings containing all optional keys.
- require_block_measurement_support: bool = True
- classmethod required_keys() Sequence[str]
Returns a list of all configdataclass fields, that have no default value assigned and need to be specified on instantiation.
- Returns:
a list of strings containing all required keys.
- serial_number: int
- wait_sec_retry_get_device: int | float = 1.0
- class TiePieDeviceType(value=<no_arg>, names=None, module=None, qualname=None, type=None, start=1, boundary=None)[source]
Bases:
NameEnum
TiePie device type.
- GENERATOR = 2
- OSCILLOSCOPE = 1
- exception TiePieError[source]
Bases:
DeviceError
Error of the class TiePie
- get_device_by_serial_number(serial_number: int, device_type: str | tuple[int, _LtpDeviceReturnType], n_max_try_get_device: int = 10, wait_sec_retry_get_device: float = 1.0) _LtpDeviceReturnType [source]
Open and return handle of TiePie device with a given serial number
- Parameters:
serial_number – int serial number of the device
device_type – a TiePieDeviceType instance containing device identifier (int number) and its corresponding class, both from libtiepie, or a string name of such instance
n_max_try_get_device – maximal number of device list updates (int number)
wait_sec_retry_get_device – waiting time in seconds between retries (int number)
- Returns:
Instance of a libtiepie device class according to the specified device_type
- Raises:
TiePieError – when there is no device with given serial number
ValueError – when device_type is not an instance of TiePieDeviceType
- wrap_libtiepie_exception(func: Callable) Callable [source]
Decorator wrapper for libtiepie methods that use libtiepie.library.check_last_status_raise_on_error() calls.
- Parameters:
func – Function or method to be wrapped
- Raises:
TiePieError – instead of LibTiePieException or one of its subtypes.
- Returns:
whatever func returns