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("Successful"),
140  I18N_NOOP("Syncing"), I18N_NOOP("Slewing"), I18N_NOOP("Rotating"),
141  I18N_NOOP("Suspended")
142  };
143 
144 typedef enum
145 {
146  ALIGN_IDLE, /**< No ongoing operations */
147  ALIGN_COMPLETE, /**< Alignment successfully completed. No operations pending. */
148  ALIGN_FAILED, /**< Alignment failed. No operations pending. */
149  ALIGN_ABORTED, /**< Alignment aborted by user or agent. */
150  ALIGN_PROGRESS, /**< Alignment operation in progress. This include capture and sovling. */
151  ALIGN_SUCCESSFUL, /**< Alignment Astrometry solver successfully solved the image. */
152  ALIGN_SYNCING, /**< Syncing mount to solution coordinates. */
153  ALIGN_SLEWING, /**< Slewing mount to target coordinates. */
154  ALIGN_ROTATING, /**< Rotating (Automatic or Manual) to target position angle. */
155  ALIGN_SUSPENDED /**< Alignment operations suspended. */
156 } AlignState;
157 
158 const QString getAlignStatusString(AlignState state, bool translated = true);
159 
160 // Filter Manager States
161 static const QList<const char *> filterStates = { I18N_NOOP("Idle"), I18N_NOOP("Changing Filter"), I18N_NOOP("Focus Offset"),
162  I18N_NOOP("Auto Focus")
163  };
164 typedef enum
165 {
166  FILTER_IDLE,
167  FILTER_CHANGE,
168  FILTER_OFFSET,
169  FILTER_AUTOFOCUS
170 } FilterState;
171 
172 typedef enum
173 {
174  SCRIPT_PRE_JOB, /**< Script to run before a sequence job is started */
175  SCRIPT_PRE_CAPTURE, /**< Script to run before a sequence capture is started */
176  SCRIPT_POST_CAPTURE,/**< Script to run after a sequence capture is completed */
177  SCRIPT_POST_JOB, /**< Script to run after a sequence job is completed */
178  SCRIPT_N
179 } ScriptTypes;
180 
181 const QString getFilterStatusString(FilterState state, bool translated = true);
182 
183 // Scheduler states
184 
185 const QString getSchedulerStatusString(AlignState state, bool translated = true);
186 
187 static const QList<const char *> schedulerStates = { I18N_NOOP("Idle"), I18N_NOOP("Startup"), I18N_NOOP("Running"),
188  I18N_NOOP("Paused"), I18N_NOOP("Shutdown"), I18N_NOOP("Aborted"),
189  I18N_NOOP("Loading")
190  };
191 
192 typedef enum
193 {
194  SCHEDULER_IDLE, /*< Scheduler is stopped. */
195  SCHEDULER_STARTUP, /*< Scheduler is starting the observatory up. */
196  SCHEDULER_RUNNING, /*< Scheduler is running. */
197  SCHEDULER_PAUSED, /*< Scheduler is paused by the end-user. */
198  SCHEDULER_SHUTDOWN, /*< Scheduler is shutting the observatory down. */
199  SCHEDULER_ABORTED, /*< Scheduler is stopped in error. */
200  SCHEDULER_LOADING /*< Scheduler is loading a schedule. */
201 } SchedulerState;
202 
203 typedef enum
204 {
205  Idle,
206  Pending,
207  Success,
208  Error
209 } CommunicationStatus;
210 
211 std::vector<double> gsl_polynomial_fit(const double *const data_x, const double *const data_y, const int n,
212  const int order, double &chisq);
213 
214 // Invalid value
215 const int INVALID_VALUE = -1e6;
216 }
217 
218 // Communication Status
219 Q_DECLARE_METATYPE(Ekos::CommunicationStatus)
220 QDBusArgument &operator<<(QDBusArgument &argument, const Ekos::CommunicationStatus &source);
221 const QDBusArgument &operator>>(const QDBusArgument &argument, Ekos::CommunicationStatus &dest);
222 
223 // Capture Status
224 // FIXME is there a way to avoid unnecessary duplicating code? The solution suggested in KDE WiKi is to use Boost
225 // which we do not have to add as dependency
226 Q_DECLARE_METATYPE(Ekos::CaptureState)
227 QDBusArgument &operator<<(QDBusArgument &argument, const Ekos::CaptureState &source);
228 const QDBusArgument &operator>>(const QDBusArgument &argument, Ekos::CaptureState &dest);
229 
230 // Focus
231 Q_DECLARE_METATYPE(Ekos::FocusState)
232 QDBusArgument &operator<<(QDBusArgument &argument, const Ekos::FocusState &source);
233 const QDBusArgument &operator>>(const QDBusArgument &argument, Ekos::FocusState &dest);
234 
235 // Guide
236 Q_DECLARE_METATYPE(Ekos::GuideState)
237 QDBusArgument &operator<<(QDBusArgument &argument, const Ekos::GuideState &source);
238 const QDBusArgument &operator>>(const QDBusArgument &argument, Ekos::GuideState &dest);
239 
240 // Align
241 Q_DECLARE_METATYPE(Ekos::AlignState)
242 QDBusArgument &operator<<(QDBusArgument &argument, const Ekos::AlignState &source);
243 const QDBusArgument &operator>>(const QDBusArgument &argument, Ekos::AlignState &dest);
244 
245 // Scheduler
246 Q_DECLARE_METATYPE(Ekos::SchedulerState)
247 QDBusArgument &operator<<(QDBusArgument &argument, const Ekos::SchedulerState &source);
248 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:177
@ 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:69
@ CAPTURE_CAPTURING
Definition: ekos.h:95
@ ALIGN_SUSPENDED
Alignment operations suspended.
Definition: ekos.h:155
ScriptTypes
Definition: ekos.h:172
@ CAPTURE_SETTING_ROTATOR
Definition: ekos.h:108
@ ALIGN_COMPLETE
Alignment successfully completed.
Definition: ekos.h:147
@ CAPTURE_PROGRESS
Definition: ekos.h:94
@ SCRIPT_PRE_CAPTURE
Script to run before a sequence capture is started.
Definition: ekos.h:175
@ CAPTURE_SETTING_TEMPERATURE
Definition: ekos.h:107
@ CAPTURE_IDLE
Definition: ekos.h:93
CaptureState
Capture states.
Definition: ekos.h:91
@ ALIGN_ABORTED
Alignment aborted by user or agent.
Definition: ekos.h:149
@ ALIGN_SUCCESSFUL
Alignment Astrometry solver successfully solved the image.
Definition: ekos.h:151
@ CAPTURE_ABORTED
Definition: ekos.h:99
@ CAPTURE_DITHERING
Definition: ekos.h:102
@ ALIGN_FAILED
Alignment failed.
Definition: ekos.h:148
@ CAPTURE_FILTER_FOCUS
Definition: ekos.h:104
@ ALIGN_PROGRESS
Alignment operation in progress.
Definition: ekos.h:150
@ ALIGN_ROTATING
Rotating (Automatic or Manual) to target position angle.
Definition: ekos.h:154
QDebug operator<<(QDebug d, const QCPVector2D &vec)
Definition: qcustomplot.h:446
@ ALIGN_IDLE
No ongoing operations.
Definition: ekos.h:146
@ 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
@ ALIGN_SYNCING
Syncing mount to solution coordinates.
Definition: ekos.h:152
@ CAPTURE_IMAGE_RECEIVED
Definition: ekos.h:101
@ ALIGN_SLEWING
Slewing mount to target coordinates.
Definition: ekos.h:153
@ CAPTURE_MERIDIAN_FLIP
Definition: ekos.h:111
@ SCRIPT_PRE_JOB
Script to run before a sequence job is started.
Definition: ekos.h:174
@ SCRIPT_POST_CAPTURE
Script to run after a sequence capture is completed.
Definition: ekos.h:176
QDataStream & operator>>(QDataStream &in, KDateTime &dateTime)
AlignState
Definition: ekos.h:144
@ CAPTURE_GUIDER_DRIFT
Definition: ekos.h:106
@ CAPTURE_ALIGNING
Definition: ekos.h:109
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Fri Jan 27 2023 07:45:12 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.