aboutsummaryrefslogtreecommitdiffstats
path: root/src/Xpl2Client.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Xpl2Client.cpp')
-rw-r--r--src/Xpl2Client.cpp283
1 files changed, 283 insertions, 0 deletions
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));