Instrument Neutral Distributed Interface INDI  2.0.2
indirotatorinterface.h
Go to the documentation of this file.
1 /*
2  Rotator Interface
3  Copyright (C) 2017 Jasem Mutlaq (mutlaqja@ikarustech.com)
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 <stdint.h>
25 
27 
42 namespace INDI
43 {
44 
46 {
47  public:
48 
53  enum
54  {
55  ROTATOR_CAN_ABORT = 1 << 0,
56  ROTATOR_CAN_HOME = 1 << 1,
57  ROTATOR_CAN_SYNC = 1 << 2,
59  ROTATOR_HAS_BACKLASH = 1 << 4
61 
65  uint32_t GetCapability() const
66  {
67  return rotatorCapability;
68  }
69 
74  void SetCapability(uint32_t cap)
75  {
76  rotatorCapability = cap;
77  }
78 
82  bool CanAbort()
83  {
85  }
86 
90  bool CanHome()
91  {
93  }
94 
98  bool CanSync()
99  {
101  }
102 
106  bool CanReverse()
107  {
109  }
110 
114  bool HasBacklash()
115  {
117  }
118 
119  protected:
120 
121  explicit RotatorInterface(DefaultDevice *defaultDevice);
122 
128  void initProperties(const char *groupName);
129 
134  bool updateProperties();
135 
137  bool processNumber(const char *dev, const char *name, double values[], char *names[], int n);
138 
140  bool processSwitch(const char *dev, const char *name, ISState *states, char *names[], int n);
141 
147  virtual IPState MoveRotator(double angle) = 0;
148 
154  virtual bool SyncRotator(double angle);
155 
160  virtual IPState HomeRotator();
161 
167  virtual bool ReverseRotator(bool enabled);
168 
173  virtual bool AbortRotator();
174 
180  virtual bool SetRotatorBacklash(int32_t steps);
181 
187  virtual bool SetRotatorBacklashEnabled(bool enabled);
188 
194  bool saveConfigItems(FILE * fp);
195 
196 
199 
202 
205 
208 
211 
212  // Backlash toogle
215 
216  // Backlash steps
219 
220  uint32_t rotatorCapability = 0;
222 };
223 
224 }
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
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
INumberVectorProperty RotatorBacklashNP
virtual bool AbortRotator()
AbortRotator Abort all motion.
enum INDI::RotatorInterface::@250 RotatorCapability
RotatorInterface(DefaultDevice *defaultDevice)
INumberVectorProperty GotoRotatorNP
void initProperties(const char *groupName)
Initilize Rotator properties. It is recommended to call this function within initProperties() of your...
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.
INumberVectorProperty SyncRotatorNP
ISwitchVectorProperty HomeRotatorSP
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,...
ISwitchVectorProperty ReverseRotatorSP
virtual bool SetRotatorBacklashEnabled(bool enabled)
SetRotatorBacklashEnabled Enables or disables the Rotator backlash compensation.
uint32_t GetCapability() const
GetRotatorCapability returns the capability of the Rotator.
bool processNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process Rotator number properties.
ISwitchVectorProperty RotatorBacklashSP
virtual IPState HomeRotator()
HomeRotator Go to home position.
ISwitchVectorProperty AbortRotatorSP
virtual bool SetRotatorBacklash(int32_t steps)
SetRotatorBacklash Set the Rotatorer backlash compensation value.
ISState
Switch state.
Definition: indiapi.h:150
IPState
Property state.
Definition: indiapi.h:160
Namespace to encapsulate INDI client, drivers, and mediator classes.
One number descriptor.
One switch descriptor.
Number vector property descriptor.
Definition: indiapi.h:319
Switch vector property descriptor.
Definition: indiapi.h:367