summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorRainer Keller <Rainer.Keller@qt.io>2018-05-15 09:11:40 +0200
committerRainer Keller <Rainer.Keller@qt.io>2018-08-07 12:04:51 +0000
commit0c9e805b18d240293f2696a17634ecab0cbac5f3 (patch)
treed60ea41a762c78bc5b9566269f4dfffabaa5e772 /examples
parent52d7b185c5cc5c9924ceefebad97fbcdb098c849 (diff)
Add QML API
Change-Id: I56fe77b473c9422870c71f055e9ebf818f70e0b5 Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'examples')
-rw-r--r--examples/opcua/waterpump/waterpump-qml/MachineDisplay.qml124
-rw-r--r--examples/opcua/waterpump/waterpump-qml/Pump.qml81
-rw-r--r--examples/opcua/waterpump/waterpump-qml/ServerControl.qml87
-rw-r--r--examples/opcua/waterpump/waterpump-qml/Tank1Unit.qml84
-rw-r--r--examples/opcua/waterpump/waterpump-qml/Tank2Unit.qml83
-rw-r--r--examples/opcua/waterpump/waterpump-qml/TankDisplay.qml64
-rw-r--r--examples/opcua/waterpump/waterpump-qml/ValueDisplay.qml92
-rw-r--r--examples/opcua/waterpump/waterpump-qml/doc/images/tankexample.jpgbin0 -> 15364 bytes
-rw-r--r--examples/opcua/waterpump/waterpump-qml/doc/waterpump-qml.qdoc128
-rw-r--r--examples/opcua/waterpump/waterpump-qml/machine/Machine.qml169
-rw-r--r--examples/opcua/waterpump/waterpump-qml/machine/Tank.qml70
-rw-r--r--examples/opcua/waterpump/waterpump-qml/main.cpp91
-rw-r--r--examples/opcua/waterpump/waterpump-qml/main.qml100
-rw-r--r--examples/opcua/waterpump/waterpump-qml/qml.qrc14
-rw-r--r--examples/opcua/waterpump/waterpump-qml/waterpump-qml.pro6
-rw-r--r--examples/opcua/waterpump/waterpump.pro2
16 files changed, 1194 insertions, 1 deletions
diff --git a/examples/opcua/waterpump/waterpump-qml/MachineDisplay.qml b/examples/opcua/waterpump/waterpump-qml/MachineDisplay.qml
new file mode 100644
index 0000000..d4b0edb
--- /dev/null
+++ b/examples/opcua/waterpump/waterpump-qml/MachineDisplay.qml
@@ -0,0 +1,124 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the QtOpcUa module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Layouts 1.3
+import QtQuick.Controls 2.3
+import QtOpcUa 5.12 as QtOpcUa
+import "qrc:/machine"
+
+RowLayout {
+ property Machine machine
+ property QtOpcUa.Connection connection
+
+ opacity: connection.connected ? 1.0 : 0.25
+ Tank1Unit {
+ startButtonEnabled: connection.connected && machine.state === Machine.MachineState.Idle &&
+ machine.tank1.percentFilled > 0 && machine.tank2.percentFilled < machine.tank2.targetPercent
+ stopButtonEnabled: connection.connected && machine.state === Machine.MachineState.Pumping
+ percentFilled: machine.tank1.percentFilled
+
+ id: tank1unit
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+
+ Component.onCompleted: {
+ tank1unit.startPump.connect(machine.startMethod.callMethod)
+ tank1unit.stopPump.connect(machine.stopMethod.callMethod)
+ }
+ }
+ Pump {
+ machineIsPumping: machine.state === Machine.MachineState.Pumping
+
+ Component.onCompleted: {
+ machine.tank2.onPercentFilledChanged.connect(rotatePump)
+ }
+ }
+ Tank2Unit {
+ flushButtonEnabled: connection.connected && machine.state === Machine.MachineState.Idle && machine.tank2.percentFilled > machine.tank2.targetPercent
+ percentFilled: machine.tank2.percentFilled
+ valveState: machine.tank2valveState
+
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+
+ id: tank2unit
+
+ Component.onCompleted: {
+ tank2unit.flushTank.connect(machine.flushMethod.callMethod)
+ }
+ }
+ Slider {
+ id: setpointSlider
+ Layout.fillHeight: false
+ Layout.preferredHeight: tank1unit.tankHeight
+ Layout.alignment: Qt.AlignBottom
+ enabled: connection.connected && machine.state === Machine.MachineState.Idle
+ from: 0
+ to: 100
+ value: machine.tank2.targetPercent
+ live: false
+ stepSize: 1.0
+ orientation: Qt.Vertical
+ onValueChanged: {
+ machine.tank2.targetPercent = value;
+ }
+ }
+ ValueDisplay {
+ designation: machine.designation
+ percentFilledTank1: machine.tank1.percentFilled
+ percentFilledTank2: machine.tank2.percentFilled
+ targetPercentTank2: machine.tank2.targetPercent
+ machineState: machine.state === Machine.MachineState.Idle ?
+ "Idle" : (machine.state === Machine.MachineState.Pumping ? "Pumping" : "Flushing")
+ valveState: machine.tank2valveState
+ }
+}
diff --git a/examples/opcua/waterpump/waterpump-qml/Pump.qml b/examples/opcua/waterpump/waterpump-qml/Pump.qml
new file mode 100644
index 0000000..c6988d1
--- /dev/null
+++ b/examples/opcua/waterpump/waterpump-qml/Pump.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the QtOpcUa module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+
+Rectangle {
+ property bool machineIsPumping;
+
+ function rotatePump() {
+ if (machineIsPumping)
+ rotation += 15
+ }
+
+ id: pump
+ width: 40
+ height: 40
+ radius: width / 2
+ color: machineIsPumping ? "#00BFFF" : "lightgrey"
+ Rectangle {
+ antialiasing: true
+ width: height / 4
+ height: pump.width * 0.75
+ anchors.centerIn: parent
+ color: "grey"
+ }
+ Rectangle {
+ antialiasing: true
+ width: pump.width * 0.75
+ height: width / 4
+ anchors.centerIn: parent
+ color: "grey"
+ }
+}
diff --git a/examples/opcua/waterpump/waterpump-qml/ServerControl.qml b/examples/opcua/waterpump/waterpump-qml/ServerControl.qml
new file mode 100644
index 0000000..867308a
--- /dev/null
+++ b/examples/opcua/waterpump/waterpump-qml/ServerControl.qml
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the QtOpcUa module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+import QtQuick.Layouts 1.3
+import QtOpcUa 5.12 as QtOpcUa
+
+RowLayout {
+ readonly property alias backend: backendSelector.currentText
+ property QtOpcUa.Connection connection
+ signal resetSimulation()
+
+ TextField {
+ id: uaUrl
+ Layout.fillWidth: true
+ text: "opc.tcp://127.0.0.1:43344"
+ }
+ ComboBox {
+ id: backendSelector
+ model: connection.availableBackends
+ }
+
+ Button {
+ text: connection.connected ? "Disconnect" : "Connect"
+ enabled: connection.availableBackends.length > 0
+ onClicked: {
+ if (connection.connected)
+ connection.disconnectFromEndpoint()
+ else
+ connection.connectToEndpoint(uaUrl.text)
+ }
+ }
+ Button {
+ text: "Reset simulation"
+ enabled: connection.connected
+ onClicked: resetSimulation()
+ }
+}
diff --git a/examples/opcua/waterpump/waterpump-qml/Tank1Unit.qml b/examples/opcua/waterpump/waterpump-qml/Tank1Unit.qml
new file mode 100644
index 0000000..eb8410d
--- /dev/null
+++ b/examples/opcua/waterpump/waterpump-qml/Tank1Unit.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the QtOpcUa module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+import QtQuick.Layouts 1.3
+
+Item {
+ property alias tankHeight: tank1.height
+ property alias startButtonEnabled: startButton.enabled
+ property alias stopButtonEnabled: stopButton.enabled
+ property alias percentFilled: tank1.percentFilled
+ signal startPump()
+ signal stopPump()
+
+ ColumnLayout {
+ anchors.fill: parent
+ RowLayout {
+ Button {
+ id: startButton
+ text: "Start"
+ onClicked: startPump()
+ }
+ Button {
+ id: stopButton
+ text: "Stop"
+ onClicked: stopPump()
+ }
+ }
+ TankDisplay {
+ id: tank1
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ }
+ }
+}
diff --git a/examples/opcua/waterpump/waterpump-qml/Tank2Unit.qml b/examples/opcua/waterpump/waterpump-qml/Tank2Unit.qml
new file mode 100644
index 0000000..05efdd6
--- /dev/null
+++ b/examples/opcua/waterpump/waterpump-qml/Tank2Unit.qml
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the QtOpcUa module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+import QtQuick.Layouts 1.3
+
+Item {
+ property alias flushButtonEnabled: flushButton.enabled
+ property alias percentFilled: tank2.percentFilled
+ property bool valveState
+ signal flushTank()
+
+ ColumnLayout {
+ anchors.fill: parent
+ Button {
+ id: flushButton
+ text: "Flush"
+ onClicked: flushTank()
+ }
+ Layout.fillHeight: true
+ TankDisplay {
+ id: tank2
+ Layout.fillHeight: true
+ Layout.fillWidth: true
+ Rectangle {
+ color: valveState ? "#00BFFF" : "lightgrey"
+ anchors.top: parent.bottom
+ anchors.right: parent.right
+ width: tank2.width / 10
+ height: 40
+ }
+ }
+ }
+}
diff --git a/examples/opcua/waterpump/waterpump-qml/TankDisplay.qml b/examples/opcua/waterpump/waterpump-qml/TankDisplay.qml
new file mode 100644
index 0000000..8de4a07
--- /dev/null
+++ b/examples/opcua/waterpump/waterpump-qml/TankDisplay.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the QtOpcUa module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+
+Rectangle {
+ property real percentFilled: 0
+ color: "lightgrey"
+ width: parent.width
+ height: parent.height
+ Rectangle {
+ y: parent.height - percentFilled * (parent.height / 100)
+ width: parent.width
+ height: percentFilled * (parent.height / 100)
+ color: "#00BFFF"
+ }
+}
diff --git a/examples/opcua/waterpump/waterpump-qml/ValueDisplay.qml b/examples/opcua/waterpump/waterpump-qml/ValueDisplay.qml
new file mode 100644
index 0000000..bb0b22e
--- /dev/null
+++ b/examples/opcua/waterpump/waterpump-qml/ValueDisplay.qml
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the QtOpcUa module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+import QtQuick.Layouts 1.3
+
+ColumnLayout {
+ property string designation
+ property int percentFilledTank1
+ property int percentFilledTank2
+ property int targetPercentTank2
+ property string machineState
+ property bool valveState
+
+ Text {
+ font.pointSize: 12
+ text: "<b>Machine Status</b>"
+ }
+ Text {
+ font.pointSize: 10
+ text: "<b>Designation:</b> " + designation
+ }
+ Text {
+ font.pointSize: 10
+ text: "<b>State:</b> " + machineState
+ }
+ Text {
+ font.pointSize: 10
+ text: "<b>Tank 1:</b> " + percentFilledTank1 + "%"
+ }
+ Text {
+ font.pointSize: 10
+ text: "<b>Tank 2:</b> " + percentFilledTank2 + "%"
+ }
+ Text {
+ font.pointSize: 10
+ text: "<b>Setpoint:</b> " + targetPercentTank2 + "%"
+ }
+ Text {
+ font.pointSize: 10
+ text: "<b>Valve:</b> " + (valveState ? "Open" : "Closed")
+ }
+}
diff --git a/examples/opcua/waterpump/waterpump-qml/doc/images/tankexample.jpg b/examples/opcua/waterpump/waterpump-qml/doc/images/tankexample.jpg
new file mode 100644
index 0000000..4c6a429
--- /dev/null
+++ b/examples/opcua/waterpump/waterpump-qml/doc/images/tankexample.jpg
Binary files differ
diff --git a/examples/opcua/waterpump/waterpump-qml/doc/waterpump-qml.qdoc b/examples/opcua/waterpump/waterpump-qml/doc/waterpump-qml.qdoc
new file mode 100644
index 0000000..982b3af
--- /dev/null
+++ b/examples/opcua/waterpump/waterpump-qml/doc/waterpump-qml.qdoc
@@ -0,0 +1,128 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+ \example waterpump/waterpump-qml
+ \ingroup qtopcua-examples
+ \title Example using the QML API for Qt OPC UA
+ \brief This example shows how to use Qt OPC UA QML API to interact with an OPC UA
+ server to build a QML based HMI for a simple machine.
+
+ \section1 Introduction
+ This example shows how to use Qt OPC UA QML API to interact with an OPC UA
+ server to build a QML based HMI for a simple machine.
+
+ \section1 The Simulation
+ The OPC UA server included in this example runs a simulation of a machine
+ containing two tanks, a water pump and a valve. Water can be pumped from the
+ first tank into the second tank and then be flushed from the second tank
+ by opening the valve. Both operations have a user-configurable setpoint
+ which controls how much water is pumped to or flushed from the second tank.
+
+ The following nodes exist on the server:
+
+ \table
+ \header
+ \li NodeId
+ \li Function
+ \row
+ \li ns=2;s=Machine
+ \li The folder containing the method and variable nodes for the machine
+ \row
+ \li ns=2;s=Machine.State
+ \li The state of the machine
+ \row
+ \li ns=2;s=Machine.Tank1.PercentFilled
+ \li The current fill status of the first tank
+ \row
+ \li ns=2;s=Machine.Tank2.PercentFilled
+ \li The current fill status of the second tank
+ \row
+ \li ns=2;s=Machine.Tank2.TargetPercent
+ \li The setpoint for pumping and flushing
+ \row
+ \li ns=2;s=Machine.Tank2.ValveState
+ \li The state of the valve of the second tank
+ \row
+ \li ns=2;s=Machine.Designation
+ \li A human readable designation of the machine for display purposes
+ \row
+ \li ns=2;s=Machine.Start
+ \li Call this method to start the pump
+ \row
+ \li ns=2;s=Machine.Stop
+ \li Call this method to stop the pump
+ \row
+ \li ns=2;s=Machine.FlushTank2
+ \li Call this method to flush tank 2
+ \endtable
+
+ \section1 Implementation
+
+ This example uses QML items to read and write values as well as method calls.
+ All operations are asynchronous and handled by QML in the background.
+
+ A QML item represents the machine and its components. This item does not have any
+ graphical interface and only provides access to the properties of the machine.
+ It has two tanks which are instances of a separate \c Tank component.
+
+ \section2 Properties
+
+ The machine item exposes all properties and subitems as properties.
+
+ \quotefromfile waterpump/waterpump-qml/machine/Machine.qml
+ \dots
+ \skipto readonly
+ \printuntil flushMethod
+ \codeline
+ \dots
+
+ \section2 Asynchronous Handlers
+
+ The asynchronous parts of the API are handled by QML automatically because
+ signals are emitted for every property change by default.
+
+ For example, the button to flush the second tank is enabled
+ only if the backend is connected to the server, the machine is idle, and
+ the tank level is above the setpoint. On click, the flushTank2() method
+ is called on the server.
+
+ \quotefromfile waterpump/waterpump-qml/MachineDisplay.qml
+ \skipto Tank2Unit
+ \printuntil valveState
+
+ \section1 Usage
+ The server is started automatically by the HMI application.
+ After connecting to the server by clicking the \uicontrol Connect button,
+ drag the slider to set a setpoint, then click \uicontrol Start to start pumping water
+ from the first tank to the second tank. After setting a setpoint lower than
+ the current value of the second tank, a click on \uicontrol Flush opens the valve.
+
+ If there is no water left, click \uicontrol {Reset simulation} to refill the first tank.
+
+ \image tankexample.jpg
+*/
diff --git a/examples/opcua/waterpump/waterpump-qml/machine/Machine.qml b/examples/opcua/waterpump/waterpump-qml/machine/Machine.qml
new file mode 100644
index 0000000..217a3dc
--- /dev/null
+++ b/examples/opcua/waterpump/waterpump-qml/machine/Machine.qml
@@ -0,0 +1,169 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the QtOpcUa module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtOpcUa 5.12 as QtOpcUa
+
+Item {
+ readonly property alias tank1: tank1
+ readonly property alias tank2: tank2
+ readonly property alias state: machineState.value
+ readonly property alias tank2PercentFilled: tank2.percentFilled
+ readonly property alias tank2valveState: tank2.valveState
+ readonly property alias designation: designation.value
+ property alias resetMethod: resetMethod
+ property alias startMethod: startMethod
+ property alias stopMethod: stopMethod
+ property alias flushMethod: flushMethod
+
+ QtOpcUa.NodeId {
+ identifier: "s=Machine"
+ ns: "Demo Namespace"
+ id: machineNodeId
+ }
+
+ QtOpcUa.MethodNode {
+ nodeId: machineNodeId
+ objectNodeId : QtOpcUa.NodeId {
+ identifier: "s=Machine.Start"
+ ns: "Demo Namespace"
+ }
+ id: startMethod
+ }
+
+ QtOpcUa.MethodNode {
+ nodeId: machineNodeId
+ objectNodeId : QtOpcUa.NodeId {
+ identifier: "s=Machine.Stop"
+ ns: "Demo Namespace"
+ }
+ id: stopMethod
+ }
+
+ QtOpcUa.MethodNode {
+ nodeId: machineNodeId
+ objectNodeId : QtOpcUa.NodeId {
+ identifier: "s=Machine.FlushTank2"
+ ns: "Demo Namespace"
+ }
+ id: flushMethod
+ }
+
+ QtOpcUa.MethodNode {
+ nodeId: machineNodeId
+ objectNodeId : QtOpcUa.NodeId {
+ identifier: "s=Machine.Reset"
+ ns: "Demo Namespace"
+ }
+ id: resetMethod
+ }
+
+ enum MachineState {
+ Idle = 0,
+ Pumping = 1,
+ Flushing = 2
+ }
+
+ Tank {
+ id: tank1
+ tankNode: QtOpcUa.Node {
+ nodeId: QtOpcUa.NodeId {
+ identifier: "s=Machine.Tank1"
+ ns: "Demo Namespace"
+ }
+ }
+ }
+
+ Tank {
+ id: tank2
+ tankNode: QtOpcUa.Node {
+ nodeId: QtOpcUa.NodeId {
+ identifier: "s=" + tank2.tankName
+ ns: "Demo Namespace"
+ }
+ }
+ property alias targetPercent: targetPercent.value
+ readonly property string tankName: "Machine.Tank2"
+ readonly property alias valveState: valveState.value
+
+ QtOpcUa.ValueNode {
+ nodeId: QtOpcUa.NodeId {
+ identifier: "s=" + tank2.tankName + ".TargetPercent"
+ ns: "Demo Namespace"
+ }
+ id: targetPercent
+ }
+
+ QtOpcUa.ValueNode {
+ nodeId: QtOpcUa.NodeId {
+ identifier: "s=" + tank2.tankName + ".ValveState"
+ ns: "Demo Namespace"
+ }
+ id: valveState
+ }
+ }
+
+ QtOpcUa.ValueNode {
+ nodeId: QtOpcUa.NodeId {
+ identifier: "s=Machine.State"
+ ns: "Demo Namespace"
+ }
+ id: machineState
+ }
+
+ QtOpcUa.ValueNode {
+ nodeId: QtOpcUa.NodeId {
+ identifier: "s=Machine.Designation"
+ ns: "Demo Namespace"
+ }
+ id: designation
+ }
+}
+
diff --git a/examples/opcua/waterpump/waterpump-qml/machine/Tank.qml b/examples/opcua/waterpump/waterpump-qml/machine/Tank.qml
new file mode 100644
index 0000000..51ab83d
--- /dev/null
+++ b/examples/opcua/waterpump/waterpump-qml/machine/Tank.qml
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the QtOpcUa module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtOpcUa 5.12 as QtOpcUa
+
+Item {
+ property QtOpcUa.Node tankNode
+ readonly property alias percentFilled: filledState.value
+
+ QtOpcUa.ValueNode {
+ nodeId: QtOpcUa.RelativeNodeId {
+ startNode: tankNode.nodeId
+ path: [
+ QtOpcUa.RelativeNodePath {
+ ns: "Demo Namespace"
+ browseName: "PercentFilled"
+ }
+ ]
+ }
+ id: filledState
+ }
+}
diff --git a/examples/opcua/waterpump/waterpump-qml/main.cpp b/examples/opcua/waterpump/waterpump-qml/main.cpp
new file mode 100644
index 0000000..f643b3b
--- /dev/null
+++ b/examples/opcua/waterpump/waterpump-qml/main.cpp
@@ -0,0 +1,91 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the QtOpcUa module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QGuiApplication>
+#include <QQmlApplicationEngine>
+#include <QFile>
+#include <QDebug>
+#include <QProcess>
+
+int main(int argc, char *argv[])
+{
+ QGuiApplication app(argc, argv);
+
+ QString serverExePath;
+#ifdef Q_OS_WIN
+ #ifdef QT_DEBUG
+ serverExePath = app.applicationDirPath().append("/../../simulationserver/debug/simulationserver.exe");
+ #else
+ serverExePath = app.applicationDirPath().append("/../../simulationserver/release/simulationserver.exe");
+ #endif
+#else
+ serverExePath = app.applicationDirPath().append("/../simulationserver/simulationserver");
+#endif
+
+ if (!QFile::exists(serverExePath)) {
+ qWarning() << "Could not find server executable:" << serverExePath;
+ return EXIT_FAILURE;
+ }
+
+ QProcess serverProcess;
+
+ serverProcess.start(serverExePath);
+ if (!serverProcess.waitForStarted()) {
+ qWarning() << "Could not start server:" << serverProcess.errorString();
+ return EXIT_FAILURE;
+ }
+
+ QQmlApplicationEngine engine;
+ engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
+ if (engine.rootObjects().isEmpty())
+ return EXIT_FAILURE;
+
+ return app.exec();
+}
diff --git a/examples/opcua/waterpump/waterpump-qml/main.qml b/examples/opcua/waterpump/waterpump-qml/main.qml
new file mode 100644
index 0000000..5f04832
--- /dev/null
+++ b/examples/opcua/waterpump/waterpump-qml/main.qml
@@ -0,0 +1,100 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 basysKom GmbH, opensource@basyskom.com
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the examples of the QtOpcUa module.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Window 2.2
+import QtQuick.Controls 2.3
+import QtQuick.Layouts 1.3
+import QtOpcUa 5.12 as QtOpcUa
+import "qrc:/machine"
+
+Window {
+ visible: true
+ width: 800
+ height: 600
+ minimumWidth: 800
+ minimumHeight: 600
+ title: "OPC UA Tank Example"
+
+ QtOpcUa.Connection {
+ id: connection
+ backend: serverControl.backend
+ defaultConnection: true
+ }
+
+ Machine {
+ id: machine
+ }
+
+ ColumnLayout {
+ anchors.margins: 10
+ anchors.fill: parent
+ spacing: 45
+ ServerControl {
+ id: serverControl
+ connection: connection
+ }
+ MachineDisplay {
+ Layout.fillHeight: true
+ machine: machine
+ connection: connection
+ }
+ Text {
+ id: messageText
+ font.pointSize: 10
+ // FIXME text: uaBackend.message
+ }
+ }
+
+ Component.onCompleted: {
+ serverControl.resetSimulation.connect(machine.resetMethod.callMethod)
+ }
+}
diff --git a/examples/opcua/waterpump/waterpump-qml/qml.qrc b/examples/opcua/waterpump/waterpump-qml/qml.qrc
new file mode 100644
index 0000000..b4d9f70
--- /dev/null
+++ b/examples/opcua/waterpump/waterpump-qml/qml.qrc
@@ -0,0 +1,14 @@
+<RCC>
+ <qresource prefix="/">
+ <file>main.qml</file>
+ <file>TankDisplay.qml</file>
+ <file>Tank1Unit.qml</file>
+ <file>Tank2Unit.qml</file>
+ <file>ValueDisplay.qml</file>
+ <file>ServerControl.qml</file>
+ <file>Pump.qml</file>
+ <file>MachineDisplay.qml</file>
+ <file>machine/Tank.qml</file>
+ <file>machine/Machine.qml</file>
+ </qresource>
+</RCC>
diff --git a/examples/opcua/waterpump/waterpump-qml/waterpump-qml.pro b/examples/opcua/waterpump/waterpump-qml/waterpump-qml.pro
new file mode 100644
index 0000000..a611823
--- /dev/null
+++ b/examples/opcua/waterpump/waterpump-qml/waterpump-qml.pro
@@ -0,0 +1,6 @@
+QT += quick
+CONFIG += c++11
+SOURCES += main.cpp
+RESOURCES += qml.qrc
+target.path = $$[QT_INSTALL_EXAMPLES]/opcua/waterpump/waterpump-qml
+INSTALLS += target
diff --git a/examples/opcua/waterpump/waterpump.pro b/examples/opcua/waterpump/waterpump.pro
index 9610c1b..1b9f2bd 100644
--- a/examples/opcua/waterpump/waterpump.pro
+++ b/examples/opcua/waterpump/waterpump.pro
@@ -1,2 +1,2 @@
TEMPLATE = subdirs
-SUBDIRS += simulationserver waterpump-qmlcpp
+SUBDIRS += simulationserver waterpump-qmlcpp waterpump-qml