Kstars

indidome.h
1 /*
2  SPDX-FileCopyrightText: 2015 Jasem Mutlaq <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include <memory>
10 #include <QTimer>
11 
12 #include "indiconcretedevice.h"
13 
14 namespace ISD
15 {
16 /**
17  * @class Dome
18  * Class handles control of INDI dome devices. Both open and closed loop (sensor feedback) domes are supported.
19  *
20  * @author Jasem Mutlaq
21  */
22 class Dome : public ConcreteDevice
23 {
24  Q_OBJECT
25 
26  public:
27  explicit Dome(GenericDevice *parent);
28  typedef enum
29  {
30  DOME_IDLE,
31  DOME_MOVING_CW,
32  DOME_MOVING_CCW,
33  DOME_TRACKING,
34  DOME_PARKING,
35  DOME_UNPARKING,
36  DOME_PARKED,
37  DOME_ERROR
38  } Status;
39 
40  typedef enum
41  {
42  SHUTTER_UNKNOWN,
43  SHUTTER_OPEN,
44  SHUTTER_CLOSED,
45  SHUTTER_OPENING,
46  SHUTTER_CLOSING,
47  SHUTTER_ERROR
48  } ShutterStatus;
49 
50  typedef enum
51  {
52  DOME_CW,
53  DOME_CCW
54  } DomeDirection;
55 
56  typedef enum
57  {
58  MOTION_START,
59  MOTION_STOP
60  } DomeMotionCommand;
61 
62 
63  void processSwitch(ISwitchVectorProperty *svp) override;
64  void processNumber(INumberVectorProperty *nvp) override;
65  void registerProperty(INDI::Property prop) override;
66 
67  bool canPark() const
68  {
69  return m_CanPark;
70  }
71  bool canAbsMove() const
72  {
73  return m_CanAbsMove;
74  }
75  bool canRelMove() const
76  {
77  return m_CanRelMove;
78  }
79  bool canAbort() const
80  {
81  return m_CanAbort;
82  }
83  bool isParked() const
84  {
85  return m_ParkStatus == PARK_PARKED;
86  }
87  bool isMoving() const;
88 
89  double azimuthPosition() const;
90  bool setAzimuthPosition(double position);
91  bool setRelativePosition(double position);
92 
93  bool moveDome(DomeDirection dir, DomeMotionCommand operation);
94 
95  bool hasShutter() const
96  {
97  return m_HasShutter;
98  }
99 
100  // slaving
101  bool isAutoSync();
102  bool setAutoSync(bool activate);
103 
104  Status status() const
105  {
106  return m_Status;
107  }
108  static const QString getStatusString (Status status, bool translated = true);
109 
110  ShutterStatus shutterStatus();
111  ShutterStatus shutterStatus(ISwitchVectorProperty *svp);
112 
113  public slots:
114  bool Abort();
115  bool Park();
116  bool UnPark();
117  bool ControlShutter(bool open);
118 
119  signals:
120  void newStatus(Status status);
121  void newParkStatus(ParkStatus status);
122  void newShutterStatus(ShutterStatus status);
123  void newAutoSyncStatus(bool enabled);
124  void azimuthPositionChanged(double Az);
125 
126  private:
127  ParkStatus m_ParkStatus { PARK_UNKNOWN };
128  ShutterStatus m_ShutterStatus { SHUTTER_UNKNOWN };
129  Status m_Status { DOME_IDLE };
130  bool m_CanAbsMove { false };
131  bool m_CanRelMove { false };
132  bool m_CanPark { false };
133  bool m_CanAbort { false };
134  bool m_HasShutter { false };
135  static const QList<const char *> domeStates;
136 };
137 }
138 
139 Q_DECLARE_METATYPE(ISD::Dome::Status)
140 QDBusArgument &operator<<(QDBusArgument &argument, const ISD::Dome::Status &source);
141 const QDBusArgument &operator>>(const QDBusArgument &argument, ISD::Dome::Status &dest);
142 
Q_OBJECTQ_OBJECT
The ConcreteDevice class.
QDebug operator<<(QDebug d, const QCPVector2D &vec)
Definition: qcustomplot.h:450
QDataStream & operator>>(QDataStream &in, KDateTime &dateTime)
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Thu Aug 11 2022 03:59:59 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.