Instrument Neutral Distributed Interface INDI  2.0.2
Public Types | Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
INDI::FocuserInterface Class Reference

Provides interface to implement focuser functionality. More...

#include <indifocuserinterface.h>

Inheritance diagram for INDI::FocuserInterface:
CelestronGPS INDI::Focuser LX200Telescope PegasusPPBA PegasusUPB AAF2 ActiveFocuser CelestronSCT DMFC DeepSkyDadAF1 DeepSkyDadAF2 DeepSkyDadAF3 EFA Esatto EsattoArco FCUSB FocusLynxBase FocusMaster FocusSim FocuserDriver Gemini HitecAstroDCFocuser Integra Lakeside Microtouch MoonLite MoonLiteDRO MyFocuserPro2 NFocus NStep NightCrawler OnFocus PegasusFocusCube PegasusProdigyMF PegasusScopsOAG PerfectStar RBFOCUS RainbowRSF RoboFocus SIEFS SestoSenso SestoSenso2 SmartFocus SteelDrive SteelDriveII TCFS TeenAstroFocuser USBFocusV3 lacerta_mfoc lacerta_mfoc_fmc LX200Generic

Public Types

enum  FocusDirection { FOCUS_INWARD , FOCUS_OUTWARD }
 
enum  {
  FOCUSER_CAN_ABS_MOVE = 1 << 0 , FOCUSER_CAN_REL_MOVE = 1 << 1 , FOCUSER_CAN_ABORT = 1 << 2 , FOCUSER_CAN_REVERSE = 1 << 3 ,
  FOCUSER_CAN_SYNC = 1 << 4 , FOCUSER_HAS_VARIABLE_SPEED = 1 << 5 , FOCUSER_HAS_BACKLASH = 1 << 6
}
 

Public Member Functions

uint32_t GetCapability () const
 GetFocuserCapability returns the capability of the focuser. More...
 
void SetCapability (uint32_t cap)
 FI::SetCapability sets the focuser capabilities. All capabilities must be initialized. More...
 
bool CanAbsMove ()
 
bool CanRelMove ()
 
bool CanAbort ()
 
bool CanReverse ()
 
bool CanSync ()
 
bool HasVariableSpeed ()
 
bool HasBacklash ()
 

Public Attributes

enum INDI::FocuserInterface:: { ... }  FocuserCapability
 

Protected Member Functions

 FocuserInterface (DefaultDevice *defaultDevice)
 
virtual ~FocuserInterface ()=default
 
void initProperties (const char *groupName)
 Initilize focuser properties. It is recommended to call this function within initProperties() of your primary device. More...
 
bool updateProperties ()
 updateProperties Define or Delete Rotator properties based on the connection status of the base device More...
 
bool processNumber (const char *dev, const char *name, double values[], char *names[], int n)
 Process focus number properties. More...
 
bool processSwitch (const char *dev, const char *name, ISState *states, char *names[], int n)
 Process focus switch properties. More...
 
virtual bool SetFocuserSpeed (int speed)
 SetFocuserSpeed Set Focuser speed. More...
 
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. More...
 
virtual IPState MoveAbsFocuser (uint32_t targetTicks)
 MoveFocuser the focuser to an absolute position. More...
 
virtual IPState MoveRelFocuser (FocusDirection dir, uint32_t ticks)
 MoveFocuser the focuser to an relative position. More...
 
virtual bool ReverseFocuser (bool enabled)
 ReverseFocuser Reverse focuser motion direction. More...
 
virtual bool SyncFocuser (uint32_t ticks)
 SyncFocuser Set current position to ticks without moving the focuser. More...
 
virtual bool SetFocuserMaxPosition (uint32_t ticks)
 SetFocuserMaxPosition Set Focuser Maximum position limit in the hardware. More...
 
virtual bool SetFocuserBacklash (int32_t steps)
 SetFocuserBacklash Set the focuser backlash compensation value. More...
 
virtual bool SetFocuserBacklashEnabled (bool enabled)
 SetFocuserBacklashEnabled Enables or disables the focuser backlash compensation. More...
 
virtual bool AbortFocuser ()
 AbortFocuser all focus motion. More...
 
bool saveConfigItems (FILE *fp)
 saveConfigItems save focuser properties defined in the interface in config file More...
 

Protected Attributes

INumberVectorProperty FocusSpeedNP
 
INumber FocusSpeedN [1]
 
ISwitchVectorProperty FocusMotionSP
 
ISwitch FocusMotionS [2]
 
INumberVectorProperty FocusTimerNP
 
INumber FocusTimerN [1]
 
INumberVectorProperty FocusAbsPosNP
 
INumber FocusAbsPosN [1]
 
INumberVectorProperty FocusRelPosNP
 
INumber FocusRelPosN [1]
 
INumberVectorProperty FocusMaxPosNP
 
INumber FocusMaxPosN [1]
 
INumberVectorProperty FocusSyncNP
 
INumber FocusSyncN [1]
 
ISwitchVectorProperty FocusAbortSP
 
ISwitch FocusAbortS [1]
 
ISwitchVectorProperty FocusReverseSP
 
ISwitch FocusReverseS [2]
 
ISwitchVectorProperty FocusBacklashSP
 
ISwitch FocusBacklashS [2]
 
INumberVectorProperty FocusBacklashNP
 
INumber FocusBacklashN [1]
 
uint32_t capability
 
double lastTimerValue = { 0 }
 
DefaultDevicem_defaultDevice { nullptr }
 

Detailed Description

Provides interface to implement focuser functionality.

A focuser can be an independent device, or an embedded focuser within another device (e.g. Camera or mount).

When developing a driver for a fully indepdent focuser device, use INDI::Focuser directly. To add focus functionality to an existing mount or camera driver, subclass INDI::FocuserInterface. In your driver, then call the necessary focuser interface functions.

FunctionWhere to call it from your driver
FI::SetCapabilityConstructor
FI::initPropertiesinitProperties()
FI::updatePropertiesupdateProperties()
FI::processNumberISNewNumber(...) Check if the property name contains FOCUS_* and then call FI::processNumber(..) for such properties
FI::processSwitchISNewSwitch(...)

The interface supports three types of focusers:

Implement and overwrite the rest of the virtual functions as needed. INDI GPhoto driver is a good example to check for an actual implementation of a focuser interface within a CCD driver.

Author
Jasem Mutlaq

Definition at line 63 of file indifocuserinterface.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
FOCUSER_CAN_ABS_MOVE 

Can the focuser move by absolute position?

FOCUSER_CAN_REL_MOVE 

Can the focuser move by relative position?

FOCUSER_CAN_ABORT 

Is it possible to abort focuser motion?

FOCUSER_CAN_REVERSE 

Is it possible to reverse focuser motion?

FOCUSER_CAN_SYNC 

Can the focuser sync to a custom position

FOCUSER_HAS_VARIABLE_SPEED 

Can the focuser move in different configurable speeds?

FOCUSER_HAS_BACKLASH 

Can the focuser compensate for backlash?

Definition at line 72 of file indifocuserinterface.h.

◆ FocusDirection

Enumerator
FOCUS_INWARD 
FOCUS_OUTWARD 

Definition at line 66 of file indifocuserinterface.h.

Constructor & Destructor Documentation

◆ FocuserInterface()

INDI::FocuserInterface::FocuserInterface ( DefaultDevice defaultDevice)
explicitprotected

Definition at line 31 of file indifocuserinterface.cpp.

◆ ~FocuserInterface()

virtual INDI::FocuserInterface::~FocuserInterface ( )
protectedvirtualdefault

Member Function Documentation

◆ AbortFocuser()

bool INDI::FocuserInterface::AbortFocuser ( )
protectedvirtual

◆ CanAbort()

bool INDI::FocuserInterface::CanAbort ( )
inline
Returns
True if the focuser motion can be aborted.

Definition at line 119 of file indifocuserinterface.h.

◆ CanAbsMove()

bool INDI::FocuserInterface::CanAbsMove ( )
inline
Returns
True if the focuser has absolute position encoders.

Definition at line 103 of file indifocuserinterface.h.

◆ CanRelMove()

bool INDI::FocuserInterface::CanRelMove ( )
inline
Returns
True if the focuser has relative position encoders.

Definition at line 111 of file indifocuserinterface.h.

◆ CanReverse()

bool INDI::FocuserInterface::CanReverse ( )
inline
Returns
True if the focuser motion can be reversed.

Definition at line 127 of file indifocuserinterface.h.

◆ CanSync()

bool INDI::FocuserInterface::CanSync ( )
inline
Returns
True if the focuser motion can be reversed.

Definition at line 135 of file indifocuserinterface.h.

◆ GetCapability()

uint32_t INDI::FocuserInterface::GetCapability ( ) const
inline

GetFocuserCapability returns the capability of the focuser.

Definition at line 86 of file indifocuserinterface.h.

◆ HasBacklash()

bool INDI::FocuserInterface::HasBacklash ( )
inline
Returns
True if the focuser supports backlash.

Definition at line 151 of file indifocuserinterface.h.

◆ HasVariableSpeed()

bool INDI::FocuserInterface::HasVariableSpeed ( )
inline
Returns
True if the focuser has multiple speeds.

Definition at line 143 of file indifocuserinterface.h.

◆ initProperties()

void INDI::FocuserInterface::initProperties ( const char *  groupName)
protected

Initilize focuser properties. It is recommended to call this function within initProperties() of your primary device.

Parameters
groupNameGroup or tab name to be used to define focuser properties.

Definition at line 35 of file indifocuserinterface.cpp.

◆ MoveAbsFocuser()

IPState INDI::FocuserInterface::MoveAbsFocuser ( uint32_t  targetTicks)
protectedvirtual

MoveFocuser the focuser to an absolute position.

Parameters
ticksThe new position of the focuser.
Returns
Return IPS_OK if motion is completed and focuser reached requested position. Return IPS_BUSY if focuser started motion to requested position and is in progress. Return IPS_ALERT if there is an error.

Reimplemented in OnFocus, Lakeside, TeenAstroFocuser, LX200_OpenAstroTech, LX200_OnStep, CelestronGPS, FocuserDriver, NightCrawler, Integra, USBFocusV3, TCFS, SteelDriveII, SteelDrive, SIEFS, SestoSenso2, SestoSenso, RoboFocus, RBFOCUS, RainbowRSF, EFA, PerfectStar, PegasusScopsOAG, PegasusProdigyMF, PegasusFocusCube, NStep, MyFocuserPro2, MoonLiteDRO, MoonLite, Microtouch, lacerta_mfoc_fmc, lacerta_mfoc, FocusSim, EsattoArco, Esatto, DMFC, DeepSkyDadAF3, DeepSkyDadAF2, DeepSkyDadAF1, CelestronSCT, ActiveFocuser, AAF2, PegasusUPB, PegasusPPBA, FocusMaster, Gemini, SmartFocus, and FocusLynxBase.

Definition at line 538 of file indifocuserinterface.cpp.

◆ MoveFocuser()

IPState INDI::FocuserInterface::MoveFocuser ( FocusDirection  dir,
int  speed,
uint16_t  duration 
)
protectedvirtual

MoveFocuser the focuser in a particular direction with a specific speed for a finite duration.

Parameters
dirDirection of focuser, either FOCUS_INWARD or FOCUS_OUTWARD.
speedSpeed of focuser if supported by the focuser.
durationThe timeout in milliseconds before the focus motion halts. Pass 0 to move indefinitely.
Returns
Return IPS_OK if motion is completed and focuser reached requested position. Return IPS_BUSY if focuser started motion to requested position and is in progress. Return IPS_ALERT if there is an error.

Reimplemented in LX200Telescope, LX200_OpenAstroTech, LX200_OnStep, Gemini, SteelDrive, MyFocuserPro2, MoonLite, Microtouch, HitecAstroDCFocuser, FocusLynxBase, FocusSim, FCUSB, DeepSkyDadAF3, DeepSkyDadAF2, DeepSkyDadAF1, and FocusMaster.

Definition at line 521 of file indifocuserinterface.cpp.

◆ MoveRelFocuser()

IPState INDI::FocuserInterface::MoveRelFocuser ( FocusDirection  dir,
uint32_t  ticks 
)
protectedvirtual

MoveFocuser the focuser to an relative position.

Parameters
dirDirection of focuser, either FOCUS_INWARD or FOCUS_OUTWARD.
ticksThe relative ticks to move.
Returns
Return IPS_OK if motion is completed and focuser reached requested position. Return IPS_BUSY if focuser started motion to requested position and is in progress. Return IPS_ALERT if there is an error.

Reimplemented in LX200_OpenAstroTech, LX200_OnStep, CelestronGPS, FocuserDriver, NightCrawler, Integra, Gemini, USBFocusV3, TCFS, SmartFocus, SIEFS, SestoSenso2, SestoSenso, RoboFocus, PerfectStar, PegasusScopsOAG, PegasusProdigyMF, PegasusFocusCube, OnFocus, NStep, NFocus, MyFocuserPro2, MoonLiteDRO, MoonLite, Microtouch, Lakeside, lacerta_mfoc_fmc, lacerta_mfoc, HitecAstroDCFocuser, FocusLynxBase, FocusSim, EsattoArco, Esatto, DMFC, DeepSkyDadAF3, DeepSkyDadAF2, DeepSkyDadAF1, CelestronSCT, ActiveFocuser, AAF2, PegasusUPB, PegasusPPBA, FocusMaster, and TeenAstroFocuser.

Definition at line 530 of file indifocuserinterface.cpp.

◆ processNumber()

bool INDI::FocuserInterface::processNumber ( const char *  dev,
const char *  name,
double  values[],
char *  names[],
int  n 
)
protected

Process focus number properties.

Definition at line 168 of file indifocuserinterface.cpp.

◆ processSwitch()

bool INDI::FocuserInterface::processSwitch ( const char *  dev,
const char *  name,
ISState states,
char *  names[],
int  n 
)
protected

Process focus switch properties.

Definition at line 414 of file indifocuserinterface.cpp.

◆ ReverseFocuser()

bool INDI::FocuserInterface::ReverseFocuser ( bool  enabled)
protectedvirtual

ReverseFocuser Reverse focuser motion direction.

Parameters
enabledIf true, normal default focuser motion is reversed. If false, the direction is set to the default focuser motion.
Returns
True if successful, false otherwise.

Reimplemented in LX200Telescope, SteelDriveII, SestoSenso2, SestoSenso, EFA, PegasusProdigyMF, PegasusFocusCube, MyFocuserPro2, Lakeside, HitecAstroDCFocuser, FocusLynxBase, FCUSB, Esatto, DMFC, DeepSkyDadAF3, DeepSkyDadAF2, DeepSkyDadAF1, PegasusUPB, PegasusPPBA, and TeenAstroFocuser.

Definition at line 553 of file indifocuserinterface.cpp.

◆ saveConfigItems()

bool INDI::FocuserInterface::saveConfigItems ( FILE *  fp)
protected

saveConfigItems save focuser properties defined in the interface in config file

Parameters
fppointer to config file
Returns
Always return true

Definition at line 596 of file indifocuserinterface.cpp.

◆ SetCapability()

void INDI::FocuserInterface::SetCapability ( uint32_t  cap)
inline

FI::SetCapability sets the focuser capabilities. All capabilities must be initialized.

Parameters
cappointer to focuser capability struct.

Definition at line 95 of file indifocuserinterface.h.

◆ SetFocuserBacklash()

bool INDI::FocuserInterface::SetFocuserBacklash ( int32_t  steps)
protectedvirtual

SetFocuserBacklash Set the focuser backlash compensation value.

Parameters
stepsvalue in absolute steps to compensate
Returns
True if successful, false otherwise.

Reimplemented in LX200_OpenAstroTech, CelestronGPS, Gemini, USBFocusV3, SestoSenso2, RoboFocus, PegasusFocusCube, Lakeside, lacerta_mfoc_fmc, lacerta_mfoc, FocusLynxBase, FocusSim, EsattoArco, Esatto, DMFC, DeepSkyDadAF3, CelestronSCT, PegasusUPB, and PegasusPPBA.

Definition at line 580 of file indifocuserinterface.cpp.

◆ SetFocuserBacklashEnabled()

bool INDI::FocuserInterface::SetFocuserBacklashEnabled ( bool  enabled)
protectedvirtual

SetFocuserBacklashEnabled Enables or disables the focuser backlash compensation.

Parameters
enableflag to enable or disable backlash compensation
Returns
True if successful, false otherwise.

Reimplemented in Gemini, PegasusFocusCube, FocusLynxBase, FocusSim, DMFC, PegasusUPB, and PegasusPPBA.

Definition at line 587 of file indifocuserinterface.cpp.

◆ SetFocuserMaxPosition()

bool INDI::FocuserInterface::SetFocuserMaxPosition ( uint32_t  ticks)
protectedvirtual

SetFocuserMaxPosition Set Focuser Maximum position limit in the hardware.

Parameters
ticksmaximum steps permitted
Returns
True if successful, false otherwise.
Note
If setting maximum position limit in the hardware is not available or not supported, do not override this function as the default implementation will always return true.

Reimplemented in TeenAstroFocuser, INDI::Focuser, SteelDriveII, SIEFS, RBFOCUS, EFA, MyFocuserPro2, lacerta_mfoc_fmc, lacerta_mfoc, FocusLynxBase, and DeepSkyDadAF3.

Definition at line 574 of file indifocuserinterface.cpp.

◆ SetFocuserSpeed()

bool INDI::FocuserInterface::SetFocuserSpeed ( int  speed)
protectedvirtual

SetFocuserSpeed Set Focuser speed.

Parameters
speedfocuser speed
Returns
true if successful, false otherwise

Reimplemented in TeenAstroFocuser, LX200Telescope, LX200Autostar, USBFocusV3, SteelDrive, NStep, MyFocuserPro2, MoonLite, Microtouch, FocusSim, and FCUSB.

Definition at line 567 of file indifocuserinterface.cpp.

◆ SyncFocuser()

bool INDI::FocuserInterface::SyncFocuser ( uint32_t  ticks)
protectedvirtual

SyncFocuser Set current position to ticks without moving the focuser.

Parameters
ticksDesired new sync position.
Returns
True if successful, false otherwise.

Reimplemented in TeenAstroFocuser, FocuserDriver, SteelDriveII, SIEFS, RoboFocus, RBFOCUS, EFA, PerfectStar, PegasusScopsOAG, PegasusProdigyMF, PegasusFocusCube, NStep, MyFocuserPro2, MoonLiteDRO, MoonLite, Microtouch, lacerta_mfoc_fmc, FocusLynxBase, DMFC, DeepSkyDadAF3, DeepSkyDadAF2, DeepSkyDadAF1, AAF2, PegasusUPB, and PegasusPPBA.

Definition at line 560 of file indifocuserinterface.cpp.

◆ updateProperties()

bool INDI::FocuserInterface::updateProperties ( )
protected

updateProperties Define or Delete Rotator properties based on the connection status of the base device

Returns
True if successful, false otherwise.

Definition at line 101 of file indifocuserinterface.cpp.

Member Data Documentation

◆ capability

uint32_t INDI::FocuserInterface::capability
protected

Definition at line 313 of file indifocuserinterface.h.

◆ FocusAbortS

ISwitch INDI::FocuserInterface::FocusAbortS[1]
protected

Definition at line 299 of file indifocuserinterface.h.

◆ FocusAbortSP

ISwitchVectorProperty INDI::FocuserInterface::FocusAbortSP
protected

Definition at line 298 of file indifocuserinterface.h.

◆ FocusAbsPosN

INumber INDI::FocuserInterface::FocusAbsPosN[1]
protected

Definition at line 283 of file indifocuserinterface.h.

◆ FocusAbsPosNP

INumberVectorProperty INDI::FocuserInterface::FocusAbsPosNP
protected

Definition at line 282 of file indifocuserinterface.h.

◆ FocusBacklashN

INumber INDI::FocuserInterface::FocusBacklashN[1]
protected

Definition at line 311 of file indifocuserinterface.h.

◆ FocusBacklashNP

INumberVectorProperty INDI::FocuserInterface::FocusBacklashNP
protected

Definition at line 310 of file indifocuserinterface.h.

◆ FocusBacklashS

ISwitch INDI::FocuserInterface::FocusBacklashS[2]
protected

Definition at line 307 of file indifocuserinterface.h.

◆ FocusBacklashSP

ISwitchVectorProperty INDI::FocuserInterface::FocusBacklashSP
protected

Definition at line 306 of file indifocuserinterface.h.

◆ 

enum { ... } INDI::FocuserInterface::FocuserCapability

◆ FocusMaxPosN

INumber INDI::FocuserInterface::FocusMaxPosN[1]
protected

Definition at line 291 of file indifocuserinterface.h.

◆ FocusMaxPosNP

INumberVectorProperty INDI::FocuserInterface::FocusMaxPosNP
protected

Definition at line 290 of file indifocuserinterface.h.

◆ FocusMotionS

ISwitch INDI::FocuserInterface::FocusMotionS[2]
protected

Definition at line 275 of file indifocuserinterface.h.

◆ FocusMotionSP

ISwitchVectorProperty INDI::FocuserInterface::FocusMotionSP
protected

Definition at line 274 of file indifocuserinterface.h.

◆ FocusRelPosN

INumber INDI::FocuserInterface::FocusRelPosN[1]
protected

Definition at line 287 of file indifocuserinterface.h.

◆ FocusRelPosNP

INumberVectorProperty INDI::FocuserInterface::FocusRelPosNP
protected

Definition at line 286 of file indifocuserinterface.h.

◆ FocusReverseS

ISwitch INDI::FocuserInterface::FocusReverseS[2]
protected

Definition at line 303 of file indifocuserinterface.h.

◆ FocusReverseSP

ISwitchVectorProperty INDI::FocuserInterface::FocusReverseSP
protected

Definition at line 302 of file indifocuserinterface.h.

◆ FocusSpeedN

INumber INDI::FocuserInterface::FocusSpeedN[1]
protected

Definition at line 269 of file indifocuserinterface.h.

◆ FocusSpeedNP

INumberVectorProperty INDI::FocuserInterface::FocusSpeedNP
protected

Definition at line 268 of file indifocuserinterface.h.

◆ FocusSyncN

INumber INDI::FocuserInterface::FocusSyncN[1]
protected

Definition at line 295 of file indifocuserinterface.h.

◆ FocusSyncNP

INumberVectorProperty INDI::FocuserInterface::FocusSyncNP
protected

Definition at line 294 of file indifocuserinterface.h.

◆ FocusTimerN

INumber INDI::FocuserInterface::FocusTimerN[1]
protected

Definition at line 279 of file indifocuserinterface.h.

◆ FocusTimerNP

INumberVectorProperty INDI::FocuserInterface::FocusTimerNP
protected

Definition at line 278 of file indifocuserinterface.h.

◆ lastTimerValue

double INDI::FocuserInterface::lastTimerValue = { 0 }
protected

Definition at line 315 of file indifocuserinterface.h.

◆ m_defaultDevice

DefaultDevice* INDI::FocuserInterface::m_defaultDevice { nullptr }
protected

Definition at line 317 of file indifocuserinterface.h.


The documentation for this class was generated from the following files: