7#include "indirotator.h"
12bool Rotator::setAbsoluteAngle(
double angle)
14 auto nvp = getNumber(
"ABS_ROTATOR_ANGLE");
19 if (std::abs(angle - nvp->at(0)->getValue()) < 0.01)
22 nvp->at(0)->setValue(angle);
28bool Rotator::setAbsoluteSteps(uint32_t steps)
30 auto nvp = getNumber(
"ABS_ROTATOR_POSITION");
35 if (steps ==
static_cast<uint32_t
>(nvp->at(0)->getValue()))
38 nvp->at(0)->setValue(steps);
44bool Rotator::setReversed(
bool enabled)
51 if ( (enabled && svp->sp[0].s == ISS_ON) ||
52 (!enabled && svp->sp[1].s == ISS_ON))
56 svp->at(0)->setState(enabled ? ISS_ON : ISS_OFF);
57 svp->at(1)->setState(enabled ? ISS_OFF : ISS_ON);
63void Rotator::registerProperty(INDI::Property prop)
65 if (prop.isNameMatch(
"ABS_ROTATOR_ANGLE"))
67 else if (prop.isNameMatch(
"ROTATOR_REVERSE"))
71void Rotator::processNumber(INDI::Property prop)
73 auto nvp = prop.getNumber();
74 if (nvp->isNameMatch(
"ABS_ROTATOR_ANGLE"))
76 if (std::abs(nvp->at(0)->getValue() - m_AbsoluteAngle) > 0 || nvp->getState() != m_AbsoluteAngleState)
78 m_AbsoluteAngle = nvp->at(0)->getValue();
79 m_AbsoluteAngleState = nvp->getState();
80 emit newAbsoluteAngle(m_AbsoluteAngle, m_AbsoluteAngleState);
85void Rotator::processSwitch(INDI::Property prop)
87 auto svp = prop.getSwitch();
88 if (svp->isNameMatch(
"ROTATOR_REVERSE"))
90 auto reverse = svp->findOnSwitchIndex() == 0;
91 if (m_Reversed != reverse)
94 emit reverseToggled(m_Reversed);
void sendNewProperty(INDI::Property prop)
Send new property command to server.
INDI::PropertyView< ISwitch > * getSwitch(const QString &name) const
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 Mon Nov 4 2024 16:38:43 by
doxygen 1.12.0 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.