TwiceAsNice  2019-02-18
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:
Inheritance graph
Collaboration diagram for INDI::FocuserInterface:
Collaboration graph

Public Types

enum  FocusDirection { FOCUS_INWARD, FOCUS_OUTWARD, FOCUS_INWARD, FOCUS_OUTWARD }
 
enum  { FOCUSER_CAN_ABS_MOVE = 1 << 0, FOCUSER_CAN_REL_MOVE = 1 << 1, FOCUSER_CAN_ABORT = 1 << 2, FOCUSER_HAS_VARIABLE_SPEED = 1 << 3 }
 
enum  FocusDirection { FOCUS_INWARD, FOCUS_OUTWARD, FOCUS_INWARD, FOCUS_OUTWARD }
 
enum  { FOCUSER_CAN_ABS_MOVE = 1 << 0, FOCUSER_CAN_REL_MOVE = 1 << 1, FOCUSER_CAN_ABORT = 1 << 2, FOCUSER_HAS_VARIABLE_SPEED = 1 << 3 }
 

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. More...
 
bool CanAbsMove ()
 
bool CanRelMove ()
 
bool CanAbort ()
 
bool HasVariableSpeed ()
 
uint32_t GetCapability () const
 GetFocuserCapability returns the capability of the focuser. More...
 
void SetCapability (uint32_t cap)
 FI::SetCapability sets the focuser capabilities. More...
 
bool CanAbsMove ()
 
bool CanRelMove ()
 
bool CanAbort ()
 
bool HasVariableSpeed ()
 

Public Attributes

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

Protected Member Functions

 FocuserInterface (DefaultDevice *defaultDevice)
 
virtual ~FocuserInterface ()=default
 
void initProperties (const char *groupName)
 Initilize focuser properties. 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 AbortFocuser ()
 AbortFocuser all focus motion. More...
 
 FocuserInterface (DefaultDevice *defaultDevice)
 
virtual ~FocuserInterface ()=default
 
void initProperties (const char *groupName)
 Initilize focuser properties. 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 AbortFocuser ()
 AbortFocuser all focus motion. 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]
 
ISwitchVectorProperty AbortSP
 
ISwitch AbortS [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(...)

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

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_HAS_VARIABLE_SPEED 

Can the focuser move in different configurable speeds?

◆ 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_HAS_VARIABLE_SPEED 

Can the focuser move in different configurable speeds?

◆ FocusDirection [1/2]

Enumerator
FOCUS_INWARD 
FOCUS_OUTWARD 
FOCUS_INWARD 
FOCUS_OUTWARD 

◆ FocusDirection [2/2]

Enumerator
FOCUS_INWARD 
FOCUS_OUTWARD 
FOCUS_INWARD 
FOCUS_OUTWARD 

Constructor & Destructor Documentation

◆ FocuserInterface() [1/2]

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

◆ ~FocuserInterface() [1/2]

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

◆ FocuserInterface() [2/2]

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

◆ ~FocuserInterface() [2/2]

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

Member Function Documentation

◆ AbortFocuser() [1/2]

bool INDI::FocuserInterface::AbortFocuser ( )
protectedvirtual

AbortFocuser all focus motion.

Returns
True if abort is successful, false otherwise.

Reimplemented in USBFocusV3, FocusLynxBase, Gemini, SteelDrive, Microtouch, Integra, PerfectStar, FocusMaster, Lakeside, NightCrawler, NSTEP, SestoSenso, ArmPlat, MoonLite, DMFC, RoboFocus, and SmartFocus.

◆ AbortFocuser() [2/2]

virtual bool INDI::FocuserInterface::AbortFocuser ( )
protectedvirtual

AbortFocuser all focus motion.

Returns
True if abort is successful, false otherwise.

Reimplemented in USBFocusV3, FocusLynxBase, Gemini, SteelDrive, Microtouch, Integra, PerfectStar, FocusMaster, Lakeside, NightCrawler, NSTEP, SestoSenso, ArmPlat, MoonLite, DMFC, RoboFocus, and SmartFocus.

◆ CanAbort() [1/2]

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

◆ CanAbort() [2/2]

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

◆ CanAbsMove() [1/2]

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

◆ CanAbsMove() [2/2]

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

◆ CanRelMove() [1/2]

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

◆ CanRelMove() [2/2]

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

◆ GetCapability() [1/2]

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

GetFocuserCapability returns the capability of the focuser.

◆ GetCapability() [2/2]

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

GetFocuserCapability returns the capability of the focuser.

◆ HasVariableSpeed() [1/2]

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

◆ HasVariableSpeed() [2/2]

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

◆ initProperties() [1/2]

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.

◆ initProperties() [2/2]

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.

◆ MoveAbsFocuser() [1/2]

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 USBFocusV3, FocusLynxBase, Gemini, TCFS, SteelDrive, Microtouch, FocusSim, Integra, FLIPDF, PerfectStar, FocusMaster, Lakeside, NSTEP, NightCrawler, SestoSenso, ArmPlat, NFocus, MoonLite, DMFC, SmartFocus, and RoboFocus.

◆ MoveAbsFocuser() [2/2]

virtual 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 USBFocusV3, FocusLynxBase, Gemini, TCFS, SteelDrive, Microtouch, FocusSim, Integra, FLIPDF, PerfectStar, FocusMaster, Lakeside, NSTEP, NightCrawler, SestoSenso, ArmPlat, NFocus, MoonLite, DMFC, SmartFocus, and RoboFocus.

◆ MoveFocuser() [1/2]

virtual 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 GPhotoCCD, FocusLynxBase, Gemini, SteelDrive, Microtouch, FocusSim, HitecAstroDCFocuser, FocusMaster, and MoonLite.

◆ MoveFocuser() [2/2]

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 GPhotoCCD, FocusLynxBase, Gemini, SteelDrive, Microtouch, FocusSim, HitecAstroDCFocuser, FocusMaster, and MoonLite.

◆ MoveRelFocuser() [1/2]

virtual 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 USBFocusV3, FocusLynxBase, Gemini, TCFS, SteelDrive, Microtouch, FocusSim, Integra, FLIPDF, HitecAstroDCFocuser, PerfectStar, FocusMaster, Lakeside, NightCrawler, NSTEP, ArmPlat, NFocus, MoonLite, SestoSenso, DMFC, SmartFocus, and RoboFocus.

◆ MoveRelFocuser() [2/2]

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 USBFocusV3, FocusLynxBase, Gemini, TCFS, SteelDrive, Microtouch, FocusSim, Integra, FLIPDF, HitecAstroDCFocuser, PerfectStar, FocusMaster, Lakeside, NightCrawler, NSTEP, ArmPlat, NFocus, MoonLite, SestoSenso, DMFC, SmartFocus, and RoboFocus.

◆ processNumber() [1/2]

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

Process focus number properties.

◆ processNumber() [2/2]

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

Process focus number properties.

◆ processSwitch() [1/2]

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

Process focus switch properties.

◆ processSwitch() [2/2]

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

Process focus switch properties.

◆ SetCapability() [1/2]

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.

◆ SetCapability() [2/2]

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.

◆ SetFocuserSpeed() [1/2]

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

SetFocuserSpeed Set Focuser speed.

Parameters
speedfocuser speed
Returns
true if successful, false otherwise

Reimplemented in USBFocusV3, GPhotoCCD, SteelDrive, Microtouch, FocusSim, NSTEP, and MoonLite.

◆ SetFocuserSpeed() [2/2]

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

SetFocuserSpeed Set Focuser speed.

Parameters
speedfocuser speed
Returns
true if successful, false otherwise

Reimplemented in USBFocusV3, GPhotoCCD, SteelDrive, Microtouch, FocusSim, NSTEP, and MoonLite.

◆ updateProperties() [1/2]

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.

◆ updateProperties() [2/2]

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.

Member Data Documentation

◆ AbortS

ISwitch INDI::FocuserInterface::AbortS
protected

◆ AbortSP

ISwitchVectorProperty INDI::FocuserInterface::AbortSP
protected

◆ capability

uint32_t INDI::FocuserInterface::capability
protected

◆ FocusAbsPosN

INumber INDI::FocuserInterface::FocusAbsPosN
protected

◆ FocusAbsPosNP

INumberVectorProperty INDI::FocuserInterface::FocusAbsPosNP
protected

◆ FocuserCapability [1/2]

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

◆ FocuserCapability [2/2]

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

◆ FocusMotionS

ISwitch INDI::FocuserInterface::FocusMotionS
protected

◆ FocusMotionSP

ISwitchVectorProperty INDI::FocuserInterface::FocusMotionSP
protected

◆ FocusRelPosN

INumber INDI::FocuserInterface::FocusRelPosN
protected

◆ FocusRelPosNP

INumberVectorProperty INDI::FocuserInterface::FocusRelPosNP
protected

◆ FocusSpeedN

INumber INDI::FocuserInterface::FocusSpeedN
protected

◆ FocusSpeedNP

INumberVectorProperty INDI::FocuserInterface::FocusSpeedNP
protected

◆ FocusTimerN

INumber INDI::FocuserInterface::FocusTimerN
protected

◆ FocusTimerNP

INumberVectorProperty INDI::FocuserInterface::FocusTimerNP
protected

◆ lastTimerValue

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

◆ m_defaultDevice

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

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