File indexing completed on 2024-07-21 06:28:23

0001 /*
0002     SPDX-FileCopyrightText: 2022 Jasem Mutlaq <mutlaqja@ikarustech.com>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "indiconcretedevice.h"
0010 
0011 namespace ISD
0012 {
0013 /**
0014  * @class Rotator
0015  * Rotator class handles control of INDI Rotator devices.
0016  *
0017  * @author Jasem Mutlaq
0018  */
0019 class Rotator : public ConcreteDevice
0020 {
0021         Q_OBJECT
0022 
0023     public:
0024         explicit Rotator(GenericDevice *parent) : ConcreteDevice(parent) {}
0025 
0026         virtual void registerProperty(INDI::Property prop) override;
0027         virtual void processNumber(INDI::Property prop) override;
0028         virtual void processSwitch(INDI::Property prop) override;
0029 
0030         bool setAbsoluteAngle(double angle);
0031         bool setAbsoluteSteps(uint32_t steps);
0032         bool setReversed(bool enabled);
0033 
0034         bool isReversed() const {return m_Reversed;}
0035         double absoluteAngle() const {return m_AbsoluteAngle;}
0036         IPState absoluteAngleState() const {return m_AbsoluteAngleState;}
0037 
0038     signals:
0039         void newAbsoluteAngle(double value, IPState state);
0040         void reverseToggled(bool enabled);
0041 
0042     private:
0043         bool m_Reversed {false};
0044         double m_AbsoluteAngle {0};
0045         IPState m_AbsoluteAngleState {IPS_IDLE};
0046 };
0047 }