Kstars

ekos.h
1/*
2 SPDX-FileCopyrightText: 2017 Jasem Mutlaq <mutlaqja@ikarustech.com>
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
17namespace Ekos
18{
19// Guide States
20static 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
42typedef 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
66const QString getGuideStatusString(GuideState state, bool translated = true);
67
68// Capture States
69static 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 */
91typedef 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 */
114
115const QString getCaptureStatusString(CaptureState state, bool translated = true);
116
117// Focus States
118static 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
123typedef 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
135const QString getFocusStatusString(FocusState state, bool translated = true);
136
137// Align States
138static 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
144typedef 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. */
157
158const QString getAlignStatusString(AlignState state, bool translated = true);
159
160// Filter Manager States
161static const QList<const char *> filterStates = { I18N_NOOP("Idle"), I18N_NOOP("Changing Filter"), I18N_NOOP("Focus Offset"),
162 I18N_NOOP("Auto Focus")
163 };
164typedef enum
165{
166 FILTER_IDLE,
167 FILTER_CHANGE,
168 FILTER_OFFSET,
169 FILTER_AUTOFOCUS
170} FilterState;
171
172typedef 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
180
181const QString getFilterStatusString(FilterState state, bool translated = true);
182
183// Scheduler states
184
185typedef enum
186{
187 SCHEDULER_IDLE, /*< Scheduler is stopped. */
188 SCHEDULER_STARTUP, /*< Scheduler is starting the observatory up. */
189 SCHEDULER_RUNNING, /*< Scheduler is running. */
190 SCHEDULER_PAUSED, /*< Scheduler is paused by the end-user. */
191 SCHEDULER_SHUTDOWN, /*< Scheduler is shutting the observatory down. */
192 SCHEDULER_ABORTED, /*< Scheduler is stopped in error. */
193 SCHEDULER_LOADING /*< Scheduler is loading a schedule. */
195
196const QString getSchedulerStatusString(SchedulerState state, bool translated = true);
197
198static const QList<const char *> schedulerStates = { I18N_NOOP("Idle"), I18N_NOOP("Startup"), I18N_NOOP("Running"),
199 I18N_NOOP("Paused"), I18N_NOOP("Shutdown"), I18N_NOOP("Aborted"),
200 I18N_NOOP("Loading")
201 };
202typedef enum
203{
204 Idle,
205 Pending,
206 Success,
207 Error
208} CommunicationStatus;
209
210std::vector<double> gsl_polynomial_fit(const double *const data_x, const double *const data_y, const int n,
211 const int order, double &chisq);
212
213// Invalid value
214const int INVALID_VALUE = -1e6;
215// Invalid star HFR, FWHM result
216static double constexpr INVALID_STAR_MEASURE = -1.0;
217
218}
219
220// Communication Status
221Q_DECLARE_METATYPE(Ekos::CommunicationStatus)
222QDBusArgument &operator<<(QDBusArgument &argument, const Ekos::CommunicationStatus &source);
223const QDBusArgument &operator>>(const QDBusArgument &argument, Ekos::CommunicationStatus &dest);
224
225// Capture Status
226// FIXME is there a way to avoid unnecessary duplicating code? The solution suggested in KDE WiKi is to use Boost
227// which we do not have to add as dependency
228Q_DECLARE_METATYPE(Ekos::CaptureState)
231
232// Focus
233Q_DECLARE_METATYPE(Ekos::FocusState)
234QDBusArgument &operator<<(QDBusArgument &argument, const Ekos::FocusState &source);
235const QDBusArgument &operator>>(const QDBusArgument &argument, Ekos::FocusState &dest);
236
237// Guide
238Q_DECLARE_METATYPE(Ekos::GuideState)
239QDBusArgument &operator<<(QDBusArgument &argument, const Ekos::GuideState &source);
240const QDBusArgument &operator>>(const QDBusArgument &argument, Ekos::GuideState &dest);
241
242// Align
243Q_DECLARE_METATYPE(Ekos::AlignState)
246
247// Scheduler
248Q_DECLARE_METATYPE(Ekos::SchedulerState)
249QDBusArgument &operator<<(QDBusArgument &argument, const Ekos::SchedulerState &source);
250const QDBusArgument &operator>>(const QDBusArgument &argument, Ekos::SchedulerState &dest);
The SchedulerState class holds all attributes defining the scheduler's state.
Ekos is an advanced Astrophotography tool for Linux.
Definition align.cpp:78
AlignState
Definition ekos.h:145
@ ALIGN_FAILED
Alignment failed.
Definition ekos.h:148
@ ALIGN_PROGRESS
Alignment operation in progress.
Definition ekos.h:150
@ ALIGN_SUCCESSFUL
Alignment Astrometry solver successfully solved the image.
Definition ekos.h:151
@ ALIGN_SLEWING
Slewing mount to target coordinates.
Definition ekos.h:153
@ ALIGN_ABORTED
Alignment aborted by user or agent.
Definition ekos.h:149
@ ALIGN_SYNCING
Syncing mount to solution coordinates.
Definition ekos.h:152
@ ALIGN_IDLE
No ongoing operations.
Definition ekos.h:146
@ ALIGN_COMPLETE
Alignment successfully completed.
Definition ekos.h:147
@ ALIGN_SUSPENDED
Alignment operations suspended.
Definition ekos.h:155
@ ALIGN_ROTATING
Rotating (Automatic or Manual) to target position angle.
Definition ekos.h:154
CaptureState
Capture states.
Definition ekos.h:92
@ CAPTURE_GUIDER_DRIFT
Definition ekos.h:106
@ CAPTURE_DITHERING
Definition ekos.h:102
@ CAPTURE_SETTING_ROTATOR
Definition ekos.h:108
@ CAPTURE_FILTER_FOCUS
Definition ekos.h:104
@ CAPTURE_WAITING
Definition ekos.h:100
@ CAPTURE_PROGRESS
Definition ekos.h:94
@ CAPTURE_PAUSE_PLANNED
Definition ekos.h:96
@ CAPTURE_PAUSED
Definition ekos.h:97
@ CAPTURE_FOCUSING
Definition ekos.h:103
@ CAPTURE_IMAGE_RECEIVED
Definition ekos.h:101
@ CAPTURE_SUSPENDED
Definition ekos.h:98
@ CAPTURE_ABORTED
Definition ekos.h:99
@ CAPTURE_COMPLETE
Definition ekos.h:112
@ CAPTURE_MERIDIAN_FLIP
Definition ekos.h:111
@ CAPTURE_CAPTURING
Definition ekos.h:95
@ CAPTURE_CALIBRATING
Definition ekos.h:110
@ CAPTURE_ALIGNING
Definition ekos.h:109
@ CAPTURE_CHANGING_FILTER
Definition ekos.h:105
@ CAPTURE_IDLE
Definition ekos.h:93
@ CAPTURE_SETTING_TEMPERATURE
Definition ekos.h:107
ScriptTypes
Definition ekos.h:173
@ SCRIPT_POST_CAPTURE
Script to run after a sequence capture is completed.
Definition ekos.h:176
@ SCRIPT_POST_JOB
Script to run after a sequence job is completed.
Definition ekos.h:177
@ SCRIPT_PRE_CAPTURE
Script to run before a sequence capture is started.
Definition ekos.h:175
@ SCRIPT_PRE_JOB
Script to run before a sequence job is started.
Definition ekos.h:174
KCALENDARCORE_EXPORT QDataStream & operator>>(QDataStream &in, const KCalendarCore::Alarm::Ptr &)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:19:02 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.