Instrument Neutral Distributed Interface INDI  1.8.0
Public Types | Public Member Functions | Public Attributes | Protected Types | 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 PegasusUPB AAF2 CelestronSCT DeepSkyDadAF1 DeepSkyDadAF2 DMFC FCUSB FocuserDriver FocusLynxBase FocusMaster FocusSim Gemini HitecAstroDCFocuser Integra lacerta_mfoc Lakeside Microtouch MoonLite MoonLiteDRO NFocus NightCrawler NStep OnFocus PerfectStar RoboFocus SestoSenso SIEFS SmartFocus SteelDrive TCFS USBFocusV3 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
}
 

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 ()
 

Public Attributes

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

Protected Types

enum  { REVERSED_ENABLED, REVERSED_DISABLED }
 

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 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]
 
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?

Definition at line 72 of file indifocuserinterface.h.

◆ anonymous enum

anonymous enum
protected
Enumerator
REVERSED_ENABLED 
REVERSED_DISABLED 

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

◆ CanAbsMove()

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

Definition at line 102 of file indifocuserinterface.h.

◆ CanRelMove()

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

Definition at line 110 of file indifocuserinterface.h.

◆ CanReverse()

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

Definition at line 126 of file indifocuserinterface.h.

◆ CanSync()

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

Definition at line 134 of file indifocuserinterface.h.

◆ GetCapability()

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

GetFocuserCapability returns the capability of the focuser.

Definition at line 85 of file indifocuserinterface.h.

◆ HasVariableSpeed()

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

Definition at line 142 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 LX200_OnStep, CelestronGPS, USBFocusV3, FocusLynxBase, TCFS, Gemini, DeepSkyDadAF1, DeepSkyDadAF2, MoonLite, SIEFS, SteelDrive, PegasusUPB, Microtouch, CelestronSCT, FocusSim, Integra, FocuserDriver, AAF2, PerfectStar, NStep, NightCrawler, FocusMaster, Lakeside, MoonLiteDRO, SestoSenso, lacerta_mfoc, RoboFocus, DMFC, SmartFocus, and OnFocus.

Definition at line 444 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_OnStep, FocusLynxBase, Gemini, FCUSB, DeepSkyDadAF1, DeepSkyDadAF2, SteelDrive, MoonLite, Microtouch, FocusSim, HitecAstroDCFocuser, and FocusMaster.

Definition at line 427 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_OnStep, CelestronGPS, USBFocusV3, FocusLynxBase, TCFS, Gemini, DeepSkyDadAF1, DeepSkyDadAF2, MoonLite, SIEFS, CelestronSCT, NFocus, PegasusUPB, Microtouch, AAF2, FocusSim, Integra, FocuserDriver, HitecAstroDCFocuser, PerfectStar, NightCrawler, FocusMaster, Lakeside, MoonLiteDRO, NStep, lacerta_mfoc, RoboFocus, SestoSenso, DMFC, SmartFocus, and OnFocus.

Definition at line 436 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 138 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 346 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, FocusLynxBase, DeepSkyDadAF1, DeepSkyDadAF2, FCUSB, PegasusUPB, HitecAstroDCFocuser, Lakeside, and SestoSenso.

Definition at line 459 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 489 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 94 of file indifocuserinterface.h.

◆ 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 FocusLynxBase, INDI::Focuser, SIEFS, and lacerta_mfoc.

Definition at line 483 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 LX200Telescope, USBFocusV3, MoonLite, FCUSB, SteelDrive, Microtouch, FocusSim, NStep, and LX200Autostar.

Definition at line 473 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 FocusLynxBase, DeepSkyDadAF1, DeepSkyDadAF2, MoonLite, SIEFS, AAF2, PegasusUPB, Microtouch, FocuserDriver, MoonLiteDRO, PerfectStar, NStep, and RoboFocus.

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

Member Data Documentation

◆ capability

uint32_t INDI::FocuserInterface::capability
protected

Definition at line 287 of file indifocuserinterface.h.

◆ FocusAbortS

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

Definition at line 276 of file indifocuserinterface.h.

◆ FocusAbortSP

ISwitchVectorProperty INDI::FocuserInterface::FocusAbortSP
protected

Definition at line 275 of file indifocuserinterface.h.

◆ FocusAbsPosN

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

Definition at line 260 of file indifocuserinterface.h.

◆ FocusAbsPosNP

INumberVectorProperty INDI::FocuserInterface::FocusAbsPosNP
protected

Definition at line 259 of file indifocuserinterface.h.

◆ FocuserCapability

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

◆ FocusMaxPosN

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

Definition at line 268 of file indifocuserinterface.h.

◆ FocusMaxPosNP

INumberVectorProperty INDI::FocuserInterface::FocusMaxPosNP
protected

Definition at line 267 of file indifocuserinterface.h.

◆ FocusMotionS

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

Definition at line 252 of file indifocuserinterface.h.

◆ FocusMotionSP

ISwitchVectorProperty INDI::FocuserInterface::FocusMotionSP
protected

Definition at line 251 of file indifocuserinterface.h.

◆ FocusRelPosN

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

Definition at line 264 of file indifocuserinterface.h.

◆ FocusRelPosNP

INumberVectorProperty INDI::FocuserInterface::FocusRelPosNP
protected

Definition at line 263 of file indifocuserinterface.h.

◆ FocusReverseS

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

Definition at line 280 of file indifocuserinterface.h.

◆ FocusReverseSP

ISwitchVectorProperty INDI::FocuserInterface::FocusReverseSP
protected

Definition at line 279 of file indifocuserinterface.h.

◆ FocusSpeedN

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

Definition at line 246 of file indifocuserinterface.h.

◆ FocusSpeedNP

INumberVectorProperty INDI::FocuserInterface::FocusSpeedNP
protected

Definition at line 245 of file indifocuserinterface.h.

◆ FocusSyncN

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

Definition at line 272 of file indifocuserinterface.h.

◆ FocusSyncNP

INumberVectorProperty INDI::FocuserInterface::FocusSyncNP
protected

Definition at line 271 of file indifocuserinterface.h.

◆ FocusTimerN

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

Definition at line 256 of file indifocuserinterface.h.

◆ FocusTimerNP

INumberVectorProperty INDI::FocuserInterface::FocusTimerNP
protected

Definition at line 255 of file indifocuserinterface.h.

◆ lastTimerValue

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

Definition at line 289 of file indifocuserinterface.h.

◆ m_defaultDevice

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

Definition at line 291 of file indifocuserinterface.h.


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