Instrument Neutral Distributed Interface INDI  1.9.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,
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 }
INDI::RotatorInterface::saveConfigItems
bool saveConfigItems(FILE *fp)
saveConfigItems save focuser properties defined in the interface in config file
Definition: indirotatorinterface.cpp:332
indibase.h
INDI::RotatorInterface::RotatorBacklashSP
ISwitchVectorProperty RotatorBacklashSP
Definition: indirotatorinterface.h:213
IPState
IPState
Property state.
Definition: indiapi.h:158
ISwitch
One switch descriptor.
INDI::RotatorInterface::initProperties
void initProperties(const char *groupName)
Initilize Rotator properties. It is recommended to call this function within initProperties() of your...
Definition: indirotatorinterface.cpp:35
INumber
One number descriptor.
INDI::RotatorInterface::SyncRotatorNP
INumberVectorProperty SyncRotatorNP
Definition: indirotatorinterface.h:201
INDI::RotatorInterface::updateProperties
bool updateProperties()
updateProperties Define or Delete Rotator properties based on the connection status of the base devic...
Definition: indirotatorinterface.cpp:248
INDI::RotatorInterface::CanReverse
bool CanReverse()
Definition: indirotatorinterface.h:106
INDI::RotatorInterface::ROTATOR_CAN_ABORT
@ ROTATOR_CAN_ABORT
Definition: indirotatorinterface.h:55
INDI::RotatorInterface::RotatorCapability
enum INDI::RotatorInterface::@186 RotatorCapability
INDI::RotatorInterface::GotoRotatorN
INumber GotoRotatorN[1]
Definition: indirotatorinterface.h:197
INDI::RotatorInterface::ROTATOR_CAN_SYNC
@ ROTATOR_CAN_SYNC
Definition: indirotatorinterface.h:57
_INumberVectorProperty
Number vector property descriptor.
Definition: indiapi.h:317
INDI::RotatorInterface::processNumber
bool processNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process Rotator number properties.
Definition: indirotatorinterface.cpp:79
INDI::RotatorInterface::SetRotatorBacklashEnabled
virtual bool SetRotatorBacklashEnabled(bool enabled)
SetRotatorBacklashEnabled Enables or disables the Rotator backlash compensation.
Definition: indirotatorinterface.cpp:323
INDI::RotatorInterface::MoveRotator
virtual IPState MoveRotator(double angle)=0
MoveRotator Go to specific angle.
INDI::RotatorInterface::ROTATOR_CAN_HOME
@ ROTATOR_CAN_HOME
Definition: indirotatorinterface.h:56
INDI::RotatorInterface::RotatorBacklashN
INumber RotatorBacklashN[1]
Definition: indirotatorinterface.h:218
INDI::RotatorInterface::CanAbort
bool CanAbort()
Definition: indirotatorinterface.h:82
INDI::RotatorInterface::HomeRotatorSP
ISwitchVectorProperty HomeRotatorSP
Definition: indirotatorinterface.h:207
INDI::RotatorInterface::ROTATOR_HAS_BACKLASH
@ ROTATOR_HAS_BACKLASH
Definition: indirotatorinterface.h:59
INDI::RotatorInterface::HomeRotator
virtual IPState HomeRotator()
HomeRotator Go to home position.
Definition: indirotatorinterface.cpp:297
INDI::RotatorInterface::RotatorBacklashS
ISwitch RotatorBacklashS[2]
Definition: indirotatorinterface.h:214
INDI::RotatorInterface::AbortRotator
virtual bool AbortRotator()
AbortRotator Abort all motion.
Definition: indirotatorinterface.cpp:303
INDI::RotatorInterface::ROTATOR_CAN_REVERSE
@ ROTATOR_CAN_REVERSE
Definition: indirotatorinterface.h:58
INDI::RotatorInterface::GotoRotatorNP
INumberVectorProperty GotoRotatorNP
Definition: indirotatorinterface.h:198
INDI::RotatorInterface::RotatorBacklashNP
INumberVectorProperty RotatorBacklashNP
Definition: indirotatorinterface.h:217
INDI::RotatorInterface::AbortRotatorSP
ISwitchVectorProperty AbortRotatorSP
Definition: indirotatorinterface.h:204
INDI::RotatorInterface::HomeRotatorS
ISwitch HomeRotatorS[1]
Definition: indirotatorinterface.h:206
INDI::RotatorInterface::SyncRotator
virtual bool SyncRotator(double angle)
SyncRotator Set current angle as the supplied angle without moving the rotator.
Definition: indirotatorinterface.cpp:290
INDI::RotatorInterface::SyncRotatorN
INumber SyncRotatorN[1]
Definition: indirotatorinterface.h:200
INDI::RotatorInterface::SetCapability
void SetCapability(uint32_t cap)
SetRotatorCapability sets the Rotator capabilities. All capabilities must be initialized.
Definition: indirotatorinterface.h:74
INDI::RotatorInterface::CanSync
bool CanSync()
Definition: indirotatorinterface.h:98
INDI::RotatorInterface::processSwitch
bool processSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process Rotator switch properties.
Definition: indirotatorinterface.cpp:153
INDI::RotatorInterface::ReverseRotatorSP
ISwitchVectorProperty ReverseRotatorSP
Definition: indirotatorinterface.h:210
INDI::RotatorInterface::RotatorInterface
RotatorInterface(DefaultDevice *defaultDevice)
Definition: indirotatorinterface.cpp:31
INDI
Namespace to encapsulate INDI client, drivers, and mediator classes.
Definition: AlignmentSubsystemForClients.cpp:11
INDI::RotatorInterface::rotatorCapability
uint32_t rotatorCapability
Definition: indirotatorinterface.h:220
INDI::RotatorInterface::SetRotatorBacklash
virtual bool SetRotatorBacklash(int32_t steps)
SetRotatorBacklash Set the Rotatorer backlash compensation value.
Definition: indirotatorinterface.cpp:316
INDI::RotatorInterface::m_defaultDevice
DefaultDevice * m_defaultDevice
Definition: indirotatorinterface.h:221
ISState
ISState
Switch state.
Definition: indiapi.h:148
INDI::RotatorInterface
Definition: indirotatorinterface.h:45
INDI::RotatorInterface::ReverseRotator
virtual bool ReverseRotator(bool enabled)
ReverseRotator Reverse the direction of the rotator. CW is usually the normal direction,...
Definition: indirotatorinterface.cpp:309
INDI::DefaultDevice
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
Definition: defaultdevice.h:118
INDI::RotatorInterface::HasBacklash
bool HasBacklash()
Definition: indirotatorinterface.h:114
INDI::RotatorInterface::ReverseRotatorS
ISwitch ReverseRotatorS[2]
Definition: indirotatorinterface.h:209
INDI::RotatorInterface::CanHome
bool CanHome()
Definition: indirotatorinterface.h:90
INDI::RotatorInterface::AbortRotatorS
ISwitch AbortRotatorS[1]
Definition: indirotatorinterface.h:203
INDI::RotatorInterface::GetCapability
uint32_t GetCapability() const
GetRotatorCapability returns the capability of the Rotator.
Definition: indirotatorinterface.h:65
_ISwitchVectorProperty
Switch vector property descriptor.
Definition: indiapi.h:365