Instrument Neutral Distributed Interface INDI  1.1.0
Classes | Public Member Functions | Protected Member Functions | List of all members
INDI::Telescope Class Referenceabstract

Class to provide general functionality of a telescope device. More...

#include <inditelescope.h>

Inheritance diagram for INDI::Telescope:
INDI::DefaultDevice INDI::BaseDevice

Classes

struct  TelescopeCapability
 Holds the capabilities of a telescope. More...
 

Public Member Functions

virtual bool ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n)
 Process the client newNumber command. More...
 
virtual bool ISNewText (const char *dev, const char *name, char *texts[], char *names[], int n)
 Process the client newSwitch command. More...
 
virtual bool ISNewSwitch (const char *dev, const char *name, ISState *states, char *names[], int n)
 Process the client newSwitch command. More...
 
virtual void ISGetProperties (const char *dev)
 define the driver's properties to the client. Usually, only a minumum set of properties are defined to the client in this function if the device is in disconnected state. Those properties should be enough to enable the client to establish a connection to the device. In addition to CONNECT/DISCONNECT, such properties may include port name, IP address, etc... You should check if the device is already connected, and if this is true, then you must define the remainder of the the properties to the client in this function. Otherweise, the remainder of the driver's properties are defined to the client in updateProperties() function which is called when a client connects/disconnects from a device. More...
 
virtual bool ISSnoopDevice (XMLEle *root)
 Process a snoop event from INDI server. This function is called when a snooped property is updated in a snooped driver. More...
 
TelescopeCapability GetTelescopeCapability () const
 GetTelescopeCapability returns the capability of the Telescope.
 
void SetTelescopeCapability (TelescopeCapability *cap)
 SetTelescopeCapability sets the Telescope capabilities. All capabilities must be initialized. More...
 
virtual bool initProperties ()
 Called to initialize basic properties required all the time.
 
virtual bool updateProperties ()
 Called when connected state changes, to add/remove properties.
 
virtual void TimerHit ()
 Called when setTimer() time is up.
 
virtual bool Connect ()
 Connect to the telescope. More...
 
virtual bool Disconnect ()
 Disconnect from telescope. More...
 
virtual bool Connect (const char *port, uint16_t baud)
 INDI::Telescope implementation of Connect() assumes 9600 baud, 8 bit word, even parity, and no stop bit. Override function if communication paramaters are different. More...
 
void SetParkDataType (TelescopeParkData type)
 setParkDataType Sets the type of parking data stored in the park data file and presented to the user. More...
 
bool InitPark ()
 InitPark Loads parking data (stored in ~/.indi/ParkData.xml) that contains parking status and parking position. More...
 
bool isParked ()
 isParked is mount currently parked? More...
 
void SetParked (bool isparked)
 SetParked Change the mount parking status. The data park file (stored in ~/.indi/ParkData.xml) is updated in the process. More...
 
double GetAxis1Park ()
 
double GetAxis1ParkDefault ()
 
double GetAxis2Park ()
 
double GetAxis2ParkDefault ()
 
void SetAxis1Park (double value)
 SetRAPark Set current RA/AZ parking position. The data park file (stored in ~/.indi/ParkData.xml) is updated in the process. More...
 
void SetAxis1ParkDefault (double steps)
 SetRAPark Set default RA/AZ parking position. More...
 
void SetAxis2Park (double steps)
 SetDEPark Set current DEC/ALT parking position. The data park file (stored in ~/.indi/ParkData.xml) is updated in the process. More...
 
void SetAxis2ParkDefault (double steps)
 SetDEParkDefault Set default DEC/ALT parking position. More...
 
- Public Member Functions inherited from INDI::DefaultDevice
void addAuxControls ()
 Add Debug, Simulation, and Configuration options to the driver.
 
void addDebugControl ()
 Add Debug control to the driver.
 
void addSimulationControl ()
 Add Simulation control to the driver.
 
void addConfigurationControl ()
 Add Configuration control to the driver.
 
void resetProperties ()
 Set all properties to IDLE state.
 
void defineNumber (INumberVectorProperty *nvp)
 Define number vector to client & register it. Alternatively, IDDefNumber can be used but the property will not get registered and the driver will not be able to save configuration files. More...
 
void defineText (ITextVectorProperty *tvp)
 Define text vector to client & register it. Alternatively, IDDefText can be used but the property will not get registered and the driver will not be able to save configuration files. More...
 
void defineSwitch (ISwitchVectorProperty *svp)
 Define switch vector to client & register it. Alternatively, IDDefswitch can be used but the property will not get registered and the driver will not be able to save configuration files. More...
 
void defineLight (ILightVectorProperty *lvp)
 Define light vector to client & register it. Alternatively, IDDeflight can be used but the property will not get registered and the driver will not be able to save configuration files. More...
 
void defineBLOB (IBLOBVectorProperty *bvp)
 Define BLOB vector to client & register it. Alternatively, IDDefBLOB can be used but the property will not get registered and the driver will not be able to save configuration files. More...
 
virtual bool deleteProperty (const char *propertyName)
 Delete a property and unregister it. It will also be deleted from all clients. More...
 
virtual void setConnected (bool status, IPState state=IPS_OK, const char *msg=NULL)
 Set connection switch status in the client. More...
 
int SetTimer (int ms)
 Set a timer to call the function TimerHit after ms milliseconds. More...
 
void RemoveTimer (int id)
 Remove timer added with SetTimer. More...
 
virtual const char * getDriverName ()
 
void setVersion (unsigned int vMajor, unsigned int vMinor)
 Set driver version information to be defined in DRIVER_INFO property as vMajor.vMinor. More...
 
unsigned int getMajorVersion ()
 
unsigned int getMinorVersion ()
 
virtual bool ISNewBLOB (const char *dev, const char *name, int sizes[], int blobsizes[], char *blobs[], char *formats[], char *names[], int n)
 Process the client newBLOB command. More...
 
unsigned int getInterfaceDescriptor () const
 
void setInterfaceDescriptor (unsigned int value)
 setInterface Set driver interface. By default the driver interface is set to GENERAL_DEVICE. You may send an ORed list of DeviceInterface values. More...
 
- Public Member Functions inherited from INDI::BaseDevice
INumberVectorPropertygetNumber (const char *name)
 
ITextVectorPropertygetText (const char *name)
 
ISwitchVectorPropertygetSwitch (const char *name)
 
ILightVectorPropertygetLight (const char *name)
 
IBLOBVectorPropertygetBLOB (const char *name)
 
IPState getPropertyState (const char *name)
 
IPerm getPropertyPermission (const char *name)
 
int removeProperty (const char *name, char *errmsg)
 Remove a property. More...
 
void * getRawProperty (const char *name, INDI_PROPERTY_TYPE type=INDI_UNKNOWN)
 Return a property and its type given its name. More...
 
INDI::Property * getProperty (const char *name, INDI_PROPERTY_TYPE type=INDI_UNKNOWN)
 Return a property and its type given its name. More...
 
std::vector< INDI::Property * > * getProperties ()
 Return a list of all properties in the device.
 
bool buildSkeleton (const char *filename)
 Build driver properties from a skeleton file. More...
 
bool isConnected ()
 
void setDeviceName (const char *dev)
 Set the device name. More...
 
const char * getDeviceName ()
 
void addMessage (std::string msg)
 Add message to the driver's message queue. More...
 
std::string messageQueue (int index)
 
std::string lastMessage ()
 
void setMediator (INDI::BaseMediator *med)
 Set the driver's mediator to receive notification of news devices and updated property values.
 
INDI::BaseMediatorgetMediator ()
 
const char * getDriverName ()
 
const char * getDriverExec ()
 
const char * getDriverVersion ()
 
unsigned int getDriverInterface ()
 

Protected Member Functions

void NewRaDec (double ra, double dec)
 The child class calls this function when it has updates.
 
virtual bool ReadScopeStatus ()=0
 Read telescope status. This function checks the following: More...
 
virtual bool Goto (double ra, double dec)=0
 Move the scope to the supplied RA and DEC coordinates. More...
 
virtual bool Sync (double ra, double dec)
 Set the telescope current RA and DEC coordinates to the supplied RA and DEC coordinates. More...
 
virtual bool MoveNS (INDI_DIR_NS dir, TelescopeMotionCommand command)
 Start or Stop the telescope motion in the direction dir. More...
 
virtual bool MoveWE (INDI_DIR_WE dir, TelescopeMotionCommand command)
 Move the telescope in the direction dir. More...
 
virtual bool Park ()
 Park the telescope to its home position. More...
 
virtual bool UnPark ()
 Unpark the telescope if already parked. More...
 
virtual bool Abort ()=0
 Abort telescope motion. More...
 
virtual bool updateTime (ln_date *utc, double utc_offset)
 Update telescope time, date, and UTC offset. More...
 
virtual bool updateLocation (double latitude, double longitude, double elevation)
 Update telescope location settings. More...
 
virtual void SetCurrentPark ()
 SetCurrentPark Set current coordinates/encoders value as the desired parking position. More...
 
virtual void SetDefaultPark ()
 SetDefaultPark Set default coordinates/encoders value as the desired parking position. More...
 
virtual bool SetSlewRate (int index)
 SetSlewRate Set desired slew rate index. More...
 
- Protected Member Functions inherited from INDI::DefaultDevice
virtual bool loadConfig (bool silent=false, const char *property=NULL)
 Load the last saved configuration file. More...
 
virtual bool saveConfig (bool silent=false)
 Save the current properties in a configuration file. More...
 
virtual bool loadDefaultConfig ()
 Load the default configuration file. More...
 
void setDebug (bool enable)
 Toggle driver debug status. More...
 
void setSimulation (bool enable)
 Toggle driver simulation status. More...
 
virtual void debugTriggered (bool enable)
 Inform driver that the debug option was triggered. More...
 
virtual void simulationTriggered (bool enable)
 Inform driver that the simulation option was triggered. More...
 
bool isDebug ()
 
bool isSimulation ()
 
virtual const char * getDefaultName ()=0
 
- Protected Member Functions inherited from INDI::BaseDevice
int buildProp (XMLEle *root, char *errmsg)
 Build a property given the supplied XML element (defXXX) More...
 
int setValue (XMLEle *root, char *errmsg)
 handle SetXXX commands from client
 
int setBLOB (IBLOBVectorProperty *pp, XMLEle *root, char *errmsg)
 Parse and store BLOB in the respective vector.
 

Additional Inherited Members

- Public Types inherited from INDI::DefaultDevice
enum  {
  GENERAL_INTERFACE = 0, TELESCOPE_INTERFACE = (1 << 0), CCD_INTERFACE = (1 << 1), GUIDER_INTERFACE = (1 << 2),
  FOCUSER_INTERFACE = (1 << 3), FILTER_INTERFACE = (1 << 4), DOME_INTERFACE = (1 << 5), AUX_INTERFACE = (1 << 6)
}
 
- Public Types inherited from INDI::BaseDevice
enum  INDI_ERROR { INDI_DEVICE_NOT_FOUND =-1, INDI_PROPERTY_INVALID =-2, INDI_PROPERTY_DUPLICATED = -3, INDI_DISPATCH_ERROR =-4 }
 
- Public Attributes inherited from INDI::DefaultDevice
enum INDI::DefaultDevice:: { ... }  DeviceInterface
 

Detailed Description

Class to provide general functionality of a telescope device.

Developers need to subclass INDI::Telescope to implement any driver for telescopes within INDI.

Implementing a basic telescope driver involves the child class performing the following steps:

Author
Jasem Mutlaq, Gerry Rozema
See also
TelescopeSimulator and SynScan drivers for examples of implementations of INDI::Telescope.
Examples:
simplescope.h.

Definition at line 48 of file inditelescope.h.

Member Function Documentation

virtual bool INDI::Telescope::Abort ( )
protectedpure virtual

Abort telescope motion.

Returns
True if successful, false otherewise
Note
This function is not implemented in INDI::Telescope, it must be implemented in the child class
Examples:
simplescope.h.
bool INDI::Telescope::Connect ( )
virtual

Connect to the telescope.

Returns
True if connection is successful, false otherwise

Implements INDI::DefaultDevice.

Examples:
simplescope.h.

Definition at line 867 of file inditelescope.cpp.

bool INDI::Telescope::Connect ( const char *  port,
uint16_t  baud 
)
virtual

INDI::Telescope implementation of Connect() assumes 9600 baud, 8 bit word, even parity, and no stop bit. Override function if communication paramaters are different.

Parameters
portPort to connect to
baudBaud rate
Returns
True if connection is successful, false otherwise
Warning
Do not call this function directly, it is called by INDI::Telescope Connect() function.

Definition at line 882 of file inditelescope.cpp.

bool INDI::Telescope::Disconnect ( )
virtual

Disconnect from telescope.

Returns
True if successful, false otherwise

Implements INDI::DefaultDevice.

Examples:
simplescope.h.

Definition at line 920 of file inditelescope.cpp.

double INDI::Telescope::GetAxis1Park ( )
Returns
Get current RA/AZ parking position.

Definition at line 1306 of file inditelescope.cpp.

double INDI::Telescope::GetAxis1ParkDefault ( )
Returns
Get default RA/AZ parking position.

Definition at line 1310 of file inditelescope.cpp.

double INDI::Telescope::GetAxis2Park ( )
Returns
Get current DEC/ALT parking position.

Definition at line 1314 of file inditelescope.cpp.

double INDI::Telescope::GetAxis2ParkDefault ( )
Returns
Get defailt DEC/ALT parking position.

Definition at line 1318 of file inditelescope.cpp.

virtual bool INDI::Telescope::Goto ( double  ra,
double  dec 
)
protectedpure virtual

Move the scope to the supplied RA and DEC coordinates.

Returns
True if successful, false otherewise
Note
This function is not implemented in INDI::Telescope, it must be implemented in the child class
Examples:
simplescope.h.
bool INDI::Telescope::InitPark ( )

InitPark Loads parking data (stored in ~/.indi/ParkData.xml) that contains parking status and parking position.

Returns
True if loading is successful and data is read, false otherwise. On success, you must call SetAxis1ParkDefault() and SetAxis2ParkDefault() to set the default parking values. On failure, you must call SetAxis1ParkDefault() and SetAxis2ParkDefault() to set the default parking values in addition to SetAxis1Park() and SetAxis2Park() to set the current parking position.

Definition at line 1147 of file inditelescope.cpp.

void INDI::Telescope::ISGetProperties ( const char *  dev)
virtual

define the driver's properties to the client. Usually, only a minumum set of properties are defined to the client in this function if the device is in disconnected state. Those properties should be enough to enable the client to establish a connection to the device. In addition to CONNECT/DISCONNECT, such properties may include port name, IP address, etc... You should check if the device is already connected, and if this is true, then you must define the remainder of the the properties to the client in this function. Otherweise, the remainder of the driver's properties are defined to the client in updateProperties() function which is called when a client connects/disconnects from a device.

Parameters
devname of the device
Note
This function is called by the INDI framework, do not call it directly. See LX200 Generic driver for an example implementation

Reimplemented from INDI::DefaultDevice.

Definition at line 140 of file inditelescope.cpp.

bool INDI::Telescope::ISNewNumber ( const char *  dev,
const char *  name,
double  values[],
char *  names[],
int  n 
)
virtual

Process the client newNumber command.

Note
This function is called by the INDI framework, do not call it directly.
Returns
True if any property was successfully processed, false otherwise.

Reimplemented from INDI::DefaultDevice.

Definition at line 438 of file inditelescope.cpp.

bool INDI::Telescope::ISNewSwitch ( const char *  dev,
const char *  name,
ISState states,
char *  names[],
int  n 
)
virtual

Process the client newSwitch command.

Note
This function is called by the INDI framework, do not call it directly.
Returns
True if any property was successfully processed, false otherwise.

Reimplemented from INDI::DefaultDevice.

Definition at line 557 of file inditelescope.cpp.

bool INDI::Telescope::ISNewText ( const char *  dev,
const char *  name,
char *  texts[],
char *  names[],
int  n 
)
virtual

Process the client newSwitch command.

Note
This function is called by the INDI framework, do not call it directly.
Returns
True if any property was successfully processed, false otherwise.

Reimplemented from INDI::DefaultDevice.

Definition at line 391 of file inditelescope.cpp.

bool INDI::Telescope::isParked ( )

isParked is mount currently parked?

Returns
True if parked, false otherwise.

Definition at line 1142 of file inditelescope.cpp.

bool INDI::Telescope::ISSnoopDevice ( XMLEle *  root)
virtual

Process a snoop event from INDI server. This function is called when a snooped property is updated in a snooped driver.

Note
This function is called by the INDI framework, do not call it directly.
Returns
True if any property was successfully processed, false otherwise.

Reimplemented from INDI::DefaultDevice.

Definition at line 257 of file inditelescope.cpp.

bool INDI::Telescope::MoveNS ( INDI_DIR_NS  dir,
TelescopeMotionCommand  command 
)
protectedvirtual

Start or Stop the telescope motion in the direction dir.

Parameters
dirdirection of motion
commandStart or Stop command
Returns
True if successful, false otherewise
Note
This function is not implemented in INDI::Telescope, it must be implemented in the child class

Definition at line 366 of file inditelescope.cpp.

bool INDI::Telescope::MoveWE ( INDI_DIR_WE  dir,
TelescopeMotionCommand  command 
)
protectedvirtual

Move the telescope in the direction dir.

Parameters
dirdirection of motion
commandStart or Stop command
Returns
True if successful, false otherewise
Note
This function is not implemented in INDI::Telescope, it must be implemented in the child class

Definition at line 377 of file inditelescope.cpp.

bool INDI::Telescope::Park ( )
protectedvirtual

Park the telescope to its home position.

Returns
True if successful, false otherewise
Note
This function defaults to return false unless subclassed by the child class.

Definition at line 951 of file inditelescope.cpp.

virtual bool INDI::Telescope::ReadScopeStatus ( )
protectedpure virtual

Read telescope status. This function checks the following:

  1. Check if the link to the telescope is alive.
  2. Update telescope status: Idle, Slewing, Parking..etc.
  3. Read coordinates
Returns
True if reading scope status is OK, false if an error is encounterd.
Note
This function is not implemented in INDI::Telescope, it must be implemented in the child class
Examples:
simplescope.h.
void INDI::Telescope::SetAxis1Park ( double  value)

SetRAPark Set current RA/AZ parking position. The data park file (stored in ~/.indi/ParkData.xml) is updated in the process.

Parameters
valuecurrent Axis 1 value (RA or AZ either in angles or encoder values as specificed by the TelescopeParkData type).

Definition at line 1323 of file inditelescope.cpp.

void INDI::Telescope::SetAxis1ParkDefault ( double  steps)

SetRAPark Set default RA/AZ parking position.

Parameters
valueDefault Axis 1 value (RA or AZ either in angles or encoder values as specificed by the TelescopeParkData type).

Definition at line 1330 of file inditelescope.cpp.

void INDI::Telescope::SetAxis2Park ( double  steps)

SetDEPark Set current DEC/ALT parking position. The data park file (stored in ~/.indi/ParkData.xml) is updated in the process.

Parameters
valuecurrent Axis 1 value (DEC or ALT either in angles or encoder values as specificed by the TelescopeParkData type).

Definition at line 1335 of file inditelescope.cpp.

void INDI::Telescope::SetAxis2ParkDefault ( double  steps)

SetDEParkDefault Set default DEC/ALT parking position.

Parameters
valueDefault Axis 2 value (DEC or ALT either in angles or encoder values as specificed by the TelescopeParkData type).

Definition at line 1342 of file inditelescope.cpp.

void INDI::Telescope::SetCurrentPark ( )
protectedvirtual

SetCurrentPark Set current coordinates/encoders value as the desired parking position.

Note
This function performs no action unless subclassed by the child class if required.

Definition at line 963 of file inditelescope.cpp.

void INDI::Telescope::SetDefaultPark ( )
protectedvirtual

SetDefaultPark Set default coordinates/encoders value as the desired parking position.

Note
This function performs no action unless subclassed by the child class if required.

Definition at line 968 of file inditelescope.cpp.

void INDI::Telescope::SetParkDataType ( TelescopeParkData  type)

setParkDataType Sets the type of parking data stored in the park data file and presented to the user.

Parameters
typeparking data type. If PARK_NONE then no properties will be presented to the user for custom parking position.

Definition at line 1081 of file inditelescope.cpp.

void INDI::Telescope::SetParked ( bool  isparked)

SetParked Change the mount parking status. The data park file (stored in ~/.indi/ParkData.xml) is updated in the process.

Parameters
isparkedset to true if parked, false otherwise.

Definition at line 1117 of file inditelescope.cpp.

bool INDI::Telescope::SetSlewRate ( int  index)
protectedvirtual

SetSlewRate Set desired slew rate index.

Parameters
indexIndex of slew rate where 0 is slowest rate and capability.nSlewRate-1 is maximum rate.
Returns
True is operation successful, false otherwise.
Note
This function as implemented in INDI::Telescope performs no function and always return true. Only reimplement it if you need to issue a command to change the slew rate at the hardware level. Most telescope drivers only utilize slew rate when issuing a motion command.

Definition at line 1347 of file inditelescope.cpp.

void INDI::Telescope::SetTelescopeCapability ( TelescopeCapability cap)

SetTelescopeCapability sets the Telescope capabilities. All capabilities must be initialized.

Parameters
cappointer to Telescope capability struct.

Definition at line 1043 of file inditelescope.cpp.

bool INDI::Telescope::Sync ( double  ra,
double  dec 
)
protectedvirtual

Set the telescope current RA and DEC coordinates to the supplied RA and DEC coordinates.

Returns
True if successful, false otherewise
Note
This function implemented INDI::Telescope always returns false. Override the function to return true.

Definition at line 359 of file inditelescope.cpp.

bool INDI::Telescope::UnPark ( )
protectedvirtual

Unpark the telescope if already parked.

Returns
True if successful, false otherewise
Note
This function defaults to return false unless subclassed by the child class.

Definition at line 957 of file inditelescope.cpp.

bool INDI::Telescope::updateLocation ( double  latitude,
double  longitude,
double  elevation 
)
protectedvirtual

Update telescope location settings.

Parameters
latitudeSite latitude in degrees.
longitudeSite latitude in degrees increasing eastward from Greenwich (0 to 360).
elevationSite elevation in meters.
Returns
True if successful, false otherewise
Note
This function performs no action unless subclassed by the child class if required.

Definition at line 1034 of file inditelescope.cpp.

bool INDI::Telescope::updateTime ( ln_date *  utc,
double  utc_offset 
)
protectedvirtual

Update telescope time, date, and UTC offset.

Parameters
utcUTC time.
utc_offsetUTC offset in hours.
Returns
True if successful, false otherewise
Note
This function performs no action unless subclassed by the child class if required.

Definition at line 1026 of file inditelescope.cpp.


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