aboutsummaryrefslogtreecommitdiffstats
path: root/demo
diff options
context:
space:
mode:
Diffstat (limited to 'demo')
-rw-r--r--demo/Main.qml175
1 files changed, 37 insertions, 138 deletions
diff --git a/demo/Main.qml b/demo/Main.qml
index d234eae..edf317c 100644
--- a/demo/Main.qml
+++ b/demo/Main.qml
@@ -14,13 +14,6 @@ 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");
@@ -30,22 +23,21 @@ ApplicationWindow {
debugConsole.appendLog("ERROR: " + error);
}
- function onImagingSocketResponseReceived(response: string) {
- debugConsole.appendLog("Imaging: " + response);
- responseModel.append({
- text: "[Imaging] " + response
- });
+ function onJcVersionReceived() {
+ debugConsole.appendLog(
+ "JC Version: controller=%1 fw=%2 hw=%3 phCount=%4".arg(
+ Xpl2Client.controllerId).arg(
+ Xpl2Client.firmwareVersion).arg(
+ Xpl2Client.hardwareVersion).arg(
+ Xpl2Client.printheadCount));
}
function onStatusMessage(message: string) {
debugConsole.appendLog(message);
}
- function onStatusSocketResponseReceived(response: string) {
- debugConsole.appendLog("Status: " + response);
- responseModel.append({
- text: "[Status] " + response
- });
+ function onWireDebugMessage(message: string) {
+ debugConsole.appendLog("WIRE: " + message);
}
target: Xpl2Client
@@ -66,9 +58,8 @@ ApplicationWindow {
Layout.fillWidth: true
title: "Connection"
- GridLayout {
+ RowLayout {
anchors.fill: parent
- columns: 2
Label {
text: "Host:"
@@ -83,66 +74,7 @@ ApplicationWindow {
onEditingFinished: Xpl2Client.host = text
}
- Label {
- text: "Command port:"
- }
-
- TextField {
- id: commandPortField
-
- Layout.fillWidth: true
- text: Xpl2Client.commandPort
-
- validator: IntValidator {
- bottom: 1
- top: 65535
- }
-
- onEditingFinished: Xpl2Client.commandPort = parseInt(
- text)
- }
-
- Label {
- text: "Imaging port:"
- }
-
- TextField {
- id: imagingPortField
-
- Layout.fillWidth: true
- text: Xpl2Client.imagingPort
-
- validator: IntValidator {
- bottom: 1
- top: 65535
- }
-
- onEditingFinished: Xpl2Client.imagingPort = parseInt(
- text)
- }
-
- Label {
- text: "Status port:"
- }
-
- TextField {
- id: statusPortField
-
- Layout.fillWidth: true
- text: Xpl2Client.statusPort
-
- validator: IntValidator {
- bottom: 1
- top: 65535
- }
-
- onEditingFinished: Xpl2Client.statusPort = parseInt(
- text)
- }
-
Button {
- Layout.alignment: Qt.AlignRight
- Layout.columnSpan: 2
text: Xpl2Client.connected ? "Disconnect" : "Connect"
onClicked: {
@@ -152,81 +84,48 @@ ApplicationWindow {
Xpl2Client.connectToServer();
}
}
+
+ CheckBox {
+ checked: Xpl2Client.wireDebug
+ text: "Wire debug"
+
+ onToggled: Xpl2Client.wireDebug = checked
+ }
}
}
- // --- Send Message ---
+ // --- Protocol Commands ---
GroupBox {
Layout.fillWidth: true
enabled: Xpl2Client.connected
- title: "Send"
+ title: "Protocol Commands"
- RowLayout {
+ ColumnLayout {
anchors.fill: parent
- ComboBox {
- id: portCombo
-
- model: ["Command", "Imaging", "Status"]
- }
-
- TextField {
- id: cmdField
-
- Layout.fillWidth: true
- placeholderText: "Enter message…"
-
- onAccepted: sendBtn.clicked()
- }
-
- Button {
- id: sendBtn
+ RowLayout {
+ Button {
+ text: "Get JC Version"
- text: "Send"
+ onClicked: Xpl2Client.getJcVersion()
+ }
- onClicked: {
- 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 = "";
+ Label {
+ text: Xpl2Client.controllerId > 0
+ ? "Controller: %1 | FW: %2 | HW: %3 | PHs: %4".arg(
+ Xpl2Client.controllerId).arg(
+ Xpl2Client.firmwareVersion).arg(
+ Xpl2Client.hardwareVersion).arg(
+ Xpl2Client.printheadCount) :
+ "No version data"
}
}
}
}
- // --- Responses ---
- GroupBox {
+ // --- Spacer ---
+ Item {
Layout.fillHeight: true
- Layout.fillWidth: true
- title: "Responses"
-
- ListView {
- id: responseView
-
- anchors.fill: parent
- clip: true
-
- delegate: Text {
- id: responseDelegate
-
- required property string text
-
- font.family: "monospace"
- font.pixelSize: 13
- text: responseDelegate.text
- width: responseView.width
- wrapMode: Text.Wrap
- }
- model: ListModel {
- id: responseModel
-
- }
- }
}
}
@@ -234,14 +133,14 @@ ApplicationWindow {
Rectangle {
id: debugConsole
- function appendLog(msg) {
+ function appendLog(msg: string): void {
let ts = new Date().toLocaleTimeString(Qt.locale(), "HH:mm:ss");
debugLog.text += "[" + ts + "] " + msg + "\n";
debugLog.cursorPosition = debugLog.text.length;
}
Layout.fillWidth: true
- Layout.preferredHeight: 120
+ Layout.preferredHeight: 160
border.color: "#444"
color: "#1e1e1e"
radius: 4