Warning, file /education/kstars/kstars/indi/indifilterwheel.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     SPDX-FileCopyrightText: 2022 Jasem Mutlaq <mutlaqja@ikarustech.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "indifilterwheel.h"
0008 
0009 namespace ISD
0010 {
0011 
0012 bool FilterWheel::setPosition(uint8_t index)
0013 {
0014     auto nvp = getNumber("FILTER_SLOT");
0015 
0016     if (!nvp)
0017         return false;
0018 
0019     if (index == static_cast<uint8_t>(nvp->np[0].value))
0020         return true;
0021 
0022     nvp->at(0)->setValue(index);
0023 
0024     sendNewProperty(nvp);
0025 
0026     return true;
0027 }
0028 
0029 bool FilterWheel::setLabels(const QStringList &names)
0030 {
0031     auto tvp = getText("FILTER_NAME");
0032 
0033     if (!tvp)
0034         return false;
0035 
0036     if (names.count() != tvp->count())
0037         return false;
0038 
0039     for (uint8_t i = 0; i < tvp->ntp; i++)
0040         tvp->at(i)->setText(names[i].toLatin1().constData());
0041 
0042     sendNewProperty(tvp);
0043     return true;
0044 }
0045 
0046 bool FilterWheel::confirmFilter()
0047 {
0048     auto svp = getSwitch("CONFIRM_FILTER_SET");
0049     if (!svp)
0050         return false;
0051 
0052     svp->at(0)->setState(ISS_ON);
0053     sendNewProperty(svp);
0054     return true;
0055 }
0056 
0057 }