Kstars

inditelescopelite.h
1/*
2 SPDX-FileCopyrightText: 2012 Jasem Mutlaq <mutlaqja@ikarustech.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "basedevice.h"
10#include "skypoint.h"
11#include "kstarslite/skypointlite.h"
12#include "kstarslite/skyobjectlite.h"
13
14#include <QObject>
15
17
18/**
19 * @class TelescopeLite
20 *
21 * device handle controlling telescope. It can slew and sync to a specific sky point and supports all standard properties with INDI
22 * telescope device.
23 *
24 * @author Jasem Mutlaq
25 */
26class TelescopeLite : public QObject
27{
29
30 Q_PROPERTY(bool slewDecreasable READ isSlewDecreasable WRITE setSlewDecreasable NOTIFY slewDecreasableChanged)
31 Q_PROPERTY(bool slewIncreasable READ isSlewIncreasable WRITE setSlewIncreasable NOTIFY slewIncreasableChanged)
32 Q_PROPERTY(QString slewRateLabel READ getSlewRateLabel WRITE setSlewRateLabel NOTIFY slewRateLabelChanged)
33 Q_PROPERTY(QString deviceName READ getDeviceName WRITE setDeviceName NOTIFY deviceNameChanged)
34
35 public:
36 explicit TelescopeLite(INDI::BaseDevice *device);
37 TelescopeLite() { }
39
40 enum TelescopeMotionNS
41 {
42 MOTION_NORTH,
43 MOTION_SOUTH
44 };
45 enum TelescopeMotionWE
46 {
47 MOTION_WEST,
48 MOTION_EAST
49 };
50 enum TelescopeMotionCommand
51 {
52 MOTION_START,
53 MOTION_STOP
54 };
55
56 Q_ENUMS(TelescopeMotionNS)
57 Q_ENUMS(TelescopeMotionWE)
58 Q_ENUMS(TelescopeMotionCommand)
59
60 void registerProperty(INDI::Property prop);
61 void processSwitch(ISwitchVectorProperty *svp);
62 void processText(ITextVectorProperty *tvp);
63 void processNumber(INumberVectorProperty *nvp);
64
65 INDI::BaseDevice *getDevice() { return baseDevice; }
66 //deviceName
67 QString getDeviceName() { return m_deviceName; }
68 void setDeviceName(const QString &deviceName);
69
70 bool isSlewDecreasable() { return m_slewDecreasable; }
71 bool isSlewIncreasable() { return m_slewIncreasable; }
72
73 QString getSlewRateLabel() { return m_slewRateLabel; }
74
75 void setSlewDecreasable(bool slewDecreasable);
76 void setSlewIncreasable(bool slewIncreasable);
77
78 void setSlewRateLabel(const QString &slewRateLabel);
79
80 Q_INVOKABLE bool decreaseSlewRate();
81 Q_INVOKABLE bool increaseSlewRate();
82
83 // Common Commands
84 Q_INVOKABLE bool slew(SkyPointLite *ScopeTarget) { return slew(ScopeTarget->getPoint()); }
85 Q_INVOKABLE bool slew(SkyPoint *ScopeTarget);
86 bool slew(double ra, double dec);
87 Q_INVOKABLE bool sync(SkyPointLite *ScopeTarget) { return sync(ScopeTarget->getPoint()); }
88 Q_INVOKABLE bool sync(SkyPoint *ScopeTarget);
89 bool sync(double ra, double dec);
90 Q_INVOKABLE bool moveNS(TelescopeMotionNS dir, TelescopeMotionCommand cmd);
91 Q_INVOKABLE bool moveWE(TelescopeMotionWE dir, TelescopeMotionCommand cmd);
92 bool canGuide();
93 bool canSync();
94 bool canPark();
95 bool isSlewing();
96 bool isParked();
97 bool isInMotion();
98 /*bool doPulse(GuideDirection ra_dir, int ra_msecs, GuideDirection dec_dir, int dec_msecs );
99 bool doPulse(GuideDirection dir, int msecs );*/
100 bool getEqCoords(double *ra, double *dec);
101 void setAltLimits(double minAltitude, double maxAltitude);
102 Q_INVOKABLE bool isConnected() { return baseDevice->isConnected(); }
103 Q_INVOKABLE QStringList getSlewRateLabels() { return m_slewRateLabels; };
104
105 protected:
106 bool sendCoords(SkyPoint *ScopeTarget);
107
108 public slots:
109 Q_INVOKABLE bool abort();
110 bool park();
111 bool unPark();
112 bool setSlewRate(int index);
113 void updateSlewRate(const QString &deviceName, const QString &propName);
114
115 signals:
116 void slewDecreasableChanged(bool);
117 void slewIncreasableChanged(bool);
118 void slewRateLabelChanged(QString);
119 void deviceNameChanged(QString);
120 void newTelescopeLiteCreated(TelescopeLite *);
121 void slewRateUpdate(int index, int count);
122
123 private:
124 SkyPoint currentCoord;
125 double minAlt { 0 };
126 double maxAlt { 0 };
127 bool IsParked { false };
128 ClientManagerLite *clientManager { nullptr };
129 INDI::BaseDevice *baseDevice { nullptr };
130 int slewRateIndex { 0 };
131 QString m_deviceName;
132 bool m_slewDecreasable { false };
133 bool m_slewIncreasable { false };
134 QString m_slewRateLabel;
135 QStringList m_slewRateLabels;
136};
Wrapper for SkyPoint to allow access of some of its properties from QML.
Q_INVOKABLE SkyPoint * getPoint()
The sky coordinates of a point in the sky.
Definition skypoint.h:45
device handle controlling telescope.
Q_ENUMS(...)
Q_INVOKABLEQ_INVOKABLE
Q_OBJECTQ_OBJECT
Q_PROPERTY(...)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:53:00 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.