QFakeInstrument#

class QInstrument.lib.QFakeInstrument.QFakeInstrument(*args, **kwargs)[source]#

Bases: QAbstractInstrument

Base class for fake instruments used in UI development without hardware.

Provides an in-memory property store and a _register() override so that a concrete fake can be derived from both QFakeInstrument and a real instrument class with minimal boilerplate:

class QFakeDS345(QFakeInstrument, QDS345):
    pass

MRO resolution ensures that _register() here is called instead of the real instrument’s version, wiring every standard property to _store rather than to the serial port. __init__() initializes _store, then calls QAbstractInstrument.__init__ directly, bypassing QSerialInstrument so no serial port is created. QAbstractInstrument.__init__ calls _registerProperties() and _registerMethods() automatically.

Properties whose getters cannot be expressed through _register() (non-standard response formats, internal state) must be re-registered by the concrete fake after calling super()._registerProperties(). registerProperty() overwrites any previous registration for the same name, so this is safe.

Subclasses that do not inherit a real instrument class may define their own __init__, call super().__init__(), and then register properties directly via registerProperty().

transmit(data)[source]#

No-op: fake instruments have no transport layer.

Return type:

None

receive(**kwargs)[source]#

No-op: fake instruments have no transport layer.

Return type:

str

isOpen()[source]#

Return True: fake instruments are always available.

Return type:

bool