diff options
| author | Thomas Vanbesien <tvanbesi@proton.me> | 2026-03-16 16:48:34 +0100 |
|---|---|---|
| committer | Thomas Vanbesien <tvanbesi@proton.me> | 2026-03-16 16:48:34 +0100 |
| commit | f2251311a8523b6c24839ccd1e6834ef065c679f (patch) | |
| tree | 56d89508f564281c6a8ae09f3e7c05d214c87170 /src/Xpl2Client.cpp | |
| parent | fa095de6cc8ec5a5b5c14091f2b3179ad7071876 (diff) | |
| download | QtXpl2-f2251311a8523b6c24839ccd1e6834ef065c679f.tar.gz QtXpl2-f2251311a8523b6c24839ccd1e6834ef065c679f.zip | |
Imaging (m/n) commands: start/stop, masks, image count, n reply
Diffstat (limited to 'src/Xpl2Client.cpp')
| -rw-r--r-- | src/Xpl2Client.cpp | 66 |
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 ()); } |
