Instrument Neutral Distributed Interface INDI 2.2.5
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 IndiAstroLink4mini2 IndiAstrolink4 LX200Telescope PegasusPPBA PegasusUPB PegasusUPB3

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.
 
void SetCapability (uint32_t cap)
 FI::SetCapability sets the focuser capabilities. All capabilities must be initialized.
 
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)
 Initialize focuser properties. It is recommended to call this function within initProperties() of your primary device.
 
bool updateProperties ()
 updateProperties Define or Delete Rotator properties based on the connection status of the base device
 
bool processNumber (const char *dev, const char *name, double values[], char *names[], int n)
 Process focus number properties.
 
bool processSwitch (const char *dev, const char *name, ISState *states, char *names[], int n)
 Process focus switch properties.
 
virtual bool SetFocuserSpeed (int speed)
 SetFocuserSpeed Set Focuser speed.
 
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.
 
virtual IPState MoveAbsFocuser (uint32_t targetTicks)
 MoveFocuser the focuser to an absolute position.
 
virtual IPState MoveRelFocuser (FocusDirection dir, uint32_t ticks)
 MoveFocuser the focuser to an relative position.
 
virtual bool ReverseFocuser (bool enabled)
 ReverseFocuser Reverse focuser motion direction.
 
virtual bool SyncFocuser (uint32_t ticks)
 SyncFocuser Set current position to ticks without moving the focuser.
 
virtual bool SetFocuserMaxPosition (uint32_t ticks)
 SetFocuserMaxPosition Set Focuser Maximum position limit in the hardware.
 
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 AbortFocuser ()
 AbortFocuser all focus motion.
 
bool saveConfigItems (FILE *fp)
 saveConfigItems save focuser properties defined in the interface in config file
 

Protected Attributes

INDI::PropertyNumber FocusSpeedNP {1}
 
INDI::PropertySwitch FocusMotionSP {2}
 
INDI::PropertyNumber FocusTimerNP {1}
 
INDI::PropertyNumber FocusAbsPosNP {1}
 
INDI::PropertyNumber FocusRelPosNP {1}
 
INDI::PropertyNumber FocusMaxPosNP {1}
 
INDI::PropertyNumber FocusSyncNP {1}
 
INDI::PropertySwitch FocusAbortSP {1}
 
INDI::PropertySwitch FocusReverseSP {2}
 
INDI::PropertySwitch FocusBacklashSP {2}
 
INDI::PropertyNumber FocusBacklashNP {1}
 
uint32_t capability
 
double lastTimerValue = { 0 }
 
DefaultDevice * m_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 65 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 74 of file indifocuserinterface.h.

◆ FocusDirection

Enumerator
FOCUS_INWARD 
FOCUS_OUTWARD 

Definition at line 68 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 121 of file indifocuserinterface.h.

◆ CanAbsMove()

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

Definition at line 105 of file indifocuserinterface.h.

◆ CanRelMove()

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

Definition at line 113 of file indifocuserinterface.h.

◆ CanReverse()

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

Definition at line 129 of file indifocuserinterface.h.

◆ CanSync()

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

Definition at line 137 of file indifocuserinterface.h.

◆ GetCapability()

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

GetFocuserCapability returns the capability of the focuser.

Definition at line 88 of file indifocuserinterface.h.

◆ HasBacklash()

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

Definition at line 153 of file indifocuserinterface.h.

◆ HasVariableSpeed()

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

Definition at line 145 of file indifocuserinterface.h.

◆ initProperties()

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

Initialize 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 FocusLynxBase, SmartFocus, Gemini, FocusMaster, IndiAstrolink4, IndiAstroLink4mini2, AAF2, ActiveFocuser, AllunaTCS2, AskarWAF, astromechanics_foc, CelestronSCT, DeepSkyDadAF1, DeepSkyDadAF2, DeepSkyDadAF3, DMFC, Esatto, EsattoArco, FocusSim, IKunFocuser, AlpacaFocuser, lacerta_mfoc, lacerta_mfoc_fmc, Microtouch, MoonLite, MoonLiteDRO, MyFocuserPro2, NStep, PegasusFocusCube, PegasusFocusCube3, PegasusProdigyMF, PegasusScopsOAG, PerfectStar, PinefeatCEF, EFA, RainbowRSF, RBFOCUS, RoboFocus, SestoSenso, SestoSenso2, SestoSenso3, SIEFS, SteelDrive, SteelDriveII, TCFS, USBFocusV3, PegasusPPBA, PegasusUPB, PegasusUPB3, Integra, NightCrawler, FocuserDriver, CelestronGPS, LX200_esp32go, LX200_OnStep, LX200_OpenAstroTech, TeenAstroFocuser, DreamFocuser, iEAFFocus, Lakeside, OnFocus, and iAFSRotator.

Definition at line 535 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 FocusMaster, DeepSkyDadAF1, DeepSkyDadAF2, DeepSkyDadAF3, FCUSB, FocusSim, FocusLynxBase, HitecAstroDCFocuser, Microtouch, MoonLite, MyFocuserPro2, SteelDrive, Gemini, LX200_OnStep, LX200_OpenAstroTech, and LX200Telescope.

Definition at line 518 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 TeenAstroFocuser, FocusMaster, IndiAstrolink4, IndiAstroLink4mini2, AAF2, ActiveFocuser, AllunaTCS2, AskarWAF, astromechanics_foc, CelestronSCT, DeepSkyDadAF1, DeepSkyDadAF2, DeepSkyDadAF3, DMFC, DreamFocuser, Esatto, EsattoArco, FocusSim, FocusLynxBase, HitecAstroDCFocuser, iEAFFocus, IKunFocuser, lacerta_mfoc, lacerta_mfoc_fmc, Lakeside, Microtouch, MoonLite, MoonLiteDRO, MyFocuserPro2, NFocus, NStep, OnFocus, PegasusFocusCube, PegasusFocusCube3, PegasusProdigyMF, PegasusScopsOAG, PerfectStar, PinefeatCEF, RoboFocus, SestoSenso, SestoSenso2, SestoSenso3, SIEFS, SmartFocus, TCFS, USBFocusV3, PegasusPPBA, PegasusUPB, PegasusUPB3, Gemini, iAFSRotator, Integra, NightCrawler, FocuserDriver, CelestronGPS, LX200_esp32go, LX200_OnStep, and LX200_OpenAstroTech.

Definition at line 527 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 159 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 409 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 TeenAstroFocuser, IndiAstrolink4, IndiAstroLink4mini2, AskarWAF, DeepSkyDadAF1, DeepSkyDadAF2, DeepSkyDadAF3, DMFC, Esatto, FCUSB, FocusLynxBase, HitecAstroDCFocuser, iEAFFocus, IKunFocuser, Lakeside, MyFocuserPro2, PegasusFocusCube, PegasusFocusCube3, PegasusProdigyMF, EFA, SestoSenso, SestoSenso2, SestoSenso3, SIEFS, SteelDriveII, PegasusPPBA, PegasusUPB, PegasusUPB3, iAFSRotator, and LX200Telescope.

Definition at line 550 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 593 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 97 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 IndiAstrolink4, IndiAstroLink4mini2, AskarWAF, CelestronSCT, DeepSkyDadAF3, DMFC, Esatto, EsattoArco, FocusSim, FocusLynxBase, lacerta_mfoc, lacerta_mfoc_fmc, Lakeside, PegasusFocusCube, PegasusFocusCube3, RoboFocus, SestoSenso2, SestoSenso3, USBFocusV3, PegasusPPBA, PegasusUPB, PegasusUPB3, Gemini, CelestronGPS, and LX200_OpenAstroTech.

Definition at line 577 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 IndiAstrolink4, IndiAstroLink4mini2, AskarWAF, DMFC, FocusSim, FocusLynxBase, Lakeside, PegasusFocusCube, PegasusPPBA, PegasusUPB, PegasusUPB3, and Gemini.

Definition at line 584 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 IndiAstrolink4, IndiAstroLink4mini2, AskarWAF, DeepSkyDadAF1, DeepSkyDadAF2, DeepSkyDadAF3, FocusLynxBase, iEAFFocus, IKunFocuser, lacerta_mfoc, lacerta_mfoc_fmc, MyFocuserPro2, EFA, RBFOCUS, SIEFS, SteelDriveII, iAFSRotator, INDI::Focuser, and TeenAstroFocuser.

Definition at line 571 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 FCUSB, FocusSim, IKunFocuser, Microtouch, MoonLite, MyFocuserPro2, NStep, PinefeatCEF, EFA, SteelDrive, USBFocusV3, LX200Autostar, LX200Telescope, and TeenAstroFocuser.

Definition at line 564 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 IndiAstrolink4, IndiAstroLink4mini2, AAF2, AskarWAF, DeepSkyDadAF1, DeepSkyDadAF2, DeepSkyDadAF3, DMFC, DreamFocuser, FocusSim, FocusLynxBase, IKunFocuser, lacerta_mfoc_fmc, Microtouch, MoonLite, MoonLiteDRO, MyFocuserPro2, NStep, PegasusFocusCube, PegasusFocusCube3, PegasusProdigyMF, PegasusScopsOAG, PerfectStar, EFA, RBFOCUS, RoboFocus, SIEFS, SteelDriveII, PegasusPPBA, PegasusUPB, PegasusUPB3, FocuserDriver, LX200_OpenAstroTech, and TeenAstroFocuser.

Definition at line 557 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 92 of file indifocuserinterface.cpp.

Member Data Documentation

◆ capability

uint32_t INDI::FocuserInterface::capability
protected

Definition at line 304 of file indifocuserinterface.h.

◆ FocusAbortSP

INDI::PropertySwitch INDI::FocuserInterface::FocusAbortSP {1}
protected

Definition at line 293 of file indifocuserinterface.h.

◆ FocusAbsPosNP

INDI::PropertyNumber INDI::FocuserInterface::FocusAbsPosNP {1}
protected

Definition at line 281 of file indifocuserinterface.h.

◆ FocusBacklashNP

INDI::PropertyNumber INDI::FocuserInterface::FocusBacklashNP {1}
protected

Definition at line 302 of file indifocuserinterface.h.

◆ FocusBacklashSP

INDI::PropertySwitch INDI::FocuserInterface::FocusBacklashSP {2}
protected

Definition at line 299 of file indifocuserinterface.h.

◆ []

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

◆ FocusMaxPosNP

INDI::PropertyNumber INDI::FocuserInterface::FocusMaxPosNP {1}
protected

Definition at line 287 of file indifocuserinterface.h.

◆ FocusMotionSP

INDI::PropertySwitch INDI::FocuserInterface::FocusMotionSP {2}
protected

Definition at line 275 of file indifocuserinterface.h.

◆ FocusRelPosNP

INDI::PropertyNumber INDI::FocuserInterface::FocusRelPosNP {1}
protected

Definition at line 284 of file indifocuserinterface.h.

◆ FocusReverseSP

INDI::PropertySwitch INDI::FocuserInterface::FocusReverseSP {2}
protected

Definition at line 296 of file indifocuserinterface.h.

◆ FocusSpeedNP

INDI::PropertyNumber INDI::FocuserInterface::FocusSpeedNP {1}
protected

Definition at line 270 of file indifocuserinterface.h.

◆ FocusSyncNP

INDI::PropertyNumber INDI::FocuserInterface::FocusSyncNP {1}
protected

Definition at line 290 of file indifocuserinterface.h.

◆ FocusTimerNP

INDI::PropertyNumber INDI::FocuserInterface::FocusTimerNP {1}
protected

Definition at line 278 of file indifocuserinterface.h.

◆ lastTimerValue

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

Definition at line 306 of file indifocuserinterface.h.

◆ m_defaultDevice

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

Definition at line 308 of file indifocuserinterface.h.


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