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

KDE's Doxygen guidelines are available online.