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 setFilterManager(QSharedPointer<FilterManager> device);
113 QSharedPointer<FilterManager> getFilterManager()
114 {
115 return m_FilterManager;
116 }
117
118 /**
119 * @brief disconnectDevices Connect all current devices to the job's
120 * state machine
121 */
122 void disconnectDevices(SequenceJobState *state);
123
124 //////////////////////////////////////////////////////////////////////
125 // Rotator commands
126 //////////////////////////////////////////////////////////////////////
127 /**
128 * @brief Set the rotator's angle
129 */
130 void setRotatorAngle(double rawAngle);
131
132 /**
133 * @brief Get the rotator's angle
134 */
135 double getRotatorAngle();
136
137 /**
138 * @brief Get the rotator's angle state
139 */
140 IPState getRotatorAngleState();
141
142 /**
143 * @brief reverseRotator Toggle rotation reverse
144 * @param toggled If true, reverse rotator normal direction. If false, use rotator normal direction.
145 */
146 void reverseRotator(bool toggled);
147
148 /**
149 * @brief Read the current rotator's angle from the rotator device
150 * and emit it as {@see newRotatorAngle()}
151 */
152 void readRotatorAngle();
153
154 //////////////////////////////////////////////////////////////////////
155 // Camera commands
156 //////////////////////////////////////////////////////////////////////
157
158 /**
159 * @brief Set the CCD target temperature
160 * @param temp
161 */
162 void setCCDTemperature(double temp);
163
164 /**
165 * @brief Set CCD to batch mode
166 * @param enable true iff batch mode
167 */
168 void enableCCDBatchMode(bool enable);
169
170 /**
171 * @brief Abort exposure if fast exposure is enabled
172 */
173 void abortFastExposure();
174
175 /**
176 * @brief getGain Retrieve the gain value from the custom property value. Depending
177 * on the camera, it is either stored as GAIN property value of CCD_GAIN or as
178 * Gain property value from CCD_CONTROLS.
179 */
180 double cameraGain(QMap<QString, QMap<QString, QVariant> > propertyMap);
181
182 /**
183 * @brief cameraGain Retrieve the gain value from the active camera
184 */
185 double cameraGain();
186
187 /**
188 * @brief getOffset Retrieve the offset value from the custom property value. Depending
189 * on the camera, it is either stored as OFFSET property value of CCD_OFFSET or as
190 * Offset property value from CCD_CONTROLS.
191 */
192 double cameraOffset(QMap<QString, QMap<QString, QVariant> > propertyMap);
193 /**
194 * @brief cameraOffset Retrieve the offset value from the active camera
195 */
196 double cameraOffset();
197
198 /**
199 * @brief cameraTemperature Retrieve the current chip temperature from the active camera
200 */
201 double cameraTemperature();
202
203 //////////////////////////////////////////////////////////////////////
204 // Filter wheel commands
205 //////////////////////////////////////////////////////////////////////
206
207 /**
208 * @brief Select the filter at the given position
209 */
210 void setFilterPosition(int targetFilterPosition, FilterManager::FilterPolicy policy = FilterManager::ALL_POLICIES);
211 /**
212 * @brief updateFilterPosition Inform the sequence job state machine about the current filter position
213 */
214 void updateFilterPosition();
215
216 //////////////////////////////////////////////////////////////////////
217 // Flat capturing commands
218 //////////////////////////////////////////////////////////////////////
219
220 /**
221 * @brief Ask for covering the scope manually with a flats light source or dark cover
222 */
223 void askManualScopeCover(QString question, QString title, bool light);
224 /**
225 * @brief Ask for opening the scope cover manually
226 */
227 void askManualScopeOpen(bool light);
228 /**
229 * @brief Turn light on in the light box
230 */
231 void setLightBoxLight(bool on);
232 /**
233 * @brief park the dust cap
234 */
235 void parkDustCap(bool park);
236 /**
237 * @brief Slew the telescope to a target
238 */
239 void slewTelescope(SkyPoint &target);
240 /**
241 * @brief Turn scope tracking on and off
242 */
243 void setScopeTracking(bool on);
244 /**
245 * @brief Park / unpark telescope
246 */
247 void setScopeParked(bool parked);
248 /**
249 * @brief Park / unpark dome
250 */
251 void setDomeParked(bool parked);
252 /**
253 * @brief Check if the focuser needs to be moved to the focus position.
254 */
255 void flatSyncFocus(int targetFilterID);
256
257 //////////////////////////////////////////////////////////////////////
258 // Dark capturing commands
259 //////////////////////////////////////////////////////////////////////
260
261 /**
262 * @brief Check whether the CCD has a shutter
263 */
264 void queryHasShutter();
265
266signals:
267 /**
268 * @brief filterIdChanged Update of the currently selected filter ID
269 */
270 void filterIdChanged(int id);
271 /**
272 * @brief newCamera A new camera has been set
273 * @param name device name (empty if none)
274 */
275 void newCamera(QString name);
276 /**
277 * @brief CameraConnected signal if the camera got connected
278 * @param connected is it connected?
279 */
280 void CameraConnected(bool connected);
281 /**
282 * @brief Update for the CCD temperature
283 */
284 void newCCDTemperatureValue(double value);
285 /**
286 * @brief newRotator A new rotator has been set
287 * @param name device name (empty if none)
288 */
289 void newRotator(QString name);
290 /**
291 * @brief Update for the rotator's angle
292 */
293 void newRotatorAngle(double value, IPState state);
294 /**
295 * @brief Update for the rotator reverse status
296 */
297 void rotatorReverseToggled(bool enabled);
298 /**
299 * @brief newFilterWheel A new filter wheel has been set
300 * @param name device name (empty if none)
301 */
302 void newFilterWheel(QString name);
303 /**
304 * @brief FilterWheelConnected signal if the filter wheel got connected
305 * @param connected is it connected?
306 */
307 void FilterWheelConnected(bool connected);
308 /**
309 * @brief Cover for the scope with a flats light source (light is true) or dark (light is false)
310 */
311 void manualScopeCoverUpdated(bool closed, bool success, bool light);
312 /**
313 * @brief Light box light is on.
314 */
315 void lightBoxLight(bool on);
316 /**
317 * @brief dust cap status change
318 */
319 void dustCapStatusChanged(ISD::DustCap::Status status);
320 /**
321 * @brief telescope status change
322 */
323 void scopeStatusChanged(ISD::Mount::Status status);
324 /**
325 * @brief telescope pier side change
326 */
327 void pierSideChanged(ISD::Mount::PierSide pierside);
328 /**
329 * @brief telescope park status change
330 */
331 void scopeParkStatusChanged(ISD::ParkStatus status);
332 /**
333 * @brief dome status change
334 */
335 void domeStatusChanged(ISD::Dome::Status status);
336 /**
337 * @brief flat sync focus status change
338 */
339 void flatSyncFocusChanged(bool completed);
340 /**
341 * @brief CCD has a shutter
342 */
343 void hasShutter(bool present);
344
345public slots:
346 /**
347 * @brief Slot that reads the requested device state and publishes the corresponding event
348 * @param state device state that needs to be read directly
349 */
350 void readCurrentState(CaptureState state);
351 /**
352 * @brief Slot that reads the current park state of the mount and publishes it.
353 */
354 void readCurrentMountParkState();
355
356private:
357 // the state machine for the current sequence job
358 QSharedPointer<SequenceJobState> currentSequenceJobState;
359 // the light box device
360 ISD::LightBox *m_ActiveLightBox { nullptr };
361 // the dust cap
362 ISD::DustCap *m_ActiveDustCap { nullptr };
363 // the current mount
364 ISD::Mount *m_ActiveMount { nullptr };
365 // the current dome
366 ISD::Dome *m_ActiveDome { nullptr };
367 // active rotator device
368 ISD::Rotator * m_ActiveRotator { nullptr };
369 // active camera device
370 ISD::Camera * m_ActiveCamera { nullptr };
371 // active CCD chip
372 ISD::CameraChip * m_ActiveChip { nullptr };
373 // currently active filter wheel device
374 ISD::FilterWheel * m_ActiveFilterWheel { nullptr };
375 // currently active filter manager
376 QSharedPointer<FilterManager> m_FilterManager;
377
378 // flag if light manual cover has been asked
379 bool m_ManualLightCoveringAsked { false };
380 bool m_ManualLightOpeningAsked { false };
381
382 // flag if dark manual cover has been asked
383 bool m_ManualDarkCoveringAsked { false };
384 bool m_ManualDarkOpeningAsked { false };
385
386 //////////////////////////////////////////////////////////////////////
387 // Device Connections
388 //////////////////////////////////////////////////////////////////////
389 void connectDustCap(SequenceJobState *state);
390 void disconnectDustCap(SequenceJobState *state);
391 void connectMount(SequenceJobState *state);
392 void disconnectMount(SequenceJobState *state);
393 void connectDome(SequenceJobState *state);
394 void disconnectDome(SequenceJobState *state);
395 void connectRotator(SequenceJobState *state);
396 void disconnectRotator(SequenceJobState *state);
397 void connectActiveCamera(SequenceJobState *state);
398 void disconnectActiveCamera(SequenceJobState *state);
399 void connectFilterManager(SequenceJobState *state);
400 void disconnectFilterManager(SequenceJobState *state);
401};
402}; // 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 Mon Nov 4 2024 16:38:42 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.