Instrument Neutral Distributed Interface INDI  1.9.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,
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 }
INDI::FocuserInterface::FocusAbsPosNP
INumberVectorProperty FocusAbsPosNP
Definition: indifocuserinterface.h:282
INDI::FocuserInterface::FOCUSER_CAN_REL_MOVE
@ FOCUSER_CAN_REL_MOVE
Definition: indifocuserinterface.h:75
indibase.h
INDI::FocuserInterface::FocusMaxPosNP
INumberVectorProperty FocusMaxPosNP
Definition: indifocuserinterface.h:290
IPState
IPState
Property state.
Definition: indiapi.h:158
INDI::FocuserInterface::FocusBacklashN
INumber FocusBacklashN[1]
Definition: indifocuserinterface.h:311
INDI::FocuserInterface::FocusSyncNP
INumberVectorProperty FocusSyncNP
Definition: indifocuserinterface.h:294
ISwitch
One switch descriptor.
INumber
One number descriptor.
INDI::FocuserInterface::FocuserCapability
enum INDI::FocuserInterface::@182 FocuserCapability
INDI::FocuserInterface::m_defaultDevice
DefaultDevice * m_defaultDevice
Definition: indifocuserinterface.h:317
INDI::FocuserInterface::capability
uint32_t capability
Definition: indifocuserinterface.h:313
INDI::FocuserInterface::FocusTimerN
INumber FocusTimerN[1]
Definition: indifocuserinterface.h:279
INDI::FocuserInterface::CanReverse
bool CanReverse()
Definition: indifocuserinterface.h:127
INDI::FocuserInterface::FOCUSER_CAN_ABS_MOVE
@ FOCUSER_CAN_ABS_MOVE
Definition: indifocuserinterface.h:74
INDI::FocuserInterface
Provides interface to implement focuser functionality.
Definition: indifocuserinterface.h:63
INDI::FocuserInterface::FOCUSER_HAS_VARIABLE_SPEED
@ FOCUSER_HAS_VARIABLE_SPEED
Definition: indifocuserinterface.h:79
INDI::FocuserInterface::FocusAbortS
ISwitch FocusAbortS[1]
Definition: indifocuserinterface.h:299
INDI::FocuserInterface::FocusAbortSP
ISwitchVectorProperty FocusAbortSP
Definition: indifocuserinterface.h:298
INDI::FocuserInterface::FOCUSER_CAN_SYNC
@ FOCUSER_CAN_SYNC
Definition: indifocuserinterface.h:78
INDI::FocuserInterface::SetFocuserBacklash
virtual bool SetFocuserBacklash(int32_t steps)
SetFocuserBacklash Set the focuser backlash compensation value.
Definition: indifocuserinterface.cpp:574
INDI::FocuserInterface::FocusMotionS
ISwitch FocusMotionS[2]
Definition: indifocuserinterface.h:275
INDI::FocuserInterface::SetFocuserMaxPosition
virtual bool SetFocuserMaxPosition(uint32_t ticks)
SetFocuserMaxPosition Set Focuser Maximum position limit in the hardware.
Definition: indifocuserinterface.cpp:568
INDI::FocuserInterface::FOCUSER_HAS_BACKLASH
@ FOCUSER_HAS_BACKLASH
Definition: indifocuserinterface.h:80
INDI::FocuserInterface::FocusReverseSP
ISwitchVectorProperty FocusReverseSP
Definition: indifocuserinterface.h:302
INDI::FocuserInterface::SetFocuserSpeed
virtual bool SetFocuserSpeed(int speed)
SetFocuserSpeed Set Focuser speed.
Definition: indifocuserinterface.cpp:561
INDI::FocuserInterface::FocusBacklashSP
ISwitchVectorProperty FocusBacklashSP
Definition: indifocuserinterface.h:306
_INumberVectorProperty
Number vector property descriptor.
Definition: indiapi.h:317
INDI::FocuserInterface::saveConfigItems
bool saveConfigItems(FILE *fp)
saveConfigItems save focuser properties defined in the interface in config file
Definition: indifocuserinterface.cpp:590
INDI::FocuserInterface::GetCapability
uint32_t GetCapability() const
GetFocuserCapability returns the capability of the focuser.
Definition: indifocuserinterface.h:86
INDI::FocuserInterface::CanAbort
bool CanAbort()
Definition: indifocuserinterface.h:119
INDI::FocuserInterface::FocusTimerNP
INumberVectorProperty FocusTimerNP
Definition: indifocuserinterface.h:278
INDI::FocuserInterface::AbortFocuser
virtual bool AbortFocuser()
AbortFocuser all focus motion.
Definition: indifocuserinterface.cpp:539
INDI::FocuserInterface::FOCUS_INWARD
@ FOCUS_INWARD
Definition: indifocuserinterface.h:68
INDI::FocuserInterface::FocuserInterface
FocuserInterface(DefaultDevice *defaultDevice)
Definition: indifocuserinterface.cpp:31
INDI::FocuserInterface::FocusMotionSP
ISwitchVectorProperty FocusMotionSP
Definition: indifocuserinterface.h:274
INDI::FocuserInterface::HasBacklash
bool HasBacklash()
Definition: indifocuserinterface.h:151
INDI::FocuserInterface::SyncFocuser
virtual bool SyncFocuser(uint32_t ticks)
SyncFocuser Set current position to ticks without moving the focuser.
Definition: indifocuserinterface.cpp:554
INDI::FocuserInterface::FocusRelPosN
INumber FocusRelPosN[1]
Definition: indifocuserinterface.h:287
INDI::FocuserInterface::processNumber
bool processNumber(const char *dev, const char *name, double values[], char *names[], int n)
Process focus number properties.
Definition: indifocuserinterface.cpp:168
INDI::FocuserInterface::CanSync
bool CanSync()
Definition: indifocuserinterface.h:135
INDI::FocuserInterface::FOCUSER_CAN_REVERSE
@ FOCUSER_CAN_REVERSE
Definition: indifocuserinterface.h:77
INDI::FocuserInterface::MoveRelFocuser
virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks)
MoveFocuser the focuser to an relative position.
Definition: indifocuserinterface.cpp:524
INDI::FocuserInterface::FocusRelPosNP
INumberVectorProperty FocusRelPosNP
Definition: indifocuserinterface.h:286
INDI::FocuserInterface::SetFocuserBacklashEnabled
virtual bool SetFocuserBacklashEnabled(bool enabled)
SetFocuserBacklashEnabled Enables or disables the focuser backlash compensation.
Definition: indifocuserinterface.cpp:581
INDI::FocuserInterface::ReverseFocuser
virtual bool ReverseFocuser(bool enabled)
ReverseFocuser Reverse focuser motion direction.
Definition: indifocuserinterface.cpp:547
INDI::FocuserInterface::FocusBacklashS
ISwitch FocusBacklashS[2]
Definition: indifocuserinterface.h:307
INDI::FocuserInterface::CanAbsMove
bool CanAbsMove()
Definition: indifocuserinterface.h:103
INDI::FocuserInterface::SetCapability
void SetCapability(uint32_t cap)
FI::SetCapability sets the focuser capabilities. All capabilities must be initialized.
Definition: indifocuserinterface.h:95
INDI::FocuserInterface::MoveAbsFocuser
virtual IPState MoveAbsFocuser(uint32_t targetTicks)
MoveFocuser the focuser to an absolute position.
Definition: indifocuserinterface.cpp:532
INDI::FocuserInterface::HasVariableSpeed
bool HasVariableSpeed()
Definition: indifocuserinterface.h:143
INDI::FocuserInterface::updateProperties
bool updateProperties()
updateProperties Define or Delete Rotator properties based on the connection status of the base devic...
Definition: indifocuserinterface.cpp:101
INDI::FocuserInterface::initProperties
void initProperties(const char *groupName)
Initilize focuser properties. It is recommended to call this function within initProperties() of your...
Definition: indifocuserinterface.cpp:35
INDI::FocuserInterface::FocusReverseS
ISwitch FocusReverseS[2]
Definition: indifocuserinterface.h:303
INDI::FocuserInterface::FocusMaxPosN
INumber FocusMaxPosN[1]
Definition: indifocuserinterface.h:291
INDI
Namespace to encapsulate INDI client, drivers, and mediator classes.
Definition: AlignmentSubsystemForClients.cpp:11
INDI::FocuserInterface::FOCUSER_CAN_ABORT
@ FOCUSER_CAN_ABORT
Definition: indifocuserinterface.h:76
INDI::FocuserInterface::processSwitch
bool processSwitch(const char *dev, const char *name, ISState *states, char *names[], int n)
Process focus switch properties.
Definition: indifocuserinterface.cpp:410
INDI::FocuserInterface::CanRelMove
bool CanRelMove()
Definition: indifocuserinterface.h:111
INDI::FocuserInterface::~FocuserInterface
virtual ~FocuserInterface()=default
INDI::FocuserInterface::FocusDirection
FocusDirection
Definition: indifocuserinterface.h:66
INDI::FocuserInterface::FocusSpeedNP
INumberVectorProperty FocusSpeedNP
Definition: indifocuserinterface.h:268
ISState
ISState
Switch state.
Definition: indiapi.h:148
INDI::FocuserInterface::FocusSyncN
INumber FocusSyncN[1]
Definition: indifocuserinterface.h:295
INDI::DefaultDevice
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
Definition: defaultdevice.h:118
INDI::FocuserInterface::FocusBacklashNP
INumberVectorProperty FocusBacklashNP
Definition: indifocuserinterface.h:310
INDI::FocuserInterface::FocusAbsPosN
INumber FocusAbsPosN[1]
Definition: indifocuserinterface.h:283
INDI::FocuserInterface::MoveFocuser
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.
Definition: indifocuserinterface.cpp:515
_ISwitchVectorProperty
Switch vector property descriptor.
Definition: indiapi.h:365
INDI::FocuserInterface::lastTimerValue
double lastTimerValue
Definition: indifocuserinterface.h:315
INDI::FocuserInterface::FocusSpeedN
INumber FocusSpeedN[1]
Definition: indifocuserinterface.h:269
INDI::FocuserInterface::FOCUS_OUTWARD
@ FOCUS_OUTWARD
Definition: indifocuserinterface.h:69