Base Classes
- class lys_instr.Interfaces.HardwareInterface(interval=0.1, **kwargs)[source]
Bases:
QThreadAbstract 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.Subclasses must implement
_loadState()to provide device-specific behavior.- kill()[source]
Stop the monitoring thread for this device instance.
This method sets the internal stop flag under the mutex so the running thread will exit its loop and terminate cleanly.
- lys_instr.Interfaces.lock(func)[source]
Decorator to ensure thread-safe execution of a method using a QMutex.
This decorator acquires the instance’s
_mutexbefore 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