Kstars

indilightbox.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 <basedevice.h>
8#include "indilightbox.h"
9
10namespace ISD
11{
12
13bool LightBox::isLightOn()
14{
15 auto lightSP = getSwitch("FLAT_LIGHT_CONTROL");
16 if (!lightSP)
17 return false;
18
19 auto lightON = lightSP->findWidgetByName("FLAT_LIGHT_ON");
20 if (!lightON)
21 return false;
22
23 return lightON->getState() == ISS_ON;
24}
25
27{
28 auto lightSP = getSwitch("FLAT_LIGHT_CONTROL");
29
30 if (!lightSP)
31 return false;
32
33 auto lightON = lightSP->findWidgetByName("FLAT_LIGHT_ON");
34 auto lightOFF = lightSP->findWidgetByName("FLAT_LIGHT_OFF");
35
36 if (!lightON || !lightOFF)
37 return false;
38
39 lightSP->reset();
40
41 if (enable)
42 lightON->setState(ISS_ON);
43 else
44 lightOFF->setState(ISS_ON);
45
46 sendNewProperty(lightSP);
47
48 return true;
49}
50
51bool LightBox::setBrightness(uint16_t val)
52{
53 auto lightIntensity = getNumber("FLAT_LIGHT_INTENSITY");
54 if (!lightIntensity)
55 return false;
56
57 lightIntensity->at(0)->setValue(val);
58 sendNewProperty(lightIntensity);
59 return true;
60}
61
62
63}
void sendNewProperty(INDI::Property prop)
Send new property command to server.
INDI::PropertyView< ISwitch > * getSwitch(const QString &name) const
Q_SCRIPTABLE bool setLightEnabled(bool enable)
SetLightEnabled Turn on/off light.
Q_SCRIPTABLE bool setBrightness(uint16_t val)
SetBrightness Set light box brightness levels if dimmable.
ISD is a collection of INDI Standard Devices.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:04:46 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.