Kstars

indifilterwheel.cpp
1/*
2 SPDX-FileCopyrightText: 2022 Jasem Mutlaq <mutlaqja@ikarustech.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "indifilterwheel.h"
8
9namespace ISD
10{
11
12bool FilterWheel::setPosition(uint8_t index)
13{
14 auto nvp = getNumber("FILTER_SLOT");
15
16 if (!nvp)
17 return false;
18
19 if (index == static_cast<uint8_t>(nvp->np[0].value))
20 return true;
21
22 nvp->at(0)->setValue(index);
23
24 sendNewProperty(nvp);
25
26 return true;
27}
28
29bool FilterWheel::setLabels(const QStringList &names)
30{
31 auto tvp = getText("FILTER_NAME");
32
33 if (!tvp)
34 return false;
35
36 if (names.count() != tvp->count())
37 return false;
38
39 for (uint8_t i = 0; i < tvp->ntp; i++)
40 tvp->at(i)->setText(names[i].toLatin1().constData());
41
42 sendNewProperty(tvp);
43 return true;
44}
45
46bool FilterWheel::confirmFilter()
47{
48 auto svp = getSwitch("CONFIRM_FILTER_SET");
49 if (!svp)
50 return false;
51
52 svp->at(0)->setState(ISS_ON);
53 sendNewProperty(svp);
54 return true;
55}
56
57}
void sendNewProperty(INDI::Property prop)
Send new property command to server.
INDI::PropertyView< IText > * getText(const QString &name) const
INDI::PropertyView< ISwitch > * getSwitch(const QString &name) const
ISD is a collection of INDI Standard Devices.
qsizetype count() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 1 2024 18:54:15 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.