aboutsummaryrefslogtreecommitdiffstats
path: root/src/Xpl2Client.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Xpl2Client.cpp')
-rw-r--r--src/Xpl2Client.cpp66
1 files changed, 65 insertions, 1 deletions
diff --git a/src/Xpl2Client.cpp b/src/Xpl2Client.cpp
index ac7079f..d3a6da2 100644
--- a/src/Xpl2Client.cpp
+++ b/src/Xpl2Client.cpp
@@ -559,6 +559,52 @@ Xpl2Client::phSaveSettings (int printheadId)
}
/* ------------------------------------------------------------------ */
+/* Imaging (m/n) commands */
+/* ------------------------------------------------------------------ */
+
+void
+Xpl2Client::imagingStart (double speed)
+{
+ sendCommand (m_imagingSocket, "m2", { speed });
+}
+
+void
+Xpl2Client::imagingStop ()
+{
+ sendCommand (m_imagingSocket, "m4");
+}
+
+void
+Xpl2Client::imageMaskStart (const QString &mask)
+{
+ sendCommand (m_imagingSocket, "m0", { mask });
+}
+
+void
+Xpl2Client::imageMaskEnd (const QString &tail)
+{
+ sendCommand (m_imagingSocket, "m1", { tail });
+}
+
+void
+Xpl2Client::dutyCycleMaskStart (const QString &mask)
+{
+ sendCommand (m_imagingSocket, "m5", { mask });
+}
+
+void
+Xpl2Client::dutyCycleMaskEnd (const QString &tail)
+{
+ sendCommand (m_imagingSocket, "m6", { tail });
+}
+
+void
+Xpl2Client::imageCount ()
+{
+ sendCommand (m_imagingSocket, "m3");
+}
+
+/* ------------------------------------------------------------------ */
/* Send / dispatch */
/* ------------------------------------------------------------------ */
@@ -605,7 +651,25 @@ Xpl2Client::dispatchImagingMessage (const Xpl2Protocol::ParsedMessage &msg)
handleKaPing (m_imagingSocket);
else if (msg.command == "EV_SHUTTING_DOWN")
emit shuttingDown ();
- else
+ else if (msg.command == "n")
+ {
+ int lines = 0;
+ if (!msg.params.isEmpty ())
+ lines = msg.params[0].toString ().toInt (nullptr, 16);
+ qDebug ("%s n imageLines=%d", qPrintable (logTag (&m_imagingSocket)),
+ lines);
+ emit statusMessage (QStringLiteral ("RX n: imageLines=%1").arg (lines));
+ emit imagingReply (lines);
+ }
+ else if (msg.command == "m4")
+ {
+ bool ok = !msg.params.isEmpty () && msg.params[0].toInt () == 1;
+ qDebug ("%s m4 success=%d", qPrintable (logTag (&m_imagingSocket)),
+ ok);
+ emit statusMessage (QStringLiteral ("RX m4: success=%1").arg (ok));
+ emit imagingStopResult (ok);
+ }
+ else if (!dispatchResponse (msg.command, msg.params, &m_imagingSocket))
qWarning ("%s Unknown command: %s", qPrintable (logTag (&m_imagingSocket)),
msg.command.constData ());
}