blob: 2de0a15b2c5ddb2374c10075621c8644a9700824 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
// NodePage.qml — Demo page displaying a single OPC UA node.
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
import Bobink
Page {
id: nodePage
required property StackView stackRef
required property int pageNumber
required property var logFunction
OpcUaMonitoredNode {
id: demoNode
nodeId: nodePage.pageNumber === 1 ? "ns=1;s=double_rw_scalar" : "ns=1;s=string_rw_scalar"
monitored: nodePage.StackView.status === StackView.Active
onMonitoredChanged: nodePage.logFunction("Page " + nodePage.pageNumber + " node [" + nodeId + "] " + (monitored ? "MONITORED" : "UNMONITORED"))
onValueChanged: nodePage.logFunction("Page " + nodePage.pageNumber + " value = " + value)
}
ColumnLayout {
anchors.fill: parent
anchors.margins: 20
spacing: 8
RowLayout {
Label {
text: "Node Page " + nodePage.pageNumber
font.bold: true
font.pointSize: 14
}
Item {
Layout.fillWidth: true
}
Button {
text: "Disconnect"
onClicked: Bobink.disconnectFromServer()
}
}
// Value (prominent)
Rectangle {
Layout.fillWidth: true
height: 60
color: "#f0f0f0"
radius: 4
ColumnLayout {
anchors.fill: parent
anchors.margins: 8
spacing: 2
Label {
text: "Value"
font.pointSize: 10
color: "gray"
}
Label {
text: demoNode.value !== undefined ? String(demoNode.value) : "—"
font.pointSize: 16
font.bold: true
elide: Text.ElideRight
Layout.fillWidth: true
}
}
}
// Node info
GridLayout {
Layout.fillWidth: true
columns: 2
columnSpacing: 12
rowSpacing: 4
Label {
text: "Node ID:"
color: "gray"
}
Label {
text: demoNode.nodeId
Layout.fillWidth: true
}
Label {
text: "Display Name:"
color: "gray"
}
Label {
text: demoNode.info.displayName || "—"
Layout.fillWidth: true
}
Label {
text: "Data Type:"
color: "gray"
}
Label {
text: demoNode.info.dataType || "—"
Layout.fillWidth: true
}
Label {
text: "Node Class:"
color: "gray"
}
Label {
text: demoNode.info.nodeClass || "—"
Layout.fillWidth: true
}
Label {
text: "Access Level:"
color: "gray"
}
Label {
text: demoNode.info.accessLevel
Layout.fillWidth: true
}
Label {
text: "Status:"
color: "gray"
}
Label {
text: demoNode.info.status || "—"
Layout.fillWidth: true
}
Label {
text: "Source Time:"
color: "gray"
}
Label {
text: demoNode.info.sourceTimestamp.toLocaleString() || "—"
Layout.fillWidth: true
}
Label {
text: "Server Time:"
color: "gray"
}
Label {
text: demoNode.info.serverTimestamp.toLocaleString() || "—"
Layout.fillWidth: true
}
Label {
text: "Monitored:"
color: "gray"
}
Label {
text: demoNode.monitored ? "Yes" : "No"
color: demoNode.monitored ? "green" : "gray"
Layout.fillWidth: true
}
}
Item {
Layout.fillHeight: true
}
Button {
Layout.fillWidth: true
text: nodePage.pageNumber === 1 ? "Go to Page 2" : "Back to Page 1"
onClicked: {
if (nodePage.pageNumber === 1)
nodePage.stackRef.push("NodePage.qml", {
stackRef: nodePage.stackRef,
pageNumber: 2,
logFunction: nodePage.logFunction
});
else
nodePage.stackRef.pop();
}
}
}
}
|