Instrument Neutral Distributed Interface INDI 2.2.5
indifocuserinterface.h
Go to the documentation of this file.
1/*
2 Filter Interface
3 Copyright (C) 2011 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 "indipropertytext.h"
27#include <stdint.h>
28
29// Alias
31
32namespace INDI
33{
34
66{
67 public:
73
74 enum
75 {
82 FOCUSER_HAS_BACKLASH = 1 << 6
84
88 uint32_t GetCapability() const
89 {
90 return capability;
91 }
92
97 void SetCapability(uint32_t cap)
98 {
99 capability = cap;
100 }
101
106 {
108 }
109
114 {
116 }
117
121 bool CanAbort()
122 {
124 }
125
130 {
132 }
133
137 bool CanSync()
138 {
140 }
141
149
154 {
156 }
157
158 protected:
159 explicit FocuserInterface(DefaultDevice * defaultDevice);
160 virtual ~FocuserInterface() = default;
161
167 void initProperties(const char * groupName);
168
173 bool updateProperties();
174
176 bool processNumber(const char * dev, const char * name, double values[], char * names[], int n);
177
179 bool processSwitch(const char * dev, const char * name, ISState * states, char * names[], int n);
180
186 virtual bool SetFocuserSpeed(int speed);
187
198 virtual IPState MoveFocuser(FocusDirection dir, int speed, uint16_t duration);
199
207 virtual IPState MoveAbsFocuser(uint32_t targetTicks);
208
217 virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks);
218
224 virtual bool ReverseFocuser(bool enabled);
225
231 virtual bool SyncFocuser(uint32_t ticks);
232
240 virtual bool SetFocuserMaxPosition(uint32_t ticks);
241
247 virtual bool SetFocuserBacklash(int32_t steps);
248
254 virtual bool SetFocuserBacklashEnabled(bool enabled);
255
260 virtual bool AbortFocuser();
261
267 bool saveConfigItems(FILE * fp);
268
269 // Focuser Speed (if variable speeds are supported)
271
272 // Focuser Motion switch.
273 // For absolute focusers, this controls the directoin of FocusRelPos when updated.
274 // 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
279
280 // Absolute Focuser Position in steps
282
283 // Relative Focuser position to be commanded
285
286 // Absolute Focuser position is 0 to this maximum limit. By Default, it is set to 200,000.
288
289 // Sync
291
292 // Abort Focuser
294
295 // Reverse Focuser
297
298 // Backlash toggle
300
301 // Backlash steps
303
304 uint32_t capability;
305
306 double lastTimerValue = { 0 };
307
309};
310}
Class to provide extended functionality for devices in addition to the functionality provided by INDI...
Provides interface to implement focuser functionality.
INDI::PropertyNumber FocusRelPosNP
virtual bool SetFocuserBacklash(int32_t steps)
SetFocuserBacklash Set the focuser backlash compensation value.
INDI::PropertySwitch FocusReverseSP
virtual bool SetFocuserBacklashEnabled(bool enabled)
SetFocuserBacklashEnabled Enables or disables the focuser backlash compensation.
virtual bool ReverseFocuser(bool enabled)
ReverseFocuser Reverse focuser motion direction.
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...
enum INDI::FocuserInterface::@448 FocuserCapability
virtual IPState MoveRelFocuser(FocusDirection dir, uint32_t ticks)
MoveFocuser the focuser to an relative position.
uint32_t GetCapability() const
GetFocuserCapability returns the capability of the focuser.
void SetCapability(uint32_t cap)
FI::SetCapability sets the focuser capabilities. All capabilities must be initialized.
INDI::PropertyNumber FocusSyncNP
INDI::PropertySwitch FocusMotionSP
INDI::PropertyNumber FocusSpeedNP
INDI::PropertySwitch FocusAbortSP
INDI::PropertyNumber FocusTimerNP
void initProperties(const char *groupName)
Initialize focuser properties. It is recommended to call this function within initProperties() of you...
virtual bool SetFocuserMaxPosition(uint32_t ticks)
SetFocuserMaxPosition Set Focuser Maximum position limit in the hardware.
virtual ~FocuserInterface()=default
INDI::PropertyNumber FocusMaxPosNP
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.
INDI::PropertySwitch FocusBacklashSP
INDI::PropertyNumber FocusBacklashNP
virtual bool AbortFocuser()
AbortFocuser all focus motion.
INDI::PropertyNumber FocusAbsPosNP
virtual IPState MoveAbsFocuser(uint32_t targetTicks)
MoveFocuser the focuser to an absolute position.
ISState
Switch state.
Definition indiapi.h:148
IPState
Property state.
Definition indiapi.h:158
Namespace to encapsulate INDI client, drivers, and mediator classes.