Instrument Neutral Distributed Interface INDI 2.2.5
indirotatorinterface.h
Go to the documentation of this file.
1/*
2 Rotator Interface
3 Copyright (C) 2017 Jasem Mutlaq ([email protected])
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
14
15 You should have received a copy of the GNU Lesser General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
19*/
20
21#pragma once
22
23#include "indibase.h"
24#include "indipropertynumber.h"
25#include "indipropertyswitch.h"
26#include <stdint.h>
27
29
44namespace INDI
45{
46
48{
49 public:
50
55 enum
56 {
61 ROTATOR_HAS_BACKLASH = 1 << 4
63
67 uint32_t GetCapability() const
68 {
69 return rotatorCapability;
70 }
71
76 void SetCapability(uint32_t cap)
77 {
79 }
80
84 bool CanAbort()
85 {
87 }
88
92 bool CanHome()
93 {
95 }
96
100 bool CanSync()
101 {
103 }
104
109 {
111 }
112
117 {
119 }
120
121 protected:
122
123 explicit RotatorInterface(DefaultDevice *defaultDevice);
124
130 void initProperties(const char *groupName);
131
136 bool updateProperties();
137
139 bool processNumber(const char *dev, const char *name, double values[], char *names[], int n);
140
142 bool processSwitch(const char *dev, const char *name, ISState *states, char *names[], int n);
143
149 virtual IPState MoveRotator(double angle) = 0;
150
156 virtual bool SyncRotator(double angle);
157
162 virtual IPState HomeRotator();
163
169 virtual bool ReverseRotator(bool enabled);
170
175 virtual bool AbortRotator();
176
182 virtual bool SetRotatorBacklash(int32_t steps);
183
189 virtual bool SetRotatorBacklashEnabled(bool enabled);
190
196 bool saveConfigItems(FILE * fp);
197
198
199 // Goto rotator angle
201
202 // Sync rotator angle
204
205 // Abort rotator motion
207
208 // Home rotator
210
211 // Reverse rotator direction
213
214 // Backlash toggle
216
217 // Backlash steps
219
220 // Rotator Limits
222 // Fixed reference angle (set at connect time and updated on sync).
223 // The limit check prevents the rotator from moving more than ±(limit/2)°
224 // away from this point, protecting against cable wrap.
225 double m_RotatorOffset {-1}; // -1 means "not yet initialized"
226
227 uint32_t rotatorCapability = 0;
229};
230
231}
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
INDI::PropertySwitch AbortRotatorSP
bool processSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process Rotator switch properties.
virtual IPState MoveRotator(double angle)=0
MoveRotator Go to specific angle.
bool saveConfigItems(FILE *fp)
saveConfigItems save focuser properties defined in the interface in config file
INDI::PropertySwitch RotatorBacklashSP
virtual bool AbortRotator()
AbortRotator Abort all motion.
INDI::PropertyNumber RotatorLimitsNP
void initProperties(const char *groupName)
Initialize Rotator properties. It is recommended to call this function within initProperties() of you...
bool updateProperties()
updateProperties Define or Delete Rotator properties based on the connection status of the base devic...
void SetCapability(uint32_t cap)
SetRotatorCapability sets the Rotator capabilities. All capabilities must be initialized.
INDI::PropertyNumber SyncRotatorNP
virtual bool SyncRotator(double angle)
SyncRotator Set current angle as the supplied angle without moving the rotator.
virtual bool ReverseRotator(bool enabled)
ReverseRotator Reverse the direction of the rotator. CW is usually the normal direction,...
virtual bool SetRotatorBacklashEnabled(bool enabled)
SetRotatorBacklashEnabled Enables or disables the Rotator backlash compensation.
INDI::PropertyNumber RotatorBacklashNP
uint32_t GetCapability() const
GetRotatorCapability returns the capability of the Rotator.
INDI::PropertySwitch HomeRotatorSP
bool processNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process Rotator number properties.
virtual IPState HomeRotator()
HomeRotator Go to home position.
INDI::PropertySwitch ReverseRotatorSP
INDI::PropertyNumber GotoRotatorNP
virtual bool SetRotatorBacklash(int32_t steps)
SetRotatorBacklash Set the Rotatorer backlash compensation value.
enum INDI::RotatorInterface::@466 RotatorCapability
ISState
Switch state.
Definition indiapi.h:148
IPState
Property state.
Definition indiapi.h:158
Namespace to encapsulate INDI client, drivers, and mediator classes.