aboutsummaryrefslogtreecommitdiffstats
path: root/demo/Main.qml
diff options
context:
space:
mode:
authorThomas Vanbesien <tvanbesi@proton.me>2026-03-12 11:34:22 +0100
committerThomas Vanbesien <tvanbesi@proton.me>2026-03-12 11:34:22 +0100
commit34faf3cdea798c1948229ec1bb53c828e2b40bb7 (patch)
tree10d02b39f19dc524c99e13d04b0ad2f15d5bb2a0 /demo/Main.qml
parent094b8aa2bbb8b90dff9da199873cbc6b36549eb6 (diff)
downloadQtXpl2-34faf3cdea798c1948229ec1bb53c828e2b40bb7.tar.gz
QtXpl2-34faf3cdea798c1948229ec1bb53c828e2b40bb7.zip
Three-socket Xpl2Client with per-port send/receive and demo port selector
Diffstat (limited to 'demo/Main.qml')
-rw-r--r--demo/Main.qml45
1 files changed, 35 insertions, 10 deletions
diff --git a/demo/Main.qml b/demo/Main.qml
index fe9f885..d234eae 100644
--- a/demo/Main.qml
+++ b/demo/Main.qml
@@ -14,6 +14,13 @@ ApplicationWindow {
width: 800
Connections {
+ function onCommandSocketResponseReceived(response: string) {
+ debugConsole.appendLog("Command: " + response);
+ responseModel.append({
+ text: "[Command] " + response
+ });
+ }
+
function onConnectedChanged() {
debugConsole.appendLog(Xpl2Client.connected ? "Connected" :
"Disconnected");
@@ -23,10 +30,10 @@ ApplicationWindow {
debugConsole.appendLog("ERROR: " + error);
}
- function onResponseReceived(response: string) {
- debugConsole.appendLog("Received: " + response);
+ function onImagingSocketResponseReceived(response: string) {
+ debugConsole.appendLog("Imaging: " + response);
responseModel.append({
- text: response
+ text: "[Imaging] " + response
});
}
@@ -34,6 +41,13 @@ ApplicationWindow {
debugConsole.appendLog(message);
}
+ function onStatusSocketResponseReceived(response: string) {
+ debugConsole.appendLog("Status: " + response);
+ responseModel.append({
+ text: "[Status] " + response
+ });
+ }
+
target: Xpl2Client
}
@@ -141,20 +155,26 @@ ApplicationWindow {
}
}
- // --- Send Command ---
+ // --- Send Message ---
GroupBox {
Layout.fillWidth: true
enabled: Xpl2Client.connected
- title: "Command"
+ title: "Send"
RowLayout {
anchors.fill: parent
+ ComboBox {
+ id: portCombo
+
+ model: ["Command", "Imaging", "Status"]
+ }
+
TextField {
id: cmdField
Layout.fillWidth: true
- placeholderText: "Enter command…"
+ placeholderText: "Enter message…"
onAccepted: sendBtn.clicked()
}
@@ -165,10 +185,15 @@ ApplicationWindow {
text: "Send"
onClicked: {
- if (cmdField.text.length > 0) {
- Xpl2Client.sendCommand(cmdField.text);
- cmdField.text = "";
- }
+ if (cmdField.text.length === 0)
+ return;
+ if (portCombo.currentIndex === 0)
+ Xpl2Client.sendToCommandSocket(cmdField.text);
+ else if (portCombo.currentIndex === 1)
+ Xpl2Client.sendToImagingSocket(cmdField.text);
+ else
+ Xpl2Client.sendToStatusSocket(cmdField.text);
+ cmdField.text = "";
}
}
}