RuntimeDevice

class caqtus.device.RuntimeDevice(**kwargs)

Bases: Device, ABC

An implementation of the Device class that provides some useful operations.

Class inheriting from RuntimeDevice can use the methods _add_closing_callback and _enter_context to facilitate managing resources.

name

A unique name given to the device. Cannot be changed during the lifetime

Type:

caqtus.device._name.DeviceName

of the device.

Warning

This class is deprecated. Use caqtus.device.Device instead.

abstractmethod initialize() None

Initiate the communication to the device.

This method is meant to be reimplemented for each specific device. The base class implementation registers the device in the list of devices already in use. It must be called when subclassing this class.

Warning

All device classes subclassed from this class should call their parent class initialize method when overwriting it.

close() None

Close the communication to the device and free the resources used.

This method must be called once when use of the device is finished. The base class implementation unwinds the stack of closing callbacks that where registered when it is called. If you only use _enter_context and _add_closing_callback, there is no need to reimplement this method in subclasses.

Warning

All device classes subclassed from this class should call their parent class close method when overwriting it.