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);
204QString SequenceJob::setCameraDeviceProperties()
207 QString logentry =
QString(
"Capture exposure = %1 sec, type = %2").
arg(getCoreProperty(SJ_Exposure).toDouble()).
arg(
208 CCDFrameTypeNames[getFrameType()]);
209 logentry.
append(
QString(
", filter = %1, upload mode = %2").arg(getCoreProperty(SJ_Filter).
toString()).arg(getUploadMode()));
216 auto customProp = devices.
data()->getActiveCamera()->getProperty(i.key());
222 switch (customProp.getType())
226 auto sp = customProp.getSwitch();
230 auto oneSwitch = sp->findWidgetByName(j.key().toLatin1().data());
232 oneSwitch->setState(
static_cast<ISState
>(j.value().toInt()));
234 devices.
data()->getActiveCamera()->sendNewProperty(sp);
239 auto tp = customProp.getText();
243 auto oneText = tp->findWidgetByName(j.key().toLatin1().data());
245 oneText->setText(j.value().toString().toLatin1().constData());
247 devices.
data()->getActiveCamera()->sendNewProperty(tp);
252 auto np = customProp.getNumber();
256 auto oneNumber = np->findWidgetByName(j.key().toLatin1().data());
258 oneNumber->setValue(j.value().toDouble());
260 devices.
data()->getActiveCamera()->sendNewProperty(np);
270 const int ISOIndex = getCoreProperty(SJ_ISOIndex).
toInt();
274 if (ISOIndex != devices.
data()->getActiveChip()->getISOIndex())
275 devices.
data()->getActiveChip()->setISOIndex(ISOIndex);
278 const auto gain = getCoreProperty(SJ_Gain).
toDouble();
282 devices.
data()->getActiveCamera()->setGain(gain);
285 const auto offset = getCoreProperty(SJ_Offset).
toDouble();
289 devices.
data()->getActiveCamera()->setOffset(offset);
292 const auto remoteFormatDirectory = getCoreProperty(SJ_RemoteFormatDirectory).
toString();
293 const auto remoteFormatFilename = getCoreProperty(SJ_RemoteFormatFilename).
toString();
295 if (jobType() == SequenceJob::JOBTYPE_PREVIEW && !isVideo())
297 if (devices.
data()->getActiveCamera()->getUploadMode() != ISD::Camera::UPLOAD_CLIENT)
298 devices.
data()->getActiveCamera()->setUploadMode(ISD::Camera::UPLOAD_CLIENT);
301 devices.
data()->getActiveCamera()->setUploadMode(m_UploadMode);
303 if (devices.
data()->getActiveChip()->isBatchMode() &&
304 remoteFormatDirectory.isEmpty() ==
false &&
305 remoteFormatFilename.isEmpty() ==
false)
308 devices.
data()->getActiveCamera()->setSERNameDirectory(remoteFormatFilename, remoteFormatDirectory);
310 devices.
data()->getActiveCamera()->updateUploadSettings(remoteFormatDirectory, remoteFormatFilename);
317 devices.
data()->getActiveCamera()->setUploadMode(m_UploadMode);
319 devices.
data()->getActiveCamera()->setStreamRecording(getCoreProperty(SJ_Format).
toString());
320 devices.
data()->getActiveCamera()->setStreamEncoding(getCoreProperty(SJ_Encoding).
toString());
324 devices.
data()->getActiveChip()->setBatchMode(jobType() != SequenceJob::JOBTYPE_PREVIEW);
325 devices.
data()->getActiveCamera()->setSeqPrefix(getCoreProperty(SJ_FullPrefix).
toString());
326 logentry.
append(
QString(
", batch mode = %1, seq prefix = %2").arg(jobType() != SequenceJob::JOBTYPE_PREVIEW ?
"true" :
327 "false").arg(getCoreProperty(SJ_FullPrefix).
toString()));
330 devices.
data()->getActiveCamera()->setCaptureFormat(getCoreProperty(SJ_Format).
toString());
331 devices.
data()->getActiveCamera()->setEncodingFormat(getCoreProperty(SJ_Encoding).
toString());
332 devices.
data()->getActiveChip()->setFrameType(getFrameType());
334 if (getUploadMode() != ISD::Camera::UPLOAD_CLIENT)
335 logentry.
append(
QString(
", remote dir = %1, remote format = %2").arg(remoteFormatDirectory).arg(remoteFormatFilename));
337 logentry.
append(
QString(
", format = %1, encoding = %2").arg(getCoreProperty(SJ_Format).
toString()).arg(getCoreProperty(
341 int currentBinX = 1, currentBinY = 1;
342 devices.
data()->getActiveChip()->getBinning(¤tBinX, ¤tBinY);
344 const auto binning = getCoreProperty(SJ_Binning).
toPoint();
348 if (devices.
data()->getActiveChip()->canBin())
350 if (devices.
data()->getActiveChip()->setBinning(binning.x(), binning.y()) ==
false)
352 qCWarning(KSTARS_EKOS_CAPTURE()) <<
"Cannot set binning to " <<
"x =" << binning.x() <<
", y =" << binning.y();
353 setStatus(JOB_ERROR);
354 emit captureStarted(CAPTURE_BIN_ERROR);
357 logentry.
append(
QString(
", binning = %1x%2").arg(binning.x()).
arg(binning.y()));
363 const auto roi = getCoreProperty(SJ_ROI).
toRect();
365 if (devices.
data()->getActiveChip()->canSubframe())
367 if ((roi.width() > 0 && roi.height() > 0) && devices.
data()->getActiveChip()->setFrame(roi.x(),
371 currentBinX != binning.x()) ==
false)
373 qCWarning(KSTARS_EKOS_CAPTURE()) <<
"Cannot set ROI to " <<
"x =" << roi.x() <<
", y =" << roi.y() <<
", widht =" <<
374 roi.width() <<
"height =" << roi.height();
375 setStatus(JOB_ERROR);
376 emit captureStarted(CAPTURE_FRAME_ERROR);
379 logentry.
append(
QString(
", ROI = (%1+%2, %3+%4)").arg(roi.x()).
arg(roi.width()).
arg(roi.y()).
arg(roi.width()));
382 logentry.
append(
", Cannot subframe");
387void SequenceJob::capture(FITSMode mode)
389 if (!devices.
data()->getActiveCamera() || !devices.
data()->getActiveChip())
392 QString logentry = setCameraDeviceProperties();
395 setStatus(getStatus());
399 devices.
data()->getActiveCamera()->setStreamExposure(getCoreProperty(SJ_Exposure).toDouble());
400 auto frames = getCoreProperty(SJ_Count).
toUInt();
401 auto success = devices.
data()->getActiveCamera()->startFramesRecording(frames);
404 qCWarning(KSTARS_EKOS_CAPTURE) <<
"Start recording failed!";
405 emit captureStarted(CAPTURE_FRAME_ERROR);
417 devices.
data()->getActiveChip()->setCaptureMode(mode);
418 devices.
data()->getActiveChip()->setCaptureFilter(FITS_NONE);
420 m_ExposeLeft = getCoreProperty(SJ_Exposure).
toDouble();
421 devices.
data()->getActiveChip()->capture(m_ExposeLeft);
424 emit captureStarted(CAPTURE_OK);
427 qCInfo(KSTARS_EKOS_CAPTURE) << logentry;
430void SequenceJob::setTargetFilter(
int pos,
const QString &name)
432 state->targetFilterID = pos;
433 setCoreProperty(SJ_Filter, name);
436double SequenceJob::getExposeLeft()
const
441void SequenceJob::setExposeLeft(
double value)
443 m_ExposeLeft = value;
447int SequenceJob::getCaptureRetires()
const
449 return m_CaptureRetires;
452void SequenceJob::setCaptureRetires(
int value)
454 m_CaptureRetires = value;
457int SequenceJob::getCurrentFilter()
const
459 return state->m_CameraState->currentFilterID;
462ISD::Mount::PierSide SequenceJob::getPierSide()
const
464 return state->m_CameraState->getPierSide();
468void SequenceJob::setUploadMode(ISD::Camera::UploadMode value)
470 m_UploadMode = value;
473ISD::Camera::UploadMode SequenceJob::getUploadMode()
const
479void SequenceJob::setCalibrationPreAction(uint32_t value)
481 state->m_CalibrationPreAction = value;
484uint32_t SequenceJob::getCalibrationPreAction()
const
486 return state->m_CalibrationPreAction;
489void SequenceJob::setWallCoord(
const SkyPoint &value)
491 state->wallCoord = value;
494const SkyPoint &SequenceJob::getWallCoord()
const
496 return state->wallCoord;
500void SequenceJob::setFlatFieldDuration(FlatFieldDuration value)
502 m_FlatFieldDuration = value;
506FlatFieldDuration SequenceJob::getFlatFieldDuration()
const
508 return m_FlatFieldDuration;
511void SequenceJob::setJobProgressIgnored(
bool value)
513 m_JobProgressIgnored = value;
516bool SequenceJob::getJobProgressIgnored()
const
518 return m_JobProgressIgnored;
521void SequenceJob::updateDeviceStates()
523 setLightBox(devices->lightBox());
524 addMount(devices->mount());
525 setDome(devices->dome());
526 setDustCap(devices->dustCap());
531 state->m_CameraState->hasLightBox = (lightBox !=
nullptr);
536 state->m_CameraState->hasDustCap = (dustCap !=
nullptr);
541 state->m_CameraState->hasTelescope = (scope !=
nullptr);
544void SequenceJob::setDome(
ISD::Dome * dome)
546 state->m_CameraState->hasDome = (dome !=
nullptr);
549double SequenceJob::currentTemperature()
const
551 return devices->cameraTemperature();
554double SequenceJob::currentGain()
const
556 return devices->cameraGain();
559double SequenceJob::currentOffset()
const
561 return devices->cameraOffset();
564void SequenceJob::prepareCapture()
567 switch (getFrameType())
571 state->prepareLightFrameCapture(getCoreProperty(SJ_EnforceTemperature).toBool(),
572 jobType() == SequenceJob::JOBTYPE_PREVIEW);
575 state->prepareFlatFrameCapture(getCoreProperty(SJ_EnforceTemperature).toBool(),
576 jobType() == SequenceJob::JOBTYPE_PREVIEW);
579 state->prepareDarkFrameCapture(getCoreProperty(SJ_EnforceTemperature).toBool(),
580 jobType() == SequenceJob::JOBTYPE_PREVIEW);
583 state->prepareBiasFrameCapture(getCoreProperty(SJ_EnforceTemperature).toBool(),
584 jobType() == SequenceJob::JOBTYPE_PREVIEW);
588 processPrepareComplete();
593void SequenceJob::processPrepareComplete(
bool success)
595 emit prepareComplete(success);
598void SequenceJob::processAbortCapture()
600 disconnectDeviceAdaptor();
604IPState SequenceJob::checkFlatFramePendingTasksCompleted()
610void SequenceJob::setCoreProperty(PropertyID
id,
const QVariant &value)
615 case SJ_RemoteDirectory:
618 if (remoteDir.endsWith(
'/'))
621 m_CoreProperties[id] = remoteDir;
630 m_CoreProperties[id] = value;
633QVariant SequenceJob::getCoreProperty(PropertyID
id)
const
635 return m_CoreProperties[id];
638void SequenceJob::loadFrom(XMLEle *root,
const QString &targetName, SequenceJobType jobType)
643 m_CoreProperties[SJ_Exposure] = -1;
644 m_CoreProperties[SJ_Gain] = -1;
645 m_CoreProperties[SJ_Offset] = -1;
646 m_CoreProperties[SJ_ISOIndex] = -1;
647 m_CoreProperties[SJ_Count] = -1;
648 m_CoreProperties[SJ_Delay] = -1;
649 m_CoreProperties[SJ_Binning] =
QPoint(1, 1);
650 m_CoreProperties[SJ_ROI] =
QRect(0, 0, 0, 0);
651 m_CoreProperties[SJ_EnforceTemperature] =
false;
652 m_CoreProperties[SJ_GuiderActive] =
false;
653 m_CoreProperties[SJ_DitherPerJobFrequency] = 0;
654 m_CoreProperties[SJ_Encoding] =
"FITS";
657 if (targetName !=
"")
658 setCoreProperty(SequenceJob::SJ_TargetName, targetName);
663 bool isDarkFlat =
false;
668 for (ep = nextXMLEle(root, 1); ep !=
nullptr; ep = nextXMLEle(root, 0))
670 if (!strcmp(tagXMLEle(ep),
"Exposure"))
671 setCoreProperty(SequenceJob::SJ_Exposure, cLocale.
toDouble(pcdataXMLEle(ep)));
672 else if (!strcmp(tagXMLEle(ep),
"Format"))
673 setCoreProperty(SequenceJob::SJ_Format,
QString(pcdataXMLEle(ep)));
674 else if (!strcmp(tagXMLEle(ep),
"Encoding"))
676 setCoreProperty(SequenceJob::SJ_Encoding,
QString(pcdataXMLEle(ep)));
678 else if (!strcmp(tagXMLEle(ep),
"Binning"))
681 subEP = findXMLEle(ep,
"X");
683 binning.setX(cLocale.
toInt(pcdataXMLEle(subEP)));
684 subEP = findXMLEle(ep,
"Y");
686 binning.setY(cLocale.
toInt(pcdataXMLEle(subEP)));
688 setCoreProperty(SequenceJob::SJ_Binning, binning);
690 else if (!strcmp(tagXMLEle(ep),
"Frame"))
692 QRect roi(0, 0, 0, 0);
693 subEP = findXMLEle(ep,
"X");
695 roi.setX(cLocale.
toInt(pcdataXMLEle(subEP)));
696 subEP = findXMLEle(ep,
"Y");
698 roi.setY(cLocale.
toInt(pcdataXMLEle(subEP)));
699 subEP = findXMLEle(ep,
"W");
701 roi.setWidth(cLocale.
toInt(pcdataXMLEle(subEP)));
702 subEP = findXMLEle(ep,
"H");
704 roi.setHeight(cLocale.
toInt(pcdataXMLEle(subEP)));
706 setCoreProperty(SequenceJob::SJ_ROI, roi);
708 else if (!strcmp(tagXMLEle(ep),
"Temperature"))
710 setTargetTemperature(cLocale.
toDouble(pcdataXMLEle(ep)));
713 if (!strcmp(findXMLAttValu(ep,
"force"),
"true"))
714 setCoreProperty(SequenceJob::SJ_EnforceTemperature,
true);
715 else if (!strcmp(findXMLAttValu(ep,
"force"),
"false"))
716 setCoreProperty(SequenceJob::SJ_EnforceTemperature,
false);
718 else if (!strcmp(tagXMLEle(ep),
"Filter"))
720 const auto name = pcdataXMLEle(ep);
721 const auto index = std::max(1, (
int)(filterLabels().indexOf(name) + 1));
722 setTargetFilter(index, name);
724 else if (!strcmp(tagXMLEle(ep),
"Type"))
726 int index = frameTypes().
indexOf(pcdataXMLEle(ep));
727 setFrameType(
static_cast<CCDFrameType
>(qMax(0, index)));
729 else if (!strcmp(tagXMLEle(ep),
"TargetName"))
731 auto jobTarget = pcdataXMLEle(ep);
733 if (targetName ==
"")
735 setCoreProperty(SequenceJob::SJ_TargetName,
QString(jobTarget));
736 else if (strcmp(jobTarget,
"") != 0)
738 qWarning(KSTARS_EKOS_CAPTURE) <<
QString(
"Sequence job target name %1 ignored.").
arg(jobTarget);
740 else if (!strcmp(tagXMLEle(ep),
"Prefix"))
743 subEP = findXMLEle(ep,
"RawPrefix");
746 auto jobTarget = pcdataXMLEle(subEP);
748 if (targetName ==
"")
750 setCoreProperty(SequenceJob::SJ_TargetName,
QString(jobTarget));
751 else if (strcmp(jobTarget,
"") != 0)
753 qWarning(KSTARS_EKOS_CAPTURE) <<
QString(
"Sequence job raw prefix %1 ignored.").
arg(jobTarget);
755 bool filterEnabled =
false, expEnabled =
false, tsEnabled =
false;
756 subEP = findXMLEle(ep,
"FilterEnabled");
758 filterEnabled = !strcmp(
"1", pcdataXMLEle(subEP));
759 subEP = findXMLEle(ep,
"ExpEnabled");
761 expEnabled = !strcmp(
"1", pcdataXMLEle(subEP));
762 subEP = findXMLEle(ep,
"TimeStampEnabled");
764 tsEnabled = !strcmp(
"1", pcdataXMLEle(subEP));
766 setCoreProperty(SequenceJob::SJ_PlaceholderFormat,
767 PlaceholderPath::defaultFormat(filterEnabled, expEnabled, tsEnabled));
769 else if (!strcmp(tagXMLEle(ep),
"Count"))
771 setCoreProperty(SequenceJob::SJ_Count, cLocale.
toInt(pcdataXMLEle(ep)));
773 else if (!strcmp(tagXMLEle(ep),
"Delay"))
775 setCoreProperty(SequenceJob::SJ_Delay, cLocale.
toInt(pcdataXMLEle(ep)) * 1000);
777 else if (!strcmp(tagXMLEle(ep),
"PostCaptureScript"))
781 else if (!strcmp(tagXMLEle(ep),
"PreCaptureScript"))
785 else if (!strcmp(tagXMLEle(ep),
"PostJobScript"))
789 else if (!strcmp(tagXMLEle(ep),
"PreJobScript"))
793 else if (!strcmp(tagXMLEle(ep),
"GuideDitherPerJob"))
795 setCoreProperty(SequenceJob::SJ_DitherPerJobFrequency, cLocale.
toInt(pcdataXMLEle(ep)));
797 else if (!strcmp(tagXMLEle(ep),
"FITSDirectory"))
799 setCoreProperty(SequenceJob::SJ_LocalDirectory,
QString(pcdataXMLEle(ep)));
801 else if (!strcmp(tagXMLEle(ep),
"PlaceholderFormat"))
803 setCoreProperty(SequenceJob::SJ_PlaceholderFormat,
QString(pcdataXMLEle(ep)));
805 else if (!strcmp(tagXMLEle(ep),
"PlaceholderSuffix"))
807 setCoreProperty(SequenceJob::SJ_PlaceholderSuffix, cLocale.
toUInt(pcdataXMLEle(ep)));
809 else if (!strcmp(tagXMLEle(ep),
"RemoteDirectory"))
811 setCoreProperty(SequenceJob::SJ_RemoteDirectory,
QString(pcdataXMLEle(ep)));
813 else if (!strcmp(tagXMLEle(ep),
"UploadMode"))
815 setUploadMode(
static_cast<ISD::Camera::UploadMode
>(cLocale.
toInt(pcdataXMLEle(ep))));
817 else if (!strcmp(tagXMLEle(ep),
"ISOIndex"))
819 setISO(cLocale.
toInt(pcdataXMLEle(ep)));
821 else if (!strcmp(tagXMLEle(ep),
"Rotation"))
823 setTargetRotation(cLocale.
toDouble(pcdataXMLEle(ep)));
825 else if (!strcmp(tagXMLEle(ep),
"Properties"))
829 for (subEP = nextXMLEle(ep, 1); subEP !=
nullptr; subEP = nextXMLEle(ep, 0))
832 XMLEle * oneElement =
nullptr;
833 for (oneElement = nextXMLEle(subEP, 1); oneElement !=
nullptr; oneElement = nextXMLEle(subEP, 0))
835 const char *
name = findXMLAttValu(oneElement,
"name");
838 auto xmlValue = pcdataXMLEle(oneElement);
840 auto value = cLocale.
toDouble(xmlValue, &ok);
842 elements[
name] = value;
844 elements[
name] = *xmlValue;
847 const char *
name = findXMLAttValu(subEP,
"name");
848 propertyMap[
name] = elements;
851 setCustomProperties(propertyMap);
853 setCoreProperty(SequenceJob::SJ_Gain, devices->cameraGain(propertyMap));
854 setCoreProperty(SequenceJob::SJ_Offset, devices->cameraOffset(propertyMap));
856 else if (!strcmp(tagXMLEle(ep),
"Calibration"))
859 subEP = findXMLEle(ep,
"PreAction");
862 XMLEle * typeEP = findXMLEle(subEP,
"Type");
865 setCalibrationPreAction(cLocale.
toUInt(pcdataXMLEle(typeEP)));
866 if (getCalibrationPreAction() & CAPTURE_PREACTION_WALL)
868 XMLEle * azEP = findXMLEle(subEP,
"Az");
869 XMLEle * altEP = findXMLEle(subEP,
"Alt");
873 setCalibrationPreAction((getCalibrationPreAction() & ~CAPTURE_PREACTION_PARK_MOUNT) | CAPTURE_PREACTION_WALL);
877 setWallCoord(wallCoord);
881 qCWarning(KSTARS_EKOS_CAPTURE) <<
"Wall position coordinates missing, disabling slew to wall position action.";
882 setCalibrationPreAction((getCalibrationPreAction() & ~CAPTURE_PREACTION_WALL) | CAPTURE_PREACTION_NONE);
889 subEP = findXMLEle(ep,
"FlatSource");
892 XMLEle * typeEP = findXMLEle(subEP,
"Type");
896 setCalibrationPreAction(CAPTURE_PREACTION_NONE);
897 if (!strcmp(pcdataXMLEle(typeEP),
"Wall"))
899 XMLEle * azEP = findXMLEle(subEP,
"Az");
900 XMLEle * altEP = findXMLEle(subEP,
"Alt");
904 setCalibrationPreAction((getCalibrationPreAction() & ~CAPTURE_PREACTION_PARK_MOUNT) | CAPTURE_PREACTION_WALL);
908 setWallCoord(wallCoord);
915 subEP = findXMLEle(ep,
"PreMountPark");
916 if (subEP && !strcmp(pcdataXMLEle(subEP),
"True"))
917 setCalibrationPreAction(getCalibrationPreAction() | CAPTURE_PREACTION_PARK_MOUNT);
920 subEP = findXMLEle(ep,
"PreDomePark");
921 if (subEP && !strcmp(pcdataXMLEle(subEP),
"True"))
922 setCalibrationPreAction(getCalibrationPreAction() | CAPTURE_PREACTION_PARK_DOME);
924 subEP = findXMLEle(ep,
"FlatDuration");
927 const char * dark = findXMLAttValu(subEP,
"dark");
928 isDarkFlat = !strcmp(dark,
"true");
930 XMLEle * typeEP = findXMLEle(subEP,
"Type");
933 if (!strcmp(pcdataXMLEle(typeEP),
"Manual"))
934 setFlatFieldDuration(DURATION_MANUAL);
937 XMLEle * aduEP = findXMLEle(subEP,
"Value");
940 setFlatFieldDuration(DURATION_ADU);
941 setCoreProperty(SequenceJob::SJ_TargetADU,
QVariant(cLocale.
toDouble(pcdataXMLEle(aduEP))));
944 aduEP = findXMLEle(subEP,
"Tolerance");
947 setCoreProperty(SequenceJob::SJ_TargetADUTolerance,
QVariant(cLocale.
toDouble(pcdataXMLEle(aduEP))));
949 aduEP = findXMLEle(subEP,
"SkyFlat");
952 setCoreProperty(SequenceJob::SJ_SkyFlat, (
bool)!strcmp(pcdataXMLEle(aduEP),
"true"));
958 setJobType(SequenceJob::JOBTYPE_DARKFLAT);
963 auto roi = getCoreProperty(SequenceJob::SJ_ROI).
toRect();
967 outstream <<
"<Exposure>" << cLocale.
toString(getCoreProperty(SequenceJob::SJ_Exposure).toDouble()) <<
"</Exposure>" <<
969 outstream <<
"<Format>" << getCoreProperty(SequenceJob::SJ_Format).
toString() <<
"</Format>" <<
Qt::endl;
970 outstream <<
"<Encoding>" << getCoreProperty(SequenceJob::SJ_Encoding).
toString() <<
"</Encoding>" <<
Qt::endl;
971 outstream <<
"<Binning>" <<
Qt::endl;
972 outstream <<
"<X>" << cLocale.
toString(getCoreProperty(SequenceJob::SJ_Binning).toPoint().x()) <<
"</X>" <<
Qt::endl;
973 outstream <<
"<Y>" << cLocale.
toString(getCoreProperty(SequenceJob::SJ_Binning).toPoint().y()) <<
"</Y>" <<
Qt::endl;
974 outstream <<
"</Binning>" <<
Qt::endl;
980 outstream <<
"</Frame>" <<
Qt::endl;
981 if (getTargetTemperature() != Ekos::INVALID_VALUE)
982 outstream <<
"<Temperature force='" << (getCoreProperty(SequenceJob::SJ_EnforceTemperature).
toBool() ?
"true" :
984 << cLocale.
toString(getTargetTemperature()) <<
"</Temperature>" <<
Qt::endl;
985 if (getTargetFilter() >= 0)
986 outstream <<
"<Filter>" << getCoreProperty(SequenceJob::SJ_Filter).
toString() <<
"</Filter>" <<
Qt::endl;
987 outstream <<
"<Type>" << frameTypes()[getFrameType()] <<
"</Type>" <<
Qt::endl;
988 outstream <<
"<Count>" << cLocale.
toString(getCoreProperty(SequenceJob::SJ_Count).toInt()) <<
"</Count>" <<
Qt::endl;
990 outstream <<
"<Delay>" << cLocale.
toString(getCoreProperty(SequenceJob::SJ_Delay).toInt() / 1000.0) <<
"</Delay>" <<
992 if (getCoreProperty(SequenceJob::SJ_TargetName) !=
"")
993 outstream <<
"<TargetName>" << getCoreProperty(SequenceJob::SJ_TargetName).
toString() <<
"</TargetName>" <<
Qt::endl;
1002 outstream <<
"<GuideDitherPerJob>"
1003 << cLocale.
toString(getCoreProperty(SequenceJob::SJ_DitherPerJobFrequency).toInt()) <<
"</GuideDitherPerJob>" <<
1005 outstream <<
"<FITSDirectory>" << getCoreProperty(SequenceJob::SJ_LocalDirectory).
toString() <<
"</FITSDirectory>" <<
1007 outstream <<
"<PlaceholderFormat>" << getCoreProperty(SequenceJob::SJ_PlaceholderFormat).
toString() <<
1008 "</PlaceholderFormat>" <<
1010 outstream <<
"<PlaceholderSuffix>" << getCoreProperty(SequenceJob::SJ_PlaceholderSuffix).
toUInt() <<
1011 "</PlaceholderSuffix>" <<
1013 outstream <<
"<UploadMode>" << getUploadMode() <<
"</UploadMode>" <<
Qt::endl;
1014 if (getCoreProperty(SequenceJob::SJ_RemoteDirectory).
toString().isEmpty() ==
false)
1015 outstream <<
"<RemoteDirectory>" << getCoreProperty(SequenceJob::SJ_RemoteDirectory).
toString() <<
"</RemoteDirectory>"
1017 if (getCoreProperty(SequenceJob::SJ_ISOIndex).toInt() != -1)
1018 outstream <<
"<ISOIndex>" << (getCoreProperty(SequenceJob::SJ_ISOIndex).
toInt()) <<
"</ISOIndex>" <<
Qt::endl;
1019 if (getTargetRotation() != Ekos::INVALID_VALUE)
1020 outstream <<
"<Rotation>" << (getTargetRotation()) <<
"</Rotation>" <<
Qt::endl;
1022 outstream <<
"<Properties>" <<
Qt::endl;
1023 while (customIter.hasNext())
1026 outstream <<
"<PropertyVector name='" << customIter.key() <<
"'>" <<
Qt::endl;
1029 while (iter.hasNext())
1034 outstream <<
"<OneElement name='" << iter.key()
1035 <<
"'>" << iter.value().toString() <<
"</OneElement>" <<
Qt::endl;
1039 outstream <<
"<OneElement name='" << iter.key()
1040 <<
"'>" << iter.value().toDouble() <<
"</OneElement>" <<
Qt::endl;
1043 outstream <<
"</PropertyVector>" <<
Qt::endl;
1045 outstream <<
"</Properties>" <<
Qt::endl;
1047 outstream <<
"<Calibration>" <<
Qt::endl;
1048 outstream <<
"<PreAction>" <<
Qt::endl;
1050 if (getCalibrationPreAction() & CAPTURE_PREACTION_WALL)
1052 outstream <<
"<Az>" << cLocale.
toString(getWallCoord().az().Degrees()) <<
"</Az>" <<
Qt::endl;
1053 outstream <<
"<Alt>" << cLocale.
toString(getWallCoord().alt().Degrees()) <<
"</Alt>" <<
Qt::endl;
1055 outstream <<
"</PreAction>" <<
Qt::endl;
1057 outstream <<
"<FlatDuration dark='" << (jobType() == SequenceJob::JOBTYPE_DARKFLAT ?
"true" :
"false")
1059 if (getFlatFieldDuration() == DURATION_MANUAL)
1060 outstream <<
"<Type>Manual</Type>" <<
Qt::endl;
1063 outstream <<
"<Type>ADU</Type>" <<
Qt::endl;
1064 outstream <<
"<Value>" << cLocale.
toString(getCoreProperty(SequenceJob::SJ_TargetADU).toDouble()) <<
"</Value>" <<
1066 outstream <<
"<Tolerance>" << cLocale.
toString(getCoreProperty(SequenceJob::SJ_TargetADUTolerance).toDouble()) <<
1068 outstream <<
"<SkyFlat>" << (getCoreProperty(SequenceJob::SJ_SkyFlat).
toBool() ?
"true" :
"false") <<
1071 outstream <<
"</FlatDuration>" <<
Qt::endl;
1072 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(StandardAction 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