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

KDE's Doxygen guidelines are available online.