aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--demo/Main.qml38
-rw-r--r--mock-server/MockServer.cpp95
-rw-r--r--mock-server/MockServer.h11
-rw-r--r--src/Xpl2Client.cpp283
-rw-r--r--src/Xpl2Client.h114
-rw-r--r--src/Xpl2Protocol.h25
6 files changed, 564 insertions, 2 deletions
diff --git a/demo/Main.qml b/demo/Main.qml
index 52d3097..394d1ba 100644
--- a/demo/Main.qml
+++ b/demo/Main.qml
@@ -11,7 +11,7 @@ ApplicationWindow {
// Set from C++ via setInitialProperties (--printheads CLI arg, default 10).
required property int demoPhCount
- height: 700
+ height: 1200
title: "XPL2 Demo"
visible: true
width: 900
@@ -187,6 +187,42 @@ ApplicationWindow {
}
}
+ // --- Configuration ---
+ GroupBox {
+ Layout.fillWidth: true
+ enabled: Xpl2Client.connected
+ title: "Configuration"
+
+ GridLayout {
+ anchors.fill: parent
+ columns: 4
+
+ Button {
+ text: "Save All Settings"
+
+ onClicked: Xpl2Client.jcSaveAllPrintheadSettings()
+ }
+
+ Button {
+ text: "Reboot All PHs"
+
+ onClicked: Xpl2Client.jcRebootAllPrintheads()
+ }
+
+ Button {
+ text: "Restart JC"
+
+ onClicked: Xpl2Client.jcRestart()
+ }
+
+ Button {
+ text: "Shutdown JC"
+
+ onClicked: Xpl2Client.jcShutdown()
+ }
+ }
+ }
+
// --- Printheads ---
GroupBox {
Layout.fillHeight: true
diff --git a/mock-server/MockServer.cpp b/mock-server/MockServer.cpp
index d83ad17..f2431d9 100644
--- a/mock-server/MockServer.cpp
+++ b/mock-server/MockServer.cpp
@@ -147,6 +147,39 @@ MockServer::handleCommand (QTcpSocket *client, const QByteArray &line)
else if (cmd == "CN_JC_STATUS_MESSAGING_STOP"
|| cmd == "CN_PH_STATUS_MESSAGING_STOP")
handleCnStatusMessagingStop (client, cmd);
+ /* CF_ JC success shape */
+ else if (cmd == "CF_PH_DEASSIGN_ID" || cmd == "CF_JC_SAVE_CALIBRATION"
+ || cmd == "CF_JC_RESET_CALIBRATION"
+ || cmd == "CF_JC_SWITCH_OFF_PURGE"
+ || cmd == "CF_JC_RESET_SETTINGS_ALL_PRINTHEADS"
+ || cmd == "CF_JC_REBOOT_ALL_PRINTHEADS"
+ || cmd == "CF_JC_RESET_CONTROLLER_SOFTWARE"
+ || cmd == "CF_JC_RESTART" || cmd == "CF_JC_SHUTDOWN"
+ || cmd == "CF_JC_SAVE_ALL_PRINTHEAD_SETTINGS")
+ handleCnJcSuccess (client, cmd);
+ /* CF_ PH success shape */
+ else if (cmd == "CF_PH_SET_ID" || cmd == "CF_PH_SAVE_CALIBRATION"
+ || cmd == "CF_PH_RESET_CALIBRATION"
+ || cmd == "CF_PH_RESET_ALL_SETTINGS" || cmd == "CF_PH_REBOOT"
+ || cmd == "CF_PH_SAVE_SETTINGS")
+ handleCnPhSuccess (client, cmd, params);
+ /* CF_ custom-shape commands */
+ else if (cmd == "CF_JC_SET_PURGE_SETTINGS")
+ handleCfJcSetPurgeSettings (client, params);
+ else if (cmd == "CF_JC_SET_JETTING_PARAMS")
+ handleCfJcSetJettingParams (client, params);
+ else if (cmd == "CF_PH_SET_JETTING_PARAMS")
+ handleCfPhJettingParams (client, cmd, params);
+ else if (cmd == "CF_PH_GET_JETTING_PARAMS")
+ handleCfPhJettingParams (client, cmd, params);
+ else if (cmd == "CF_JC_SETTER")
+ handleCfJcSetter (client, params);
+ else if (cmd == "CF_PH_SETTER")
+ handleCfPhSetter (client, params);
+ else if (cmd == "CF_JC_GETTER")
+ handleCfJcGetter (client, params);
+ else if (cmd == "CF_PH_GETTER")
+ handleCfPhGetter (client, params);
else
qWarning ("%s Unknown command: %s",
qPrintable (logTag (client->localPort ())), cmd.constData ());
@@ -270,3 +303,65 @@ MockServer::handleCnStatusMessagingStop (QTcpSocket *client,
cmd.constData ());
sendReply (client, cmd + ",1,1\n");
}
+
+void
+MockServer::handleCfJcSetPurgeSettings (QTcpSocket *client,
+ const QByteArray &params)
+{
+ qDebug ("%s RX CF_JC_SET_PURGE_SETTINGS,%s",
+ qPrintable (logTag (client->localPort ())), params.constData ());
+ sendReply (client, "CF_JC_SET_PURGE_SETTINGS,1," + params + ",1\n");
+}
+
+void
+MockServer::handleCfJcSetJettingParams (QTcpSocket *client,
+ const QByteArray &params)
+{
+ qDebug ("%s RX CF_JC_SET_JETTING_PARAMS,%s",
+ qPrintable (logTag (client->localPort ())), params.constData ());
+ sendReply (client, "CF_JC_SET_JETTING_PARAMS,1," + params + ",1\n");
+}
+
+void
+MockServer::handleCfPhJettingParams (QTcpSocket *client, const QByteArray &cmd,
+ const QByteArray &params)
+{
+ qDebug ("%s RX %s,%s", qPrintable (logTag (client->localPort ())),
+ cmd.constData (), params.constData ());
+ if (cmd == "CF_PH_GET_JETTING_PARAMS")
+ sendReply (client, cmd + ",1," + params + ",0,0,0,0,0,1\n");
+ else
+ sendReply (client, cmd + ",1," + params + ",1\n");
+}
+
+void
+MockServer::handleCfJcSetter (QTcpSocket *client, const QByteArray &params)
+{
+ qDebug ("%s RX CF_JC_SETTER,%s", qPrintable (logTag (client->localPort ())),
+ params.constData ());
+ sendReply (client, "CF_JC_SETTER,1," + params + ",1\n");
+}
+
+void
+MockServer::handleCfPhSetter (QTcpSocket *client, const QByteArray &params)
+{
+ qDebug ("%s RX CF_PH_SETTER,%s", qPrintable (logTag (client->localPort ())),
+ params.constData ());
+ sendReply (client, "CF_PH_SETTER,1," + params + ",1\n");
+}
+
+void
+MockServer::handleCfJcGetter (QTcpSocket *client, const QByteArray &params)
+{
+ qDebug ("%s RX CF_JC_GETTER,%s", qPrintable (logTag (client->localPort ())),
+ params.constData ());
+ sendReply (client, "CF_JC_GETTER,1," + params + ",\"0\",1\n");
+}
+
+void
+MockServer::handleCfPhGetter (QTcpSocket *client, const QByteArray &params)
+{
+ qDebug ("%s RX CF_PH_GETTER,%s", qPrintable (logTag (client->localPort ())),
+ params.constData ());
+ sendReply (client, "CF_PH_GETTER,1," + params + ",\"0\",1\n");
+}
diff --git a/mock-server/MockServer.h b/mock-server/MockServer.h
index c07cdbe..b14dda5 100644
--- a/mock-server/MockServer.h
+++ b/mock-server/MockServer.h
@@ -56,6 +56,17 @@ private:
void handleCnStatusMessagingStart (QTcpSocket *client, const QByteArray &cmd,
const QByteArray &params);
void handleCnStatusMessagingStop (QTcpSocket *client, const QByteArray &cmd);
+ /* CF_ configuration command handlers */
+ void handleCfJcSetPurgeSettings (QTcpSocket *client,
+ const QByteArray &params);
+ void handleCfJcSetJettingParams (QTcpSocket *client,
+ const QByteArray &params);
+ void handleCfPhJettingParams (QTcpSocket *client, const QByteArray &cmd,
+ const QByteArray &params);
+ void handleCfJcSetter (QTcpSocket *client, const QByteArray &params);
+ void handleCfPhSetter (QTcpSocket *client, const QByteArray &params);
+ void handleCfJcGetter (QTcpSocket *client, const QByteArray &params);
+ void handleCfPhGetter (QTcpSocket *client, const QByteArray &params);
Port m_command;
Port m_imaging;
diff --git a/src/Xpl2Client.cpp b/src/Xpl2Client.cpp
index 45963fa..d6eb28a 100644
--- a/src/Xpl2Client.cpp
+++ b/src/Xpl2Client.cpp
@@ -66,6 +66,72 @@ Xpl2Client::s_responseTable = {
[](auto *s, const auto &p) { emit s->jcStatusMessagingStartResult (p[0].toInt (), p[1].toInt (), p[2].toInt (), p[3].toInt () == 1); } } },
{ "CN_PH_STATUS_MESSAGING_START", { ResponseShape::StatusStart, 4,
[](auto *s, const auto &p) { emit s->phStatusMessagingStartResult (p[0].toInt (), p[1].toInt (), p[2].toInt (), p[3].toInt () == 1); } } },
+
+ /* CF_ JC success shape: controllerId, successFlag */
+ { "CF_PH_DEASSIGN_ID", { ResponseShape::JcSuccess, 2,
+ [](auto *s, const auto &p) { emit s->phDeassignIdResult (p[0].toInt (), p[1].toInt () == 1); } } },
+ { "CF_JC_SAVE_CALIBRATION", { ResponseShape::JcSuccess, 2,
+ [](auto *s, const auto &p) { emit s->jcSaveCalibrationResult (p[0].toInt (), p[1].toInt () == 1); } } },
+ { "CF_JC_RESET_CALIBRATION", { ResponseShape::JcSuccess, 2,
+ [](auto *s, const auto &p) { emit s->jcResetCalibrationResult (p[0].toInt (), p[1].toInt () == 1); } } },
+ { "CF_JC_SWITCH_OFF_PURGE", { ResponseShape::JcSuccess, 2,
+ [](auto *s, const auto &p) { emit s->jcSwitchOffPurgeResult (p[0].toInt (), p[1].toInt () == 1); } } },
+ { "CF_JC_RESET_SETTINGS_ALL_PRINTHEADS", { ResponseShape::JcSuccess, 2,
+ [](auto *s, const auto &p) { emit s->jcResetSettingsAllPrintheadsResult (p[0].toInt (), p[1].toInt () == 1); } } },
+ { "CF_JC_REBOOT_ALL_PRINTHEADS", { ResponseShape::JcSuccess, 2,
+ [](auto *s, const auto &p) { emit s->jcRebootAllPrintheadsResult (p[0].toInt (), p[1].toInt () == 1); } } },
+ { "CF_JC_RESET_CONTROLLER_SOFTWARE", { ResponseShape::JcSuccess, 2,
+ [](auto *s, const auto &p) { emit s->jcResetControllerSoftwareResult (p[0].toInt (), p[1].toInt () == 1); } } },
+ { "CF_JC_RESTART", { ResponseShape::JcSuccess, 2,
+ [](auto *s, const auto &p) { emit s->jcRestartResult (p[0].toInt (), p[1].toInt () == 1); } } },
+ { "CF_JC_SHUTDOWN", { ResponseShape::JcSuccess, 2,
+ [](auto *s, const auto &p) { emit s->jcShutdownResult (p[0].toInt (), p[1].toInt () == 1); } } },
+ { "CF_JC_SAVE_ALL_PRINTHEAD_SETTINGS", { ResponseShape::JcSuccess, 2,
+ [](auto *s, const auto &p) { emit s->jcSaveAllPrintheadSettingsResult (p[0].toInt (), p[1].toInt () == 1); } } },
+
+ /* CF_ PH success shape: controllerId, phId, successFlag */
+ { "CF_PH_SET_ID", { ResponseShape::PhSuccess, 3,
+ [](auto *s, const auto &p) { emit s->phSetIdResult (p[0].toInt (), p[1].toInt (), p[2].toInt () == 1); } } },
+ { "CF_PH_SAVE_CALIBRATION", { ResponseShape::PhSuccess, 3,
+ [](auto *s, const auto &p) { emit s->phSaveCalibrationResult (p[0].toInt (), p[1].toInt (), p[2].toInt () == 1); } } },
+ { "CF_PH_RESET_CALIBRATION", { ResponseShape::PhSuccess, 3,
+ [](auto *s, const auto &p) { emit s->phResetCalibrationResult (p[0].toInt (), p[1].toInt (), p[2].toInt () == 1); } } },
+ { "CF_PH_RESET_ALL_SETTINGS", { ResponseShape::PhSuccess, 3,
+ [](auto *s, const auto &p) { emit s->phResetAllSettingsResult (p[0].toInt (), p[1].toInt (), p[2].toInt () == 1); } } },
+ { "CF_PH_REBOOT", { ResponseShape::PhSuccess, 3,
+ [](auto *s, const auto &p) { emit s->phRebootResult (p[0].toInt (), p[1].toInt (), p[2].toInt () == 1); } } },
+ { "CF_PH_SAVE_SETTINGS", { ResponseShape::PhSuccess, 3,
+ [](auto *s, const auto &p) { emit s->phSaveSettingsResult (p[0].toInt (), p[1].toInt (), p[2].toInt () == 1); } } },
+
+ /* CF_ purge settings: controllerId, purgeInterval, purgeTime, successFlag */
+ { "CF_JC_SET_PURGE_SETTINGS", { ResponseShape::PurgeSettings, 4,
+ [](auto *s, const auto &p) { emit s->jcSetPurgeSettingsResult (p[0].toInt (), p[1].toInt (), p[2].toInt (), p[3].toInt () == 1); } } },
+
+ /* CF_ JC jetting params: cid, dutyCycle, pwmFreq, drive, nozzleDriveFreq, nozzleDriveDutyCycle, successFlag */
+ { "CF_JC_SET_JETTING_PARAMS", { ResponseShape::JcJettingParams, 7,
+ [](auto *s, const auto &p) { emit s->jcSetJettingParamsResult (p[0].toInt (), p[1].toInt (), p[2].toInt (), p[3].toInt (), p[4].toInt (), p[5].toInt (), static_cast<Xpl2Protocol::JettingParamsResult> (p[6].toInt ())); } } },
+
+ /* CF_ PH jetting params: cid, phId, dutyCycle, pwmFreq, drive, nozzleDriveFreq, nozzleDriveDutyCycle, successFlag */
+ { "CF_PH_SET_JETTING_PARAMS", { ResponseShape::PhJettingParams, 8,
+ [](auto *s, const auto &p) { emit s->phSetJettingParamsResult (p[0].toInt (), p[1].toInt (), p[2].toInt (), p[3].toInt (), p[4].toInt (), p[5].toInt (), p[6].toInt (), static_cast<Xpl2Protocol::JettingParamsResult> (p[7].toInt ())); } } },
+ { "CF_PH_GET_JETTING_PARAMS", { ResponseShape::PhJettingParams, 8,
+ [](auto *s, const auto &p) { emit s->phGetJettingParamsResult (p[0].toInt (), p[1].toInt (), p[2].toInt (), p[3].toInt (), p[4].toInt (), p[5].toInt (), p[6].toInt (), static_cast<Xpl2Protocol::JettingParamsResult> (p[7].toInt ())); } } },
+
+ /* CF_ JC setter: cid, saveNewValue, setterId, newValue, successFlag */
+ { "CF_JC_SETTER", { ResponseShape::JcSetter, 5,
+ [](auto *s, const auto &p) { emit s->jcSetterResult (p[0].toInt (), p[1].toInt () != 0, p[2].toInt (), p[3].toString (), static_cast<Xpl2Protocol::SetterResult> (p[4].toInt ())); } } },
+
+ /* CF_ PH setter: cid, phId, saveNewValue, setterId, newValue, successFlag */
+ { "CF_PH_SETTER", { ResponseShape::PhSetter, 6,
+ [](auto *s, const auto &p) { emit s->phSetterResult (p[0].toInt (), p[1].toInt (), p[2].toInt () != 0, p[3].toInt (), p[4].toString (), static_cast<Xpl2Protocol::SetterResult> (p[5].toInt ())); } } },
+
+ /* CF_ JC getter: cid, savedValue, getterId, currentValue, successFlag */
+ { "CF_JC_GETTER", { ResponseShape::JcGetter, 5,
+ [](auto *s, const auto &p) { emit s->jcGetterResult (p[0].toInt (), p[1].toInt () != 0, p[2].toInt (), p[3].toString (), p[4].toInt () == 1); } } },
+
+ /* CF_ PH getter: cid, phId, savedValue, getterId, currentValue, successFlag */
+ { "CF_PH_GETTER", { ResponseShape::PhGetter, 6,
+ [](auto *s, const auto &p) { emit s->phGetterResult (p[0].toInt (), p[1].toInt (), p[2].toInt () != 0, p[3].toInt (), p[4].toString (), p[5].toInt () == 1); } } },
};
// clang-format on
@@ -313,6 +379,166 @@ Xpl2Client::phNozzlesDisabled (int printheadId, const QString &mask)
}
/* ------------------------------------------------------------------ */
+/* CF_ Configuration commands */
+/* ------------------------------------------------------------------ */
+
+void
+Xpl2Client::phSetId (int printheadId)
+{
+ sendCommand (m_commandSocket, "CF_PH_SET_ID", { printheadId });
+}
+
+void
+Xpl2Client::phDeassignId ()
+{
+ sendCommand (m_commandSocket, "CF_PH_DEASSIGN_ID");
+}
+
+void
+Xpl2Client::jcSetJettingParams (int dutyCycle, int pwmFreq, int drive,
+ int nozzleDriveFreq, int nozzleDriveDutyCycle)
+{
+ sendCommand (
+ m_commandSocket, "CF_JC_SET_JETTING_PARAMS",
+ { dutyCycle, pwmFreq, drive, nozzleDriveFreq, nozzleDriveDutyCycle });
+}
+
+void
+Xpl2Client::phSetJettingParams (int printheadId, int dutyCycle, int pwmFreq,
+ int drive, int nozzleDriveFreq,
+ int nozzleDriveDutyCycle)
+{
+ sendCommand (m_commandSocket, "CF_PH_SET_JETTING_PARAMS",
+ { printheadId, dutyCycle, pwmFreq, drive, nozzleDriveFreq,
+ nozzleDriveDutyCycle });
+}
+
+void
+Xpl2Client::phGetJettingParams (int printheadId)
+{
+ sendCommand (m_commandSocket, "CF_PH_GET_JETTING_PARAMS", { printheadId });
+}
+
+void
+Xpl2Client::jcSaveCalibration ()
+{
+ sendCommand (m_commandSocket, "CF_JC_SAVE_CALIBRATION");
+}
+
+void
+Xpl2Client::phSaveCalibration (int printheadId)
+{
+ sendCommand (m_commandSocket, "CF_PH_SAVE_CALIBRATION", { printheadId });
+}
+
+void
+Xpl2Client::jcResetCalibration ()
+{
+ sendCommand (m_commandSocket, "CF_JC_RESET_CALIBRATION");
+}
+
+void
+Xpl2Client::phResetCalibration (int printheadId)
+{
+ sendCommand (m_commandSocket, "CF_PH_RESET_CALIBRATION", { printheadId });
+}
+
+void
+Xpl2Client::jcSetPurgeSettings (int purgeIntervalMs, int purgeTimeMs)
+{
+ sendCommand (m_commandSocket, "CF_JC_SET_PURGE_SETTINGS",
+ { purgeIntervalMs, purgeTimeMs });
+}
+
+void
+Xpl2Client::jcSwitchOffPurge ()
+{
+ sendCommand (m_commandSocket, "CF_JC_SWITCH_OFF_PURGE");
+}
+
+void
+Xpl2Client::jcSetter (bool saveNewValue, int setterId, const QString &newValue)
+{
+ sendCommand (m_commandSocket, "CF_JC_SETTER",
+ { saveNewValue, setterId, newValue });
+}
+
+void
+Xpl2Client::phSetter (int printheadId, bool saveNewValue, int setterId,
+ const QString &newValue)
+{
+ sendCommand (m_commandSocket, "CF_PH_SETTER",
+ { printheadId, saveNewValue, setterId, newValue });
+}
+
+void
+Xpl2Client::jcGetter (bool getSavedValue, int getterId)
+{
+ sendCommand (m_commandSocket, "CF_JC_GETTER", { getSavedValue, getterId });
+}
+
+void
+Xpl2Client::phGetter (int printheadId, bool getSavedValue, int getterId)
+{
+ sendCommand (m_commandSocket, "CF_PH_GETTER",
+ { printheadId, getSavedValue, getterId });
+}
+
+void
+Xpl2Client::jcResetSettingsAllPrintheads ()
+{
+ sendCommand (m_commandSocket, "CF_JC_RESET_SETTINGS_ALL_PRINTHEADS");
+}
+
+void
+Xpl2Client::phResetAllSettings (int printheadId)
+{
+ sendCommand (m_commandSocket, "CF_PH_RESET_ALL_SETTINGS", { printheadId });
+}
+
+void
+Xpl2Client::jcRebootAllPrintheads ()
+{
+ sendCommand (m_commandSocket, "CF_JC_REBOOT_ALL_PRINTHEADS");
+}
+
+void
+Xpl2Client::phReboot (int printheadId)
+{
+ sendCommand (m_commandSocket, "CF_PH_REBOOT", { printheadId });
+}
+
+void
+Xpl2Client::jcResetControllerSoftware ()
+{
+ sendCommand (m_commandSocket, "CF_JC_RESET_CONTROLLER_SOFTWARE");
+}
+
+void
+Xpl2Client::jcRestart ()
+{
+ sendCommand (m_commandSocket, "CF_JC_RESTART");
+}
+
+void
+Xpl2Client::jcShutdown ()
+{
+ sendCommand (m_commandSocket, "CF_JC_SHUTDOWN");
+}
+
+void
+Xpl2Client::jcSaveAllPrintheadSettings ()
+{
+ sendCommand (m_commandSocket, "CF_JC_SAVE_ALL_PRINTHEAD_SETTINGS");
+}
+
+void
+Xpl2Client::phSaveSettings (int printheadId)
+{
+ sendCommand (m_commandSocket, "CF_PH_SAVE_SETTINGS", { printheadId });
+}
+
+/* ------------------------------------------------------------------ */
/* Send / dispatch */
/* ------------------------------------------------------------------ */
@@ -495,6 +721,63 @@ Xpl2Client::dispatchResponse (const QByteArray &command,
.arg (params[2].toInt ())
.arg (params[3].toInt () == 1);
break;
+ case ResponseShape::PurgeSettings:
+ logStr = QStringLiteral (
+ "RX %1: controller=%2 interval=%3 time=%4 success=%5")
+ .arg (cmd)
+ .arg (cid)
+ .arg (params[1].toInt ())
+ .arg (params[2].toInt ())
+ .arg (params[3].toInt () == 1);
+ break;
+ case ResponseShape::JcJettingParams:
+ logStr = QStringLiteral ("RX %1: controller=%2 result=%3")
+ .arg (cmd)
+ .arg (cid)
+ .arg (params[6].toInt ());
+ break;
+ case ResponseShape::PhJettingParams:
+ logStr = QStringLiteral ("RX %1: controller=%2 ph=%3 result=%4")
+ .arg (cmd)
+ .arg (cid)
+ .arg (params[1].toInt ())
+ .arg (params[7].toInt ());
+ break;
+ case ResponseShape::JcSetter:
+ logStr = QStringLiteral ("RX %1: controller=%2 setter=%3 result=%4")
+ .arg (cmd)
+ .arg (cid)
+ .arg (params[2].toInt ())
+ .arg (params[4].toInt ());
+ break;
+ case ResponseShape::PhSetter:
+ logStr
+ = QStringLiteral ("RX %1: controller=%2 ph=%3 setter=%4 result=%5")
+ .arg (cmd)
+ .arg (cid)
+ .arg (params[1].toInt ())
+ .arg (params[3].toInt ())
+ .arg (params[5].toInt ());
+ break;
+ case ResponseShape::JcGetter:
+ logStr = QStringLiteral ("RX %1: controller=%2 getter=%3 value=%4 "
+ "success=%5")
+ .arg (cmd)
+ .arg (cid)
+ .arg (params[2].toInt ())
+ .arg (params[3].toString ())
+ .arg (params[4].toInt () == 1);
+ break;
+ case ResponseShape::PhGetter:
+ logStr = QStringLiteral ("RX %1: controller=%2 ph=%3 getter=%4 "
+ "value=%5 success=%6")
+ .arg (cmd)
+ .arg (cid)
+ .arg (params[1].toInt ())
+ .arg (params[3].toInt ())
+ .arg (params[4].toString ())
+ .arg (params[5].toInt () == 1);
+ break;
}
qDebug ("%s %s", qPrintable (logTag (socket)), qPrintable (logStr));
diff --git a/src/Xpl2Client.h b/src/Xpl2Client.h
index c9da25d..78eca0a 100644
--- a/src/Xpl2Client.h
+++ b/src/Xpl2Client.h
@@ -98,6 +98,65 @@ public:
/** Disable nozzles on one printhead using a 12-char mask. */
Q_INVOKABLE void phNozzlesDisabled (int printheadId, const QString &mask);
+ /* -- CF_ Configuration commands ----------------------------------- */
+
+ /** Set the printhead ID. */
+ Q_INVOKABLE void phSetId (int printheadId);
+ /** De-assign the printhead ID. */
+ Q_INVOKABLE void phDeassignId ();
+ /** Set jetting parameters for all printheads on the controller. */
+ Q_INVOKABLE void jcSetJettingParams (int dutyCycle, int pwmFreq, int drive,
+ int nozzleDriveFreq,
+ int nozzleDriveDutyCycle);
+ /** Set jetting parameters for one printhead. */
+ Q_INVOKABLE void phSetJettingParams (int printheadId, int dutyCycle,
+ int pwmFreq, int drive,
+ int nozzleDriveFreq,
+ int nozzleDriveDutyCycle);
+ /** Get jetting parameters from one printhead. */
+ Q_INVOKABLE void phGetJettingParams (int printheadId);
+ /** Save calibration for all printheads. */
+ Q_INVOKABLE void jcSaveCalibration ();
+ /** Save calibration for one printhead. */
+ Q_INVOKABLE void phSaveCalibration (int printheadId);
+ /** Reset calibration for all printheads. */
+ Q_INVOKABLE void jcResetCalibration ();
+ /** Reset calibration for one printhead. */
+ Q_INVOKABLE void phResetCalibration (int printheadId);
+ /** Set purge settings for all printheads on the controller. */
+ Q_INVOKABLE void jcSetPurgeSettings (int purgeIntervalMs, int purgeTimeMs);
+ /** Switch off purge for all printheads on the controller. */
+ Q_INVOKABLE void jcSwitchOffPurge ();
+ /** Set a JC setting by setter ID. */
+ Q_INVOKABLE void jcSetter (bool saveNewValue, int setterId,
+ const QString &newValue);
+ /** Set a PH setting by setter ID. */
+ Q_INVOKABLE void phSetter (int printheadId, bool saveNewValue, int setterId,
+ const QString &newValue);
+ /** Get a JC setting by getter ID. */
+ Q_INVOKABLE void jcGetter (bool getSavedValue, int getterId);
+ /** Get a PH setting by getter ID. */
+ Q_INVOKABLE void phGetter (int printheadId, bool getSavedValue,
+ int getterId);
+ /** Reset settings for all printheads on the controller. */
+ Q_INVOKABLE void jcResetSettingsAllPrintheads ();
+ /** Reset all settings for one printhead. */
+ Q_INVOKABLE void phResetAllSettings (int printheadId);
+ /** Reboot all printheads on the controller. */
+ Q_INVOKABLE void jcRebootAllPrintheads ();
+ /** Reboot one printhead. */
+ Q_INVOKABLE void phReboot (int printheadId);
+ /** Reset the Jetting Controller software. */
+ Q_INVOKABLE void jcResetControllerSoftware ();
+ /** Restart the Jetting Controller. */
+ Q_INVOKABLE void jcRestart ();
+ /** Shut down the Jetting Controller. */
+ Q_INVOKABLE void jcShutdown ();
+ /** Save settings for all printheads on the controller. */
+ Q_INVOKABLE void jcSaveAllPrintheadSettings ();
+ /** Save settings for one printhead. */
+ Q_INVOKABLE void phSaveSettings (int printheadId);
+
signals:
void hostChanged ();
void connectedChanged ();
@@ -143,6 +202,52 @@ signals:
void phNozzlesDisabledResult (int controllerId, int printheadId,
bool success);
+ /* CF_ response signals */
+ void phSetIdResult (int controllerId, int printheadId, bool success);
+ void phDeassignIdResult (int controllerId, bool success);
+ void jcSetJettingParamsResult (int controllerId, int dutyCycle, int pwmFreq,
+ int drive, int nozzleDriveFreq,
+ int nozzleDriveDutyCycle,
+ Xpl2Protocol::JettingParamsResult result);
+ void phSetJettingParamsResult (int controllerId, int printheadId,
+ int dutyCycle, int pwmFreq, int drive,
+ int nozzleDriveFreq, int nozzleDriveDutyCycle,
+ Xpl2Protocol::JettingParamsResult result);
+ void phGetJettingParamsResult (int controllerId, int printheadId,
+ int dutyCycle, int pwmFreq, int drive,
+ int nozzleDriveFreq, int nozzleDriveDutyCycle,
+ Xpl2Protocol::JettingParamsResult result);
+ void jcSaveCalibrationResult (int controllerId, bool success);
+ void phSaveCalibrationResult (int controllerId, int printheadId,
+ bool success);
+ void jcResetCalibrationResult (int controllerId, bool success);
+ void phResetCalibrationResult (int controllerId, int printheadId,
+ bool success);
+ void jcSetPurgeSettingsResult (int controllerId, int purgeIntervalMs,
+ int purgeTimeMs, bool success);
+ void jcSwitchOffPurgeResult (int controllerId, bool success);
+ void jcSetterResult (int controllerId, bool saveNewValue, int setterId,
+ const QString &newValue,
+ Xpl2Protocol::SetterResult result);
+ void phSetterResult (int controllerId, int printheadId, bool saveNewValue,
+ int setterId, const QString &newValue,
+ Xpl2Protocol::SetterResult result);
+ void jcGetterResult (int controllerId, bool savedValue, int getterId,
+ const QString &currentValue, bool success);
+ void phGetterResult (int controllerId, int printheadId, bool savedValue,
+ int getterId, const QString &currentValue,
+ bool success);
+ void jcResetSettingsAllPrintheadsResult (int controllerId, bool success);
+ void phResetAllSettingsResult (int controllerId, int printheadId,
+ bool success);
+ void jcRebootAllPrintheadsResult (int controllerId, bool success);
+ void phRebootResult (int controllerId, int printheadId, bool success);
+ void jcResetControllerSoftwareResult (int controllerId, bool success);
+ void jcRestartResult (int controllerId, bool success);
+ void jcShutdownResult (int controllerId, bool success);
+ void jcSaveAllPrintheadSettingsResult (int controllerId, bool success);
+ void phSaveSettingsResult (int controllerId, int printheadId, bool success);
+
private slots:
void onSocketConnected ();
void onSocketDisconnected ();
@@ -164,7 +269,14 @@ private:
PhSuccess,
CalData,
BaseFreq,
- StatusStart
+ StatusStart,
+ PurgeSettings,
+ JcJettingParams,
+ PhJettingParams,
+ JcSetter,
+ PhSetter,
+ JcGetter,
+ PhGetter
};
struct ResponseEntry
diff --git a/src/Xpl2Protocol.h b/src/Xpl2Protocol.h
index 6d4a348..85d6895 100644
--- a/src/Xpl2Protocol.h
+++ b/src/Xpl2Protocol.h
@@ -5,11 +5,36 @@
#pragma once
#include <QByteArray>
+#include <QObject>
#include <QVariantList>
namespace Xpl2Protocol
{
+Q_NAMESPACE
+
+/** Extended success flag for CF_JC/PH_SET_JETTING_PARAMS responses. */
+enum class JettingParamsResult
+{
+ NozzleDriveDutyCycle = -5,
+ NozzleDriveFrequency = -4,
+ Drive = -3,
+ PwmFrequency = -2,
+ DutyCycle = -1,
+ Failed = 0,
+ Ok = 1
+};
+Q_ENUM_NS (JettingParamsResult)
+
+/** Extended success flag for CF_JC/PH_SETTER responses. */
+enum class SetterResult
+{
+ IncorrectNewValue = -1,
+ Failed = 0,
+ Ok = 1
+};
+Q_ENUM_NS (SetterResult)
+
constexpr char Terminator = '\n';
struct ParsedMessage