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
116 /** DBUS interface function.
117 * select the CCD device from the available CCD drivers.
118 * @param device The CCD device name
119 */
120 Q_SCRIPTABLE QString camera();
121
122 /** DBUS interface function.
123 * 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.
124 * @param device The filter device name
125 */
126 Q_SCRIPTABLE QString filterWheel();
127
128 /** DBUS interface function.
129 * select the filter name from the available filters in case a filter device is active.
130 * @param filter The filter name
131 */
132 Q_SCRIPTABLE bool setFilter(const QString &filter);
133 Q_SCRIPTABLE QString filter();
134
135 /** DBUS interface function.
136 * Aborts any current jobs and remove all sequence queue jobs.
137 */
138 Q_SCRIPTABLE Q_NOREPLY void clearSequenceQueue()
139 {
140 mainCamera()->clearSequenceQueue();
141 }
142
143 /** DBUS interface function.
144 * 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
145 * 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".
146 */
148 {
149 return mainCameraState()->sequenceQueueStatus();
150 }
151
152 /** DBUS interface function.
153 * Loads the Ekos Sequence Queue file in the Sequence Queue. Jobs are appended to existing jobs.
154 * @param fileURL full URL of the filename
155 * @param train name of the optical train to be used
156 * @param lead lead or follower job?
157 * @param targetName override the target in the sequence queue file (necessary for using the target of the scheduler)
158 */
159 Q_SCRIPTABLE bool loadSequenceQueue(const QString &fileURL, QString train = "", bool isLead = true, QString targetName = "");
160
161 /** DBUS interface function.
162 * Saves the Sequence Queue to the Ekos Sequence Queue file.
163 * @param fileURL full URL of the filename
164 */
165 Q_SCRIPTABLE bool saveSequenceQueue(const QString &path)
166 {
167 return mainCamera()->saveSequenceQueue(path);
168 }
169
170 /** DBUS interface function.
171 * Enables or disables the maximum guiding deviation and sets its value.
172 * @param enable If true, enable the guiding deviation check, otherwise, disable it.
173 * @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.
174 */
175 Q_SCRIPTABLE Q_NOREPLY void setMaximumGuidingDeviation(bool enable, double value)
176 {
177 mainCamera()->setMaximumGuidingDeviation(enable, value);
178 }
179
180 /** DBUS interface function.
181 * Enables or disables the in sequence focus and sets Half-Flux-Radius (HFR) limit.
182 * @param enable If true, enable the in sequence auto focus check, otherwise, disable it.
183 * @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.
184 */
185 Q_SCRIPTABLE Q_NOREPLY void setInSequenceFocus(bool enable, double HFR)
186 {
187 mainCamera()->setInSequenceFocus(enable, HFR);
188 }
189
190 /** DBUS interface function.
191 * Does the CCD has a cooler control (On/Off) ?
192 */
193 Q_SCRIPTABLE bool hasCoolerControl();
194
195 /** DBUS interface function.
196 * Set the CCD cooler ON/OFF
197 *
198 */
199 Q_SCRIPTABLE bool setCoolerControl(bool enable);
200
201 /** DBUS interface function.
202 * @return Returns the percentage of completed captures in all active jobs
203 */
204 Q_SCRIPTABLE double getProgressPercentage()
205 {
206 return mainCameraState()->progressPercentage();
207 }
208
209 /** DBUS interface function.
210 * @return Returns true if an ongoing capture is a preview capture.
211 */
212 Q_SCRIPTABLE bool isActiveJobPreview()
213 {
214 return mainCamera()->isActiveJobPreview();
215 }
216
217 /** DBUS interface function.
218 * @return Returns the number of jobs in the sequence queue.
219 */
220 Q_SCRIPTABLE int getJobCount()
221 {
222 return mainCameraState()->allJobs().count();
223 }
224
225 /** DBUS interface function.
226 * @return Returns the number of pending uncompleted jobs in the sequence queue.
227 */
228 Q_SCRIPTABLE int getPendingJobCount()
229 {
230 return mainCameraState()->pendingJobCount();
231 }
232
233 /** DBUS interface function.
234 * @return Returns ID of current active job if any, or -1 if there are no active jobs.
235 */
236 Q_SCRIPTABLE int getActiveJobID()
237 {
238 return mainCameraState()->activeJobID();
239 }
240
241 /** DBUS interface function.
242 * @return Returns time left in seconds until active job is estimated to be complete.
243 */
244 Q_SCRIPTABLE int getActiveJobRemainingTime()
245 {
246 return mainCameraState()->activeJobRemainingTime();
247 }
248
249 /** DBUS interface function.
250 * @return Returns overall time left in seconds until all jobs are estimated to be complete
251 */
252 Q_SCRIPTABLE int getOverallRemainingTime()
253 {
254 return mainCameraState()->overallRemainingTime();
255 }
256
257 /** DBUS interface function.
258 * @param id job number. Job IDs start from 0 to N-1.
259 * @return Returns the job state (Idle, In Progress, Error, Aborted, Complete)
260 */
261 Q_SCRIPTABLE QString getJobState(int id)
262 {
263 return mainCameraState()->jobState(id);
264 }
265
266 /** DBUS interface function.
267 * @param id job number. Job IDs start from 0 to N-1.
268 * @return Returns the job filter name.
269 */
270 Q_SCRIPTABLE QString getJobFilterName(int id)
271 {
272 return mainCameraState()->jobFilterName(id);
273 }
274
275 /** DBUS interface function.
276 * @param id job number. Job IDs start from 0 to N-1.
277 * @return Returns The number of images completed capture in the job.
278 */
279 Q_SCRIPTABLE int getJobImageProgress(int id)
280 {
281 return mainCameraState()->jobImageProgress(id);
282 }
283
284 /** DBUS interface function.
285 * @param id job number. Job IDs start from 0 to N-1.
286 * @return Returns the total number of images to capture in the job.
287 */
288 Q_SCRIPTABLE int getJobImageCount(int id)
289 {
290 return mainCameraState()->jobImageCount(id);
291 }
292
293 /**
294 * @brief prepareGUI Perform once only GUI prep processing
295 */
296 void prepareGUI();
297
298 // Settings popup
299 OpsMiscSettings *m_OpsMiscSettings { nullptr };
300 OpsDslrSettings *m_OpsDslrSettings { nullptr };
301
302 /** DBUS interface function.
303 * @param id job number. Job IDs start from 0 to N-1.
304 * @return Returns the number of seconds left in an exposure operation.
305 */
306 Q_SCRIPTABLE double getJobExposureProgress(int id)
307 {
308 return mainCameraState()->jobExposureProgress(id);
309 }
310
311 /** DBUS interface function.
312 * @param id job number. Job IDs start from 0 to N-1.
313 * @return Returns the total requested exposure duration in the job.
314 */
315 Q_SCRIPTABLE double getJobExposureDuration(int id)
316 {
317 return mainCameraState()->jobExposureDuration(id);
318 }
319
320 /** DBUS interface function.
321 * @param id job number. Job IDs start from 0 to N-1.
322 * @return Returns the frame type (light, dark, ...) of the job.
323 */
324 Q_SCRIPTABLE CCDFrameType getJobFrameType(int id)
325 {
326 return mainCameraState()->jobFrameType(id);
327 }
328
329 /** DBUS interface function.
330 * @param id job number. Job IDs start from 0 to N-1.
331 * @return Returns the placeholder format of the job.
332 */
334 {
335 return mainCamera()->placeholderFormatT->text();
336 }
337
338 /** DBUS interface function.
339 * @return Returns the Preview Filename of the job.
340 */
342 {
343 return mainCamera()->previewFilename();
344 }
345
346 /** DBUS interface function.
347 * Clear in-sequence focus settings. It sets the autofocus HFR to zero so that next autofocus value is remembered for the in-sequence focusing.
348 */
349 Q_SCRIPTABLE Q_NOREPLY void clearAutoFocusHFR()
350 {
351 mainCamera()->clearAutoFocusHFR();
352 }
353
354 /** DBUS interface function.
355 * Jobs will NOT be checked for progress against the file system and will be always assumed as new jobs.
356 */
357 Q_SCRIPTABLE Q_NOREPLY void ignoreSequenceHistory();
358
359 /** DBUS interface function.
360 * Set count of already completed frames. This is required when we have identical external jobs
361 * with identical paths, but we need to continue where we left off. For example, if we have 3 identical
362 * jobs, each capturing 5 images. Let's suppose 9 images were captured before. If the count for this signature
363 * is set to 1, then we continue to capture frame #2 even though the number of completed images is already
364 * larger than required count (5). It is mostly used in conjunction with Ekos Scheduler.
365 */
366 Q_SCRIPTABLE Q_NOREPLY void setCapturedFramesMap(const QString &signature, int count, QString train = "");
367
368 /** DBUS interface function.
369 * List of logging entries for the capture module.
370 */
371 Q_SCRIPTABLE QStringList logText()
372 {
373 return m_LogText;
374 }
375
376 /** DBUS interface function.
377 * Single text string holding all log lines for the capture module.
378 */
379 Q_SCRIPTABLE QString getLogText()
380 {
381 return m_LogText.join("\n");
382 }
383
384 /** DBUS interface function.
385 * Status of the capture module
386 */
387 Q_SCRIPTABLE CaptureState status()
388 {
389 return mainCameraState()->getCaptureState();
390 }
391 /** @} end of group CaptureDBusInterface */
392
393 QSharedPointer<CaptureModuleState> moduleState() const
394 {
395 return m_moduleState;
396 }
397
398 // ////////////////////////////////////////////////////////////////////
399 // Access to the cameras
400 // ////////////////////////////////////////////////////////////////////
401
402 QSharedPointer<Camera> &camera(int i);
403
404 void checkCloseCameraTab(int tabIndex);
405
406 const QSharedPointer<Camera> mainCamera() const;
407
408 /**
409 * @brief find the camera using the given train
410 * @param train optical train name
411 * @param addIfNecessary if true, add a new camera with the given train, if none uses this train
412 * @return index in the lost of cameras (@see #camera(int))
413 */
414 int findCamera(QString train, bool addIfNecessary);
415
416 // ////////////////////////////////////////////////////////////////////
417 // Changing the devices used by Capture
418 // ////////////////////////////////////////////////////////////////////
419
420 /**
421 * @brief Update the camera
422 * @param ID that holds the camera
423 * @param current camera is valid
424 */
425 void updateCamera(int tabID, bool isValid);
426
427 /**
428 * @brief setDome Set dome device
429 * @param device pointer to dome device
430 * @return true if successfull, false otherewise.
431 */
432 bool setDome(ISD::Dome *device);
433
434 /**
435 * @brief Generic method for removing any connected device.
436 */
438
439 /**
440 * @brief registerNewModule Register an Ekos module as it arrives via DBus
441 * and create the appropriate DBus interface to communicate with it.
442 * @param name of module
443 */
444 void registerNewModule(const QString &name);
445
446 // ////////////////////////////////////////////////////////////////////
447 // Optical Train handling
448 // ////////////////////////////////////////////////////////////////////
449
450 QString opticalTrain() const
451 {
452 return mainCamera()->opticalTrainCombo->currentText();
453 }
454 void setOpticalTrain(const QString &value)
455 {
456 mainCamera()->opticalTrainCombo->setCurrentText(value);
457 }
458
459 // ////////////////////////////////////////////////////////////////////
460 // Read and write access for EkosLive
461 // ////////////////////////////////////////////////////////////////////
462
463 /**
464 * @brief getSequence Return the JSON representation of the current sequeue queue
465 * @return Reference to JSON array containing sequence queue jobs.
466 */
467 const QJsonArray &getSequence() const
468 {
469 return mainCameraState()->getSequence();
470 }
471
472 /**
473 * @brief setVideoLimits sets the buffer size and max preview fps for live preview
474 * @param maxBufferSize in bytes
475 * @param maxPreviewFPS number of frames per second
476 * @return True if value is updated, false otherwise.
477 */
478 bool setVideoLimits(uint16_t maxBufferSize, uint16_t maxPreviewFPS);
479
480 const QList<QSharedPointer<Camera>> &cameras() const
481 {
482 return moduleState()->cameras();
483 }
484
485public slots:
486 // ////////////////////////////////////////////////////////////////////
487 // Main capturing actions
488 // ////////////////////////////////////////////////////////////////////
489
490 /** \addtogroup CaptureDBusInterface
491 * @{
492 */
493
494 /** DBUS interface function.
495 * @brief Start the execution of the Capture::SequenceJob list #jobs.
496 *
497 * Starting the execution of the Capture::SequenceJob list selects the first job
498 * from the list that may be executed and starts to prepare the job (@see prepareJob()).
499 *
500 * Several factors determine, which of the jobs will be selected:
501 * - First, the list is searched to find the first job that is marked as idle or aborted.
502 * - If none is found, it is checked whether ignoring job progress is set. If yes,
503 * all jobs are are reset (@see reset()) and the first one from the list is selected.
504 * If no, the user is asked whether the jobs should be reset. If the user declines,
505 * starting is aborted.
506 * @return train name of the camera
507 */
508 Q_SCRIPTABLE QString start(QString train = "");
509
510 /** DBUS interface function.
511 * Stops currently running jobs:
512 * CAPTURE_IDLE: capture in idle state waiting for further action (e.g. single sequence
513 * is complete, next one starting)
514 * CAPTURE_COMPLETE: all capture sequences are complete
515 * CAPTURE_ABORT: capture aborted either by user interaction or by a technical error
516 * CAPTURE_SUSPEND: capture suspended and waiting to be restarted
517 * @param targetState status of the job after stop
518 */
519 Q_SCRIPTABLE Q_NOREPLY void stop(CaptureState targetState = CAPTURE_IDLE)
520 {
521 mainCamera()->stop(targetState);
522 }
523
524 /** DBUS interface function.
525 * Aborts all jobs and mark current state as ABORTED. It simply calls stop(CAPTURE_ABORTED)
526 */
527 Q_SCRIPTABLE Q_NOREPLY void abort(QString train = "");
528
529 /** DBUS interface function.
530 * Aborts all jobs and mark current state as SUSPENDED. It simply calls stop(CAPTURE_SUSPENDED)
531 * The only difference between SUSPENDED and ABORTED it that capture module can automatically resume a suspended
532 * state on its own without external trigger once the right conditions are met. When whatever reason caused the module
533 * to go into suspended state ceases to exist, the capture module automatically resumes. On the other hand, ABORTED state
534 * must be started via an external programmatic or user trigger (e.g. click the start button again).
535 */
536 Q_SCRIPTABLE Q_NOREPLY void suspend()
537 {
538 mainCamera()->suspend();
539 }
540 /** DBUS interface function.
541 * @brief pause Pauses the Sequence Queue progress AFTER the current capture is complete.
542 */
543 Q_SCRIPTABLE Q_NOREPLY void pause()
544 {
545 mainCamera()->pause();
546 }
547
548 /** DBUS interface function.
549 * @brief toggleSequence Toggle sequence state depending on its current state.
550 * 1. If paused, then resume sequence.
551 * 2. If idle or completed, then start sequence.
552 * 3. Otherwise, abort current sequence.
553 */
554 Q_SCRIPTABLE Q_NOREPLY void toggleSequence()
555 {
556 mainCamera()->toggleSequence();
557 }
558
559
560 /** DBUS interface function.
561 * Toggle video streaming if supported by the device.
562 * @param enabled Set to true to start video streaming, false to stop it if active.
563 */
564 Q_SCRIPTABLE Q_NOREPLY void toggleVideo(bool enabled)
565 {
566 mainCamera()->toggleVideo(enabled);
567 }
568
569
570 /** DBus interface function
571 * @brief restartCamera Restarts the INDI driver associated with a camera. Remote and Local drivers are supported.
572 * @param name Name of camera to restart. If a driver defined multiple cameras, they would be removed and added again
573 * after driver restart.
574 */
575 Q_SCRIPTABLE Q_NOREPLY void restartCamera(const QString &name)
576 {
577 mainCamera()->restartCamera(name);
578 }
579
580 /** DBus interface function
581 * @brief Set the name of the target to be captured.
582 */
583 Q_SCRIPTABLE Q_NOREPLY void setTargetName(const QString &newTargetName)
584 {
585 mainCamera()->setTargetName(newTargetName);
586 }
587
588 Q_SCRIPTABLE QString getTargetName();
589
590 /** DBus interface function
591 * @brief Set the observer name.
592 */
593 Q_SCRIPTABLE Q_NOREPLY void setObserverName(const QString &value)
594 {
595 mainCamera()->setObserverName(value);
596 };
597 Q_SCRIPTABLE QString getObserverName()
598 {
599 return mainCamera()->getObserverName();
600 }
601
602 /**
603 * @brief Name of the main camera's device
604 */
606 {
607 return mainCamera()->activeCamera()->getDeviceName();
608 }
609
610 /** @}*/
611
612 /**
613 * @brief process shortcut for the process engine
614 */
616 {
617 return mainCamera()->process();
618 }
619
620 // ////////////////////////////////////////////////////////////////////
621 // public capture settings
622 // ////////////////////////////////////////////////////////////////////
623 /**
624 * @brief Slot receiving the update of the current target distance.
625 * @param targetDiff distance to the target in arcseconds.
626 */
627 void updateTargetDistance(double targetDiff)
628 {
629 mainCamera()->updateTargetDistance(targetDiff);
630 }
631
632 void setMeridianFlipState(QSharedPointer<MeridianFlipState> newstate);
633
634 // ////////////////////////////////////////////////////////////////////
635 // slots handling device and module events
636 // ////////////////////////////////////////////////////////////////////
637
638 /**
639 * @brief setGuideDeviation Set the guiding deviation as measured by the guiding module. Abort capture
640 * if deviation exceeds user value. Resume capture if capture was aborted and guiding
641 * deviations are below user value.
642 * @param delta_ra Deviation in RA in arcsecs from the selected guide star.
643 * @param delta_dec Deviation in DEC in arcsecs from the selected guide star.
644 */
645 void setGuideDeviation(double delta_ra, double delta_dec);
646
647 void setGuideChip(ISD::CameraChip *guideChip);
648
649 // Auto Focus
650 /**
651 * @brief setFocusStatus Forward the new focus state to the capture module state machine
652 * @param trainname name of the optical train to select the focuser
653 */
654 void setFocusStatus(FocusState newstate, const QString &trainname);
655
656 // Adaptive Focus
657 /**
658 * @brief focusAdaptiveComplete Forward the new focus state to the capture module state machine
659 * @param trainname name of the optical train to select the focuser
660 */
661 void focusAdaptiveComplete(bool success, const QString &trainname);
662
663 /**
664 * @brief setFocusTemperatureDelta update the focuser's temperature delta
665 * @param trainname name of the optical train to select the focuser
666 */
667 void setFocusTemperatureDelta(double focusTemperatureDelta, double absTemperature, const QString &trainname);
668
669 /**
670 * @brief setHFR Receive the measured HFR value of the latest frame
671 * @param trainname name of the optical train to select the focuser
672 */
673 void setHFR(double newHFR, int position, bool inAutofocus, const QString &trainname);
674
675 /**
676 * @brief inSequenceAFRequested Focuser informs that the user wishes an AF run as soon as possible.
677 * @param requested true iff AF is requested.
678 * @param trainname name of the optical train to select the focuser
679 */
680 void inSequenceAFRequested(bool requested, const QString &trainname);
681
682 // Guide
683 void setGuideStatus(GuideState newstate);
684
685 // Align
686
687 void setAlignStatus(Ekos::AlignState newstate);
688 void setAlignResults(double solverPA, double ra, double de, double pixscale);
689
690 // Update Mount module status
691 void setMountStatus(ISD::Mount::Status newState);
692
693 // ////////////////////////////////////////////////////////////////////
694 // Module logging
695 // ////////////////////////////////////////////////////////////////////
696 Q_SCRIPTABLE void clearLog();
697 void appendLogText(const QString &);
698
699 private slots:
700
701 // ////////////////////////////////////////////////////////////////////
702 // UI controls
703 // ////////////////////////////////////////////////////////////////////
704
705 signals:
706 Q_SCRIPTABLE void newLog(const QString &text);
707 Q_SCRIPTABLE void meridianFlipStarted(const QString &trainname);
708 Q_SCRIPTABLE void guideAfterMeridianFlip();
709 Q_SCRIPTABLE void newStatus(CaptureState status, const QString &trainname, int cameraID);
710 Q_SCRIPTABLE void captureComplete(const QVariantMap &metadata, const QString &trainname);
711
712 void newFilterStatus(FilterState state);
713
714 void ready();
715
716 // communication with other modules
717 void checkFocus(double, const QString &opticaltrain);
718 void runAutoFocus(AutofocusReason autofocusReason, const QString &reasonInfo, const QString &trainname);
719 void resetFocusFrame(const QString &trainname);
720 void abortFocus(const QString &trainname);
721 void adaptiveFocus(const QString &trainname);
722 void suspendGuiding();
723 void resumeGuiding();
724 void dither();
725 void resetNonGuidedDither();
726 void captureTarget(QString targetName);
727 void newImage(SequenceJob *job, const QSharedPointer<FITSData> &data, const QString &trainname);
728 void newExposureProgress(SequenceJob *job, const QString &trainname);
729 void newDownloadProgress(double, const QString &trainname);
730 void sequenceChanged(const QJsonArray &sequence);
731 void settingsUpdated(const QVariantMap &settings);
732 void newLocalPreview(const QString &preview);
733 void dslrInfoRequested(const QString &cameraName);
734 void driverTimedout(const QString &deviceName);
735
736 // Signals for the Analyze tab.
737 void captureStarting(double exposureSeconds, const QString &filter);
738 void captureAborted(double exposureSeconds);
739
740 // Filter Manager
741 void filterManagerUpdated(ISD::FilterWheel *device);
742
743 void trainChanged();
744
745
746 private:
747 // ////////////////////////////////////////////////////////////////////
748 // camera handling
749 // ////////////////////////////////////////////////////////////////////
750
751 /**
752 * @brief addCamera Add a new camera under capture control
753 */
754 QSharedPointer<Camera> addCamera();
755
756 // ////////////////////////////////////////////////////////////////////
757 // helper functions
758 // ////////////////////////////////////////////////////////////////////
759
760 // shortcut for the module state
761 QSharedPointer<CameraState> mainCameraState() const
762 {
763 return mainCamera()->state();
764 }
765 // shortcut to device adapter
766 QSharedPointer<CaptureDeviceAdaptor> mainCameraDevices()
767 {
768 return mainCamera()->devices();
769 }
770 // shortcut for the active job
771 SequenceJob *activeJob() const
772 {
773 return mainCameraState()->getActiveJob();
774 }
775
776 /**
777 * @brief findUnusedOpticalTrain Find the name of the first optical train that is not used by another tab
778 * @return
779 */
780 const QString findUnusedOpticalTrain();
781
782 /**
783 * @brief Sync refocus options to the GUI settings
784 */
785 //void syncRefocusOptionsFromGUI();
786
787 // ////////////////////////////////////////////////////////////////////
788 // device control
789 // ////////////////////////////////////////////////////////////////////
790
791 // ////////////////////////////////////////////////////////////////////
792 // Attributes
793 // ////////////////////////////////////////////////////////////////////
794 double seqExpose { 0 };
795 int seqTotalCount;
796 int seqCurrentCount { 0 };
797
798 // overall state
800
801 QPointer<QDBusInterface> mountInterface;
802
803 QStringList m_LogText;
804
805 // Flat field automation
807
808 // Controls
809 double GainSpinSpecialValue { INVALID_VALUE };
810 double OffsetSpinSpecialValue { INVALID_VALUE };
811
812 QVariantMap m_Metadata;
813 void closeCameraTab(int tabIndex);
814};
815
816}
Captures single or sequence of images from a CCD.
Definition capture.h:94
void setHFR(double newHFR, int position, bool inAutofocus, const QString &trainname)
setHFR Receive the measured HFR value of the latest frame
Definition capture.cpp:597
bool setVideoLimits(uint16_t maxBufferSize, uint16_t maxPreviewFPS)
setVideoLimits sets the buffer size and max preview fps for live preview
Definition capture.cpp:383
bool setDome(ISD::Dome *device)
setDome Set dome device
Definition capture.cpp:207
void updateCamera(int tabID, bool isValid)
Update the camera.
Definition capture.cpp:182
void updateTargetDistance(double targetDiff)
Slot receiving the update of the current target distance.
Definition capture.h:627
void inSequenceAFRequested(bool requested, const QString &trainname)
inSequenceAFRequested Focuser informs that the user wishes an AF run as soon as possible.
Definition capture.cpp:605
QSharedPointer< CameraProcess > process() const
process shortcut for the process engine
Definition capture.h:615
void setFocusStatus(FocusState newstate, const QString &trainname)
setFocusStatus Forward the new focus state to the capture module state machine
Definition capture.cpp:248
void setFocusTemperatureDelta(double focusTemperatureDelta, double absTemperature, const QString &trainname)
setFocusTemperatureDelta update the focuser's temperature delta
Definition capture.cpp:331
void setGuideDeviation(double delta_ra, double delta_dec)
setGuideDeviation Set the guiding deviation as measured by the guiding module.
Definition capture.cpp:340
void registerNewModule(const QString &name)
registerNewModule Register an Ekos module as it arrives via DBus and create the appropriate DBus inte...
Definition capture.cpp:212
void focusAdaptiveComplete(bool success, const QString &trainname)
focusAdaptiveComplete Forward the new focus state to the capture module state machine
Definition capture.cpp:256
int findCamera(QString train, bool addIfNecessary)
find the camera using the given train
Definition capture.cpp:500
const QJsonArray & getSequence() const
getSequence Return the JSON representation of the current sequeue queue
Definition capture.h:467
void removeDevice(const QSharedPointer< ISD::GenericDevice > &device)
Generic method for removing any connected device.
Definition capture.cpp:584
CameraChip class controls a particular chip in camera.
Class handles control of INDI dome devices.
Definition indidome.h:25
Sequence Job is a container for the details required to capture a series of images.
Q_SCRIPTABLE bool hasCoolerControl()
DBUS interface function.
Definition capture.cpp:565
Q_SCRIPTABLE double getJobExposureProgress(int id)
DBUS interface function.
Definition capture.h:306
Q_SCRIPTABLE bool isActiveJobPreview()
DBUS interface function.
Definition capture.h:212
void prepareGUI()
prepareGUI Perform once only GUI prep processing
Definition capture.cpp:97
Q_SCRIPTABLE QString getJobPlaceholderFormat()
DBUS interface function.
Definition capture.h:333
Q_SCRIPTABLE Q_NOREPLY void setInSequenceFocus(bool enable, double HFR)
DBUS interface function.
Definition capture.h:185
Q_SCRIPTABLE int getActiveJobID()
DBUS interface function.
Definition capture.h:236
Q_SCRIPTABLE QString getJobState(int id)
DBUS interface function.
Definition capture.h:261
Q_SCRIPTABLE Q_NOREPLY void abort(QString train="")
DBUS interface function.
Definition capture.cpp:414
Q_SCRIPTABLE Q_NOREPLY void clearAutoFocusHFR()
DBUS interface function.
Definition capture.h:349
Q_SCRIPTABLE QString getJobPreviewFileName()
DBUS interface function.
Definition capture.h:341
Q_SCRIPTABLE Q_NOREPLY void toggleSequence()
DBUS interface function.
Definition capture.h:554
Q_SCRIPTABLE Q_NOREPLY void setTargetName(const QString &newTargetName)
DBus interface function.
Definition capture.h:583
Q_SCRIPTABLE Q_NOREPLY void toggleVideo(bool enabled)
DBUS interface function.
Definition capture.h:564
Q_SCRIPTABLE Q_NOREPLY void setMaximumGuidingDeviation(bool enable, double value)
DBUS interface function.
Definition capture.h:175
Q_SCRIPTABLE QString getSequenceQueueStatus()
DBUS interface function.
Definition capture.h:147
Q_SCRIPTABLE Q_NOREPLY void ignoreSequenceHistory()
DBUS interface function.
Definition capture.cpp:347
Q_SCRIPTABLE int getJobCount()
DBUS interface function.
Definition capture.h:220
Q_SCRIPTABLE Q_NOREPLY void restartCamera(const QString &name)
DBus interface function.
Definition capture.h:575
Q_SCRIPTABLE Q_NOREPLY void stop(CaptureState targetState=CAPTURE_IDLE)
DBUS interface function.
Definition capture.h:519
Q_SCRIPTABLE double getProgressPercentage()
DBUS interface function.
Definition capture.h:204
Q_SCRIPTABLE QString getJobFilterName(int id)
DBUS interface function.
Definition capture.h:270
Q_SCRIPTABLE QString start(QString train="")
DBUS interface function.
Definition capture.cpp:391
Q_SCRIPTABLE Q_NOREPLY void setObserverName(const QString &value)
DBus interface function.
Definition capture.h:593
Q_SCRIPTABLE double getJobExposureDuration(int id)
DBUS interface function.
Definition capture.h:315
Q_SCRIPTABLE QString filterWheel()
DBUS interface function.
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:288
Q_SCRIPTABLE QStringList logText()
DBUS interface function.
Definition capture.h:371
Q_SCRIPTABLE int getActiveJobRemainingTime()
DBUS interface function.
Definition capture.h:244
Q_SCRIPTABLE bool setCoolerControl(bool enable)
DBUS interface function.
Definition capture.cpp:574
Q_SCRIPTABLE bool setFilter(const QString &filter)
DBUS interface function.
Definition capture.cpp:272
Q_SCRIPTABLE CCDFrameType getJobFrameType(int id)
DBUS interface function.
Definition capture.h:324
Q_SCRIPTABLE int getJobImageCount(int id)
DBUS interface function.
Definition capture.h:288
Q_SCRIPTABLE int getJobImageProgress(int id)
DBUS interface function.
Definition capture.h:279
Q_SCRIPTABLE QString mainCameraDeviceName()
Name of the main camera's device.
Definition capture.h:605
Q_SCRIPTABLE bool saveSequenceQueue(const QString &path)
DBUS interface function.
Definition capture.h:165
Q_SCRIPTABLE int getOverallRemainingTime()
DBUS interface function.
Definition capture.h:252
Q_SCRIPTABLE QString getLogText()
DBUS interface function.
Definition capture.h:379
Q_SCRIPTABLE int getPendingJobCount()
DBUS interface function.
Definition capture.h:228
Q_SCRIPTABLE Q_NOREPLY void pause()
DBUS interface function.
Definition capture.h:543
Q_SCRIPTABLE Q_NOREPLY void setCapturedFramesMap(const QString &signature, int count, QString train="")
DBUS interface function.
Definition capture.cpp:353
Q_SCRIPTABLE CaptureState status()
DBUS interface function.
Definition capture.h:387
Q_SCRIPTABLE Q_NOREPLY void suspend()
DBUS interface function.
Definition capture.h:536
Q_SCRIPTABLE Q_NOREPLY void clearSequenceQueue()
DBUS interface function.
Definition capture.h:138
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(...)
QString join(QChar separator) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:40 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.