MCPcopy Create free account
hub / github.com/awawa-dev/HyperHDR / handleLutCalibrationCommand

Method handleLutCalibrationCommand

sources/api/HyperAPI.cpp:988–1022  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

986}
987
988void HyperAPI::handleLutCalibrationCommand(const QJsonObject& message, const QString& command, int tan)
989{
990 QString subcommand = message["subcommand"].toString("");
991
992 if (subcommand == "capture")
993 {
994 bool debug = message["debug"].toBool(false);
995 bool lchCorrection = message["lch_correction"].toBool(false);
996
997 QThread* lutThread = new QThread();
998 LutCalibrator* lutCalibrator = new LutCalibrator(_instanceManager->getRootPath(), getActiveComponent(), debug, lchCorrection);
999 lutCalibrator->moveToThread(lutThread);
1000 connect(lutThread, &QThread::finished, lutCalibrator, &LutCalibrator::deleteLater);
1001 connect(lutThread, &QThread::started, lutCalibrator, &LutCalibrator::startHandler);
1002 connect(lutCalibrator, &LutCalibrator::SignalLutCalibrationUpdated, this, &CallbackAPI::lutCalibrationUpdateHandler);
1003
1004 _lutCalibratorThread = std::unique_ptr<QThread, std::function<void(QThread*)>>(lutThread,
1005 [lutCalibrator](QThread* mqttThread) {
1006 lutCalibrator->cancelCalibrationSafe();
1007 THREAD_REMOVER(QString("LutCalibrator"), mqttThread, lutCalibrator);
1008 });
1009 _lutCalibratorThread->start();
1010 }
1011 else if (_lutCalibratorThread != nullptr && subcommand == "stop")
1012 {
1013 _lutCalibratorThread = nullptr;
1014 }
1015 else
1016 {
1017 sendErrorReply("The command does not have any effect", command + "-" + subcommand, tan);
1018 return;
1019 }
1020
1021 sendSuccessReply(command, tan);
1022}
1023
1024void HyperAPI::handleInstanceCommand(const QJsonObject& message, const QString& command, int tan)
1025{

Callers

nothing calls this directly

Calls 6

sendErrorReplyFunction · 0.85
sendSuccessReplyFunction · 0.85
getRootPathMethod · 0.80
cancelCalibrationSafeMethod · 0.80
toStringMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected