From 34faf3cdea798c1948229ec1bb53c828e2b40bb7 Mon Sep 17 00:00:00 2001 From: Thomas Vanbesien Date: Thu, 12 Mar 2026 11:34:22 +0100 Subject: Three-socket Xpl2Client with per-port send/receive and demo port selector --- demo/Main.qml | 45 +++++++++++++++++++++++++++++++++++---------- 1 file changed, 35 insertions(+), 10 deletions(-) (limited to 'demo/Main.qml') 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 = ""; } } } -- cgit v1.2.3