Provides the global 'filter' object within scripts.
More...
|
void | connected () |
| Emited after all Pins have been connected.
|
|
void | propertiesChanged () |
|
void | propertyChanged (const QString &strName, const QVariant &oValue) |
| Emited for each property change. More...
|
|
|
Q_INVOKABLE QObject * | createInputPin (const QString &strName, bool bForwardTriggerViaOutputPins=true) |
| Creates a new Input Pin. More...
|
|
Q_INVOKABLE QObject * | createOutputPin (const QString &strName, const QJSValue &oStreamType=QJSValue()) |
| Creates a new Output Pin. More...
|
|
Q_INVOKABLE QObject * | createRunner (const QString &strName, bool bForwardTriggerViaOutputPins=true) |
| Creates a new Runner. More...
|
|
Q_INVOKABLE QObject * | createInterfaceClient (const QString &strName, const QString &strInterface) |
| Create a new interface client. More...
|
|
Q_INVOKABLE void | linkTrigger (const QString &strSource, const QString &strDestination) |
| Creates an internal Trigger Pipe between two Runners. More...
|
|
Q_INVOKABLE QVariant | getProperty (const QString &strName) |
|
Q_INVOKABLE void | setProperty (const QString &strName, const QVariant &oValue, const QString &strType="") |
|
void | enablePropertyValueOverride () |
|
Provides the global 'filter' object within scripts.
Definition at line 48 of file javascriptfiltersdk/src/filter.h.
◆ createInputPin()
Q_INVOKABLE QObject* createInputPin |
( |
const QString & |
strName, |
|
|
bool |
bForwardTriggerViaOutputPins = true |
|
) |
| |
Creates a new Input Pin.
Example Usage
var input = filter.createInputPin("input")
input.sample.connect(function(sample)
{
console.info("sample with timestamp " + sample.timestamp)
})
- Parameters
-
[in] | strName | The name of the Pin. |
[in] | bForwardTriggerViaOutputPins | If true, triggers will be forwarded via all output pins after all callbacks have been called. |
- Returns
- an instance of cScriptReader.
◆ createInterfaceClient()
Q_INVOKABLE QObject* createInterfaceClient |
( |
const QString & |
strName, |
|
|
const QString & |
strInterface |
|
) |
| |
Create a new interface client.
Example Usage
var recorder = filter.createInterfaceClient("recorder_control", "recorder")
var input = filter.createInputPin("input")
input.sample.connect(function(sample)
{
if (sample.data.value > 10)
{
recorder.start()
}
})
filter.connected.connect(function()
{
if (!recorder.connected)
{
throw "This script requires a connected recorder"
}
})
- Parameters
-
[in] | strName | The name of the Interface Binding Pin. |
[in] | strInterface | The type of the interface. Currently supported are:
|
- Returns
- an instance of an interface client.
◆ createOutputPin()
Q_INVOKABLE QObject* createOutputPin |
( |
const QString & |
strName, |
|
|
const QJSValue & |
oStreamType = QJSValue() |
|
) |
| |
Creates a new Output Pin.
Example Usage
var outputType = types.createDefinition("my_data")
.add("value1", "tUInt32")
.add("value2", "tFloat32")
var output = filter.createOutputPin("output", outputType)
var runner = filter.createRunner("generate_data")
var counter = 0
runner.trigger.connect(function(timestamp)
{
output.write(timestamp, {value1: counter, value2: counter})
++counter
})
- Parameters
-
- Returns
- an instance of cScriptWriter.
◆ createRunner()
Q_INVOKABLE QObject* createRunner |
( |
const QString & |
strName, |
|
|
bool |
bForwardTriggerViaOutputPins = true |
|
) |
| |
Creates a new Runner.
Example Usage
var runner = filter.createRunner("print_trigger_timestamp")
runner.trigger.connect(function(timestamp)
{
console.info("trigger at " + timestamp)
})
- Parameters
-
[in] | strName | The name of the Runner. |
[in] | bForwardTriggerViaOutputPins | If true, triggers will be forwarded via all output pins after all callbacks have been called. |
- Returns
- an instance of cScriptRunner.
◆ getProperty()
Q_INVOKABLE QVariant getProperty |
( |
const QString & |
strName | ) |
|
Example Usage
var myValue = filter.getProperty("my_property")
console.info("myValue = " + myValue)
- Parameters
-
[in] | strName | The name of the property. |
- Returns
- The value of a Property. Null if no such Property exists.
◆ linkTrigger()
Q_INVOKABLE void linkTrigger |
( |
const QString & |
strSource, |
|
|
const QString & |
strDestination |
|
) |
| |
Creates an internal Trigger Pipe between two Runners.
- Parameters
-
[in] | strSource | The name of the first Runner. |
[in] | strDestination | The name of the second Runner. |
◆ propertyChanged
void propertyChanged |
( |
const QString & |
strName, |
|
|
const QVariant & |
oValue |
|
) |
| |
|
signal |
Emited for each property change.
Example Usage
filter.setProperty("my_property", "default");
// Properties will be set during the filter initialisation
filter.propertyChanged.connect(function(name, value)
{
console.log("Changed: " + name + " " + value);
})
◆ setProperty()
Q_INVOKABLE void setProperty |
( |
const QString & |
strName, |
|
|
const QVariant & |
oValue, |
|
|
const QString & |
strType = "" |
|
) |
| |
Example Usage
filter.setProperty("my_property", "default");
// Properties will be set during the filter initialisation
filter.propertyChanged.connect(function(name, value)
{
console.log("Changed: " + name + " " + value);
})
- Parameters
-
[in] | strName | The name of the property. |
[in] | oValue | The value of the property. |
[in] | strType | Of the property. |
◆ properties
QQmlPropertyMap* properties |
|
read |
Example Usage
import QtQuick 2.9
import QtQuick.Layouts 1.3
import QtQuick.Controls 2.0
Item
{
anchors.fill: parent
Component.onCompleted:
{
filter.setProperty("my_property", "default");
valueLabel.text = Qt.binding(function() { return "Value: " + filter.properties.my_property })
}
Label
{
id: valueLabel
anchors.fill: parent
}
}
Definition at line 1 of file javascriptfiltersdk/src/filter.h.