Kstars

indidustcap.h
1/*
2 SPDX-FileCopyrightText: 2015 Jasem Mutlaq <mutlaqja@ikarustech.com>
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
14namespace ISD
15{
16/**
17 * @class DustCap
18 * Handles operation of a remotely controlled dust cover cap.
19 *
20 * @author Jasem Mutlaq
21 */
22class DustCap : public ConcreteDevice
23{
25 Q_CLASSINFO("D-Bus Interface", "org.kde.kstars.INDI.DustCap")
26 Q_PROPERTY(ISD::DustCap::Status status READ status NOTIFY newStatus)
27 Q_PROPERTY(ISD::ParkStatus parkStatus READ parkStatus NOTIFY newParkStatus)
28 Q_PROPERTY(bool canPark READ canPark)
29
30 public:
31 explicit DustCap(GenericDevice *parent);
32 virtual ~DustCap() override = default;
33 typedef enum
34 {
35 CAP_IDLE,
36 CAP_PARKING,
37 CAP_UNPARKING,
38 CAP_PARKED,
39 CAP_ERROR
40 } Status;
41
42 virtual void processSwitch(INDI::Property prop) override;
43
44 Q_SCRIPTABLE virtual bool canPark();
45 // Check if cap is fully parked.
46 Q_SCRIPTABLE virtual bool isParked();
47 // Check if cap is fully unparked. We need this because we have parking and unparking in progress
48 Q_SCRIPTABLE virtual bool isUnParked();
49
50 static const QString getStatusString(Status status, bool translated = true);
51
52 public slots:
53 /**
54 * @brief Park Close dust cap
55 * @return True if operation is successful, false otherwise.
56 */
57 Q_SCRIPTABLE bool park();
58
59 /**
60 * @brief UnPark Open dust cap
61 * @return True if operation is successful, false otherwise.
62 */
63 Q_SCRIPTABLE bool unpark();
64
65 Q_SCRIPTABLE Status status()
66 {
67 return m_Status;
68 }
69 ISD::ParkStatus parkStatus() const
70 {
71 return m_ParkStatus;
72 }
73
74 signals:
75 void newStatus(ISD::DustCap::Status status);
76 void newParkStatus(ISD::ParkStatus status);
77
78 private:
79 Status m_Status { CAP_IDLE };
80 ParkStatus m_ParkStatus { PARK_UNKNOWN };
81 static const QList<const char *> capStates;
82};
83
84}
85
86Q_DECLARE_METATYPE(ISD::DustCap::Status)
87QDBusArgument &operator<<(QDBusArgument &argument, const ISD::DustCap::Status &source);
88const QDBusArgument &operator>>(const QDBusArgument &argument, ISD::DustCap::Status &dest);
The ConcreteDevice class.
Handles operation of a remotely controlled dust cover cap.
Definition indidustcap.h:23
Q_SCRIPTABLE bool unpark()
UnPark Open dust cap.
Q_SCRIPTABLE bool park()
Park Close dust cap.
GenericDevice is the Generic Device for INDI devices.
Definition indistd.h:117
ISD is a collection of INDI Standard Devices.
Q_CLASSINFO(Name, Value)
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:48:26 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.