Kstars

capturedeviceadaptor.h
1/* Ekos commands for the capture module
2 SPDX-FileCopyrightText: Wolfgang Reissenberger <sterne-jaeger@openfuture.de>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7
8#pragma once
9
10#include "ekos/ekos.h"
11#include "indi/indicommon.h"
12#include "indiapi.h"
13
14#include "indi/indidome.h"
15#include "indi/indicamerachip.h"
16#include "indi/indidustcap.h"
17#include "indi/indimount.h"
18
19#include "ekos/auxiliary/filtermanager.h"
20
21namespace {
22class Camera;
23class LightBox;
24class Rotator;
25}
26
27namespace Ekos
28{
29
30class SequenceJobState;
31
32class CaptureDeviceAdaptor: public QObject
33{
35
36public:
37 CaptureDeviceAdaptor() {}
38
39 //////////////////////////////////////////////////////////////////////
40 // current sequence job's state machine
41 //////////////////////////////////////////////////////////////////////
42 /**
43 * @brief Set the state machine for the current sequence job and attach
44 * all active devices to it.
45 */
46 void setCurrentSequenceJobState(QSharedPointer<SequenceJobState> jobState);
47
48
49 //////////////////////////////////////////////////////////////////////
50 // Devices
51 //////////////////////////////////////////////////////////////////////
52 void setLightBox(ISD::LightBox *device)
53 {
54 m_ActiveLightBox = device;
55 }
56 ISD::LightBox *lightBox()
57 {
58 return m_ActiveLightBox;
59 }
60
61 void setDustCap(ISD::DustCap *device);
62 ISD::DustCap *dustCap()
63 {
64 return m_ActiveDustCap;
65 }
66
67 void setMount(ISD::Mount *device);
68 ISD::Mount *mount()
69 {
70 return m_ActiveMount;
71 }
72
73 void setDome(ISD::Dome *device);
74 ISD::Dome *dome()
75 {
76 return m_ActiveDome;
77 }
78
79 void setRotator(ISD::Rotator *device);
80 ISD::Rotator *rotator()
81 {
82 return m_ActiveRotator;
83 }
84
85 void setActiveCamera(ISD::Camera *device);
86 ISD::Camera *getActiveCamera()
87 {
88 return m_ActiveCamera;
89 }
90
91 void setActiveChip(ISD::CameraChip *device)
92 {
93 m_ActiveChip = device;
94 }
95 ISD::CameraChip *getActiveChip()
96 {
97 return m_ActiveChip;
98 }
99
100 // FIXME add support for guide head, not implemented yet
101 void addGuideHead(ISD::Camera *device)
102 {
103 Q_UNUSED(device)
104 }
105
106 void setFilterWheel(ISD::FilterWheel *device);
107 ISD::FilterWheel *filterWheel()
108 {
109 return m_ActiveFilterWheel;
110 }
111
112 void clearFilterManager();
113 void setFilterManager(const QSharedPointer<FilterManager> &device);
114 const QSharedPointer<FilterManager> &getFilterManager() const
115 {
116 return m_FilterManager;
117 }
118
119 /**
120 * @brief disconnectDevices Connect all current devices to the job's
121 * state machine
122 */
123 void disconnectDevices(SequenceJobState *state);
124
125 //////////////////////////////////////////////////////////////////////
126 // Rotator commands
127 //////////////////////////////////////////////////////////////////////
128 /**
129 * @brief Set the rotator's angle
130 */
131 void setRotatorAngle(double rawAngle);
132
133 /**
134 * @brief Get the rotator's angle
135 */
136 double getRotatorAngle();
137
138 /**
139 * @brief Get the rotator's angle state
140 */
141 IPState getRotatorAngleState();
142
143 /**
144 * @brief reverseRotator Toggle rotation reverse
145 * @param toggled If true, reverse rotator normal direction. If false, use rotator normal direction.
146 */
147 void reverseRotator(bool toggled);
148
149 /**
150 * @brief Read the current rotator's angle from the rotator device
151 * and emit it as {@see newRotatorAngle()}
152 */
153 void readRotatorAngle();
154
155 //////////////////////////////////////////////////////////////////////
156 // Camera commands
157 //////////////////////////////////////////////////////////////////////
158
159 /**
160 * @brief Set the CCD target temperature
161 * @param temp
162 */
163 void setCCDTemperature(double temp);
164
165 /**
166 * @brief Set CCD to batch mode
167 * @param enable true iff batch mode
168 */
169 void enableCCDBatchMode(bool enable);
170
171 /**
172 * @brief Abort exposure if fast exposure is enabled
173 */
174 void abortFastExposure();
175
176 /**
177 * @brief getGain Retrieve the gain value from the custom property value. Depending
178 * on the camera, it is either stored as GAIN property value of CCD_GAIN or as
179 * Gain property value from CCD_CONTROLS.
180 */
181 double cameraGain(QMap<QString, QMap<QString, QVariant> > propertyMap);
182
183 /**
184 * @brief cameraGain Retrieve the gain value from the active camera
185 */
186 double cameraGain();
187
188 /**
189 * @brief getOffset Retrieve the offset value from the custom property value. Depending
190 * on the camera, it is either stored as OFFSET property value of CCD_OFFSET or as
191 * Offset property value from CCD_CONTROLS.
192 */
193 double cameraOffset(QMap<QString, QMap<QString, QVariant> > propertyMap);
194 /**
195 * @brief cameraOffset Retrieve the offset value from the active camera
196 */
197 double cameraOffset();
198
199 /**
200 * @brief cameraTemperature Retrieve the current chip temperature from the active camera
201 */
202 double cameraTemperature();
203
204 //////////////////////////////////////////////////////////////////////
205 // Filter wheel commands
206 //////////////////////////////////////////////////////////////////////
207
208 /**
209 * @brief Select the filter at the given position
210 */
211 void setFilterPosition(int targetFilterPosition, FilterManager::FilterPolicy policy = FilterManager::ALL_POLICIES);
212 /**
213 * @brief updateFilterPosition Inform the sequence job state machine about the current filter position
214 */
215 void updateFilterPosition();
216 /**
217 * @brief setFilterChangeFailed Inform the sequence job state machine that filter change operation failed.
218 */
219 void setFilterChangeFailed();
220
221 //////////////////////////////////////////////////////////////////////
222 // Flat capturing commands
223 //////////////////////////////////////////////////////////////////////
224
225 /**
226 * @brief Ask for covering the scope manually with a flats light source or dark cover
227 */
228 void askManualScopeCover(QString question, QString title, bool light);
229 /**
230 * @brief Ask for opening the scope cover manually
231 */
232 void askManualScopeOpen(bool light);
233 /**
234 * @brief Turn light on in the light box
235 */
236 void setLightBoxLight(bool on);
237 /**
238 * @brief park the dust cap
239 */
240 void parkDustCap(bool park);
241 /**
242 * @brief Slew the telescope to a target
243 */
244 void slewTelescope(SkyPoint &target);
245 /**
246 * @brief Turn scope tracking on and off
247 */
248 void setScopeTracking(bool on);
249 /**
250 * @brief Park / unpark telescope
251 */
252 void setScopeParked(bool parked);
253 /**
254 * @brief Park / unpark dome
255 */
256 void setDomeParked(bool parked);
257 /**
258 * @brief Check if the focuser needs to be moved to the focus position.
259 */
260 void flatSyncFocus(int targetFilterID);
261
262 //////////////////////////////////////////////////////////////////////
263 // Dark capturing commands
264 //////////////////////////////////////////////////////////////////////
265
266 /**
267 * @brief Check whether the CCD has a shutter
268 */
269 void queryHasShutter();
270
271signals:
272 /**
273 * @brief filterIdChanged Update of the currently selected filter ID
274 */
275 void filterIdChanged(int id);
276 /**
277 * @brief newCamera A new camera has been set
278 * @param name device name (empty if none)
279 */
280 void newCamera(QString name);
281 /**
282 * @brief CameraConnected signal if the camera got connected
283 * @param connected is it connected?
284 */
285 void CameraConnected(bool connected);
286 /**
287 * @brief Update for the CCD temperature
288 */
289 void newCCDTemperatureValue(double value);
290 /**
291 * @brief newRotator A new rotator has been set
292 * @param name device name (empty if none)
293 */
294 void newRotator(QString name);
295 /**
296 * @brief Update for the rotator's angle
297 */
298 void newRotatorAngle(double value, IPState state);
299 /**
300 * @brief Update for the rotator reverse status
301 */
302 void rotatorReverseToggled(bool enabled);
303 /**
304 * @brief newFilterWheel A new filter wheel has been set
305 * @param name device name (empty if none)
306 */
307 void newFilterWheel(QString name);
308 /**
309 * @brief FilterWheelConnected signal if the filter wheel got connected
310 * @param connected is it connected?
311 */
312 void FilterWheelConnected(bool connected);
313 /**
314 * @brief Cover for the scope with a flats light source (light is true) or dark (light is false)
315 */
316 void manualScopeCoverUpdated(bool closed, bool success, bool light);
317 /**
318 * @brief Light box light is on.
319 */
320 void lightBoxLight(bool on);
321 /**
322 * @brief dust cap status change
323 */
324 void dustCapStatusChanged(ISD::DustCap::Status status);
325 /**
326 * @brief telescope status change
327 */
328 void scopeStatusChanged(ISD::Mount::Status status);
329 /**
330 * @brief telescope pier side change
331 */
332 void pierSideChanged(ISD::Mount::PierSide pierside);
333 /**
334 * @brief telescope park status change
335 */
336 void scopeParkStatusChanged(ISD::ParkStatus status);
337 /**
338 * @brief dome status change
339 */
340 void domeStatusChanged(ISD::Dome::Status status);
341 /**
342 * @brief flat sync focus status change
343 */
344 void flatSyncFocusChanged(bool completed);
345 /**
346 * @brief CCD has a shutter
347 */
348 void hasShutter(bool present);
349
350public slots:
351 /**
352 * @brief Slot that reads the requested device state and publishes the corresponding event
353 * @param state device state that needs to be read directly
354 */
355 void readCurrentState(CaptureState state);
356 /**
357 * @brief Slot that reads the current park state of the mount and publishes it.
358 */
359 void readCurrentMountParkState();
360
361private:
362 // the state machine for the current sequence job
363 QSharedPointer<SequenceJobState> currentSequenceJobState;
364 // the light box device
365 ISD::LightBox *m_ActiveLightBox { nullptr };
366 // the dust cap
367 ISD::DustCap *m_ActiveDustCap { nullptr };
368 // the current mount
369 ISD::Mount *m_ActiveMount { nullptr };
370 // the current dome
371 ISD::Dome *m_ActiveDome { nullptr };
372 // active rotator device
373 ISD::Rotator * m_ActiveRotator { nullptr };
374 // active camera device
375 ISD::Camera * m_ActiveCamera { nullptr };
376 // active CCD chip
377 ISD::CameraChip * m_ActiveChip { nullptr };
378 // currently active filter wheel device
379 ISD::FilterWheel * m_ActiveFilterWheel { nullptr };
380 // currently active filter manager
381 QSharedPointer<FilterManager> m_FilterManager;
382
383 // flag if light manual cover has been asked
384 bool m_ManualLightCoveringAsked { false };
385 bool m_ManualLightOpeningAsked { false };
386
387 // flag if dark manual cover has been asked
388 bool m_ManualDarkCoveringAsked { false };
389 bool m_ManualDarkOpeningAsked { false };
390
391 //////////////////////////////////////////////////////////////////////
392 // Device Connections
393 //////////////////////////////////////////////////////////////////////
394 void connectDustCap(SequenceJobState *state);
395 void disconnectDustCap(SequenceJobState *state);
396 void connectMount(SequenceJobState *state);
397 void disconnectMount(SequenceJobState *state);
398 void connectDome(SequenceJobState *state);
399 void disconnectDome(SequenceJobState *state);
400 void connectRotator(SequenceJobState *state);
401 void disconnectRotator(SequenceJobState *state);
402 void connectActiveCamera(SequenceJobState *state);
403 void disconnectActiveCamera(SequenceJobState *state);
404 void connectFilterManager(SequenceJobState *state);
405 void disconnectFilterManager(SequenceJobState *state);
406};
407}; // namespace
CameraChip class controls a particular chip in camera.
Camera class controls an INDI Camera device.
Definition indicamera.h:45
Class handles control of INDI dome devices.
Definition indidome.h:25
Handles operation of a remotely controlled dust cover cap.
Definition indidustcap.h:25
Handles operation of a remotely controlled light box.
device handle controlling Mounts.
Definition indimount.h:29
Rotator class handles control of INDI Rotator devices.
Definition indirotator.h:20
The sky coordinates of a point in the sky.
Definition skypoint.h:45
Ekos is an advanced Astrophotography tool for Linux.
Definition align.cpp:83
Q_OBJECTQ_OBJECT
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 27 2024 11:51:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.