7#include "sequencejob.h"
9#include <knotification.h>
10#include <ekos_capture_debug.h>
11#include "capturedeviceadaptor.h"
12#include "skyobjects/skypoint.h"
13#include "ksnotification.h"
15#define MF_TIMER_TIMEOUT 90000
16#define MF_RA_DIFF_LIMIT 4
20QString const &SequenceJob::ISOMarker(
"_ISO8601");
35SequenceJob::SequenceJob(XMLEle * root,
QString targetName)
39 sharedState.
reset(
new CameraState);
40 state.
reset(
new SequenceJobState(sharedState));
42 devices.
reset(
new CaptureDeviceAdaptor());
44 init(SequenceJob::JOBTYPE_BATCH, root, sharedState, targetName);
49 SequenceJobType jobType, XMLEle *root,
QString targetName)
52 init(jobType, root, sharedState, targetName);
55void Ekos::SequenceJob::init(SequenceJobType jobType, XMLEle *root,
60 state.reset(
new SequenceJobState(sharedState));
62 loadFrom(root, targetName, jobType);
65 connect(state.data(), &SequenceJobState::prepareState,
this, &SequenceJob::prepareState);
66 connect(state.data(), &SequenceJobState::prepareComplete,
this, &SequenceJob::processPrepareComplete);
67 connect(state.data(), &SequenceJobState::abortCapture,
this, &SequenceJob::processAbortCapture);
68 connect(state.data(), &SequenceJobState::newLog,
this, &SequenceJob::newLog);
70 connect(state.data(), &SequenceJobState::initCaptureComplete,
this, &SequenceJob::capture);
77 auto placeholderPath = Ekos::PlaceholderPath();
78 placeholderPath.processJobInfo(
this);
81void SequenceJob::resetStatus(JOBStatus status)
84 setCalibrationStage(SequenceJobState::CAL_NONE);
98 m_JobProgressIgnored =
false;
106void SequenceJob::abort()
108 setStatus(JOB_ABORTED);
109 if (devices.
data()->getActiveChip())
111 if (devices.
data()->getActiveChip()->canAbort())
112 devices.
data()->getActiveChip()->abortExposure();
113 devices.
data()->getActiveChip()->setBatchMode(
false);
117void SequenceJob::done()
122int SequenceJob::getJobRemainingTime(
double estimatedDownloadTime)
124 double remaining = (getCoreProperty(SJ_Exposure).
toDouble() +
125 estimatedDownloadTime +
126 getCoreProperty(SJ_Delay).
toDouble() / 1000) *
127 (getCoreProperty(SJ_Count).toDouble() - getCompleted());
129 if (getStatus() == JOB_BUSY)
131 if (getExposeLeft() > 0.0)
132 remaining -= getCoreProperty(SJ_Exposure).
toDouble() - getExposeLeft();
134 remaining += getExposeLeft() + estimatedDownloadTime;
137 return static_cast<int>(std::round(remaining));
140void SequenceJob::setStatus(JOBStatus
const in_status)
142 state->reset(in_status);
145void SequenceJob::setISO(
int index)
147 if (devices->getActiveChip())
149 setCoreProperty(SequenceJob::SJ_ISOIndex, index);
150 const auto isolist = devices->getActiveChip()->getISOList();
151 if (isolist.count() > index && index >= 0)
152 setCoreProperty(SequenceJob::SJ_ISO, isolist[index]);
158 if (!devices->getActiveCamera())
159 return QStringList({
"Light",
"Bias",
"Dark",
"Flat"});
161 ISD::CameraChip *tChip = devices->getActiveCamera()->getChip(ISD::CameraChip::PRIMARY_CCD);
163 return tChip->getFrameTypes();
168 if (devices->getFilterManager().isNull())
171 return devices->getFilterManager()->getFilterLabels();
175void SequenceJob::connectDeviceAdaptor()
177 devices->setCurrentSequenceJobState(state);
179 connect(state.
data(), &SequenceJobState::readCurrentState, devices.
data(),
180 &CaptureDeviceAdaptor::readCurrentState);
181 connect(state.
data(), &SequenceJobState::flatSyncFocus, devices.
data(),
182 &CaptureDeviceAdaptor::flatSyncFocus);
184 connect(devices.
data(), &CaptureDeviceAdaptor::flatSyncFocusChanged, state.
data(),
185 &SequenceJobState::flatSyncFocusChanged);
188void SequenceJob::disconnectDeviceAdaptor()
190 devices->disconnectDevices(state.
data());
192 &CaptureDeviceAdaptor::readCurrentState);
194 &CaptureDeviceAdaptor::flatSyncFocus);
196 &SequenceJobState::flatSyncFocusChanged);
199void SequenceJob::startCapturing(
bool autofocusReady, FITSMode mode)
201 state->initCapture(getFrameType(), jobType() == SequenceJob::JOBTYPE_PREVIEW, autofocusReady, mode);
204void SequenceJob::capture(FITSMode mode)
206 if (!devices.
data()->getActiveCamera() || !devices.
data()->getActiveChip())
210 QString logentry =
QString(
"Capture exposure = %1 sec, type = %2").
arg(getCoreProperty(SJ_Exposure).toDouble()).
arg(
211 CCDFrameTypeNames[getFrameType()]);
212 logentry.
append(
QString(
", filter = %1, upload mode = %2").arg(getCoreProperty(SJ_Filter).
toString()).arg(getUploadMode()));
214 devices.
data()->getActiveChip()->setBatchMode(jobType() != SequenceJob::JOBTYPE_PREVIEW);
215 devices.
data()->getActiveCamera()->setSeqPrefix(getCoreProperty(SJ_FullPrefix).
toString());
216 logentry.
append(
QString(
", batch mode = %1, seq prefix = %2").arg(jobType() != SequenceJob::JOBTYPE_PREVIEW ?
"true" :
217 "false").arg(getCoreProperty(SJ_FullPrefix).
toString()));
219 if (jobType() == SequenceJob::JOBTYPE_PREVIEW)
221 if (devices.
data()->getActiveCamera()->getUploadMode() != ISD::Camera::UPLOAD_CLIENT)
222 devices.
data()->getActiveCamera()->setUploadMode(ISD::Camera::UPLOAD_CLIENT);
225 devices.
data()->getActiveCamera()->setUploadMode(m_UploadMode);
231 auto customProp = devices.
data()->getActiveCamera()->getProperty(i.key());
237 switch (customProp.getType())
241 auto sp = customProp.getSwitch();
245 auto oneSwitch = sp->findWidgetByName(j.key().toLatin1().data());
247 oneSwitch->setState(
static_cast<ISState
>(j.value().toInt()));
249 devices.
data()->getActiveCamera()->sendNewProperty(sp);
254 auto tp = customProp.getText();
258 auto oneText = tp->findWidgetByName(j.key().toLatin1().data());
260 oneText->setText(j.value().toString().toLatin1().constData());
262 devices.
data()->getActiveCamera()->sendNewProperty(tp);
267 auto np = customProp.getNumber();
271 auto oneNumber = np->findWidgetByName(j.key().toLatin1().data());
273 oneNumber->setValue(j.value().toDouble());
275 devices.
data()->getActiveCamera()->sendNewProperty(np);
284 const auto remoteFormatDirectory = getCoreProperty(SJ_RemoteFormatDirectory).
toString();
285 const auto remoteFormatFilename = getCoreProperty(SJ_RemoteFormatFilename).
toString();
286 if (devices.
data()->getActiveChip()->isBatchMode() &&
287 remoteFormatDirectory.isEmpty() ==
false &&
288 remoteFormatFilename.isEmpty() ==
false)
290 devices.
data()->getActiveCamera()->updateUploadSettings(remoteFormatDirectory, remoteFormatFilename);
291 if (getUploadMode() != ISD::Camera::UPLOAD_CLIENT)
292 logentry.
append(
QString(
", remote dir = %1, remote format = %2").arg(remoteFormatDirectory).arg(remoteFormatFilename));
295 const int ISOIndex = getCoreProperty(SJ_ISOIndex).
toInt();
299 if (ISOIndex != devices.
data()->getActiveChip()->getISOIndex())
300 devices.
data()->getActiveChip()->setISOIndex(ISOIndex);
303 const auto gain = getCoreProperty(SJ_Gain).
toDouble();
307 devices.
data()->getActiveCamera()->setGain(gain);
310 const auto offset = getCoreProperty(SJ_Offset).
toDouble();
314 devices.
data()->getActiveCamera()->setOffset(offset);
317 devices.
data()->getActiveCamera()->setCaptureFormat(getCoreProperty(SJ_Format).
toString());
318 devices.
data()->getActiveCamera()->setEncodingFormat(getCoreProperty(SJ_Encoding).
toString());
319 devices.
data()->getActiveChip()->setFrameType(getFrameType());
320 logentry.
append(
QString(
", format = %1, encoding = %2").arg(getCoreProperty(SJ_Format).
toString()).arg(getCoreProperty(
324 int currentBinX = 1, currentBinY = 1;
325 devices.
data()->getActiveChip()->getBinning(¤tBinX, ¤tBinY);
327 const auto binning = getCoreProperty(SJ_Binning).
toPoint();
331 if (devices.
data()->getActiveChip()->canBin())
333 if (devices.
data()->getActiveChip()->setBinning(binning.x(), binning.y()) ==
false)
335 qCWarning(KSTARS_EKOS_CAPTURE()) <<
"Cannot set binning to " <<
"x =" << binning.x() <<
", y =" << binning.y();
336 setStatus(JOB_ERROR);
337 emit captureStarted(CAPTURE_BIN_ERROR);
340 logentry.
append(
QString(
", binning = %1x%2").arg(binning.x()).
arg(binning.y()));
346 const auto roi = getCoreProperty(SJ_ROI).
toRect();
348 if (devices.
data()->getActiveChip()->canSubframe())
350 if ((roi.width() > 0 && roi.height() > 0) && devices.
data()->getActiveChip()->setFrame(roi.x(),
354 currentBinX != binning.x()) ==
false)
356 qCWarning(KSTARS_EKOS_CAPTURE()) <<
"Cannot set ROI to " <<
"x =" << roi.x() <<
", y =" << roi.y() <<
", widht =" <<
357 roi.width() <<
"height =" << roi.height();
358 setStatus(JOB_ERROR);
359 emit captureStarted(CAPTURE_FRAME_ERROR);
362 logentry.
append(
QString(
", ROI = (%1+%2, %3+%4)").arg(roi.x()).
arg(roi.width()).
arg(roi.y()).
arg(roi.width()));
365 logentry.
append(
", Cannot subframe");
372 devices.
data()->getActiveChip()->setCaptureMode(mode);
373 devices.
data()->getActiveChip()->setCaptureFilter(FITS_NONE);
375 setStatus(getStatus());
377 const auto exposure = getCoreProperty(SJ_Exposure).
toDouble();
378 m_ExposeLeft = exposure;
379 devices.
data()->getActiveChip()->capture(exposure);
381 qCInfo(KSTARS_EKOS_CAPTURE()) << logentry;
383 emit captureStarted(CAPTURE_OK);
386void SequenceJob::setTargetFilter(
int pos,
const QString &name)
388 state->targetFilterID = pos;
389 setCoreProperty(SJ_Filter, name);
392double SequenceJob::getExposeLeft()
const
397void SequenceJob::setExposeLeft(
double value)
399 m_ExposeLeft = value;
403int SequenceJob::getCaptureRetires()
const
405 return m_CaptureRetires;
408void SequenceJob::setCaptureRetires(
int value)
410 m_CaptureRetires = value;
413int SequenceJob::getCurrentFilter()
const
415 return state->m_CameraState->currentFilterID;
418ISD::Mount::PierSide SequenceJob::getPierSide()
const
420 return state->m_CameraState->getPierSide();
424void SequenceJob::setUploadMode(ISD::Camera::UploadMode value)
426 m_UploadMode = value;
429ISD::Camera::UploadMode SequenceJob::getUploadMode()
const
435void SequenceJob::setCalibrationPreAction(uint32_t value)
437 state->m_CalibrationPreAction = value;
440uint32_t SequenceJob::getCalibrationPreAction()
const
442 return state->m_CalibrationPreAction;
445void SequenceJob::setWallCoord(
const SkyPoint &value)
447 state->wallCoord = value;
450const SkyPoint &SequenceJob::getWallCoord()
const
452 return state->wallCoord;
456void SequenceJob::setFlatFieldDuration(FlatFieldDuration value)
458 m_FlatFieldDuration = value;
462FlatFieldDuration SequenceJob::getFlatFieldDuration()
const
464 return m_FlatFieldDuration;
467void SequenceJob::setJobProgressIgnored(
bool value)
469 m_JobProgressIgnored = value;
472bool SequenceJob::getJobProgressIgnored()
const
474 return m_JobProgressIgnored;
477void SequenceJob::updateDeviceStates()
479 setLightBox(devices->lightBox());
480 addMount(devices->mount());
481 setDome(devices->dome());
482 setDustCap(devices->dustCap());
487 state->m_CameraState->hasLightBox = (lightBox !=
nullptr);
492 state->m_CameraState->hasDustCap = (dustCap !=
nullptr);
497 state->m_CameraState->hasTelescope = (scope !=
nullptr);
500void SequenceJob::setDome(
ISD::Dome * dome)
502 state->m_CameraState->hasDome = (dome !=
nullptr);
505double SequenceJob::currentTemperature()
const
507 return devices->cameraTemperature();
510double SequenceJob::currentGain()
const
512 return devices->cameraGain();
515double SequenceJob::currentOffset()
const
517 return devices->cameraOffset();
520void SequenceJob::prepareCapture()
523 switch (getFrameType())
526 state->prepareLightFrameCapture(getCoreProperty(SJ_EnforceTemperature).toBool(),
527 jobType() == SequenceJob::JOBTYPE_PREVIEW);
530 state->prepareFlatFrameCapture(getCoreProperty(SJ_EnforceTemperature).toBool(),
531 jobType() == SequenceJob::JOBTYPE_PREVIEW);
534 state->prepareDarkFrameCapture(getCoreProperty(SJ_EnforceTemperature).toBool(),
535 jobType() == SequenceJob::JOBTYPE_PREVIEW);
538 state->prepareBiasFrameCapture(getCoreProperty(SJ_EnforceTemperature).toBool(),
539 jobType() == SequenceJob::JOBTYPE_PREVIEW);
543 processPrepareComplete();
548void SequenceJob::processPrepareComplete(
bool success)
550 emit prepareComplete(success);
553void SequenceJob::processAbortCapture()
555 disconnectDeviceAdaptor();
559IPState SequenceJob::checkFlatFramePendingTasksCompleted()
565void SequenceJob::setCoreProperty(PropertyID
id,
const QVariant &value)
570 case SJ_RemoteDirectory:
573 if (remoteDir.endsWith(
'/'))
576 m_CoreProperties[id] = remoteDir;
585 m_CoreProperties[id] = value;
588QVariant SequenceJob::getCoreProperty(PropertyID
id)
const
590 return m_CoreProperties[id];
593void SequenceJob::loadFrom(XMLEle *root,
const QString &targetName, SequenceJobType jobType)
598 m_CoreProperties[SJ_Exposure] = -1;
599 m_CoreProperties[SJ_Gain] = -1;
600 m_CoreProperties[SJ_Offset] = -1;
601 m_CoreProperties[SJ_ISOIndex] = -1;
602 m_CoreProperties[SJ_Count] = -1;
603 m_CoreProperties[SJ_Delay] = -1;
604 m_CoreProperties[SJ_Binning] =
QPoint(1, 1);
605 m_CoreProperties[SJ_ROI] =
QRect(0, 0, 0, 0);
606 m_CoreProperties[SJ_EnforceTemperature] =
false;
607 m_CoreProperties[SJ_GuiderActive] =
false;
608 m_CoreProperties[SJ_DitherPerJobFrequency] = 0;
609 m_CoreProperties[SJ_Encoding] =
"FITS";
612 if (targetName !=
"")
613 setCoreProperty(SequenceJob::SJ_TargetName, targetName);
618 bool isDarkFlat =
false;
623 for (ep = nextXMLEle(root, 1); ep !=
nullptr; ep = nextXMLEle(root, 0))
625 if (!strcmp(tagXMLEle(ep),
"Exposure"))
626 setCoreProperty(SequenceJob::SJ_Exposure, cLocale.
toDouble(pcdataXMLEle(ep)));
627 else if (!strcmp(tagXMLEle(ep),
"Format"))
628 setCoreProperty(SequenceJob::SJ_Format,
QString(pcdataXMLEle(ep)));
629 else if (!strcmp(tagXMLEle(ep),
"Encoding"))
631 setCoreProperty(SequenceJob::SJ_Encoding,
QString(pcdataXMLEle(ep)));
633 else if (!strcmp(tagXMLEle(ep),
"Binning"))
636 subEP = findXMLEle(ep,
"X");
638 binning.setX(cLocale.
toInt(pcdataXMLEle(subEP)));
639 subEP = findXMLEle(ep,
"Y");
641 binning.setY(cLocale.
toInt(pcdataXMLEle(subEP)));
643 setCoreProperty(SequenceJob::SJ_Binning, binning);
645 else if (!strcmp(tagXMLEle(ep),
"Frame"))
647 QRect roi(0, 0, 0, 0);
648 subEP = findXMLEle(ep,
"X");
650 roi.setX(cLocale.
toInt(pcdataXMLEle(subEP)));
651 subEP = findXMLEle(ep,
"Y");
653 roi.setY(cLocale.
toInt(pcdataXMLEle(subEP)));
654 subEP = findXMLEle(ep,
"W");
656 roi.setWidth(cLocale.
toInt(pcdataXMLEle(subEP)));
657 subEP = findXMLEle(ep,
"H");
659 roi.setHeight(cLocale.
toInt(pcdataXMLEle(subEP)));
661 setCoreProperty(SequenceJob::SJ_ROI, roi);
663 else if (!strcmp(tagXMLEle(ep),
"Temperature"))
665 setTargetTemperature(cLocale.
toDouble(pcdataXMLEle(ep)));
668 if (!strcmp(findXMLAttValu(ep,
"force"),
"true"))
669 setCoreProperty(SequenceJob::SJ_EnforceTemperature,
true);
670 else if (!strcmp(findXMLAttValu(ep,
"force"),
"false"))
671 setCoreProperty(SequenceJob::SJ_EnforceTemperature,
false);
673 else if (!strcmp(tagXMLEle(ep),
"Filter"))
675 const auto name = pcdataXMLEle(ep);
676 const auto index = std::max(1, (
int)(filterLabels().indexOf(name) + 1));
677 setTargetFilter(index, name);
679 else if (!strcmp(tagXMLEle(ep),
"Type"))
681 int index = frameTypes().
indexOf(pcdataXMLEle(ep));
682 setFrameType(
static_cast<CCDFrameType
>(qMax(0, index)));
684 else if (!strcmp(tagXMLEle(ep),
"TargetName"))
686 auto jobTarget = pcdataXMLEle(ep);
688 if (targetName ==
"")
690 setCoreProperty(SequenceJob::SJ_TargetName,
QString(jobTarget));
691 else if (strcmp(jobTarget,
"") != 0)
693 qWarning(KSTARS_EKOS_CAPTURE) <<
QString(
"Sequence job target name %1 ignored.").
arg(jobTarget);
695 else if (!strcmp(tagXMLEle(ep),
"Prefix"))
698 subEP = findXMLEle(ep,
"RawPrefix");
701 auto jobTarget = pcdataXMLEle(subEP);
703 if (targetName ==
"")
705 setCoreProperty(SequenceJob::SJ_TargetName,
QString(jobTarget));
706 else if (strcmp(jobTarget,
"") != 0)
708 qWarning(KSTARS_EKOS_CAPTURE) <<
QString(
"Sequence job raw prefix %1 ignored.").
arg(jobTarget);
710 bool filterEnabled =
false, expEnabled =
false, tsEnabled =
false;
711 subEP = findXMLEle(ep,
"FilterEnabled");
713 filterEnabled = !strcmp(
"1", pcdataXMLEle(subEP));
714 subEP = findXMLEle(ep,
"ExpEnabled");
716 expEnabled = !strcmp(
"1", pcdataXMLEle(subEP));
717 subEP = findXMLEle(ep,
"TimeStampEnabled");
719 tsEnabled = !strcmp(
"1", pcdataXMLEle(subEP));
721 setCoreProperty(SequenceJob::SJ_PlaceholderFormat,
722 PlaceholderPath::defaultFormat(filterEnabled, expEnabled, tsEnabled));
724 else if (!strcmp(tagXMLEle(ep),
"Count"))
726 setCoreProperty(SequenceJob::SJ_Count, cLocale.
toInt(pcdataXMLEle(ep)));
728 else if (!strcmp(tagXMLEle(ep),
"Delay"))
730 setCoreProperty(SequenceJob::SJ_Delay, cLocale.
toInt(pcdataXMLEle(ep)) * 1000);
732 else if (!strcmp(tagXMLEle(ep),
"PostCaptureScript"))
736 else if (!strcmp(tagXMLEle(ep),
"PreCaptureScript"))
740 else if (!strcmp(tagXMLEle(ep),
"PostJobScript"))
744 else if (!strcmp(tagXMLEle(ep),
"PreJobScript"))
748 else if (!strcmp(tagXMLEle(ep),
"GuideDitherPerJob"))
750 setCoreProperty(SequenceJob::SJ_DitherPerJobFrequency, cLocale.
toInt(pcdataXMLEle(ep)));
752 else if (!strcmp(tagXMLEle(ep),
"FITSDirectory"))
754 setCoreProperty(SequenceJob::SJ_LocalDirectory,
QString(pcdataXMLEle(ep)));
756 else if (!strcmp(tagXMLEle(ep),
"PlaceholderFormat"))
758 setCoreProperty(SequenceJob::SJ_PlaceholderFormat,
QString(pcdataXMLEle(ep)));
760 else if (!strcmp(tagXMLEle(ep),
"PlaceholderSuffix"))
762 setCoreProperty(SequenceJob::SJ_PlaceholderSuffix, cLocale.
toUInt(pcdataXMLEle(ep)));
764 else if (!strcmp(tagXMLEle(ep),
"RemoteDirectory"))
766 setCoreProperty(SequenceJob::SJ_RemoteDirectory,
QString(pcdataXMLEle(ep)));
768 else if (!strcmp(tagXMLEle(ep),
"UploadMode"))
770 setUploadMode(
static_cast<ISD::Camera::UploadMode
>(cLocale.
toInt(pcdataXMLEle(ep))));
772 else if (!strcmp(tagXMLEle(ep),
"ISOIndex"))
774 setISO(cLocale.
toInt(pcdataXMLEle(ep)));
776 else if (!strcmp(tagXMLEle(ep),
"Rotation"))
778 setTargetRotation(cLocale.
toDouble(pcdataXMLEle(ep)));
780 else if (!strcmp(tagXMLEle(ep),
"Properties"))
784 for (subEP = nextXMLEle(ep, 1); subEP !=
nullptr; subEP = nextXMLEle(ep, 0))
787 XMLEle * oneElement =
nullptr;
788 for (oneElement = nextXMLEle(subEP, 1); oneElement !=
nullptr; oneElement = nextXMLEle(subEP, 0))
790 const char *
name = findXMLAttValu(oneElement,
"name");
793 auto xmlValue = pcdataXMLEle(oneElement);
795 auto value = cLocale.
toDouble(xmlValue, &ok);
797 elements[
name] = value;
799 elements[
name] = *xmlValue;
802 const char *
name = findXMLAttValu(subEP,
"name");
803 propertyMap[
name] = elements;
806 setCustomProperties(propertyMap);
808 setCoreProperty(SequenceJob::SJ_Gain, devices->cameraGain(propertyMap));
809 setCoreProperty(SequenceJob::SJ_Offset, devices->cameraOffset(propertyMap));
811 else if (!strcmp(tagXMLEle(ep),
"Calibration"))
814 subEP = findXMLEle(ep,
"PreAction");
817 XMLEle * typeEP = findXMLEle(subEP,
"Type");
820 setCalibrationPreAction(cLocale.
toUInt(pcdataXMLEle(typeEP)));
821 if (getCalibrationPreAction() & CAPTURE_PREACTION_WALL)
823 XMLEle * azEP = findXMLEle(subEP,
"Az");
824 XMLEle * altEP = findXMLEle(subEP,
"Alt");
828 setCalibrationPreAction((getCalibrationPreAction() & ~CAPTURE_PREACTION_PARK_MOUNT) | CAPTURE_PREACTION_WALL);
832 setWallCoord(wallCoord);
836 qCWarning(KSTARS_EKOS_CAPTURE) <<
"Wall position coordinates missing, disabling slew to wall position action.";
837 setCalibrationPreAction((getCalibrationPreAction() & ~CAPTURE_PREACTION_WALL) | CAPTURE_PREACTION_NONE);
844 subEP = findXMLEle(ep,
"FlatSource");
847 XMLEle * typeEP = findXMLEle(subEP,
"Type");
851 setCalibrationPreAction(CAPTURE_PREACTION_NONE);
852 if (!strcmp(pcdataXMLEle(typeEP),
"Wall"))
854 XMLEle * azEP = findXMLEle(subEP,
"Az");
855 XMLEle * altEP = findXMLEle(subEP,
"Alt");
859 setCalibrationPreAction((getCalibrationPreAction() & ~CAPTURE_PREACTION_PARK_MOUNT) | CAPTURE_PREACTION_WALL);
863 setWallCoord(wallCoord);
870 subEP = findXMLEle(ep,
"PreMountPark");
871 if (subEP && !strcmp(pcdataXMLEle(subEP),
"True"))
872 setCalibrationPreAction(getCalibrationPreAction() | CAPTURE_PREACTION_PARK_MOUNT);
875 subEP = findXMLEle(ep,
"PreDomePark");
876 if (subEP && !strcmp(pcdataXMLEle(subEP),
"True"))
877 setCalibrationPreAction(getCalibrationPreAction() | CAPTURE_PREACTION_PARK_DOME);
879 subEP = findXMLEle(ep,
"FlatDuration");
882 const char * dark = findXMLAttValu(subEP,
"dark");
883 isDarkFlat = !strcmp(dark,
"true");
885 XMLEle * typeEP = findXMLEle(subEP,
"Type");
888 if (!strcmp(pcdataXMLEle(typeEP),
"Manual"))
889 setFlatFieldDuration(DURATION_MANUAL);
892 XMLEle * aduEP = findXMLEle(subEP,
"Value");
895 setFlatFieldDuration(DURATION_ADU);
896 setCoreProperty(SequenceJob::SJ_TargetADU,
QVariant(cLocale.
toDouble(pcdataXMLEle(aduEP))));
899 aduEP = findXMLEle(subEP,
"Tolerance");
902 setCoreProperty(SequenceJob::SJ_TargetADUTolerance,
QVariant(cLocale.
toDouble(pcdataXMLEle(aduEP))));
904 aduEP = findXMLEle(subEP,
"SkyFlat");
907 setCoreProperty(SequenceJob::SJ_SkyFlat, (
bool)!strcmp(pcdataXMLEle(aduEP),
"true"));
913 setJobType(SequenceJob::JOBTYPE_DARKFLAT);
918 auto roi = getCoreProperty(SequenceJob::SJ_ROI).
toRect();
922 outstream <<
"<Exposure>" << cLocale.
toString(getCoreProperty(SequenceJob::SJ_Exposure).toDouble()) <<
"</Exposure>" <<
924 outstream <<
"<Format>" << getCoreProperty(SequenceJob::SJ_Format).
toString() <<
"</Format>" <<
Qt::endl;
925 outstream <<
"<Encoding>" << getCoreProperty(SequenceJob::SJ_Encoding).
toString() <<
"</Encoding>" <<
Qt::endl;
926 outstream <<
"<Binning>" <<
Qt::endl;
927 outstream <<
"<X>" << cLocale.
toString(getCoreProperty(SequenceJob::SJ_Binning).toPoint().x()) <<
"</X>" <<
Qt::endl;
928 outstream <<
"<Y>" << cLocale.
toString(getCoreProperty(SequenceJob::SJ_Binning).toPoint().y()) <<
"</Y>" <<
Qt::endl;
929 outstream <<
"</Binning>" <<
Qt::endl;
935 outstream <<
"</Frame>" <<
Qt::endl;
936 if (getTargetTemperature() != Ekos::INVALID_VALUE)
937 outstream <<
"<Temperature force='" << (getCoreProperty(SequenceJob::SJ_EnforceTemperature).
toBool() ?
"true" :
939 << cLocale.
toString(getTargetTemperature()) <<
"</Temperature>" <<
Qt::endl;
940 if (getTargetFilter() >= 0)
941 outstream <<
"<Filter>" << getCoreProperty(SequenceJob::SJ_Filter).
toString() <<
"</Filter>" <<
Qt::endl;
942 outstream <<
"<Type>" << frameTypes()[getFrameType()] <<
"</Type>" <<
Qt::endl;
943 outstream <<
"<Count>" << cLocale.
toString(getCoreProperty(SequenceJob::SJ_Count).toInt()) <<
"</Count>" <<
Qt::endl;
945 outstream <<
"<Delay>" << cLocale.
toString(getCoreProperty(SequenceJob::SJ_Delay).toInt() / 1000.0) <<
"</Delay>" <<
947 if (getCoreProperty(SequenceJob::SJ_TargetName) !=
"")
948 outstream <<
"<TargetName>" << getCoreProperty(SequenceJob::SJ_TargetName).
toString() <<
"</TargetName>" <<
Qt::endl;
957 outstream <<
"<GuideDitherPerJob>"
958 << cLocale.
toString(getCoreProperty(SequenceJob::SJ_DitherPerJobFrequency).toInt()) <<
"</GuideDitherPerJob>" <<
960 outstream <<
"<FITSDirectory>" << getCoreProperty(SequenceJob::SJ_LocalDirectory).
toString() <<
"</FITSDirectory>" <<
962 outstream <<
"<PlaceholderFormat>" << getCoreProperty(SequenceJob::SJ_PlaceholderFormat).
toString() <<
963 "</PlaceholderFormat>" <<
965 outstream <<
"<PlaceholderSuffix>" << getCoreProperty(SequenceJob::SJ_PlaceholderSuffix).
toUInt() <<
966 "</PlaceholderSuffix>" <<
968 outstream <<
"<UploadMode>" << getUploadMode() <<
"</UploadMode>" <<
Qt::endl;
969 if (getCoreProperty(SequenceJob::SJ_RemoteDirectory).
toString().isEmpty() ==
false)
970 outstream <<
"<RemoteDirectory>" << getCoreProperty(SequenceJob::SJ_RemoteDirectory).
toString() <<
"</RemoteDirectory>"
972 if (getCoreProperty(SequenceJob::SJ_ISOIndex).toInt() != -1)
973 outstream <<
"<ISOIndex>" << (getCoreProperty(SequenceJob::SJ_ISOIndex).
toInt()) <<
"</ISOIndex>" <<
Qt::endl;
974 if (getTargetRotation() != Ekos::INVALID_VALUE)
975 outstream <<
"<Rotation>" << (getTargetRotation()) <<
"</Rotation>" <<
Qt::endl;
977 outstream <<
"<Properties>" <<
Qt::endl;
978 while (customIter.hasNext())
981 outstream <<
"<PropertyVector name='" << customIter.key() <<
"'>" <<
Qt::endl;
984 while (iter.hasNext())
989 outstream <<
"<OneElement name='" << iter.key()
990 <<
"'>" << iter.value().toString() <<
"</OneElement>" <<
Qt::endl;
994 outstream <<
"<OneElement name='" << iter.key()
995 <<
"'>" << iter.value().toDouble() <<
"</OneElement>" <<
Qt::endl;
998 outstream <<
"</PropertyVector>" <<
Qt::endl;
1000 outstream <<
"</Properties>" <<
Qt::endl;
1002 outstream <<
"<Calibration>" <<
Qt::endl;
1003 outstream <<
"<PreAction>" <<
Qt::endl;
1005 if (getCalibrationPreAction() & CAPTURE_PREACTION_WALL)
1007 outstream <<
"<Az>" << cLocale.
toString(getWallCoord().az().Degrees()) <<
"</Az>" <<
Qt::endl;
1008 outstream <<
"<Alt>" << cLocale.
toString(getWallCoord().alt().Degrees()) <<
"</Alt>" <<
Qt::endl;
1010 outstream <<
"</PreAction>" <<
Qt::endl;
1012 outstream <<
"<FlatDuration dark='" << (jobType() == SequenceJob::JOBTYPE_DARKFLAT ?
"true" :
"false")
1014 if (getFlatFieldDuration() == DURATION_MANUAL)
1015 outstream <<
"<Type>Manual</Type>" <<
Qt::endl;
1018 outstream <<
"<Type>ADU</Type>" <<
Qt::endl;
1019 outstream <<
"<Value>" << cLocale.
toString(getCoreProperty(SequenceJob::SJ_TargetADU).toDouble()) <<
"</Value>" <<
1021 outstream <<
"<Tolerance>" << cLocale.
toString(getCoreProperty(SequenceJob::SJ_TargetADUTolerance).toDouble()) <<
1023 outstream <<
"<SkyFlat>" << (getCoreProperty(SequenceJob::SJ_SkyFlat).
toBool() ?
"true" :
"false") <<
1026 outstream <<
"</FlatDuration>" <<
Qt::endl;
1027 outstream <<
"</Calibration>" <<
Qt::endl;
CameraChip class controls a particular chip in camera.
Class handles control of INDI dome devices.
Handles operation of a remotely controlled dust cover cap.
Handles operation of a remotely controlled light box.
device handle controlling Mounts.
The sky coordinates of a point in the sky.
void setAlt(dms alt)
Sets Alt, the Altitude.
void setAz(dms az)
Sets Az, the Azimuth.
QString i18n(const char *text, const TYPE &arg...)
char * toString(const EngineQuery &query)
Ekos is an advanced Astrophotography tool for Linux.
@ SCRIPT_POST_CAPTURE
Script to run after a sequence capture is completed.
@ SCRIPT_POST_JOB
Script to run after a sequence job is completed.
@ SCRIPT_PRE_CAPTURE
Script to run before a sequence capture is started.
@ SCRIPT_PRE_JOB
Script to run before a sequence job is started.
QString name(GameStandardAction id)
double toDouble(QStringView s, bool *ok) const const
int toInt(QStringView s, bool *ok) const const
QString toString(QDate date, FormatType format) const const
uint toUInt(QStringView s, bool *ok) const const
T value(const Key &key, const T &defaultValue) const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
bool disconnect(const QMetaObject::Connection &connection)
QString & append(QChar ch)
QString arg(Args &&... args) const const
qsizetype indexOf(const QRegularExpression &re, qsizetype from) const const
QTextStream & endl(QTextStream &stream)
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
bool toBool() const const
double toDouble(bool *ok) const const
int toInt(bool *ok) const const
QPoint toPoint() const const
QRect toRect() const const
QString toString() const const
uint toUInt(bool *ok) const const