Base Classes
- class lys_instr.Interfaces.HardwareInterface(interval=0.1, **kwargs)[source]
Bases:
QThread
Abstract base class for hardware interfaces with background monitoring.
This class provides background thread management and a standard structure for device state monitoring. Each subclass represents a hardware device and runs its own monitoring thread. The thread periodically calls
_loadState()
to poll and update device-specific state information. The monitoring thread can be stopped by calling the instance’skill()
method, or all threads can be stopped using thekillAll()
class method._loadState()
must be implemented in subclasses to provide device-specific behavior.- Parameters:
interval (float, optional) – Time interval (in seconds) between successive state polls. Default is 0.1.
**kwargs – Additional keyword arguments passed to
QtCore.QThread
.
- lys_instr.Interfaces.lock(func)[source]
Decorator to ensure thread-safe execution of a method using a QMutex.
Acquires the instance’s
_mutex
before executing the decorated method, ensuring that only one thread can execute the method at a time.- Parameters:
func (callable) – The method to be decorated.
- Returns:
The wrapped method with mutex locking.
- Return type:
callable