Kstars

capture.h
1/*
2 SPDX-FileCopyrightText: 2012 Jasem Mutlaq <mutlaqja@ikarustech.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "ui_capture.h"
10
11#include "camera.h"
12
13#include "opsmiscsettings.h"
14#include "opsdslrsettings.h"
15#include "capturemodulestate.h"
16#include "ekos/manager/meridianflipstate.h"
17#include "ekos/ekos.h"
18#include "ekos/auxiliary/opticaltrainsettings.h"
19#include "ekos/focus/focusutils.h"
20#include "indi/indicamera.h"
21#include "indi/indidustcap.h"
22#include "indi/indidome.h"
23#include "indi/indilightbox.h"
24#include "indi/indimount.h"
25
26#include <QTimer>
27#include <QUrl>
28#include <QtDBus/QDBusInterface>
29
30#include <memory>
31
32class DSLRInfo;
34
35/**
36 * @namespace Ekos
37 * @short Ekos is an advanced Astrophotography tool for Linux.
38 * It is based on a modular extensible framework to perform common astrophotography tasks. This includes highly accurate GOTOs using astrometry solver, ability to measure and correct polar alignment errors ,
39 * auto-focus & auto-guide capabilities, and capture of single or stack of images with filter wheel support.\n
40 * Features:
41 * - Control your telescope, CCD (& DSLRs), filter wheel, focuser, guider, adaptive optics unit, and any INDI-compatible auxiliary device from Ekos.
42 * - Extremely accurate GOTOs using astrometry.net solver (both Online and Offline solvers supported).
43 * - Load & Slew: Load a FITS image, slew to solved coordinates, and center the mount on the exact image coordinates in order to get the same desired frame.
44 * - Measure & Correct Polar Alignment errors using astrometry.net solver.
45 * - Auto and manual focus modes using Half-Flux-Radius (HFR) method.
46 * - Automated unattended meridian flip. Ekos performs post meridian flip alignment, calibration, and guiding to resume the capture session.
47 * - Automatic focus between exposures when a user-configurable HFR limit is exceeded.
48 * - Automatic focus between exposures when the temperature has changed a lot since last focus.
49 * - Auto guiding with support for automatic dithering between exposures and support for Adaptive Optics devices in addition to traditional guiders.
50 * - Powerful sequence queue for batch capture of images with optional prefixes, timestamps, filter wheel selection, and much more!
51 * - Export and import sequence queue sets as Ekos Sequence Queue (.esq) files.
52 * - Center the telescope anywhere in a captured FITS image or any FITS with World Coordinate System (WCS) header.
53 * - Automatic flat field capture, just set the desired ADU and let Ekos does the rest!
54 * - Automatic abort and resumption of exposure tasks if guiding errors exceed a user-configurable value.
55 * - Support for dome slaving.
56 * - Complete integration with KStars Observation Planner and SkyMap
57 * - Integrate with all INDI native devices.
58 * - Powerful scripting capabilities via \ref EkosDBusInterface "DBus."
59 *
60 * The primary class is Ekos::Manager. It handles startup and shutdown of local and remote INDI devices, manages and orchesterates the various Ekos modules, and provides advanced DBus
61 * interface to enable unattended scripting.
62 *
63 * @author Jasem Mutlaq
64 * @version 1.9
65 */
66namespace Ekos
67{
68
69class ScriptsManager;
70
71/**
72 *@class Capture
73 *@short Captures single or sequence of images from a CCD.
74 * The capture class support capturing single or multiple images from a CCD, it provides a
75 * powerful sequence queue with filter selection. Any sequence queue can be saved as
76 * Ekos Sequence Queue (.esq). All image capture operations are saved as Sequence Jobs
77 * that encapsulate all the different options in a capture process. The user may select in
78 * sequence autofocusing by setting limits for HFR, execution time or temperature delta. When the limit
79 * is exceeded, it automatically trigger autofocus operation. The capture process can also be
80 * linked with guide module. If guiding deviations exceed a certain threshold, the capture operation aborts until
81 * the guiding deviation resume to acceptable levels and the capture operation is resumed.
82 *
83 * Controlling the capturing execution is a complex process, that is controlled by
84 * these classes:
85 * - this class, that controll the UI and is the interface for all DBUS functions
86 * - {@see CameraState} holds all state informations
87 * - {@see CameraProcess} holds the business logic that controls the process
88 * For ore details about the capturing execution process, please visit {@see CameraProcess}.
89 *
90 *@author Jasem Mutlaq
91 *@version 1.4
92 */
93class Capture : public QWidget, public Ui::Capture
94{
96 Q_CLASSINFO("D-Bus Interface", "org.kde.kstars.Ekos.Capture")
97 Q_PROPERTY(Ekos::CaptureState status READ status NOTIFY newStatus)
98 Q_PROPERTY(QString targetName READ getTargetName WRITE setTargetName)
99 Q_PROPERTY(QString observerName READ getObserverName WRITE setObserverName)
100 Q_PROPERTY(QString opticalTrain READ opticalTrain WRITE setOpticalTrain)
101 Q_PROPERTY(QString camera READ camera)
102 Q_PROPERTY(QString filterWheel READ filterWheel)
103 Q_PROPERTY(QString filter READ filter WRITE setFilter)
104 Q_PROPERTY(bool coolerControl READ hasCoolerControl WRITE setCoolerControl)
105 Q_PROPERTY(QStringList logText READ logText NOTIFY newLog)
106
107 public:
108 Capture();
109
110 /** @defgroup CaptureDBusInterface Ekos DBus Interface - Capture Module
111 * Ekos::Capture interface provides advanced scripting capabilities to capture image sequences.
112 * @{
113 */
114
115 /** DBUS interface function.
116 * @return device The CCD device name
117 */
118 Q_SCRIPTABLE QString camera();
119
120 /** DBUS interface function.
121 * select the filter device from the available filter drivers. The filter device can be the same as the CCD driver if the filter functionality was embedded within the driver.
122 * @param device The filter device name
123 */
124 Q_SCRIPTABLE QString filterWheel();
125
126 /** DBUS interface function.
127 * select the filter name from the available filters in case a filter device is active.
128 * @param filter The filter name
129 */
130 Q_SCRIPTABLE bool setFilter(const QString &filter);
131 Q_SCRIPTABLE QString filter();
132
133 /** DBUS interface function.
134 * Aborts any current jobs and remove all sequence queue jobs.
135 */
136 Q_SCRIPTABLE Q_NOREPLY void clearSequenceQueue()
137 {
138 mainCamera()->clearSequenceQueue();
139 }
140
141 /** DBUS interface function.
142 * Returns the overall sequence queue status. If there are no jobs pending, it returns "Invalid". If all jobs are idle, it returns "Idle". If all jobs are complete, it returns "Complete". If one or more jobs are aborted
143 * it returns "Aborted" unless it was temporarily aborted due to guiding deviations, then it would return "Suspended". If one or more jobs have errors, it returns "Error". If any jobs is under progress, returns "Running".
144 */
146 {
147 return mainCameraState()->sequenceQueueStatus();
148 }
149
150 /** DBUS interface function.
151 * Loads the Ekos Sequence Queue file in the Sequence Queue. Jobs are appended to existing jobs.
152 * @param fileURL full URL of the filename
153 * @param train name of the optical train to be used
154 * @param lead lead or follower job?
155 * @param targetName override the target in the sequence queue file (necessary for using the target of the scheduler)
156 */
157 Q_SCRIPTABLE bool loadSequenceQueue(const QString &fileURL, QString train = "", bool isLead = true, QString targetName = "");
158
159 /** DBUS interface function.
160 * Saves the Sequence Queue to the Ekos Sequence Queue file.
161 * @param fileURL full URL of the filename
162 */
163 Q_SCRIPTABLE bool saveSequenceQueue(const QString &path)
164 {
165 return mainCamera()->saveSequenceQueue(path);
166 }
167
168 /** DBUS interface function.
169 * Enables or disables the maximum guiding deviation and sets its value.
170 * @param enable If true, enable the guiding deviation check, otherwise, disable it.
171 * @param value if enable is true, it sets the maximum guiding deviation in arcsecs. If the value is exceeded, the capture operation is aborted until the value falls below the value threshold.
172 */
173 Q_SCRIPTABLE Q_NOREPLY void setMaximumGuidingDeviation(bool enable, double value)
174 {
175 mainCamera()->setMaximumGuidingDeviation(enable, value);
176 }
177
178 /** DBUS interface function.
179 * Enables or disables the in sequence focus and sets Half-Flux-Radius (HFR) limit.
180 * @param enable If true, enable the in sequence auto focus check, otherwise, disable it.
181 * @param HFR if enable is true, it sets HFR in pixels. After each exposure, the HFR is re-measured and if it exceeds the specified value, an autofocus operation will be commanded.
182 */
183 Q_SCRIPTABLE Q_NOREPLY void setInSequenceFocus(bool enable, double HFR)
184 {
185 mainCamera()->setInSequenceFocus(enable, HFR);
186 }
187
188 /** DBUS interface function.
189 * Does the CCD has a cooler control (On/Off) ?
190 */
191 Q_SCRIPTABLE bool hasCoolerControl();
192
193 /** DBUS interface function.
194 * Set the CCD cooler ON/OFF
195 *
196 */
197 Q_SCRIPTABLE bool setCoolerControl(bool enable);
198
199 /** DBUS interface function.
200 * @return Returns the percentage of completed captures in all active jobs
201 */
202 Q_SCRIPTABLE double getProgressPercentage()
203 {
204 return mainCameraState()->progressPercentage();
205 }
206
207 /** DBUS interface function.
208 * @return Returns true if an ongoing capture is a preview capture.
209 */
210 Q_SCRIPTABLE bool isActiveJobPreview()
211 {
212 return mainCamera()->isActiveJobPreview();
213 }
214
215 /** DBUS interface function.
216 * @return Returns the number of jobs in the sequence queue.
217 */
218 Q_SCRIPTABLE int getJobCount()
219 {
220 return mainCameraState()->allJobs().count();
221 }
222
223 /** DBUS interface function.
224 * @return Returns the number of pending uncompleted jobs in the sequence queue.
225 */
226 Q_SCRIPTABLE int getPendingJobCount()
227 {
228 return mainCameraState()->pendingJobCount();
229 }
230
231 /** DBUS interface function.
232 * @return Returns ID of current active job if any, or -1 if there are no active jobs.
233 */
234 Q_SCRIPTABLE int getActiveJobID()
235 {
236 return mainCameraState()->activeJobID();
237 }
238
239 /** DBUS interface function.
240 * @return Returns time left in seconds until active job is estimated to be complete.
241 */
242 Q_SCRIPTABLE int getActiveJobRemainingTime()
243 {
244 return mainCameraState()->activeJobRemainingTime();
245 }
246
247 /** DBUS interface function.
248 * @return Returns overall time left in seconds until all jobs are estimated to be complete
249 */
250 Q_SCRIPTABLE int getOverallRemainingTime()
251 {
252 return mainCameraState()->overallRemainingTime();
253 }
254
255 /** DBUS interface function.
256 * @param id job number. Job IDs start from 0 to N-1.
257 * @return Returns the job state (Idle, In Progress, Error, Aborted, Complete)
258 */
259 Q_SCRIPTABLE QString getJobState(int id)
260 {
261 return mainCameraState()->jobState(id);
262 }
263
264 /** DBUS interface function.
265 * @param id job number. Job IDs start from 0 to N-1.
266 * @return Returns the job filter name.
267 */
268 Q_SCRIPTABLE QString getJobFilterName(int id)
269 {
270 return mainCameraState()->jobFilterName(id);
271 }
272
273 /** DBUS interface function.
274 * @param id job number. Job IDs start from 0 to N-1.
275 * @return Returns The number of images completed capture in the job.
276 */
277 Q_SCRIPTABLE int getJobImageProgress(int id)
278 {
279 return mainCameraState()->jobImageProgress(id);
280 }
281
282 /** DBUS interface function.
283 * @param id job number. Job IDs start from 0 to N-1.
284 * @return Returns the total number of images to capture in the job.
285 */
286 Q_SCRIPTABLE int getJobImageCount(int id)
287 {
288 return mainCameraState()->jobImageCount(id);
289 }
290
291 /**
292 * @brief prepareGUI Perform once only GUI prep processing
293 */
294 void setupOptions();
295
296 // Settings popup
297 OpsMiscSettings *m_OpsMiscSettings { nullptr };
298 OpsDslrSettings *m_OpsDslrSettings { nullptr };
299
300 /** DBUS interface function.
301 * @param id job number. Job IDs start from 0 to N-1.
302 * @return Returns the number of seconds left in an exposure operation.
303 */
304 Q_SCRIPTABLE double getJobExposureProgress(int id)
305 {
306 return mainCameraState()->jobExposureProgress(id);
307 }
308
309 /** DBUS interface function.
310 * @param id job number. Job IDs start from 0 to N-1.
311 * @return Returns the total requested exposure duration in the job.
312 */
313 Q_SCRIPTABLE double getJobExposureDuration(int id)
314 {
315 return mainCameraState()->jobExposureDuration(id);
316 }
317
318 /** DBUS interface function.
319 * @param id job number. Job IDs start from 0 to N-1.
320 * @return Returns the frame type (light, dark, ...) of the job.
321 */
322 Q_SCRIPTABLE CCDFrameType getJobFrameType(int id)
323 {
324 return mainCameraState()->jobFrameType(id);
325 }
326
327 /** DBUS interface function.
328 * @param id job number. Job IDs start from 0 to N-1.
329 * @return Returns the placeholder format of the job.
330 */
332 {
333 return mainCamera()->placeholderFormatT->text();
334 }
335
336 /** DBUS interface function.
337 * @return Returns the Preview Filename of the job.
338 */
340 {
341 return mainCamera()->previewFilename();
342 }
343
344 /** DBUS interface function.
345 * Clear in-sequence focus settings. It sets the autofocus HFR to zero so that next autofocus value is remembered for the in-sequence focusing.
346 */
347 Q_SCRIPTABLE Q_NOREPLY void clearAutoFocusHFR(const QString &trainname);
348
349 /** DBUS interface function.
350 * Jobs will NOT be checked for progress against the file system and will be always assumed as new jobs.
351 */
352 Q_SCRIPTABLE Q_NOREPLY void ignoreSequenceHistory();
353
354 /** DBUS interface function.
355 * Set count of already completed frames. This is required when we have identical external jobs
356 * with identical paths, but we need to continue where we left off. For example, if we have 3 identical
357 * jobs, each capturing 5 images. Let's suppose 9 images were captured before. If the count for this signature
358 * is set to 1, then we continue to capture frame #2 even though the number of completed images is already
359 * larger than required count (5). It is mostly used in conjunction with Ekos Scheduler.
360 */
361 Q_SCRIPTABLE Q_NOREPLY void setCapturedFramesMap(const QString &signature, int count, QString train = "");
362
363 /** DBUS interface function.
364 * List of logging entries for the capture module.
365 */
366 Q_SCRIPTABLE QStringList logText()
367 {
368 return m_LogText;
369 }
370
371 /** DBUS interface function.
372 * Single text string holding all log lines for the capture module.
373 */
374 Q_SCRIPTABLE QString getLogText()
375 {
376 return m_LogText.join("\n");
377 }
378
379 /** DBUS interface function.
380 * Status of the capture module
381 */
382 Q_SCRIPTABLE CaptureState status()
383 {
384 return mainCameraState()->getCaptureState();
385 }
386 /** @} end of group CaptureDBusInterface */
387
388 QSharedPointer<CaptureModuleState> moduleState() const
389 {
390 return m_moduleState;
391 }
392
393 // ////////////////////////////////////////////////////////////////////
394 // Access to the cameras
395 // ////////////////////////////////////////////////////////////////////
396
397 QSharedPointer<Camera> &camera(int i);
398
399 void checkCloseCameraTab(int tabIndex);
400
401 const QSharedPointer<Camera> mainCamera() const;
402
403 /**
404 * @brief find the camera using the given train
405 * @param train optical train name
406 * @param addIfNecessary if true, add a new camera with the given train, if none uses this train
407 * @return index in the lost of cameras (@see #camera(int))
408 */
409 int findCamera(QString train, bool addIfNecessary);
410
411 // ////////////////////////////////////////////////////////////////////
412 // Changing the devices used by Capture
413 // ////////////////////////////////////////////////////////////////////
414
415 /**
416 * @brief Update the camera
417 * @param ID that holds the camera
418 * @param current camera is valid
419 */
420 void updateCamera(int tabID, bool isValid);
421
422 /**
423 * @brief setDome Set dome device
424 * @param device pointer to dome device
425 * @return true if successfull, false otherewise.
426 */
427 bool setDome(ISD::Dome *device);
428
429 /**
430 * @brief Generic method for removing any connected device.
431 */
433
434 /**
435 * @brief registerNewModule Register an Ekos module as it arrives via DBus
436 * and create the appropriate DBus interface to communicate with it.
437 * @param name of module
438 */
439 void registerNewModule(const QString &name);
440
441 // ////////////////////////////////////////////////////////////////////
442 // Optical Train handling
443 // ////////////////////////////////////////////////////////////////////
444
445 QString opticalTrain() const
446 {
447 return mainCamera()->opticalTrainCombo->currentText();
448 }
449 void setOpticalTrain(const QString &value)
450 {
451 mainCamera()->opticalTrainCombo->setCurrentText(value);
452 }
453
454 // ////////////////////////////////////////////////////////////////////
455 // Read and write access for EkosLive
456 // ////////////////////////////////////////////////////////////////////
457
458 /**
459 * @brief getSequence Return the JSON representation of the current sequeue queue
460 * @return Reference to JSON array containing sequence queue jobs.
461 */
462 const QJsonArray &getSequence() const
463 {
464 return mainCameraState()->getSequence();
465 }
466
467 /**
468 * @brief setVideoLimits sets the buffer size and max preview fps for live preview
469 * @param maxBufferSize in bytes
470 * @param maxPreviewFPS number of frames per second
471 * @return True if value is updated, false otherwise.
472 */
473 bool setVideoLimits(uint16_t maxBufferSize, uint16_t maxPreviewFPS);
474
475 const QList<QSharedPointer<Camera>> &cameras() const
476 {
477 return moduleState()->cameras();
478 }
479
480public slots:
481 // ////////////////////////////////////////////////////////////////////
482 // Main capturing actions
483 // ////////////////////////////////////////////////////////////////////
484
485 /** \addtogroup CaptureDBusInterface
486 * @{
487 */
488
489 /** DBUS interface function.
490 * @brief Start the execution of the Capture::SequenceJob list #jobs.
491 *
492 * Starting the execution of the Capture::SequenceJob list selects the first job
493 * from the list that may be executed and starts to prepare the job (@see prepareJob()).
494 *
495 * Several factors determine, which of the jobs will be selected:
496 * - First, the list is searched to find the first job that is marked as idle or aborted.
497 * - If none is found, it is checked whether ignoring job progress is set. If yes,
498 * all jobs are are reset (@see reset()) and the first one from the list is selected.
499 * If no, the user is asked whether the jobs should be reset. If the user declines,
500 * starting is aborted.
501 * @return train name of the camera
502 */
503 Q_SCRIPTABLE QString start(QString train = "");
504
505 /** DBUS interface function.
506 * Stops currently running jobs:
507 * CAPTURE_IDLE: capture in idle state waiting for further action (e.g. single sequence
508 * is complete, next one starting)
509 * CAPTURE_COMPLETE: all capture sequences are complete
510 * CAPTURE_ABORT: capture aborted either by user interaction or by a technical error
511 * CAPTURE_SUSPEND: capture suspended and waiting to be restarted
512 * @param targetState status of the job after stop
513 */
514 Q_SCRIPTABLE Q_NOREPLY void stop(CaptureState targetState = CAPTURE_IDLE)
515 {
516 mainCamera()->stop(targetState);
517 }
518
519 /** DBUS interface function.
520 * Aborts all jobs and mark current state as ABORTED. It simply calls stop(CAPTURE_ABORTED)
521 */
522 Q_SCRIPTABLE Q_NOREPLY void abort(QString train = "");
523
524 /** DBUS interface function.
525 * Aborts all jobs and mark current state as SUSPENDED. It simply calls stop(CAPTURE_SUSPENDED)
526 * The only difference between SUSPENDED and ABORTED it that capture module can automatically resume a suspended
527 * state on its own without external trigger once the right conditions are met. When whatever reason caused the module
528 * to go into suspended state ceases to exist, the capture module automatically resumes. On the other hand, ABORTED state
529 * must be started via an external programmatic or user trigger (e.g. click the start button again).
530 */
531 Q_SCRIPTABLE Q_NOREPLY void suspend()
532 {
533 mainCamera()->suspend();
534 }
535 /** DBUS interface function.
536 * @brief pause Pauses the Sequence Queue progress AFTER the current capture is complete.
537 */
538 Q_SCRIPTABLE Q_NOREPLY void pause()
539 {
540 mainCamera()->pause();
541 }
542
543 /** DBUS interface function.
544 * @brief toggleSequence Toggle sequence state depending on its current state.
545 * 1. If paused, then resume sequence.
546 * 2. If idle or completed, then start sequence.
547 * 3. Otherwise, abort current sequence.
548 */
549 Q_SCRIPTABLE Q_NOREPLY void toggleSequence()
550 {
551 mainCamera()->toggleSequence();
552 }
553
554
555 /** DBUS interface function.
556 * Toggle video streaming if supported by the device.
557 * @param enabled Set to true to start video streaming, false to stop it if active.
558 */
559 Q_SCRIPTABLE Q_NOREPLY void toggleVideo(bool enabled)
560 {
561 mainCamera()->toggleVideo(enabled);
562 }
563
564
565 /** DBus interface function
566 * @brief restartCamera Restarts the INDI driver associated with a camera. Remote and Local drivers are supported.
567 * @param name Name of camera to restart. If a driver defined multiple cameras, they would be removed and added again
568 * after driver restart.
569 */
570 Q_SCRIPTABLE Q_NOREPLY void restartCamera(const QString &name)
571 {
572 mainCamera()->restartCamera(name);
573 }
574
575 /** DBus interface function
576 * @brief Set the name of the target to be captured.
577 */
578 Q_SCRIPTABLE Q_NOREPLY void setTargetName(const QString &newTargetName)
579 {
580 mainCamera()->setTargetName(newTargetName);
581 }
582
583 Q_SCRIPTABLE QString getTargetName();
584
585 /** DBus interface function
586 * @brief Set the observer name.
587 */
588 Q_SCRIPTABLE Q_NOREPLY void setObserverName(const QString &value)
589 {
590 mainCamera()->setObserverName(value);
591 };
592 Q_SCRIPTABLE QString getObserverName()
593 {
594 return mainCamera()->getObserverName();
595 }
596
597 /**
598 * @brief Name of the main camera's device
599 */
601 {
602 return mainCamera()->activeCamera()->getDeviceName();
603 }
604
605 /** @}*/
606
607 /**
608 * @brief process shortcut for the process engine
609 */
611 {
612 return mainCamera()->process();
613 }
614
615 // ////////////////////////////////////////////////////////////////////
616 // public capture settings
617 // ////////////////////////////////////////////////////////////////////
618 /**
619 * @brief Slot receiving the update of the current target distance.
620 * @param targetDiff distance to the target in arcseconds.
621 */
622 void updateTargetDistance(double targetDiff)
623 {
624 mainCamera()->updateTargetDistance(targetDiff);
625 }
626
627 void setMeridianFlipState(QSharedPointer<MeridianFlipState> newstate);
628
629 // ////////////////////////////////////////////////////////////////////
630 // slots handling device and module events
631 // ////////////////////////////////////////////////////////////////////
632
633 /**
634 * @brief setGuideDeviation Set the guiding deviation as measured by the guiding module. Abort capture
635 * if deviation exceeds user value. Resume capture if capture was aborted and guiding
636 * deviations are below user value.
637 * @param delta_ra Deviation in RA in arcsecs from the selected guide star.
638 * @param delta_dec Deviation in DEC in arcsecs from the selected guide star.
639 */
640 void setGuideDeviation(double delta_ra, double delta_dec);
641
642 void setGuideChip(ISD::CameraChip *guideChip);
643
644 // Auto Focus
645 /**
646 * @brief setFocusStatus Forward the new focus state to the capture module state machine
647 * @param trainname name of the optical train to select the focuser
648 */
649 void setFocusStatus(FocusState newstate, const QString &trainname);
650
651 // Adaptive Focus
652 /**
653 * @brief focusAdaptiveComplete Forward the new focus state to the capture module state machine
654 * @param trainname name of the optical train to select the focuser
655 */
656 void focusAdaptiveComplete(bool success, const QString &trainname);
657
658 /**
659 * @brief setFocusTemperatureDelta update the focuser's temperature delta
660 * @param trainname name of the optical train to select the focuser
661 */
662 void setFocusTemperatureDelta(double focusTemperatureDelta, double absTemperature, const QString &trainname);
663
664 /**
665 * @brief setHFR Receive the measured HFR value of the latest frame
666 * @param trainname name of the optical train to select the focuser
667 */
668 void setHFR(double newHFR, int position, bool inAutofocus, const QString &trainname);
669
670 /**
671 * @brief inSequenceAFRequested Focuser informs that the user wishes an AF run as soon as possible.
672 * @param requested true iff AF is requested.
673 * @param trainname name of the optical train to select the focuser
674 */
675 void inSequenceAFRequested(bool requested, const QString &trainname);
676
677 // Guide
678 void setGuideStatus(GuideState newstate);
679
680 // Align
681
682 void setAlignStatus(Ekos::AlignState newstate);
683 void setAlignResults(double solverPA, double ra, double de, double pixscale);
684
685 // Update Mount module status
686 void setMountStatus(ISD::Mount::Status newState);
687
688 // ////////////////////////////////////////////////////////////////////
689 // Module logging
690 // ////////////////////////////////////////////////////////////////////
691 Q_SCRIPTABLE void clearLog();
692 void appendLogText(const QString &);
693
694 private slots:
695
696 // ////////////////////////////////////////////////////////////////////
697 // UI controls
698 // ////////////////////////////////////////////////////////////////////
699
700 signals:
701 Q_SCRIPTABLE void newLog(const QString &text);
702 Q_SCRIPTABLE void meridianFlipStarted(const QString &trainname);
703 Q_SCRIPTABLE void guideAfterMeridianFlip();
704 Q_SCRIPTABLE void newStatus(CaptureState status, const QString &trainname, int cameraID);
705 Q_SCRIPTABLE void captureComplete(const QVariantMap &metadata, const QString &trainname);
706
707 void newFilterStatus(FilterState state);
708
709 void ready();
710
711 // communication with other modules
712 void checkFocus(double, const QString &opticaltrain);
713 void runAutoFocus(AutofocusReason autofocusReason, const QString &reasonInfo, const QString &trainname);
714 void resetFocusFrame(const QString &trainname);
715 void abortFocus(const QString &trainname);
716 void adaptiveFocus(const QString &trainname);
717 void suspendGuiding();
718 void resumeGuiding();
719 void dither();
720 void resetNonGuidedDither();
721 void captureTarget(QString targetName);
722 void newImage(SequenceJob *job, const QSharedPointer<FITSData> &data, const QString &trainname);
723 void newExposureProgress(SequenceJob *job, const QString &trainname);
724 void newDownloadProgress(double, const QString &trainname);
725 void sequenceChanged(const QJsonArray &sequence);
726 void settingsUpdated(const QVariantMap &settings);
727 void newLocalPreview(const QString &preview);
728 void dslrInfoRequested(const QString &cameraName);
729 void driverTimedout(const QString &deviceName);
730
731 // Signals for the Analyze tab.
732 void captureStarting(double exposureSeconds, const QString &filter);
733 void captureAborted(double exposureSeconds);
734
735 // Filter Manager
736 void filterManagerUpdated(ISD::FilterWheel *device);
737
738 void trainChanged();
739
740
741 private:
742 // ////////////////////////////////////////////////////////////////////
743 // camera handling
744 // ////////////////////////////////////////////////////////////////////
745
746 /**
747 * @brief addCamera Add a new camera under capture control
748 */
749 QSharedPointer<Camera> addCamera();
750
751 // ////////////////////////////////////////////////////////////////////
752 // helper functions
753 // ////////////////////////////////////////////////////////////////////
754
755 // shortcut for the module state
756 QSharedPointer<CameraState> mainCameraState() const
757 {
758 return mainCamera()->state();
759 }
760 // shortcut to device adapter
761 QSharedPointer<CaptureDeviceAdaptor> mainCameraDevices()
762 {
763 return mainCamera()->devices();
764 }
765 // shortcut for the active job
766 SequenceJob *activeJob() const
767 {
768 return mainCameraState()->getActiveJob();
769 }
770
771 /**
772 * @brief findUnusedOpticalTrain Find the name of the first optical train that is not used by another tab
773 * @return
774 */
775 const QString findUnusedOpticalTrain();
776
777 /**
778 * @brief Sync refocus options to the GUI settings
779 */
780 //void syncRefocusOptionsFromGUI();
781
782 // ////////////////////////////////////////////////////////////////////
783 // device control
784 // ////////////////////////////////////////////////////////////////////
785
786 // ////////////////////////////////////////////////////////////////////
787 // Attributes
788 // ////////////////////////////////////////////////////////////////////
789 double seqExpose { 0 };
790 int seqTotalCount;
791 int seqCurrentCount { 0 };
792
793 // overall state
794 QSharedPointer<CaptureModuleState> m_moduleState;
795
796 QPointer<QDBusInterface> mountInterface;
797
798 QStringList m_LogText;
799
800 // Flat field automation
801 QMap<ScriptTypes, QString> m_Scripts;
802
803 // Controls
804 double GainSpinSpecialValue { INVALID_VALUE };
805 double OffsetSpinSpecialValue { INVALID_VALUE };
806
807 QVariantMap m_Metadata;
808 void closeCameraTab(int tabIndex);
809};
810
811}
void setHFR(double newHFR, int position, bool inAutofocus, const QString &trainname)
setHFR Receive the measured HFR value of the latest frame
Definition capture.cpp:608
bool setVideoLimits(uint16_t maxBufferSize, uint16_t maxPreviewFPS)
setVideoLimits sets the buffer size and max preview fps for live preview
Definition capture.cpp:392
bool setDome(ISD::Dome *device)
setDome Set dome device
Definition capture.cpp:216
void updateCamera(int tabID, bool isValid)
Update the camera.
Definition capture.cpp:191
void updateTargetDistance(double targetDiff)
Slot receiving the update of the current target distance.
Definition capture.h:622
void inSequenceAFRequested(bool requested, const QString &trainname)
inSequenceAFRequested Focuser informs that the user wishes an AF run as soon as possible.
Definition capture.cpp:616
QSharedPointer< CameraProcess > process() const
process shortcut for the process engine
Definition capture.h:610
void setFocusStatus(FocusState newstate, const QString &trainname)
setFocusStatus Forward the new focus state to the capture module state machine
Definition capture.cpp:257
void setFocusTemperatureDelta(double focusTemperatureDelta, double absTemperature, const QString &trainname)
setFocusTemperatureDelta update the focuser's temperature delta
Definition capture.cpp:340
void setGuideDeviation(double delta_ra, double delta_dec)
setGuideDeviation Set the guiding deviation as measured by the guiding module.
Definition capture.cpp:349
void registerNewModule(const QString &name)
registerNewModule Register an Ekos module as it arrives via DBus and create the appropriate DBus inte...
Definition capture.cpp:221
void focusAdaptiveComplete(bool success, const QString &trainname)
focusAdaptiveComplete Forward the new focus state to the capture module state machine
Definition capture.cpp:265
int findCamera(QString train, bool addIfNecessary)
find the camera using the given train
Definition capture.cpp:511
const QJsonArray & getSequence() const
getSequence Return the JSON representation of the current sequeue queue
Definition capture.h:462
void removeDevice(const QSharedPointer< ISD::GenericDevice > &device)
Generic method for removing any connected device.
Definition capture.cpp:595
CameraChip class controls a particular chip in camera.
Class handles control of INDI dome devices.
Definition indidome.h:25
Q_SCRIPTABLE bool hasCoolerControl()
DBUS interface function.
Definition capture.cpp:576
Q_SCRIPTABLE double getJobExposureProgress(int id)
DBUS interface function.
Definition capture.h:304
Q_SCRIPTABLE bool isActiveJobPreview()
DBUS interface function.
Definition capture.h:210
Q_SCRIPTABLE QString getJobPlaceholderFormat()
DBUS interface function.
Definition capture.h:331
Q_SCRIPTABLE Q_NOREPLY void setInSequenceFocus(bool enable, double HFR)
DBUS interface function.
Definition capture.h:183
Q_SCRIPTABLE int getActiveJobID()
DBUS interface function.
Definition capture.h:234
Q_SCRIPTABLE QString getJobState(int id)
DBUS interface function.
Definition capture.h:259
Q_SCRIPTABLE Q_NOREPLY void abort(QString train="")
DBUS interface function.
Definition capture.cpp:425
Q_SCRIPTABLE QString getJobPreviewFileName()
DBUS interface function.
Definition capture.h:339
Q_SCRIPTABLE Q_NOREPLY void toggleSequence()
DBUS interface function.
Definition capture.h:549
Q_SCRIPTABLE Q_NOREPLY void setTargetName(const QString &newTargetName)
DBus interface function.
Definition capture.h:578
Q_SCRIPTABLE Q_NOREPLY void toggleVideo(bool enabled)
DBUS interface function.
Definition capture.h:559
Q_SCRIPTABLE Q_NOREPLY void setMaximumGuidingDeviation(bool enable, double value)
DBUS interface function.
Definition capture.h:173
Q_SCRIPTABLE QString getSequenceQueueStatus()
DBUS interface function.
Definition capture.h:145
Q_SCRIPTABLE Q_NOREPLY void ignoreSequenceHistory()
DBUS interface function.
Definition capture.cpp:356
Q_SCRIPTABLE int getJobCount()
DBUS interface function.
Definition capture.h:218
Q_SCRIPTABLE Q_NOREPLY void restartCamera(const QString &name)
DBus interface function.
Definition capture.h:570
Q_SCRIPTABLE Q_NOREPLY void stop(CaptureState targetState=CAPTURE_IDLE)
DBUS interface function.
Definition capture.h:514
void setupOptions()
prepareGUI Perform once only GUI prep processing
Definition capture.cpp:98
Q_SCRIPTABLE double getProgressPercentage()
DBUS interface function.
Definition capture.h:202
Q_SCRIPTABLE QString getJobFilterName(int id)
DBUS interface function.
Definition capture.h:268
Q_SCRIPTABLE QString start(QString train="")
DBUS interface function.
Definition capture.cpp:402
Q_SCRIPTABLE Q_NOREPLY void setObserverName(const QString &value)
DBus interface function.
Definition capture.h:588
Q_SCRIPTABLE double getJobExposureDuration(int id)
DBUS interface function.
Definition capture.h:313
Q_SCRIPTABLE QString filterWheel()
DBUS interface function.
Q_SCRIPTABLE Q_NOREPLY void clearAutoFocusHFR(const QString &trainname)
DBUS interface function.
Definition capture.cpp:117
Q_SCRIPTABLE QString camera()
DBUS interface function.
Q_SCRIPTABLE bool loadSequenceQueue(const QString &fileURL, QString train="", bool isLead=true, QString targetName="")
DBUS interface function.
Definition capture.cpp:297
Q_SCRIPTABLE QStringList logText()
DBUS interface function.
Definition capture.h:366
Q_SCRIPTABLE int getActiveJobRemainingTime()
DBUS interface function.
Definition capture.h:242
Q_SCRIPTABLE bool setCoolerControl(bool enable)
DBUS interface function.
Definition capture.cpp:585
Q_SCRIPTABLE bool setFilter(const QString &filter)
DBUS interface function.
Definition capture.cpp:281
Q_SCRIPTABLE CCDFrameType getJobFrameType(int id)
DBUS interface function.
Definition capture.h:322
Q_SCRIPTABLE int getJobImageCount(int id)
DBUS interface function.
Definition capture.h:286
Q_SCRIPTABLE int getJobImageProgress(int id)
DBUS interface function.
Definition capture.h:277
Q_SCRIPTABLE QString mainCameraDeviceName()
Name of the main camera's device.
Definition capture.h:600
Q_SCRIPTABLE bool saveSequenceQueue(const QString &path)
DBUS interface function.
Definition capture.h:163
Q_SCRIPTABLE int getOverallRemainingTime()
DBUS interface function.
Definition capture.h:250
Q_SCRIPTABLE QString getLogText()
DBUS interface function.
Definition capture.h:374
Q_SCRIPTABLE int getPendingJobCount()
DBUS interface function.
Definition capture.h:226
Q_SCRIPTABLE Q_NOREPLY void pause()
DBUS interface function.
Definition capture.h:538
Q_SCRIPTABLE Q_NOREPLY void setCapturedFramesMap(const QString &signature, int count, QString train="")
DBUS interface function.
Definition capture.cpp:362
Q_SCRIPTABLE CaptureState status()
DBUS interface function.
Definition capture.h:382
Q_SCRIPTABLE Q_NOREPLY void suspend()
DBUS interface function.
Definition capture.h:531
Q_SCRIPTABLE Q_NOREPLY void clearSequenceQueue()
DBUS interface function.
Definition capture.h:136
Ekos is an advanced Astrophotography tool for Linux.
Definition align.cpp:83
AlignState
Definition ekos.h:145
CaptureState
Capture states.
Definition ekos.h:92
@ CAPTURE_IDLE
Definition ekos.h:93
Q_CLASSINFO(Name, Value)
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
QWidget(QWidget *parent, Qt::WindowFlags f)
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Feb 21 2025 11:54:27 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.