Kstars

indiguider.cpp
1/*
2 SPDX-FileCopyrightText: 2012 Jasem Mutlaq <mutlaqja@ikarustech.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5
6 INDI Guide Interface
7*/
8
9#include "indiguider.h"
10
11namespace ISD
12{
13
14Guider::Guider(GenericDevice *parent) : ConcreteDevice(parent)
15{
16}
17
18void Guider::setDECSwap(bool enable)
19{
20 swapDEC = enable;
21}
22
23bool Guider::doPulse(GuideDirection ra_dir, int ra_msecs, GuideDirection dec_dir, int dec_msecs)
24{
25 bool raOK = doPulse(ra_dir, ra_msecs);
26 bool decOK = doPulse(dec_dir, dec_msecs);
27 return (raOK && decOK);
28}
29
30bool Guider::doPulse(GuideDirection dir, int msecs)
31{
32 INDI::PropertyNumber raPulse = getNumber("TELESCOPE_TIMED_GUIDE_WE");
33 INDI::PropertyNumber decPulse = getNumber("TELESCOPE_TIMED_GUIDE_NS");
34
35 if (!raPulse || !decPulse)
36 return false;
37
38 if (dir == RA_INC_DIR || dir == RA_DEC_DIR)
39 {
40 raPulse[0].setValue(0);
41 raPulse[1].setValue(0);
42 }
43 else
44 {
45 decPulse[0].setValue(0);
46 decPulse[1].setValue(0);
47 }
48
49 switch (dir)
50 {
51 case RA_INC_DIR: // RA is positive E of N!)
52 raPulse.findWidgetByName("TIMED_GUIDE_E")->setValue(msecs);
53 sendNewProperty(raPulse);
54 break;
55
56 case RA_DEC_DIR:
57 raPulse.findWidgetByName("TIMED_GUIDE_W")->setValue(msecs);
58 sendNewProperty(raPulse);
59 break;
60
61 case DEC_INC_DIR:
62 decPulse.findWidgetByName(swapDEC ? "TIMED_GUIDE_S" : "TIMED_GUIDE_N")->setValue(msecs);
63 sendNewProperty(decPulse);
64 break;
65
66 case DEC_DEC_DIR:
67 decPulse.findWidgetByName(swapDEC ? "TIMED_GUIDE_N" : "TIMED_GUIDE_S")->setValue(msecs);
68 sendNewProperty(decPulse);
69 break;
70
71 default:
72 return false;
73 }
74
75 return true;
76}
77}
The ConcreteDevice class.
GenericDevice is the Generic Device for INDI devices.
Definition indistd.h:117
ISD is a collection of INDI Standard Devices.
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Apr 25 2025 11:58:37 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.