summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demo/Main.qml29
-rw-r--r--demo/NodePage.qml53
2 files changed, 71 insertions, 11 deletions
diff --git a/demo/Main.qml b/demo/Main.qml
index ca0a419..361e3bd 100644
--- a/demo/Main.qml
+++ b/demo/Main.qml
@@ -153,15 +153,31 @@ ApplicationWindow {
clip: true
model: Bobink.servers
delegate: ItemDelegate {
+ id: serverDelegate
required property var modelData
width: ListView.view.width
- text: modelData.serverName + " — " + modelData.applicationUri
+ contentItem: ColumnLayout {
+ spacing: 2
+ Label {
+ text: serverDelegate.modelData.serverName
+ }
+ Label {
+ text: serverDelegate.modelData.applicationUri
+ color: "gray"
+ font.italic: true
+ font.pointSize: 8
+ elide: Text.ElideRight
+ Layout.fillWidth: true
+ }
+ }
onClicked: {
if (modelData.discoveryUrls.length > 0)
serverUrlField.text = modelData.discoveryUrls[0];
}
}
- ScrollBar.vertical: ScrollBar {}
+ ScrollBar.vertical: ScrollBar {
+ policy: ScrollBar.AsNeeded
+ }
}
RowLayout {
@@ -178,8 +194,7 @@ ApplicationWindow {
Layout.fillWidth: true
}
Button {
- text: root.showPkiSettings ? "Hide" : "Configure..."
- flat: true
+ text: root.showPkiSettings ? "Hide" : "Configure"
onClicked: root.showPkiSettings = !root.showPkiSettings
}
}
@@ -199,7 +214,7 @@ ApplicationWindow {
placeholderText: "Client certificate (.der)"
}
Button {
- text: "Browse..."
+ text: "Browse"
onClicked: certFileDialog.open()
}
@@ -213,7 +228,7 @@ ApplicationWindow {
placeholderText: "Private key (.pem, .crt)"
}
Button {
- text: "Browse..."
+ text: "Browse"
onClicked: keyFileDialog.open()
}
@@ -226,7 +241,7 @@ ApplicationWindow {
text: Bobink.pkiDir
}
Button {
- text: "Browse..."
+ text: "Browse"
onClicked: trustFolderDialog.open()
}
}
diff --git a/demo/NodePage.qml b/demo/NodePage.qml
index e9ae236..e677232 100644
--- a/demo/NodePage.qml
+++ b/demo/NodePage.qml
@@ -14,7 +14,20 @@ Page {
readonly property var pages: [
{
+ title: "Server Info",
+ description: "Standard OPC UA server nodes (namespace 0)."
+ + " CurrentTime updates live via monitoring.",
+ nodes: [
+ "ns=0;i=2258", // CurrentTime
+ "ns=0;i=2257", // StartTime
+ "ns=0;i=2259", // State
+ "ns=0;i=2261", // ProductName
+ "ns=0;i=2264" // SoftwareVersion
+ ]
+ },
+ {
title: "Read-Write Scalars",
+ description: "Single-value nodes with read and write access.",
nodes: [
"ns=1;s=bool_rw_scalar",
"ns=1;s=int16_rw_scalar",
@@ -35,6 +48,7 @@ Page {
},
{
title: "Read-Only Scalars",
+ description: "Single-value nodes with read-only access.",
nodes: [
"ns=1;s=bool_ro_scalar",
"ns=1;s=int16_ro_scalar",
@@ -55,6 +69,9 @@ Page {
},
{
title: "Read-Write Arrays",
+ description: "Array nodes. Values are displayed comma-separated."
+ + " To write, enter comma-separated values (e.g. \"1, 2, 3\")."
+ + " Commas cannot appear inside individual values.",
nodes: [
"ns=1;s=bool_rw_array",
"ns=1;s=int16_rw_array",
@@ -74,6 +91,16 @@ Page {
]
},
{
+ title: "Non-Existent Nodes",
+ description: "These node IDs do not exist on the server."
+ + " The row should show no value and no metadata in the tooltip.",
+ nodes: [
+ "ns=1;s=does_not_exist",
+ "ns=99;i=12345",
+ "ns=1;s=also_missing"
+ ]
+ },
+ {
title: "Empty (Monitoring Test)",
description: "No nodes on this page. All previous pages are inactive,"
+ " so the server log should show zero active monitored items.",
@@ -83,6 +110,22 @@ Page {
readonly property var currentPage: pages[pageNumber - 1]
+ // OPC UA ServerState enum (Part 4, Table 120).
+ readonly property var serverStates: [
+ "Running", "Failed", "NoConfiguration", "Suspended",
+ "Shutdown", "Test", "CommunicationFault", "Unknown"
+ ]
+
+ function formatValue(node) {
+ var v = node.value;
+ if (v === undefined || String(v) === "")
+ return "—";
+ // Map ServerState enum to human-readable string.
+ if (node.nodeId === "ns=0;i=2259" && !isNaN(v))
+ return serverStates[v] || String(v);
+ return String(v);
+ }
+
Component.onCompleted: nodePage.logFunction(
currentPage.title + " page loaded (" + currentPage.nodes.length + " nodes)")
@@ -133,7 +176,7 @@ Page {
Label {
text: "Value"
font.bold: true
- Layout.preferredWidth: 160
+ Layout.preferredWidth: 300
}
Label {
text: "Write"
@@ -180,9 +223,11 @@ Page {
contentItem: RowLayout {
spacing: 12
- // Column 1: Identifier
+ // Column 1: Display name if available, otherwise short ID.
Label {
text: {
+ if (node.info.displayName)
+ return node.info.displayName;
var idx = node.nodeId.indexOf(";s=");
return idx >= 0 ? node.nodeId.substring(idx + 3) : node.nodeId;
}
@@ -192,8 +237,8 @@ Page {
// Column 2: Live value (always visible)
Label {
- text: node.value !== undefined && String(node.value) !== "" ? String(node.value) : "—"
- Layout.preferredWidth: 160
+ text: nodePage.formatValue(node)
+ Layout.preferredWidth: 300
elide: Text.ElideRight
}