Kstars

ekos.h
1 /*
2  SPDX-FileCopyrightText: 2017 Jasem Mutlaq <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include <KLocalizedString>
10 
11 #include <QMetaType>
12 #include <QDBusArgument>
13 #include <QString>
14 
15 #include <vector>
16 
17 namespace Ekos
18 {
19 // Guide States
20 static const QList<const char *> guideStates = { I18N_NOOP("Idle"),
21  I18N_NOOP("Aborted"),
22  I18N_NOOP("Connected"),
23  I18N_NOOP("Disconnected"),
24  I18N_NOOP("Capturing"),
25  I18N_NOOP("Looping"),
26  I18N_NOOP("Subtracting"),
27  I18N_NOOP("Subframing"),
28  I18N_NOOP("Selecting star"),
29  I18N_NOOP("Calibrating"),
30  I18N_NOOP("Calibration error"),
31  I18N_NOOP("Calibrated"),
32  I18N_NOOP("Guiding"),
33  I18N_NOOP("Suspended"),
34  I18N_NOOP("Reacquiring"),
35  I18N_NOOP("Dithering"),
36  I18N_NOOP("Manual Dithering"),
37  I18N_NOOP("Dithering error"),
38  I18N_NOOP("Dithering successful"),
39  I18N_NOOP("Settling")
40  };
41 
42 typedef enum
43 {
44  GUIDE_IDLE,
45  GUIDE_ABORTED,
46  GUIDE_CONNECTED,
47  GUIDE_DISCONNECTED,
48  GUIDE_CAPTURE,
49  GUIDE_LOOPING,
50  GUIDE_DARK,
51  GUIDE_SUBFRAME,
52  GUIDE_STAR_SELECT,
53  GUIDE_CALIBRATING,
54  GUIDE_CALIBRATION_ERROR,
55  GUIDE_CALIBRATION_SUCCESS,
56  GUIDE_GUIDING,
57  GUIDE_SUSPENDED,
58  GUIDE_REACQUIRE,
59  GUIDE_DITHERING,
60  GUIDE_MANUAL_DITHERING,
61  GUIDE_DITHERING_ERROR,
62  GUIDE_DITHERING_SUCCESS,
63  GUIDE_DITHERING_SETTLE
64 } GuideState;
65 
66 const QString getGuideStatusString(GuideState state, bool translated = true);
67 
68 // Capture States
69 static const QList<const char *> captureStates =
70 {
71  I18N_NOOP("Idle"), I18N_NOOP("In Progress"), I18N_NOOP("Capturing"), I18N_NOOP("Pause Planned"), I18N_NOOP("Paused"),
72  I18N_NOOP("Suspended"), I18N_NOOP("Aborted"), I18N_NOOP("Waiting"), I18N_NOOP("Image Received"),
73  I18N_NOOP("Dithering"), I18N_NOOP("Focusing"), I18N_NOOP("Filter Focus"), I18N_NOOP("Changing Filter"), I18N_NOOP("Guider Settling"),
74  I18N_NOOP("Setting Temperature"), I18N_NOOP("Setting Rotator"), I18N_NOOP("Aligning"), I18N_NOOP("Calibrating"),
75  I18N_NOOP("Meridian Flip"), I18N_NOOP("Complete")
76 };
77 
78 /**
79  * @brief Capture states
80  *
81  * They can be divided into several stages:
82  * - No capturing is running (@see CAPTURE_IDLE, @see CAPTURE_COMPLETE or @see CAPTURE_ABORTED)
83  * - A capture sequence job is in preparation (@see CAPTURE_PROGRESS as state and @see CAPTURE_SETTING_TEMPERATURE,
84  * @see CAPTURE_SETTING_ROTATOR and @see CAPTURE_CHANGING_FILTER as state events signaled to
85  * @see Capture::updatePrepareState(Ekos::CaptureState))
86  * - Calibration activities to initialize the execution of a sequence job (@see CAPTURE_DITHERING, @see CAPTURE_FOCUSING,
87  * @see CAPTURE_ALIGNING and @see CAPTURE_CALIBRATING)
88  * - Waiting for start of capturing (@see CAPTURE_PAUSE_PLANNED, @see CAPTURE_PAUSED, @see CAPTURE_SUSPENDED and @see CAPTURE_WAITING)
89  * - Capturing (@see CAPTURE_CAPTURING and @see CAPTURE_IMAGE_RECEIVED)
90  */
91 typedef enum
92 {
93  CAPTURE_IDLE, /*!< no capture job active */
94  CAPTURE_PROGRESS, /*!< capture job sequence in preparation (temperature, filter, rotator) */
95  CAPTURE_CAPTURING, /*!< CCD capture running */
96  CAPTURE_PAUSE_PLANNED, /*!< user has requested to pause the capture sequence */
97  CAPTURE_PAUSED, /*!< paused capture sequence due to a user request */
98  CAPTURE_SUSPENDED, /*!< capture stopped since some limits are not met, but may be continued if all limits are met again */
99  CAPTURE_ABORTED, /*!< capture stopped by the user or aborted due to guiding problems etc. */
100  CAPTURE_WAITING, /*!< waiting for settling of the mount before start of capturing */
101  CAPTURE_IMAGE_RECEIVED, /*!< image received from the CDD device */
102  CAPTURE_DITHERING, /*!< dithering before starting to capture */
103  CAPTURE_FOCUSING, /*!< focusing before starting to capture */
104  CAPTURE_FILTER_FOCUS, /*!< not used */
105  CAPTURE_CHANGING_FILTER, /*!< preparation event changing the filter */
106  CAPTURE_GUIDER_DRIFT, /*!< preparation event waiting for the guider to settle */
107  CAPTURE_SETTING_TEMPERATURE, /*!< preparation event setting the camera temperature */
108  CAPTURE_SETTING_ROTATOR, /*!< preparation event setting the camera rotator */
109  CAPTURE_ALIGNING, /*!< aligning before starting to capture */
110  CAPTURE_CALIBRATING, /*!< startup of guiding running before starting to capture */
111  CAPTURE_MERIDIAN_FLIP, /*!< only used as signal that a meridian flip is ongoing */
112  CAPTURE_COMPLETE /*!< capture job sequence completed successfully */
113 } CaptureState;
114 
115 const QString getCaptureStatusString(CaptureState state, bool translated = true);
116 
117 // Focus States
118 static const QList<const char *> focusStates = { I18N_NOOP("Idle"), I18N_NOOP("Complete"), I18N_NOOP("Failed"),
119  I18N_NOOP("Aborted"), I18N_NOOP("User Input"), I18N_NOOP("In Progress"),
120  I18N_NOOP("Framing"), I18N_NOOP("Changing Filter")
121  };
122 
123 typedef enum
124 {
125  FOCUS_IDLE,
126  FOCUS_COMPLETE,
127  FOCUS_FAILED,
128  FOCUS_ABORTED,
129  FOCUS_WAITING,
130  FOCUS_PROGRESS,
131  FOCUS_FRAMING,
132  FOCUS_CHANGING_FILTER
133 } FocusState;
134 
135 const QString getFocusStatusString(FocusState state, bool translated = true);
136 
137 // Align States
138 static const QList<const char *> alignStates = { I18N_NOOP("Idle"), I18N_NOOP("Complete"), I18N_NOOP("Failed"),
139  I18N_NOOP("Aborted"), I18N_NOOP("In Progress"), I18N_NOOP("Syncing"),
140  I18N_NOOP("Slewing"), I18N_NOOP("Suspended")
141  };
142 
143 typedef enum
144 {
145  ALIGN_IDLE,
146  ALIGN_COMPLETE,
147  ALIGN_FAILED,
148  ALIGN_ABORTED,
149  ALIGN_PROGRESS,
150  ALIGN_SYNCING,
151  ALIGN_SLEWING,
152  ALIGN_SUSPENDED
153 } AlignState;
154 
155 const QString getAlignStatusString(AlignState state, bool translated = true);
156 
157 // Filter Manager States
158 static const QList<const char *> filterStates = { I18N_NOOP("Idle"), I18N_NOOP("Changing Filter"), I18N_NOOP("Focus Offset"),
159  I18N_NOOP("Auto Focus")
160  };
161 typedef enum
162 {
163  FILTER_IDLE,
164  FILTER_CHANGE,
165  FILTER_OFFSET,
166  FILTER_AUTOFOCUS
167 } FilterState;
168 
169 typedef enum
170 {
171  SCRIPT_PRE_JOB, /**< Script to run before a sequence job is started */
172  SCRIPT_PRE_CAPTURE, /**< Script to run before a sequence capture is started */
173  SCRIPT_POST_CAPTURE,/**< Script to run after a sequence capture is completed */
174  SCRIPT_POST_JOB, /**< Script to run after a sequence job is completed */
175  SCRIPT_N
176 } ScriptTypes;
177 
178 const QString getFilterStatusString(FilterState state, bool translated = true);
179 
180 // Scheduler states
181 
182 const QString getSchedulerStatusString(AlignState state, bool translated = true);
183 
184 static const QList<const char *> schedulerStates = { I18N_NOOP("Idle"), I18N_NOOP("Startup"), I18N_NOOP("Running"),
185  I18N_NOOP("Paused"), I18N_NOOP("Shutdown"), I18N_NOOP("Aborted"),
186  I18N_NOOP("Loading")
187  };
188 
189 typedef enum
190 {
191  SCHEDULER_IDLE, /*< Scheduler is stopped. */
192  SCHEDULER_STARTUP, /*< Scheduler is starting the observatory up. */
193  SCHEDULER_RUNNING, /*< Scheduler is running. */
194  SCHEDULER_PAUSED, /*< Scheduler is paused by the end-user. */
195  SCHEDULER_SHUTDOWN, /*< Scheduler is shutting the observatory down. */
196  SCHEDULER_ABORTED, /*< Scheduler is stopped in error. */
197  SCHEDULER_LOADING /*< Scheduler is loading a schedule. */
198 } SchedulerState;
199 
200 typedef enum
201 {
202  Idle,
203  Pending,
204  Success,
205  Error
206 } CommunicationStatus;
207 
208 std::vector<double> gsl_polynomial_fit(const double *const data_x, const double *const data_y, const int n,
209  const int order, double &chisq);
210 
211 // Invalid value
212 const int INVALID_VALUE = -1e6;
213 }
214 
215 // Communication Status
216 Q_DECLARE_METATYPE(Ekos::CommunicationStatus)
217 QDBusArgument &operator<<(QDBusArgument &argument, const Ekos::CommunicationStatus &source);
218 const QDBusArgument &operator>>(const QDBusArgument &argument, Ekos::CommunicationStatus &dest);
219 
220 // Capture Status
221 // FIXME is there a way to avoid unnecessary duplicating code? The solution suggested in KDE WiKi is to use Boost
222 // which we do not have to add as dependency
223 Q_DECLARE_METATYPE(Ekos::CaptureState)
224 QDBusArgument &operator<<(QDBusArgument &argument, const Ekos::CaptureState &source);
225 const QDBusArgument &operator>>(const QDBusArgument &argument, Ekos::CaptureState &dest);
226 
227 // Focus
228 Q_DECLARE_METATYPE(Ekos::FocusState)
229 QDBusArgument &operator<<(QDBusArgument &argument, const Ekos::FocusState &source);
230 const QDBusArgument &operator>>(const QDBusArgument &argument, Ekos::FocusState &dest);
231 
232 // Guide
233 Q_DECLARE_METATYPE(Ekos::GuideState)
234 QDBusArgument &operator<<(QDBusArgument &argument, const Ekos::GuideState &source);
235 const QDBusArgument &operator>>(const QDBusArgument &argument, Ekos::GuideState &dest);
236 
237 // Align
238 Q_DECLARE_METATYPE(Ekos::AlignState)
239 QDBusArgument &operator<<(QDBusArgument &argument, const Ekos::AlignState &source);
240 const QDBusArgument &operator>>(const QDBusArgument &argument, Ekos::AlignState &dest);
241 
242 // Scheduler
243 Q_DECLARE_METATYPE(Ekos::SchedulerState)
244 QDBusArgument &operator<<(QDBusArgument &argument, const Ekos::SchedulerState &source);
245 const QDBusArgument &operator>>(const QDBusArgument &argument, Ekos::SchedulerState &dest);
@ CAPTURE_COMPLETE
Definition: ekos.h:112
@ SCRIPT_POST_JOB
Script to run after a sequence job is completed.
Definition: ekos.h:174
@ CAPTURE_FOCUSING
Definition: ekos.h:103
@ CAPTURE_CALIBRATING
Definition: ekos.h:110
Ekos is an advanced Astrophotography tool for Linux. It is based on a modular extensible framework to...
Definition: align.cpp:70
@ CAPTURE_CAPTURING
Definition: ekos.h:95
KCALENDARCORE_EXPORT QDataStream & operator>>(QDataStream &in, const KCalendarCore::Alarm::Ptr &)
ScriptTypes
Definition: ekos.h:169
@ CAPTURE_SETTING_ROTATOR
Definition: ekos.h:108
@ CAPTURE_PROGRESS
Definition: ekos.h:94
@ SCRIPT_PRE_CAPTURE
Script to run before a sequence capture is started.
Definition: ekos.h:172
@ CAPTURE_SETTING_TEMPERATURE
Definition: ekos.h:107
@ CAPTURE_IDLE
Definition: ekos.h:93
CaptureState
Capture states.
Definition: ekos.h:91
@ CAPTURE_ABORTED
Definition: ekos.h:99
@ CAPTURE_DITHERING
Definition: ekos.h:102
@ CAPTURE_FILTER_FOCUS
Definition: ekos.h:104
QDebug operator<<(QDebug d, const QCPVector2D &vec)
Definition: qcustomplot.h:450
@ CAPTURE_WAITING
Definition: ekos.h:100
@ CAPTURE_PAUSED
Definition: ekos.h:97
@ CAPTURE_SUSPENDED
Definition: ekos.h:98
@ CAPTURE_CHANGING_FILTER
Definition: ekos.h:105
#define I18N_NOOP(text)
@ CAPTURE_PAUSE_PLANNED
Definition: ekos.h:96
@ CAPTURE_IMAGE_RECEIVED
Definition: ekos.h:101
@ CAPTURE_MERIDIAN_FLIP
Definition: ekos.h:111
@ SCRIPT_PRE_JOB
Script to run before a sequence job is started.
Definition: ekos.h:171
@ SCRIPT_POST_CAPTURE
Script to run after a sequence capture is completed.
Definition: ekos.h:173
@ CAPTURE_GUIDER_DRIFT
Definition: ekos.h:106
@ CAPTURE_ALIGNING
Definition: ekos.h:109
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 12 2022 04:00:53 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.