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 <QtDBus/QDBusArgument>
13#include <QString>
14
15#include <vector>
16
17namespace Ekos
18{
19// Guide States
20static const QList<KLocalizedString> guideStates = { ki18n("Idle"),
21 ki18n("Aborted"),
22 ki18n("Connected"),
23 ki18n("Disconnected"),
24 ki18n("Capturing"),
25 ki18n("Looping"),
26 ki18n("Subtracting"),
27 ki18n("Subframing"),
28 ki18n("Selecting star"),
29 ki18n("Calibrating"),
30 ki18n("Calibration error"),
31 ki18n("Calibrated"),
32 ki18n("Guiding"),
33 ki18n("Suspended"),
34 ki18n("Reacquiring"),
35 ki18n("Dithering"),
36 ki18n("Manual Dithering"),
37 ki18n("Dithering error"),
38 ki18n("Dithering successful"),
39 ki18n("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<KLocalizedString> captureStates =
70{
71 ki18n("Idle"), ki18n("In Progress"), ki18n("Capturing"), ki18n("Pause Planned"), ki18n("Paused"),
72 ki18n("Suspended"), ki18n("Aborted"), ki18n("Waiting"), ki18n("Image Received"),
73 ki18n("Dithering"), ki18n("Focusing"), ki18n("Filter Focus"), ki18n("Changing Filter"), ki18n("Guider Settling"),
74 ki18n("Setting Temperature"), ki18n("Setting Rotator"), ki18n("Aligning"), ki18n("Calibrating"),
75 ki18n("Meridian Flip"), ki18n("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<KLocalizedString> focusStates = { ki18n("Idle"), ki18n("Complete"), ki18n("Failed"),
119 ki18n("Aborted"), ki18n("User Input"), ki18n("In Progress"),
120 ki18n("Framing"), ki18n("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<KLocalizedString> alignStates = { ki18n("Idle"), ki18n("Complete"), ki18n("Failed"),
139 ki18n("Aborted"), ki18n("In Progress"), ki18n("Successful"),
140 ki18n("Syncing"), ki18n("Slewing"), ki18n("Rotating"),
141 ki18n("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<KLocalizedString> filterStates = { ki18n("Idle"), ki18n("Changing Filter"), ki18n("Focus Offset"),
162 ki18n("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<KLocalizedString> schedulerStates = { ki18n("Idle"), ki18n("Startup"), ki18n("Running"),
199 ki18n("Paused"), ki18n("Shutdown"), ki18n("Aborted"),
200 ki18n("Loading")
201 };
202typedef enum
203{
204 Idle,
205 Pending,
206 Success,
207 Error
208} CommunicationStatus;
209
210typedef enum
211{
212 EXTENSION_START_REQUESTED,
213 EXTENSION_STARTED,
214 EXTENSION_STOP_REQUESTED,
215 EXTENSION_STOPPED,
216} ExtensionState;
217
218const QString getExtensionStatusString(ExtensionState state, bool translated = true);
219
220static const QList<KLocalizedString> extensionStates = { ki18n("Starting"), ki18n("Started"), ki18n("Stopping"), ki18n("Stopped")};
221
222std::vector<double> gsl_polynomial_fit(const double *const data_x, const double *const data_y, const int n,
223 const int order, double &chisq);
224
225// Invalid value
226const int INVALID_VALUE = -1e6;
227// Invalid star HFR, FWHM result
228static double constexpr INVALID_STAR_MEASURE = -1.0;
229
230}
231
232// Communication Status
233Q_DECLARE_METATYPE(Ekos::CommunicationStatus)
234QDBusArgument &operator<<(QDBusArgument &argument, const Ekos::CommunicationStatus &source);
235const QDBusArgument &operator>>(const QDBusArgument &argument, Ekos::CommunicationStatus &dest);
236
237// Capture Status
238// FIXME is there a way to avoid unnecessary duplicating code? The solution suggested in KDE WiKi is to use Boost
239// which we do not have to add as dependency
240Q_DECLARE_METATYPE(Ekos::CaptureState)
242const QDBusArgument &operator>>(const QDBusArgument &argument, Ekos::CaptureState &dest);
243
244// Focus
245Q_DECLARE_METATYPE(Ekos::FocusState)
246QDBusArgument &operator<<(QDBusArgument &argument, const Ekos::FocusState &source);
247const QDBusArgument &operator>>(const QDBusArgument &argument, Ekos::FocusState &dest);
248
249// Guide
250Q_DECLARE_METATYPE(Ekos::GuideState)
251QDBusArgument &operator<<(QDBusArgument &argument, const Ekos::GuideState &source);
252const QDBusArgument &operator>>(const QDBusArgument &argument, Ekos::GuideState &dest);
253
254// Align
255Q_DECLARE_METATYPE(Ekos::AlignState)
256QDBusArgument &operator<<(QDBusArgument &argument, const Ekos::AlignState &source);
257const QDBusArgument &operator>>(const QDBusArgument &argument, Ekos::AlignState &dest);
258
259// Scheduler
260Q_DECLARE_METATYPE(Ekos::SchedulerState)
261QDBusArgument &operator<<(QDBusArgument &argument, const Ekos::SchedulerState &source);
262const QDBusArgument &operator>>(const QDBusArgument &argument, Ekos::SchedulerState &dest);
263
264// Extensions
265Q_DECLARE_METATYPE(Ekos::ExtensionState)
266QDBusArgument &operator<<(QDBusArgument &argument, const Ekos::ExtensionState &source);
267const QDBusArgument &operator>>(const QDBusArgument &argument, Ekos::ExtensionState &dest);
The SchedulerState class holds all attributes defining the scheduler's state.
KLocalizedString KI18N_EXPORT ki18n(const char *text)
Ekos is an advanced Astrophotography tool for Linux.
Definition align.cpp:83
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 &)
QDebug operator<<(QDebug dbg, const DcrawInfoContainer &c)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:46 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.