hvl_ccb.dev.visa
- class VisaDevice(com: VisaCommunication | VisaCommunicationConfig | dict, dev_config: VisaDeviceConfig | dict | None = None)[source]
Bases:
SingleCommDevice
Device communicating over the VISA protocol using VisaCommunication.
- static config_cls()[source]
Return the default configdataclass class.
- Returns:
a reference to the default configdataclass class
- static default_com_cls() type[VisaCommunication] [source]
Return the default communication protocol for this device type, which is VisaCommunication.
- Returns:
the VisaCommunication class
- get_identification() str [source]
Queries “*IDN?” and returns the identification string of the connected device.
- Returns:
the identification string of the connected device
- spoll_handler()[source]
Reads the status byte and decodes it. The status byte STB is defined in IEEE 488.2. It provides a rough overview of the instrument status.
- Returns:
- stop() None [source]
Stop the VisaDevice. Stops the polling thread and closes the communication protocol.
- Returns:
- wait_operation_complete(timeout: float | None = None) bool [source]
Waits for a operation complete event. Returns after timeout [s] has expired or the operation complete event has been caught.
- Parameters:
timeout – Time in seconds to wait for the event; None for no timeout.
- Returns:
True, if OPC event is caught, False if timeout expired
- class VisaDeviceConfig(spoll_interval: int | float = 0.5, spoll_start_delay: int | float = 2)[source]
Bases:
_VisaDeviceConfigDefaultsBase
,_VisaDeviceConfigBase
Configdataclass for a VISA device.
- 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
- classmethod keys() Sequence[str]
Returns a list of all configdataclass fields key-names.
- Returns:
a list of strings containing all keys.
- 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.
- 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.