nexxT.interface.Ports module
This module defines the Port, InputPort and OutputPort interface classes of the nexxT framework.
- nexxT.interface.Ports.InputPort(dynamic, name, environment, queueSizeSamples=1, queueSizeSeconds=None)[source]
Factory function to creates an InputPortInterface instance with an actual implementation attached. Will be dynamically implemented by the nexxT framework. This is done to prevent having implementation details in the class.
Note
Import this function with
from nexxT.interface import InputPort.- Parameters:
dynamic – boolean whether this is a dynamic input port
name – the name of the port
environment – the FilterEnvironment instance
queueSizeSamples – the size of the queue in samples
queueSizeSeconds – the size of the queue in seconds
- Returns:
an InputPortInterface instance (actually an InputPortImpl instance)
- class nexxT.interface.Ports.InputPortInterface(dynamic, name, environment)[source]
Bases:
PortThis abstract class defines the interface of an input port of a filter. In addition to the normal port attributes, there are two new attributes related to automatic buffering of input data samples. queueSizeSamples sets the maximum number of samples buffered (it can be None, if queueSizeSeconds is not None) queueSizeSeconds sets the maximum time of samples buffered (it can be None, if queueSizeSamples is not None) If both attributes are set, they are and-combined.
- ..note::
Usually nexxT is using a wrapped C++ class instead of this pure python version. In python there are no differences between the wrapped C++ class and this python class. The C++ interface is defined in
nexxT::InputPortInterface
- clone(newEnvironment)[source]
Return a copy of this port attached to a new environment.
- Parameters:
newEnvironment – the new FilterEnvironment instance
- Returns:
a new Port instance
- getData(delaySamples=0, delaySeconds=None)[source]
Return a data sample stored in the queue (called by the filter).
- Parameters:
delaySamples – 0 related the most actual sample, numbers > 0 relates to historic samples (None can be given if delaySeconds is not None)
delaySeconds – if not None, a delay of 0.0 is related to the current sample, positive numbers are related to historic samples (TODO specify the exact semantics of delaySeconds)
- Returns:
DataSample instance
- receiveAsync(dataSample, semaphore)[source]
Called from framework only and implements the asynchronous receive mechanism using a semaphore.
- Parameters:
dataSample – the transmitted DataSample instance
semaphore – a QSemaphore instance
- Returns:
None
- receiveSync(dataSample)[source]
Called from framework only and implements the synchronous receive mechanism. TODO implement
- Parameters:
dataSample – the transmitted DataSample instance
- Returns:
None
- setInterthreadDynamicQueue(enabled)[source]
If enabled is True, inter thread connections to this input port are dynamically queued for non-blocking behaviour.
This setting does not affect connections from within the same thread. This method can be called only during constructor or the onInit() method of a filter. The main use case is a recording filter where the QT signal/slot is allowed to buffer as many samples as allowed in the input port’s queue to prevent unwanted blocking behaviour.
Enabling this might cause a larger delay and might also consume a lot of memory.
- Parameters:
enabled – whether the dynamic queuing feature is enabled or not.
- Returns:
- setQueueSize(queueSizeSamples, queueSizeSeconds)[source]
Set the queue size of this port.
- Parameters:
queueSizeSamples – 0 related the most actual sample, numbers > 0 relates to historic samples (None can be given if delaySeconds is not None)
queueSizeSeconds – if not None, a delay of 0.0 is related to the current sample, positive numbers are related to historic samples
- Returns:
- staticMetaObject = PySide6.QtCore.QMetaObject("InputPortInterface" inherits "Port": )
- nexxT.interface.Ports.OutputPort(dynamic, name, environment)[source]
Note
Import this function with
from nexxT.interface import OutputPort.Factory function to create an OutputPort instance with an actual implementation attached. Will be dynamically implemented by the nexxT framework. This is done to prevent having implementation details in the class
- Parameters:
dynamic – boolean whether this is a dynamic input port
name – the name of the port
environment – the FilterEnvironment instance
- Returns:
an OutputPortInterface instance (actually an OutputPortImpl instance)
- class nexxT.interface.Ports.OutputPortInterface(dynamic, name, environment)[source]
Bases:
PortThis abstract base class defines the interface of an output port of a filter.
- ..note::
Usually nexxT is using a wrapped C++ class instead of this pure python version. In python there are no differences between the wrapped C++ class and this python class. The C++ interface is defined in
nexxT::OutputPortInterface
- clone(newEnvironment)[source]
Return a copy of this port attached to a new environment.
- Parameters:
newEnvironment – the new FilterEnvironment instance
- Returns:
a new Port instance
- setupDirectConnection(inputPort)
Setup a direct (intra-thread) connection between outputPort and inputPort Note: both instances must live in same thread!
- Parameters:
outputPort – the output port instance to be connected
inputPort – the input port instance to be connected
- Returns:
None
- setupInterThreadConnection(inputPort, outputPortThread, width)
Setup an inter thread connection between outputPort and inputPort
- Parameters:
outputPort – the output port instance to be connected
inputPort – the input port instance to be connected
outputPortThread – the QThread instance of the outputPort instance
width – the width of the connection in DataSamples (0: infinite)
- Returns:
an InterThreadConnection instance which manages the connection (has to survive until connections is deleted)
- staticMetaObject = PySide6.QtCore.QMetaObject("OutputPortInterface" inherits "Port": Methods: #4 type=Signal, signature=transmitSample(PyObject), parameters=PyObject )
- transmit(dataSample)[source]
transmit a data sample over this port
- Parameters:
dataSample – sample to transmit
- transmitSample
- class nexxT.interface.Ports.Port(dynamic, name, environment)[source]
Bases:
QObjectThis class is the base class for ports. It is used mainly as structure, containing the 3 properties dynamic (boolean), name (str) and environment (a FilterEnvironment instance).
- ..note::
Usually nexxT is using a wrapped C++ class instead of this pure python version. In python there are no differences between the wrapped C++ class and this python class. The C++ interface is defined in
nexxT::Port
- INPUT_PORT = 0
- OUTPUT_PORT = 1
- __init__(dynamic, name, environment)[source]
Constructor.
- Parameters:
dynamic – boolean whether this is a dynamic port or not
name – the port name, given as a string
environment – the corresponding FilterEnvironment instance
- clone(newEnvironment)[source]
This function must be overwritten in inherited classes to create a clone of this port attached to a different environment.
- Parameters:
newEnvironment – the new FilterEnvironment instance
- Returns:
a new Port instance
- environment()[source]
Returns the environment instance managing this port
- Returns:
FilterEnvironment instance
- setName(name)[source]
Sets the port name
- Parameters:
name – the port name given as a string
- Returns:
None
- staticMetaObject = PySide6.QtCore.QMetaObject("Port" inherits "QObject": )