Instrument Neutral Distributed Interface INDI  2.0.2
indifocuserinterface.h
Go to the documentation of this file.
1 /*
2  Filter Interface
3  Copyright (C) 2011 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 
25 #include <stdint.h>
26 
27 // Alias
29 
30 namespace INDI
31 {
32 
64 {
65  public:
67  {
70  };
71 
72  enum
73  {
76  FOCUSER_CAN_ABORT = 1 << 2,
78  FOCUSER_CAN_SYNC = 1 << 4,
80  FOCUSER_HAS_BACKLASH = 1 << 6
82 
86  uint32_t GetCapability() const
87  {
88  return capability;
89  }
90 
95  void SetCapability(uint32_t cap)
96  {
97  capability = cap;
98  }
99 
103  bool CanAbsMove()
104  {
106  }
107 
111  bool CanRelMove()
112  {
114  }
115 
119  bool CanAbort()
120  {
121  return capability & FOCUSER_CAN_ABORT;
122  }
123 
127  bool CanReverse()
128  {
130  }
131 
135  bool CanSync()
136  {
137  return capability & FOCUSER_CAN_SYNC;
138  }
139 
144  {
146  }
147 
151  bool HasBacklash()
152  {
154  }
155 
156  protected:
157  explicit FocuserInterface(DefaultDevice * defaultDevice);
158  virtual ~FocuserInterface() = default;
159 
165  void initProperties(const char * groupName);
166 
171  bool updateProperties();
172 
174  bool processNumber(const char * dev, const char * name, double values[], char * names[], int n);
175 
177  bool processSwitch(const char * dev, const char * name, ISState * states, char * names[], int n);
178 
184  virtual bool SetFocuserSpeed(int speed);
185 
196  virtual IPState MoveFocuser(FocusDirection dir, int speed, uint16_t duration);
197 
205  virtual IPState MoveAbsFocuser(uint32_t targetTicks);
206 
215  virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks);
216 
222  virtual bool ReverseFocuser(bool enabled);
223 
229  virtual bool SyncFocuser(uint32_t ticks);
230 
238  virtual bool SetFocuserMaxPosition(uint32_t ticks);
239 
245  virtual bool SetFocuserBacklash(int32_t steps);
246 
252  virtual bool SetFocuserBacklashEnabled(bool enabled);
253 
258  virtual bool AbortFocuser();
259 
265  bool saveConfigItems(FILE * fp);
266 
267  // Focuser Speed (if variable speeds are supported)
270 
271  // Focuser Motion switch.
272  // For absolute focusers, this controls the directoin of FocusRelPos when updated.
273  // For DC speed based focusers, this moves the focuser continues in the CW/CCW directions until stopped.
276 
277  // Timer for user with DC focusers to run focuser in specific direction for this duration
280 
281  // Absolute Focuser Position in steps
284 
285  // Relative Focuser position to be commanded
288 
289  // Absolute Focuser position is 0 to this maximum limit. By Default, it is set to 200,000.
292 
293  // Sync
296 
297  // Abort Focuser
300 
301  // Reverse Focuser
304 
305  // Backlash toogle
308 
309  // Backlash steps
312 
313  uint32_t capability;
314 
315  double lastTimerValue = { 0 };
316 
318 };
319 }
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
Provides interface to implement focuser functionality.
ISwitchVectorProperty FocusMotionSP
INumberVectorProperty FocusSpeedNP
INumberVectorProperty FocusSyncNP
enum INDI::FocuserInterface::@246 FocuserCapability
INumberVectorProperty FocusBacklashNP
virtual bool SetFocuserBacklash(int32_t steps)
SetFocuserBacklash Set the focuser backlash compensation value.
virtual bool SetFocuserBacklashEnabled(bool enabled)
SetFocuserBacklashEnabled Enables or disables the focuser backlash compensation.
virtual bool ReverseFocuser(bool enabled)
ReverseFocuser Reverse focuser motion direction.
ISwitchVectorProperty FocusBacklashSP
INumberVectorProperty FocusAbsPosNP
INumberVectorProperty FocusRelPosNP
virtual IPState MoveFocuser(FocusDirection dir, int speed, uint16_t duration)
MoveFocuser the focuser in a particular direction with a specific speed for a finite duration.
bool updateProperties()
updateProperties Define or Delete Rotator properties based on the connection status of the base devic...
virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks)
MoveFocuser the focuser to an relative position.
INumberVectorProperty FocusTimerNP
uint32_t GetCapability() const
GetFocuserCapability returns the capability of the focuser.
ISwitchVectorProperty FocusReverseSP
void SetCapability(uint32_t cap)
FI::SetCapability sets the focuser capabilities. All capabilities must be initialized.
void initProperties(const char *groupName)
Initilize focuser properties. It is recommended to call this function within initProperties() of your...
virtual bool SetFocuserMaxPosition(uint32_t ticks)
SetFocuserMaxPosition Set Focuser Maximum position limit in the hardware.
virtual ~FocuserInterface()=default
bool saveConfigItems(FILE *fp)
saveConfigItems save focuser properties defined in the interface in config file
bool processNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process focus number properties.
virtual bool SetFocuserSpeed(int speed)
SetFocuserSpeed Set Focuser speed.
bool processSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process focus switch properties.
virtual bool SyncFocuser(uint32_t ticks)
SyncFocuser Set current position to ticks without moving the focuser.
FocuserInterface(DefaultDevice *defaultDevice)
INumberVectorProperty FocusMaxPosNP
virtual bool AbortFocuser()
AbortFocuser all focus motion.
ISwitchVectorProperty FocusAbortSP
virtual IPState MoveAbsFocuser(uint32_t targetTicks)
MoveFocuser the focuser to an absolute position.
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