baseclient.h   baseclient.h 
/**************************************************************************
*****
Copyright(c) 2011 Jasem Mutlaq. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
***************************************************************************
****/
#ifndef INDIBASECLIENT_H #ifndef INDIBASECLIENT_H
#define INDIBASECLIENT_H #define INDIBASECLIENT_H
#include <vector> #include <vector>
#include <map> #include <map>
#include <boost/shared_ptr.hpp>
#include <string> #include <string>
#include "indiapi.h" #include "indiapi.h"
#include "indidevapi.h" #include "indidevapi.h"
#include "indibase.h" #include "indibase.h"
#define MAXRBUF 2048 #define MAXRBUF 2048
using namespace std; using namespace std;
skipping to change at line 28 skipping to change at line 45
* \class INDI::BaseClient * \class INDI::BaseClient
\brief Class to provide basic client functionality. \brief Class to provide basic client functionality.
BaseClient enables accelerated development of INDI Clients by providing a framework that facilitates communication, device BaseClient enables accelerated development of INDI Clients by providing a framework that facilitates communication, device
handling, and event notification. By subclassing BaseClient, clients can quickly connect to an INDI server, and query for handling, and event notification. By subclassing BaseClient, clients can quickly connect to an INDI server, and query for
a set of INDI::BaseDriver devices, and read and write properties seamles sly. Event driven programming is possible due to a set of INDI::BaseDriver devices, and read and write properties seamles sly. Event driven programming is possible due to
notifications upon reception of new devices or properties. notifications upon reception of new devices or properties.
\attention All notifications functions defined in INDI::BaseMediator mus t be implemented in the client class even if \attention All notifications functions defined in INDI::BaseMediator mus t be implemented in the client class even if
they are not used because these are pure virtual functions. they are not used because these are pure virtual functions.
\see <a href=http://indilib.org/index.php?title=Learn_how_to_write_INDI_
clients>INDI Client Tutorial</a> for more details.
\author Jasem Mutlaq \author Jasem Mutlaq
*/ */
class INDI::BaseClient : public INDI::BaseMediator class INDI::BaseClient : public INDI::BaseMediator
{ {
public: public:
enum { INDI_DEVICE_NOT_FOUND=-1, INDI_PROPERTY_INVALID=-2, INDI_PROPERT Y_DUPLICATED = -3, INDI_DISPATCH_ERROR=-4 }; enum { INDI_DEVICE_NOT_FOUND=-1, INDI_PROPERTY_INVALID=-2, INDI_PROPERT Y_DUPLICATED = -3, INDI_DISPATCH_ERROR=-4 };
typedef boost::shared_ptr<INDI::BaseDriver> devicePtr; //typedef boost::shared_ptr<INDI::BaseDriver> devicePtr;
BaseClient(); BaseClient();
~BaseClient(); ~BaseClient();
/** \brief Set the server host name and port /** \brief Set the server host name and port
\param hostname INDI server host name or IP address. \param hostname INDI server host name or IP address.
\param port INDI server port. \param port INDI server port.
*/ */
void setServer(const char * hostname, unsigned int port); void setServer(const char * hostname, unsigned int port);
skipping to change at line 83 skipping to change at line 102
*/ */
void setDriverConnection(bool status, const char *deviceName); void setDriverConnection(bool status, const char *deviceName);
/** \param deviceName Name of device to search for in the list of devic es owned by INDI server, /** \param deviceName Name of device to search for in the list of devic es owned by INDI server,
\returns If \e deviceName exists, it returns an instance of the de vice. Otherwise, it returns NULL. \returns If \e deviceName exists, it returns an instance of the de vice. Otherwise, it returns NULL.
*/ */
INDI::BaseDriver * getDriver(const char * deviceName); INDI::BaseDriver * getDriver(const char * deviceName);
/** \returns Returns a vector of all devices created in the client. /** \returns Returns a vector of all devices created in the client.
*/ */
const vector<devicePtr> & getDrivers() const { return cDevices; } const vector<INDI::BaseDriver *> & getDrivers() const { return cDevices ; }
/** \brief Set Binary Large Object policy mode /** \brief Set Binary Large Object policy mode
Set the BLOB handling mode for the client. The client may either reci eve: Set the BLOB handling mode for the client. The client may either reci eve:
<ul> <ul>
<li>Only BLOBS</li> <li>Only BLOBS</li>
<li>BLOBs mixed with normal messages</li> <li>BLOBs mixed with normal messages</li>
<li>Normal messages only, no BLOBs</li> <li>Normal messages only, no BLOBs</li>
</ul> </ul>
skipping to change at line 152 skipping to change at line 171
void finishBlob(); void finishBlob();
private: private:
// Listen to INDI server and process incoming messages // Listen to INDI server and process incoming messages
void listenINDI(); void listenINDI();
// Thread for listenINDI() // Thread for listenINDI()
pthread_t listen_thread; pthread_t listen_thread;
vector<devicePtr> cDevices; vector<INDI::BaseDriver *> cDevices;
vector<string> cDeviceNames; vector<string> cDeviceNames;
string cServer; string cServer;
unsigned int cPort; unsigned int cPort;
bool sConnected; bool sConnected;
// Parse & FILE buffers for IO // Parse & FILE buffers for IO
int sockfd; int sockfd;
LilXML *lillp; /* XML parser context */ LilXML *lillp; /* XML parser context */
FILE *svrwfp; /* FILE * to talk to server */ FILE *svrwfp; /* FILE * to talk to server */
 End of changes. 6 change blocks. 
4 lines changed or deleted 26 lines changed or added


 basedriver.h   basedriver.h 
/**************************************************************************
*****
Copyright(c) 2011 Jasem Mutlaq. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
***************************************************************************
****/
#ifndef INDIBASEDRIVER_H #ifndef INDIBASEDRIVER_H
#define INDIBASEDRIVER_H #define INDIBASEDRIVER_H
#include <boost/shared_ptr.hpp> #include <vector>
#include <map>
#include <string> #include <string>
#include "indiapi.h" #include "indiapi.h"
#include "indidevapi.h" #include "indidevapi.h"
#include "indibase.h" #include "indibase.h"
#define MAXRBUF 2048 #define MAXRBUF 2048
class PropertyContainer
{
public:
PropertyContainer();
~PropertyContainer();
/*! INDI property type */
typedef enum
{
INDI_NUMBER, /*!< INumberVectorProperty. */
INDI_SWITCH, /*!< ISwitchVectorProperty. */
INDI_TEXT, /*!< ITextVectorProperty. */
INDI_LIGHT, /*!< ILightVectorProperty. */
INDI_BLOB, /*!< IBLOBVectorProperty. */
INDI_UNKNOWN
} INDI_TYPE;
void setProperty(void *);
void setType(INDI_TYPE t);
void setRegistered(bool r);
void setDynamic(bool d);
void *getProperty() { return pPtr; }
INDI_TYPE getType() { return pType; }
bool getRegistered() { return pRegistered; }
bool getDynamic() { return pDynamic; }
private:
void *pPtr;
INDI_TYPE pType;
bool pRegistered;
bool pDynamic;
};
/** /**
* \class INDI::BaseDriver * \class INDI::BaseDriver
\brief Class to provide basic INDI driver functionality. \brief Class to provide basic INDI driver functionality.
INDI::BaseClient contains a vector list of INDI::BaseDrivers. Upon conne ction with INDI server, the client create a INDI::BaseDriver INDI::BaseClient contains a vector list of INDI::BaseDrivers. Upon conne ction with INDI server, the client create a INDI::BaseDriver
\e instance for each driver owned by the INDI server. Properties of the driver can be build either by loading an external \e instance for each driver owned by the INDI server. Properties of the driver can be build either by loading an external
skeleton file that contains a list of defXXX commands, or by dynamically building properties as they arrive from the server. skeleton file that contains a list of defXXX commands, or by dynamically building properties as they arrive from the server.
\author Jasem Mutlaq \author Jasem Mutlaq
*/ */
skipping to change at line 39 skipping to change at line 90
/*! INDI error codes. */ /*! INDI error codes. */
enum INDI_ERROR enum INDI_ERROR
{ {
INDI_DEVICE_NOT_FOUND=-1, /*!< INDI Device was not found. */ INDI_DEVICE_NOT_FOUND=-1, /*!< INDI Device was not found. */
INDI_PROPERTY_INVALID=-2, /*!< Property has an invalid syntax or attribute. */ INDI_PROPERTY_INVALID=-2, /*!< Property has an invalid syntax or attribute. */
INDI_PROPERTY_DUPLICATED = -3, /*!< INDI Device was not found. */ INDI_PROPERTY_DUPLICATED = -3, /*!< INDI Device was not found. */
INDI_DISPATCH_ERROR=-4 /*!< Dispatching command to driver failed. */ INDI_DISPATCH_ERROR=-4 /*!< Dispatching command to driver failed. */
}; };
/*! INDI property type */
typedef enum
{
INDI_NUMBER, /*!< INumberVectorProperty. */
INDI_SWITCH, /*!< ISwitchVectorProperty. */
INDI_TEXT, /*!< ITextVectorProperty. */
INDI_LIGHT, /*!< ILightVectorProperty. */
INDI_BLOB, /*!< IBLOBVectorProperty. */
INDI_UNKNOWN
} INDI_TYPE;
/** \return Return vector number property given its name */ /** \return Return vector number property given its name */
INumberVectorProperty * getNumber(const char *name); INumberVectorProperty * getNumber(const char *name);
/** \return Return vector text property given its name */ /** \return Return vector text property given its name */
ITextVectorProperty * getText(const char *name); ITextVectorProperty * getText(const char *name);
/** \return Return vector switch property given its name */ /** \return Return vector switch property given its name */
ISwitchVectorProperty * getSwitch(const char *name); ISwitchVectorProperty * getSwitch(const char *name);
/** \return Return vector light property given its name */ /** \return Return vector light property given its name */
ILightVectorProperty * getLight(const char *name); ILightVectorProperty * getLight(const char *name);
/** \return Return vector BLOB property given its name */ /** \return Return vector BLOB property given its name */
IBLOBVectorProperty * getBLOB(const char *name); IBLOBVectorProperty * getBLOB(const char *name);
void registerProperty(void *p, INDI_TYPE type); void registerProperty(void *p, PropertyContainer::INDI_TYPE type);
/** \brief Remove a property /** \brief Remove a property
\param name name of property to be removed \param name name of property to be removed
\return 0 if successul, -1 otherwise. \return 0 if successul, -1 otherwise.
*/ */
int removeProperty(const char *name); int removeProperty(const char *name);
/** \brief Return a property and its type given its name. /** \brief Return a property and its type given its name.
\param name of property to be found. \param name of property to be found.
\param type of property found. \param type of property found.
\return If property is found, it is returned. To be used you must u se static_cast with given the type of property \return If property is found, it is returned. To be used you must u se static_cast with given the type of property
returned. returned.
\note This is a low-level function and should not be called directl y unless necessary. Use getXXX instead where XXX \note This is a low-level function and should not be called directl y unless necessary. Use getXXX instead where XXX
is the property type (Number, Text, Switch..etc). is the property type (Number, Text, Switch..etc).
*/ */
void * getProperty(const char *name, INDI_TYPE type = INDI_UNKNOWN); void * getProperty(const char *name, PropertyContainer::INDI_TYPE type
= PropertyContainer::INDI_UNKNOWN);
PropertyContainer * getContainer(const char *name, PropertyContainer::I
NDI_TYPE type = PropertyContainer::INDI_UNKNOWN);
/** \brief Build driver properties from a skeleton file. /** \brief Build driver properties from a skeleton file.
\param filename full path name of the file. \param filename full path name of the file.
A skeloton file defines the properties supported by this driver. It is a list of defXXX elements enclosed by @<INDIDriver>@ A skeloton file defines the properties supported by this driver. It is a list of defXXX elements enclosed by @<INDIDriver>@
and @</INDIDriver>@ opening and closing tags. After the properties are cre ated, they can be rerieved, manipulated, and defined and @</INDIDriver>@ opening and closing tags. After the properties are cre ated, they can be rerieved, manipulated, and defined
to other clients. to other clients.
\see An example skeleton file can be found under examples/tutorial_four_sk .xml \see An example skeleton file can be found under examples/tutorial_four_sk .xml
skipping to change at line 133 skipping to change at line 175
\return 0 if parsing is successful, -1 otherwise and errmsg is set */ \return 0 if parsing is successful, -1 otherwise and errmsg is set */
int buildProp(XMLEle *root, char *errmsg); int buildProp(XMLEle *root, char *errmsg);
/** \brief handle SetXXX commands from client */ /** \brief handle SetXXX commands from client */
int setValue (XMLEle *root, char * errmsg); int setValue (XMLEle *root, char * errmsg);
/** \brief handle SetBLOB command from client */ /** \brief handle SetBLOB command from client */
int processBLOB(IBLOB *blobEL, XMLEle *ep, char * errmsg); int processBLOB(IBLOB *blobEL, XMLEle *ep, char * errmsg);
/** \brief Parse and store BLOB in the respective vector */ /** \brief Parse and store BLOB in the respective vector */
int setBLOB(IBLOBVectorProperty *pp, XMLEle * root, char * errmsg); int setBLOB(IBLOBVectorProperty *pp, XMLEle * root, char * errmsg);
char deviceID[MAXINDINAME];
typedef boost::shared_ptr<INumberVectorProperty> numberPtr;
typedef boost::shared_ptr<ITextVectorProperty> textPtr;
typedef boost::shared_ptr<ISwitchVectorProperty> switchPtr;
typedef boost::shared_ptr<ILightVectorProperty> lightPtr;
typedef boost::shared_ptr<IBLOBVectorProperty> blobPtr;
private: private:
std::map< boost::shared_ptr<void>, INDI_TYPE> pAll; char deviceID[MAXINDINAME];
std::vector<PropertyContainer *> pAll;
LilXML *lp; LilXML *lp;
std::string messageQueue; std::string messageQueue;
INDI::BaseMediator *mediator; INDI::BaseMediator *mediator;
friend class INDI::BaseClient; friend class INDI::BaseClient;
friend class INDI::DefaultDriver; friend class INDI::DefaultDriver;
 End of changes. 8 change blocks. 
24 lines changed or deleted 64 lines changed or added


 defaultdriver.h   defaultdriver.h 
/**************************************************************************
*****
Copyright(c) 2011 Jasem Mutlaq. All rights reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
***************************************************************************
****/
#ifndef INDIDEFAULTDRIVER_H #ifndef INDIDEFAULTDRIVER_H
#define INDIDEFAULTDRIVER_H #define INDIDEFAULTDRIVER_H
#include "basedriver.h" #include "basedriver.h"
#include "indidriver.h" #include "indidriver.h"
#include <memory.h>
extern const char *COMMUNICATION_TAB;
extern const char *MAIN_CONTROL_TAB;
extern const char *MOTION_TAB;
extern const char *DATETIME_TAB;
extern const char *SITE_TAB;
extern const char *OPTIONS_TAB;
extern const char *FILTER_TAB;
extern const char *GUIDER_TAB;
/** /**
* \class INDI::DefaultDriver * \class INDI::DefaultDriver
\brief Class to provide extended functionary for drivers in addition \brief Class to provide extended functionality for drivers in addition
to the functionality provided by INDI::BaseDriver. This class should \e onl y be subclassed by to the functionality provided by INDI::BaseDriver. This class should \e onl y be subclassed by
drivers directly as it is linked with main(). Virtual drivers cannot employ INDI::DefaultDriver. drivers directly as it is linked with main(). Virtual drivers cannot employ INDI::DefaultDriver.
INDI::DefaultDriver provides capability to add Debug, Simulation, and Co nfiguration controls. These controls (switches) are INDI::DefaultDriver provides capability to add Debug, Simulation, and Co nfiguration controls. These controls (switches) are
defined to the client. Configuration options permit saving and loading o f AS-IS property values. defined to the client. Configuration options permit saving and loading o f AS-IS property values.
\see <a href='tutorial__four_8h_source.html'>Tutorial Four</a> \see <a href='tutorial__four_8h_source.html'>Tutorial Four</a>
\author Jasem Mutlaq \author Jasem Mutlaq
*/ */
class INDI::DefaultDriver : public INDI::BaseDriver class INDI::DefaultDriver : public INDI::BaseDriver
{ {
public: public:
DefaultDriver(); DefaultDriver();
virtual ~DefaultDriver() {} virtual ~DefaultDriver();
/** \brief Add Debug, Simulation, and Configuration options to the driv er */ /** \brief Add Debug, Simulation, and Configuration options to the driv er */
void addAuxControls(); void addAuxControls();
/** \brief Add Debug control to the driver */ /** \brief Add Debug control to the driver */
void addDebugControl(); void addDebugControl();
/** \brief Add Simulation control to the driver */ /** \brief Add Simulation control to the driver */
void addSimulationControl(); void addSimulationControl();
skipping to change at line 75 skipping to change at line 104
get registered and the driver will not be able to save confi guration files. get registered and the driver will not be able to save confi guration files.
\param bvp The BLOB vector property to be defined \param bvp The BLOB vector property to be defined
*/ */
void defineBLOB(IBLOBVectorProperty *bvp); void defineBLOB(IBLOBVectorProperty *bvp);
/** \brief Delete a property and unregister it. It will also be deleted from all clients. /** \brief Delete a property and unregister it. It will also be deleted from all clients.
\param propertyName name of property to be deleted. \param propertyName name of property to be deleted.
*/ */
virtual bool deleteProperty(const char *propertyName); virtual bool deleteProperty(const char *propertyName);
/** \brief Connect or Disconnect a device. /** \brief Set connection switch status in the client.
\param status If true, the driver will attempt to connect to the devi ce (CONNECT=ON). If false, it will attempt \param status If true, the driver will attempt to connect to the devi ce (CONNECT=ON). If false, it will attempt
to disconnect the device. to disconnect the device.
\param msg A message to be sent along with connect/disconnect command \param status True to set CONNECT on, false to set DISCONNECT on.
. \param state State of CONNECTION properti, by default IPS_OK.
\param msg A message to be sent along with connect/disconnect command
, by default NULL.
*/ */
virtual void setConnected(bool status, IPState state=IPS_OK, const char *msg = NULL); virtual void setConnected(bool status, IPState state=IPS_OK, const char *msg = NULL);
int SetTimer(int); /** \brief Set a timer to call the function TimerHit after ms milliseco
void RemoveTimer(int); nds
\param ms timer duration in milliseconds.
\return id of the timer to be used with RemoveTimer
*/
int SetTimer(int ms);
/** \brief Remove timer added with SetTimer
\param id ID of the timer as returned from SetTimer
*/
void RemoveTimer(int id);
/** \brief Callback function to be called once SetTimer duration elapse
s. */
virtual void TimerHit(); virtual void TimerHit();
protected: protected:
/** \brief define the driver's properties to the client. /** \brief define the driver's properties to the client.
\param dev name of the device \param dev name of the device
\note This function is called by the INDI framework, do not call it d irectly. \note This function is called by the INDI framework, do not call it d irectly.
*/ */
virtual void ISGetProperties (const char *dev); virtual void ISGetProperties (const char *dev);
skipping to change at line 117 skipping to change at line 158
\note This function is called by the INDI framework, do not call it d irectly. \note This function is called by the INDI framework, do not call it d irectly.
\returns True if any property was successfully processed, false other wise. \returns True if any property was successfully processed, false other wise.
*/ */
virtual bool ISNewText (const char *dev, const char *name, char *texts[ ], char *names[], int n) {return false;} virtual bool ISNewText (const char *dev, const char *name, char *texts[ ], char *names[], int n) {return false;}
// Configuration // Configuration
/** \brief Load the last saved configuration file /** \brief Load the last saved configuration file
\return True if successful, false otherwise. \return True if successful, false otherwise.
*/ */
bool loadConfig(); virtual bool loadConfig();
/** \brief Save the current properties in a configuration file /** \brief Save the current properties in a configuration file
\return True if successful, false otherwise. \return True if successful, false otherwise.
*/ */
bool saveConfig(); virtual bool saveConfig();
virtual bool saveConfigItems(FILE *fp);
/** \brief Load the default configuration file /** \brief Load the default configuration file
\return True if successful, false otherwise. \return True if successful, false otherwise.
*/ */
bool loadDefaultConfig(); virtual bool loadDefaultConfig();
// Simulatin & Debug // Simulatin & Debug
/** \brief Toggle driver debug status /** \brief Toggle driver debug status
A driver can be more verbose if Debug option is enabled by the client . A driver can be more verbose if Debug option is enabled by the client .
\param enable If true, the Debug option is set to ON. \param enable If true, the Debug option is set to ON.
*/ */
void setDebug(bool enable); void setDebug(bool enable);
 End of changes. 10 change blocks. 
10 lines changed or deleted 56 lines changed or added


 indiapi.h   indiapi.h 
skipping to change at line 48 skipping to change at line 48
INDI is intended for developers who seek a scalable API for device control and automation. Hardware drivers written under INDI can be used under any I NDI-compatible client. INDI serves as a backend only, you need frontend cli ents to control devices. Current clients include <a href="http://edu.kde.or g/kstars">KStars</a>, <a href="http://www.clearyskyinstitute.com/xephem">Xe phem</a>, <a href="http://pygtkindiclient.sourceforge.net/">DCD</a>, and <a href="http://www.stargazing.net/astropc">Cartes du Ciel</a>. INDI is intended for developers who seek a scalable API for device control and automation. Hardware drivers written under INDI can be used under any I NDI-compatible client. INDI serves as a backend only, you need frontend cli ents to control devices. Current clients include <a href="http://edu.kde.or g/kstars">KStars</a>, <a href="http://www.clearyskyinstitute.com/xephem">Xe phem</a>, <a href="http://pygtkindiclient.sourceforge.net/">DCD</a>, and <a href="http://www.stargazing.net/astropc">Cartes du Ciel</a>.
\section Development Developing under INDI \section Development Developing under INDI
<p>Please refere to the <a href="http://indi.sourceforge.net/index.php/Manu al">INDI Developers Manual</a> for a complete guide on INDI's driver develo pemnt framework.</p> <p>Please refere to the <a href="http://indi.sourceforge.net/index.php/Manu al">INDI Developers Manual</a> for a complete guide on INDI's driver develo pemnt framework.</p>
<p>The INDI Library API is divided into the following main sections:</p> <p>The INDI Library API is divided into the following main sections:</p>
<ul> <ul>
<li><a href="indidevapi_8h.html">INDI Device API</a></li> <li><a href="indidevapi_8h.html">INDI Device API</a></li>
<li><a href="classINDI_1_1BaseClient.html">INDI Client API</a></li>
<li><a href="namespaceINDI.html">INDI Base Drivers</a></li>
<li><a href="indicom_8h.html">INDI Common Routine Library</a></li> <li><a href="indicom_8h.html">INDI Common Routine Library</a></li>
<li><a href="lilxml_8h.html">INDI LilXML Library</a></li> <li><a href="lilxml_8h.html">INDI LilXML Library</a></li>
<li><a href="group__configFunctions.html">Configuration</a></li> <li><a href="group__configFunctions.html">Configuration</a></li>
<li><a href="classINDI_1_1BaseClient.html">Client API</a></li>
</ul> </ul>
\section Help \section Help
You can find information on INDI development in the <a href="http://indi.sf .net">INDI sourceforge</a> site. Furthermore, you can discuss INDI related issues on the <a href="http://sourceforge.net/mail/?group_id=90275">INDI de velopment mailing list</a>. You can find information on INDI development in the <a href="http://indi.sf .net">INDI sourceforge</a> site. Furthermore, you can discuss INDI related issues on the <a href="http://sourceforge.net/mail/?group_id=90275">INDI de velopment mailing list</a>.
\author Elwood Downey \author Elwood Downey
\author Jasem Mutlaq \author Jasem Mutlaq
*/ */
skipping to change at line 75 skipping to change at line 76
*/ */
/************************************************************************** ***** /************************************************************************** *****
* INDI wire protocol version implemented by this API. * INDI wire protocol version implemented by this API.
* N.B. this is indepedent of the API itself. * N.B. this is indepedent of the API itself.
*/ */
#define INDIV 1.7 #define INDIV 1.7
/* INDI Library version */ /* INDI Library version */
#define INDI_LIBV 0.8 #define INDI_LIBV 0.9
/************************************************************************** ***** /************************************************************************** *****
* Manifest constants * Manifest constants
*/ */
/** \typedef ISState /** \typedef ISState
\brief Switch state. \brief Switch state.
*/ */
typedef enum typedef enum
{ {
 End of changes. 3 change blocks. 
2 lines changed or deleted 3 lines changed or added


 indibase.h   indibase.h 
#ifndef INDIBASE_H #ifndef INDIBASE_H
#define INDIBASE_H #define INDIBASE_H
#include "indiapi.h" #include "indiapi.h"
#include "indidevapi.h" #include "indidevapi.h"
#define MAXRBUF 2048 #define MAXRBUF 2048
/** /**
* \namespace INDI * \namespace INDI
\brief Namespace to encapsulate INDI client, device, and mediator classe \brief Namespace to encapsulate INDI client, drivers, and mediator class
s es.
Developers can subclass the base devices class to implement device speci
fic functionality. This ensures interoperability and consistency among devi
ces within the same family
and reduces code overhead.
<ul> <ul>
<li>BaseClient: Base class for INDI clients. By subclassing BaseClient, client can easily connect to INDI server <li>BaseClient: Base class for INDI clients. By subclassing BaseClient, client can easily connect to INDI server
and handle device communication, command, and notifcation.</li> and handle device communication, command, and notifcation.</li>
<li>BaseMediator: Abstract class to provide interface for event notifica tions in INDI::BaseClient.</li> <li>BaseMediator: Abstract class to provide interface for event notifica tions in INDI::BaseClient.</li>
<li>BaseDriver: Base class for all INDI virtual driver as handled and st ored in INDI::BaseClient.</li> <li>BaseDriver: Base class for all INDI virtual driver as handled and st ored in INDI::BaseClient.</li>
<li>DefaultDriver: INDI::BaseDriver with extended functionality such as debug, simulation, and configuration support. <li>DefaultDriver: INDI::BaseDriver with extended functionality such as debug, simulation, and configuration support.
It is \e only used by drivers directly, it cannot be used by clients .</li> It is \e only used by drivers directly, it cannot be used by clients .</li>
<li>FilterInterface: Basic interface for filter wheels functions.</li>
<li>GuiderInterface: Basic interface for guider (ST4) port functions.</l
i>
<li>CCD: Base class for CCD drivers. Provides basic support for single c
hip CCD and CCDs with a guide head as well.</li>
<li>Telescope: Base class for telescope drivers.</li>
<li>FilterWheel: Base class for Filter Wheels. It implements the FilterI
nterface.</li>
<li>Focuser: Base class for focusers.</li>
<li>USBDevice: Base class for USB devices for direct read/write/control
over USB.</li>
</ul> </ul>
*/ */
namespace INDI namespace INDI
{ {
class BaseMediator; class BaseMediator;
class BaseClient; class BaseClient;
class BaseDriver; class BaseDriver;
class DefaultDriver; class DefaultDriver;
class FilterInterface;
class GuiderInterface;
class CCD; class CCD;
class Telescope; class Telescope;
class FilterWheel; class FilterWheel;
class Focuser; class Focuser;
class USBDevice; class USBDevice;
} }
/** /**
* \class INDI::BaseMediator * \class INDI::BaseMediator
\brief Meditates event notification as generated by driver and passed to clients. \brief Meditates event notification as generated by driver and passed to clients.
 End of changes. 3 change blocks. 
2 lines changed or deleted 19 lines changed or added


 indiccd.h   indiccd.h 
/************************************************************************** ***** /************************************************************************** *****
Copyright(c) 2010 Gerry Rozema. All rights reserved. Copyright(c) 2010, 2011 Gerry Rozema, Jasem Mutlaq. All rights reserved.
This program is free software; you can redistribute it and/or modify it This library is free software; you can redistribute it and/or
under the terms of the GNU General Public License as published by the Fre modify it under the terms of the GNU Library General Public
e License version 2 as published by the Free Software Foundation.
Software Foundation; either version 2 of the License, or (at your option)
any later version. This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
This program is distributed in the hope that it will be useful, but WITHO MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
UT Library General Public License for more details.
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for You should have received a copy of the GNU Library General Public License
more details. along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
You should have received a copy of the GNU General Public License along w Boston, MA 02110-1301, USA.
ith
this program; if not, write to the Free Software Foundation, Inc., 59
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
The full GNU General Public License is included in this distribution in t
he
file called LICENSE.
*************************************************************************** ****/ *************************************************************************** ****/
#ifndef INDI_CCD_H #ifndef INDI_CCD_H
#define INDI_CCD_H #define INDI_CCD_H
#include <fitsio.h>
#include "defaultdriver.h" #include "defaultdriver.h"
#include "indiguiderinterface.h"
#define FRAME_TYPE_LIGHT 0 extern const char *IMAGE_SETTINGS_TAB;
#define FRAME_TYPE_BIAS 1 extern const char *IMAGE_INFO_TAB;
#define FRAME_TYPE_DARK 2 extern const char *GUIDE_HEAD_TAB;
#define FRAME_TYPE_FLAT 3 extern const char *GUIDE_CONTROL_TAB;
class INDI::CCD : public INDI::DefaultDriver class CCDChip
{ {
protected:
char *RawFrame; public:
int RawFrameSize; CCDChip();
~CCDChip();
typedef enum { LIGHT_FRAME=0, BIAS_FRAME, DARK_FRAME, FLAT_FRAME } CCD_
FRAME;
int getXRes() { return XRes; }
int getYRes() { return YRes; }
int getSubX() { return SubX; }
int getSubY() { return SubY; }
int getSubW() { return SubW; }
int getSubH() { return SubH; }
int getBinX() { return BinX; }
int getBinY() { return BinY; }
int getPixelSizeX() { return PixelSizex; }
int getPixelSizeY() { return PixelSizey; }
int getBPP() { return BPP; }
int getFrameBufferSize() { return RawFrameSize; }
double getExposure() { return ImageExposureN[0].value; }
char *getFrameBuffer() { return RawFrame; }
bool isCompressed() { return SendCompressed; }
bool isInterlaced() { return Interlaced; }
CCD_FRAME getFrameType() { return FrameType; }
void setResolutoin(int x, int y);
void setFrame(int subx, int suby, int subw, int subh);
void setBin(int hor, int ver);
void setPixelSize(int x, int y);
void setCompressed (bool cmp);
void setInterlaced(bool intr);
void setFrameBufferSize(int nbuf);
void setBPP(int bpp);
int setFrameType(CCD_FRAME);
void setExposure(double duration);
void setExposureFailed();
private:
int XRes; // native resolution of the ccd
int YRes; // ditto
int SubX; // left side of the subframe we are requesting
int SubY; // top of the subframe requested
int SubW; // width of the subframe
int SubH; // height of the subframe
int BinX; // Binning requested in the x direction
int BinY; // Binning requested in the Y direction
float PixelSizex; // pixel size in microns, x direction
float PixelSizey; // pixel size in microns, y direction
int BPP; // Bytes per Pixel
bool Interlaced;
char *RawFrame;
int RawFrameSize;
bool SendCompressed;
CCD_FRAME FrameType;
INumberVectorProperty *ImageExposureNP;
INumber ImageExposureN[1];
INumberVectorProperty *ImageFrameNP;
INumber ImageFrameN[4];
INumberVectorProperty *ImageBinNP;
INumber ImageBinN[2];
INumberVectorProperty *ImagePixelSizeNP;
INumber ImagePixelSizeN[6];
ISwitch FrameTypeS[4];
ISwitchVectorProperty *FrameTypeSP;
// Altho these numbers are indeed stored in the indi properties ISwitch CompressS[2];
// It makes for much cleaner code if we have 'plain old number' co ISwitchVectorProperty *CompressSP;
pies
// So, when we process messages, just update both
int XRes; // native resolution of the ccd
int YRes; // ditto
int SubX; // left side of the subframe we are requesting
int SubY; // top of the subframe requested
int SubW; // width of the subframe
int SubH; // height of the subframe
int BinX; // Binning requested in the x direction
int BinY; // Binning requested in the Y direction
float PixelSizex; // pixel size in microns, x direction
float PixelSizey; // pixel size in microns, y direction
bool SendCompressed;
bool HasSt4Port; IBLOB FitsB;
IBLOBVectorProperty *FitsBP;
// If the camera has a second ccd, or integrated guide head
// we need information on that one too
bool HasGuideHead;
char *RawGuiderFrame;
int RawGuideSize;
int GXRes; // native resolution of the guide head
int GYRes; // native resolution
int GSubX; // left side of the guide image subframe
int GSubY; // top of the guide image subframe
int GSubW; // Width of the guide image
int GSubH; // Height of the guide image
float GPixelSizex; // phyiscal size of the guider pixels
float GPixelSizey;
bool GuiderCompressed;
int FrameType; friend class INDI::CCD;
};
private: /**
public: * \class INDI::CCD
\brief Class to provide general functionality of CCD cameras with a sing
le CCD sensor, or a primary CCD sensor in addition to a secondary CCD guide
head.
It also implements the interface to perform guiding. The class enable th
e ability to \e snoop on telescope equatorial coordinates and record them i
n the
FITS file before upload. Developers need to subclass INDI::CCD to implem
ent any driver for CCD cameras within INDI.
\author Gerry Rozema, Jasem Mutlaq
*/
class INDI::CCD : public INDI::DefaultDriver, INDI::GuiderInterface
{
public:
CCD(); CCD();
virtual ~CCD(); virtual ~CCD();
// A ccd needs to desribe the frame virtual bool initProperties();
//INumberVectorProperty CcdFrameNV;
//INumberVectorProperty CcdExposureNV;
//INumberVectorProperty CcdBinNV;
//INumberVectorProperty CcdPixelSizeNV;
INumberVectorProperty ImageFrameNV;
INumber ImageFrameN[4];
INumberVectorProperty ImageBinNV;
INumber ImageBinN[2];
INumberVectorProperty ImagePixelSizeNV;
INumber ImagePixelSizeN[6];
INumberVectorProperty ImageExposureNV;
INumber ImageExposureN[1];
//INumberVectorProperty ImageExposureReqNV;
//INumber ImageExposureReqN[1];
INumberVectorProperty GuiderFrameNV;
INumber GuiderFrameN[4];
INumberVectorProperty GuiderPixelSizeNV;
INumber GuiderPixelSizeN[6];
INumberVectorProperty GuiderExposureNV;
INumber GuiderExposureN[1];
ISwitch FrameTypeS[4];
ISwitchVectorProperty FrameTypeSV;
ISwitch CompressS[2];
ISwitchVectorProperty CompressSV;
ISwitch GuiderCompressS[2];
ISwitchVectorProperty GuiderCompressSV;
ISwitch GuiderVideoS[2];
ISwitchVectorProperty GuiderVideoSV;
INumber GuideNS[2];
INumberVectorProperty GuideNSV;
INumber GuideEW[2];
INumberVectorProperty GuideEWV;
IBLOB FitsB;
IBLOBVectorProperty FitsBV;
IBLOB GuiderB;
IBLOBVectorProperty GuiderBV;
virtual bool initProperties();
virtual bool updateProperties(); virtual bool updateProperties();
virtual void ISGetProperties (const char *dev); virtual void ISGetProperties (const char *dev);
virtual bool ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n); virtual bool ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n);
virtual bool ISNewSwitch (const char *dev, const char *name, ISStat e *states, char *names[], int n); virtual bool ISNewSwitch (const char *dev, const char *name, ISStat e *states, char *names[], int n);
virtual bool ISNewText (const char *dev, const char *name, char *te
xts[], char *names[], int n);
virtual void ISSnoopDevice (XMLEle *root);
virtual bool ISNewText (const char *dev, const char *name, char *te protected:
xts[], char *names[], int n) {return false;} /** \brief Start exposing primary CCD chip
\param duration Duration in seconds
\return 0 if OK and exposure will take some time to complete, 1
if exposure is short and complete already (e.g. bias), -1 on error.
\note This function is not implemented in INDI::CCD, it must be
implemented in the child class
*/
virtual int StartExposure(float duration); virtual int StartExposure(float duration);
/** \brief Uploads primary CCD exposed buffer as FITS to the client
. Dervied classes should class this function when an exposure is complete.
\note This function is not implemented in INDI::CCD, it must b
e implemented in the child class
*/
virtual bool ExposureComplete(); virtual bool ExposureComplete();
/** \brief Abort ongoing exposure
\return true is abort is successful, false otherwise.
\note This function is not implemented in INDI::CCD, it must be
implemented in the child class
*/
virtual bool AbortExposure();
/** \brief Start exposing guide CCD chip
\param duration Duration in seconds
\return 0 if OK and exposure will take some time to complete, 1
if exposure is short and complete already (e.g. bias), -1 on error.
\note This function is not implemented in INDI::CCD, it must be
implemented in the child class
*/
virtual int StartGuideExposure(float duration); virtual int StartGuideExposure(float duration);
/** \brief Abort ongoing exposure
\return true is abort is successful, false otherwise.
\note This function is not implemented in INDI::CCD, it must be
implemented in the child class
*/
virtual bool AbortGuideExposure(); virtual bool AbortGuideExposure();
/** \brief Uploads Guide head CCD exposed buffer as FITS to the cli
ent. Dervied classes should class this function when an exposure is complet
e.
\note This function is not implemented in INDI::CCD, it must be
implemented in the child class
*/
virtual bool GuideExposureComplete(); virtual bool GuideExposureComplete();
virtual int uploadfile(void *fitsdata,int total);
virtual int sendPreview();
// Handy functions for child classes /** \brief INDI::CCD calls this function when CCD Frame dimension n
virtual int SetCCDParams(int x,int y,int bpp,float xf,float yf); eeds to be updated in the hardware. Derived classes should implement this f
virtual int SetGuidHeadParams(int x,int y,int bpp,float xf,float yf unction
); \param x Subframe X coordinate in pixels.
\param y Subframe Y coordinate in pixels.
virtual int GuideNorth(float); \param w Subframe width in pixels.
virtual int GuideSouth(float); \param h Subframe height in pixels.
virtual int GuideEast(float); \note (0,0) is defined as most left, top pixel in the subframe.
virtual int GuideWest(float); \return true is CCD chip update is successful, false otherwise.
\note This function is not implemented in INDI::CCD, it must be
implemented in the child class
*/
virtual bool updateCCDFrame(int x, int y, int w, int h);
/** \brief INDI::CCD calls this function when CCD Binning needs to
be updated in the hardware. Derived classes should implement this function
\param hor Horizontal binning.
\param ver Vertical binning.
\return true is CCD chip update is successful, false otherwise.
\note This function is not implemented in INDI::CCD, it must be
implemented in the child class
*/
virtual bool updateCCDBin(int hor, int ver);
/** \brief Setup CCD paramters for primary CCD. Child classes call
this function to update CCD paramaters
\param x Frame X coordinates in pixels.
\param y Frame Y coordinates in pixels.
\param bpp Bits Per Pixels.
\param xf X pixel size in microns.
\param yf Y pixel size in microns.
*/
virtual void SetCCDParams(int x,int y,int bpp,float xf,float yf);
/** \brief Setup CCD paramters for guide head CCD. Child classes ca
ll this function to update CCD paramaters
\param x Frame X coordinates in pixels.
\param y Frame Y coordinates in pixels.
\param bpp Bits Per Pixels.
\param xf X pixel size in microns.
\param yf Y pixel size in microns.
*/
virtual void SetGuidHeadParams(int x,int y,int bpp,float xf,float y
f);
/** \brief Guide northward for ms milliseconds
\param ms Duration in milliseconds.
\note This function is not implemented in INDI::CCD, it must be
implemented in the child class
\return True if successful, false otherwise.
*/
virtual bool GuideNorth(float ms);
/** \brief Guide southward for ms milliseconds
\param ms Duration in milliseconds.
\note This function is not implemented in INDI::CCD, it must be
implemented in the child class
\return 0 if successful, -1 otherwise.
*/
virtual bool GuideSouth(float ms);
/** \brief Guide easward for ms milliseconds
\param ms Duration in milliseconds.
\note This function is not implemented in INDI::CCD, it must be
implemented in the child class
\return 0 if successful, -1 otherwise.
*/
virtual bool GuideEast(float ms);
/** \brief Guide westward for ms milliseconds
\param ms Duration in milliseconds.
\note This function is not implemented in INDI::CCD, it must be
implemented in the child class
\return 0 if successful, -1 otherwise.
*/
virtual bool GuideWest(float ms);
/** \brief Add FITS keywords to a fits file
\param fptr pointer to a valid FITS file.
\note This function is not implemented in INDI::CCD, it must be
implemented in the child class
*/
virtual void addFITSKeywords(fitsfile *fptr);
float RA;
float Dec;
bool HasGuideHead;
bool HasSt4Port;
bool InExposure;
CCDChip PrimaryCCD;
CCDChip GuideCCD;
private:
// We are going to snoop these from a telescope
INumberVectorProperty EqNP;
INumber EqN[2];
ITextVectorProperty *TelescopeTP;
IText TelescopeT[1];
virtual int SetFrameType(int); int uploadfile(void *fitsdata,int total);
}; };
#endif // INDI:CCD_H #endif // INDI:CCD_H
 End of changes. 23 change blocks. 
132 lines changed or deleted 262 lines changed or added


 indifilterwheel.h   indifilterwheel.h 
/************************************************************************** ***** /************************************************************************** *****
Copyright(c) 2010 Gerry Rozema. All rights reserved. Copyright(c) 2010, 2011 Gerry Rozema. All rights reserved.
This program is free software; you can redistribute it and/or modify it This library is free software; you can redistribute it and/or
under the terms of the GNU General Public License as published by the Fre modify it under the terms of the GNU Library General Public
e License version 2 as published by the Free Software Foundation.
Software Foundation; either version 2 of the License, or (at your option)
any later version. This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
This program is distributed in the hope that it will be useful, but WITHO MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
UT Library General Public License for more details.
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for You should have received a copy of the GNU Library General Public License
more details. along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
You should have received a copy of the GNU General Public License along w Boston, MA 02110-1301, USA.
ith
this program; if not, write to the Free Software Foundation, Inc., 59
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
The full GNU General Public License is included in this distribution in t
he
file called LICENSE.
*************************************************************************** ****/ *************************************************************************** ****/
#ifndef INDI_FILTERWHEEL_H #ifndef INDI_FILTERWHEEL_H
#define INDI_FILTERWHEEL_H #define INDI_FILTERWHEEL_H
#include "defaultdriver.h" #include "defaultdriver.h"
#include "indifilterinterface.h"
class INDI::FilterWheel: public INDI::DefaultDriver /**
* \class INDI::FilterWheel
\brief Class to provide general functionality of a filter wheel device.
Developers need to subclass INDI::FilterWheel to implement any driver fo
r filter wheels within INDI.
\author Gerry Rozema, Jasem Mutlaq
\see INDI::FilterInterface
*/
class INDI::FilterWheel: public INDI::DefaultDriver, public INDI::FilterInt
erface
{ {
protected: protected:
private:
FilterWheel();
virtual ~FilterWheel();
public: public:
FilterWheel();
virtual ~FilterWheel();
INumberVectorProperty FilterSlotNV; // A number vector for filte
r slot
INumber FilterSlotN[1];
ITextVectorProperty FilterNameTV; // A text vector that stores out
physical port name
IText FilterNameT[12];
int MinFilter;
int MaxFilter;
int CurrentFilter;
int TargetFilter;
virtual bool initProperties(); virtual bool initProperties();
virtual bool updateProperties(); virtual bool updateProperties();
virtual void ISGetProperties (const char *dev); virtual void ISGetProperties (const char *dev);
virtual bool ISNewSwitch (const char *dev, const char *name, ISStat
// Ok, we do need our virtual functions from the base class for pr e *states, char *names[], int n);
ocessing
// client requests
// We process Numbers and text in a filter wheel
virtual bool ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n); virtual bool ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n);
virtual bool ISNewText (const char *dev, const char *name, char *te xts[], char *names[], int n); virtual bool ISNewText (const char *dev, const char *name, char *te xts[], char *names[], int n);
virtual bool ISNewSwitch (const char *dev, const char *name, ISStat virtual void ISSnoopDevice (XMLEle *root);
e *states, char *names[], int n) { return false; }
protected:
virtual int SelectFilter(int); virtual int QueryFilter();
virtual int SelectFilterDone(int); virtual bool SelectFilter(int);
virtual int QueryFilter(); virtual bool SetFilterNames();
//int SaveFilterNames(); virtual bool GetFilterNames(const char *deviceName, const char* groupNa
//int LoadFilterNames(); me);
}; };
#endif // INDI::FilterWheel_H #endif // INDI::FilterWheel_H
 End of changes. 10 change blocks. 
52 lines changed or deleted 43 lines changed or added


 indifocuser.h   indifocuser.h 
/************************************************************************** ***** /************************************************************************** *****
Copyright(c) 2010 Gerry Rozema. All rights reserved. Copyright(c) 2011 Gerry Rozema. All rights reserved.
This program is free software; you can redistribute it and/or modify it This library is free software; you can redistribute it and/or
under the terms of the GNU General Public License as published by the Fre modify it under the terms of the GNU Library General Public
e License version 2 as published by the Free Software Foundation.
Software Foundation; either version 2 of the License, or (at your option)
any later version. This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
This program is distributed in the hope that it will be useful, but WITHO MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
UT Library General Public License for more details.
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for You should have received a copy of the GNU Library General Public License
more details. along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
You should have received a copy of the GNU General Public License along w Boston, MA 02110-1301, USA.
ith
this program; if not, write to the Free Software Foundation, Inc., 59
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
The full GNU General Public License is included in this distribution in t
he
file called LICENSE.
*************************************************************************** ****/ *************************************************************************** ****/
#ifndef INDIFOCUSSER_H #ifndef INDIFOCUSSER_H
#define INDIFOCUSSER_H #define INDIFOCUSSER_H
#include "defaultdriver.h" #include "defaultdriver.h"
class INDI::Focuser : public INDI::DefaultDriver /**
{ * \class INDI::Focuser
\brief Class to provide general functionality of a focuser device.
protected: Developers need to subclass INDI::Focuser to implement any driver for fo
private: cusers within INDI.
\author Gerry Rozema
*/
class INDI::Focuser : public INDI::DefaultDriver
{
public: public:
Focuser(); Focuser();
virtual ~Focuser(); virtual ~Focuser();
INumberVectorProperty FocusspeedNV; enum FocusDirection { FOCUS_INWARD, FOCUS_OUTWARD };
INumber FocusspeedN[1];
ISwitchVectorProperty FocusmotionSV; // A Switch in the client int
erface to park the scope
ISwitch FocusmotionS[2];
INumberVectorProperty FocustimerNV;
INumber FocustimerN[1];
virtual bool initProperties(); virtual bool initProperties();
virtual void ISGetProperties (const char *dev); virtual void ISGetProperties (const char *dev);
bool updateProperties(); virtual bool updateProperties();
// Ok, we do need our virtual functions from the base class for pr
ocessing
// client requests
// We process Numbers in a focusser
virtual bool ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n); virtual bool ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n);
virtual bool ISNewSwitch (const char *dev, const char *name, ISStat e *states, char *names[], int n); virtual bool ISNewSwitch (const char *dev, const char *name, ISStat e *states, char *names[], int n);
virtual bool ISNewText (const char *dev, const char *name, char *te
xts[], char *names[], int n);
virtual void ISSnoopDevice (XMLEle *root);
protected:
// And here are the virtual functions we will have for easy overri /** \brief Move the focuser in a particular direction with a specif
des ic speed for a finite duration.
virtual int Move(int, int, int); \param dir Direction of focuser, either FOCUS_INWARD or FOCUS_O
UTWARD.
\param speed Speed of focuser if supported by the focuser.
\param duration The timeout in milliseconds before the focus mo
tion halts.
\return True if succssfull, false otherwise.
*/
virtual bool Move(FocusDirection dir, int speed, int duration);
INumberVectorProperty *FocusSpeedNP;
INumber FocusSpeedN[1];
ISwitchVectorProperty *FocusMotionSP; // A Switch in the client in
terface to park the scope
ISwitch FocusMotionS[2];
INumberVectorProperty *FocusTimerNP;
INumber FocusTimerN[1];
}; };
#endif // INDIFOCUSSER_H #endif // INDIFOCUSSER_H
 End of changes. 9 change blocks. 
41 lines changed or deleted 48 lines changed or added


 inditelescope.h   inditelescope.h 
/************************************************************************** ***** /************************************************************************** *****
Copyright(c) 2010 Gerry Rozema. All rights reserved. Copyright(c) 2011 Gerry Rozema, Jasem Mutlaq. All rights reserved.
This program is free software; you can redistribute it and/or modify it This library is free software; you can redistribute it and/or
under the terms of the GNU General Public License as published by the Fre modify it under the terms of the GNU Library General Public
e License version 2 as published by the Free Software Foundation.
Software Foundation; either version 2 of the License, or (at your option)
any later version. This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
This program is distributed in the hope that it will be useful, but WITHO MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
UT Library General Public License for more details.
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for You should have received a copy of the GNU Library General Public License
more details. along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
You should have received a copy of the GNU General Public License along w Boston, MA 02110-1301, USA.
ith
this program; if not, write to the Free Software Foundation, Inc., 59
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
The full GNU General Public License is included in this distribution in t
he
file called LICENSE.
*************************************************************************** ****/ *************************************************************************** ****/
#ifndef INDI_TELESCOPE_H #ifndef INDI_TELESCOPE_H
#define INDI_TELESCOPE_H #define INDI_TELESCOPE_H
#include "defaultdriver.h" #include "defaultdriver.h"
/**
* \class INDI::Telescope
\brief 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 performin
g the following steps:
<ul>
<li>If the telescope has additional properties, the child class should o
verride initProperties and initilize the respective additional properties.<
/li>
<li>Once the parent class calls Connect(), the child class attempts to c
onnect to the telescope and return either success of failure</li>
<li>INDI::Telescope calls updateProperties() to enable the child class t
o define which properties to send to the client upon connection</li>
<li>INDI::Telescope calls ReadScopeStatus() to check the link to the tel
escope and update its state and position. The child class should call newRa
Dec() whenever
a new value is read from the telescope.</li>
<li>The child class should implmenet Goto() and Sync(), and Park() if ap
plicable.</li>
<li>INDI::Telescope calls disconnect() when the client request a disconn
ection. The child class should remove any additional properties it defined
in updateProperties() if applicable</li>
</ul>
\author Gerry Rozema, Jasem Mutlaq
\see TelescopeSimulator and SynScan drivers for examples of implementations
of INDI::Telescope.
*/
class INDI::Telescope : public INDI::DefaultDriver class INDI::Telescope : public INDI::DefaultDriver
{ {
protected:
//bool Connected;
private: private:
public: public:
Telescope(); Telescope();
virtual ~Telescope(); virtual ~Telescope();
enum TelescopeStatus { SCOPE_IDLE, SCOPE_SLEWING, SCOPE_TRACKING, S COPE_PARKING, SCOPE_PARKED }; enum TelescopeStatus { SCOPE_IDLE, SCOPE_SLEWING, SCOPE_TRACKING, S COPE_PARKING, SCOPE_PARKED };
enum TelescopeMotionNS { MOTION_NORTH, MOTION_SOUTH };
enum TelescopeMotionWE { MOTION_WEST, MOTION_EAST };
// All telescopes should produce equatorial co-ordinates
INumberVectorProperty *EqNV;
INumber EqN[2];
// And we need a vector to store requests, ie, where are we asked
to go
INumberVectorProperty *EqReqNV;
INumber EqReqN[2];
ISwitchVectorProperty *CoordSV; // A switch vector that stores how
we should readct
ISwitch CoordS[3]; // On a coord_set message, sync, o
r slew
INumberVectorProperty *LocationNV; // A number vector that store
s lattitude and longitude
INumber LocationN[2];
ISwitchVectorProperty *ParkSV; // A Switch in the client interface
to park the scope
ISwitch ParkS[1];
// I dont know of any telescopes that dont
// need a port for connection
// So lets put all the port connect framework
// into our generic telescope super class
ITextVectorProperty *PortTV; // A text vector that stores out phys
ical port name
IText PortT[1];
// Ok, we do need our virtual functions from the base class for pr
ocessing
// client requests
// We process numbers,switches and text in the telescope
// These are the base IndiDevice overrides we process
virtual bool ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n); virtual bool ISNewNumber (const char *dev, const char *name, double values[], char *names[], int n);
virtual bool ISNewText (const char *dev, const char *name, char *te xts[], char *names[], int n); virtual bool ISNewText (const char *dev, const char *name, char *te xts[], char *names[], int n);
virtual bool ISNewSwitch (const char *dev, const char *name, ISStat e *states, char *names[], int n); virtual bool ISNewSwitch (const char *dev, const char *name, ISStat e *states, char *names[], int n);
virtual void ISGetProperties (const char *dev); virtual void ISGetProperties (const char *dev);
// overrides of base class virtual functions /** \brief Called to initialize basic properties required all the t
// that are specific to our way of implementing Indi ime */
virtual bool initProperties(); // Called to initialize basic virtual bool initProperties();
properties required all the time /** \brief Called when connected state changes, to add/remove prope
virtual bool updateProperties(); // Called when connected state rties */
changes, to add/remove properties virtual bool updateProperties();
/** \brief Called when setTimer() time is up */
virtual void TimerHit(); virtual void TimerHit();
/** \brief Connect to the telescope.
\return True if connection is successful, false otherwise
*/
virtual bool Connect(); virtual bool Connect();
/** \brief Disconnect from telescope
\return True if successful, false otherwise */
virtual bool Disconnect(); virtual bool Disconnect();
virtual bool Connect(const char *); /** \brief INDI::Telescope implementation of Connect() assumes 9600
baud, 8 bit word, even parity, and no stop bit. Override function if commu
nication paramaters
are different
\param port Port to connect to
\return True if connection is successful, false otherwise
\warning Do not call this function directly, it is called by INDI
::Telescope Connect() function.
*/
virtual bool Connect(const char *port);
// Since every mount I know of actually uses a serial port for con protected:
trol
// We put the serial helper into the base telescope class
// One less piece to worry about in the hardware specific
// low level stuff
int PortFD;
// This is a variable filled in by the ReadStatus telescope virtual bool saveConfigItems(FILE *fp);
// low level code, used to report current state
// are we slewing, tracking, or parked.
int TrackState;
// These functions are telescope specific /** \brief The child class calls this function when it has updates
// and meant to make life really easy for deriving */
// hardware specific telescope classes void NewRaDec(double ra,double dec);
int NewRaDec(double,double); // The child class will call this
when it has updates
// And these are the hardware specific functions our children need
to override
// They are not pure virtual, because, not all functions are relav
ent for all types
// of mount, ie, a Goto is not relavent for a Push-to mount
/** \brief Read telescope status. /** \brief Read telescope status.
This function checks the following: This function checks the following:
<ol> <ol>
<li>Check if the link to the telescope is alive.</li> <li>Check if the link to the telescope is alive.</li>
<li>Update telescope status: Idle, Slewing, Parking..etc.</li> <li>Update telescope status: Idle, Slewing, Parking..etc.</li>
<li>Read coordinates</li> <li>Read coordinates</li>
</ol> </ol>
\return True if reading scope status is OK, false if an error is \return True if reading scope status is OK, false if an error is
encounterd. */ encounterd.
\note This function is not implemented in INDI::Telescope, it mus
t be implemented in the child class */
virtual bool ReadScopeStatus(); virtual bool ReadScopeStatus();
/** \brief Move the scope to the supplied RA and DEC coordinates
\return True if successful, false otherewise
\note This function is not implemented in INDI::Telescope, it m
ust be implemented in the child class
*/
virtual bool Goto(double ra,double dec); virtual bool Goto(double ra,double dec);
/** \brief Set the telescope current RA and DEC coordinates to the
supplied RA and DEC coordinates
\return True if successful, false otherewise
\note This function is not implemented in INDI::Telescope, it m
ust be implemented in the child class
*/
virtual bool Sync(double ra,double dec); virtual bool Sync(double ra,double dec);
/** \brief Move the telescope in the direction dir.
\return True if successful, false otherewise
\note This function is not implemented in INDI::Telescope, it m
ust be implemented in the child class
*/
virtual bool MoveNS(TelescopeMotionNS dir);
/** \brief Move the telescope in the direction dir.
\return True if successful, false otherewise
\note This function is not implemented in INDI::Telescope, it m
ust be implemented in the child class
*/
virtual bool MoveWE(TelescopeMotionWE dir);
/** \brief Part the telescope to its home position.
\return True if successful, false otherewise
\note This function is not implemented in INDI::Telescope, it m
ust be implemented in the child class
*/
virtual bool Park(); virtual bool Park();
// Since every mount I know of actually uses a serial port for con
trol
// We put the serial helper into the base telescope class
// One less piece to worry about in the hardware specific
// low level stuff
int PortFD;
// This is a variable filled in by the ReadStatus telescope
// low level code, used to report current state
// are we slewing, tracking, or parked.
TelescopeStatus TrackState;
// All telescopes should produce equatorial co-ordinates
INumberVectorProperty *EqNV;
INumber EqN[2];
// And we need a vector to store requests, ie, where are we asked
to go
INumberVectorProperty *EqReqNV;
INumber EqReqN[2];
ISwitchVectorProperty *CoordSV; // A switch vector that stores how
we should readct
ISwitch CoordS[3]; // On a coord_set message, sync, o
r slew
ISwitchVectorProperty *ConfigSV; // A switch vector that stores ho
w we should readct
ISwitch ConfigS[3]; // On a coord_set message, sync,
or slew
INumberVectorProperty *LocationNV; // A number vector that store
s lattitude and longitude
INumber LocationN[2];
ISwitchVectorProperty *ParkSV; // A Switch in the client interface
to park the scope
ISwitch ParkS[1];
ITextVectorProperty *PortTV; // A text vector that stores out phys
ical port name
IText PortT[1];
ISwitch MovementNSS[2]; // A switch for North/South motion
ISwitchVectorProperty *MovementNSSP;
ISwitch MovementWES[2]; // A switch for West/East motion
ISwitchVectorProperty *MovementWESP;
}; };
#endif // INDI::Telescope_H #endif // INDI::Telescope_H
 End of changes. 19 change blocks. 
89 lines changed or deleted 162 lines changed or added


 indiusbdevice.h   indiusbdevice.h 
/************************************************************************** ***** /************************************************************************** *****
Copyright(c) 2010 Gerry Rozema. All rights reserved. Copyright(c) 2011 Gerry Rozema. All rights reserved.
This program is free software; you can redistribute it and/or modify it This library is free software; you can redistribute it and/or
under the terms of the GNU General Public License as published by the Fre modify it under the terms of the GNU Library General Public
e License version 2 as published by the Free Software Foundation.
Software Foundation; either version 2 of the License, or (at your option)
any later version. This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
This program is distributed in the hope that it will be useful, but WITHO MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
UT Library General Public License for more details.
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for You should have received a copy of the GNU Library General Public License
more details. along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
You should have received a copy of the GNU General Public License along w Boston, MA 02110-1301, USA.
ith
this program; if not, write to the Free Software Foundation, Inc., 59
Temple Place - Suite 330, Boston, MA 02111-1307, USA.
The full GNU General Public License is included in this distribution in t
he
file called LICENSE.
*************************************************************************** ****/ *************************************************************************** ****/
#ifndef USBDEVICE_H #ifndef USBDEVICE_H
#define USBDEVICE_H #define USBDEVICE_H
#pragma once #pragma once
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include <usb.h> #include <usb.h>
#include "indibase.h" #include "indibase.h"
/**
* \class INDI::USBDevice
\brief Class to provide general functionality of a generic USB device.
Developers need to subclass INDI::USBDevice to implement any driver with
in INDI that requires direct read/write/control over USB.
\author Gerry Rozema
\see Starlight Xpress INDI CCD driver for an example implementation of INDI
::USBDevice
*/
class INDI::USBDevice class INDI::USBDevice
{ {
protected: protected:
struct usb_device *dev; struct usb_device *dev;
struct usb_dev_handle *usb_handle; struct usb_dev_handle *usb_handle;
int ProductId; int ProductId;
int VendorId; int VendorId;
int OutputType; int OutputType;
skipping to change at line 58 skipping to change at line 64
int InputEndpoint; int InputEndpoint;
struct usb_device * FindDevice(int,int,int); struct usb_device * FindDevice(int,int,int);
public: public:
int WriteInterrupt(char *,int,int); int WriteInterrupt(char *,int,int);
int ReadInterrupt(char *,int,int); int ReadInterrupt(char *,int,int);
int ControlMessage(); int ControlMessage();
int WriteBulk(char *,int,int); int WriteBulk(char *buf,int nbytes,int timeout);
int ReadBulk(char *,int,int); int ReadBulk(char *buf,int nbytes,int timeout);
int FindEndpoints(); int FindEndpoints();
int Open(); int Open();
USBDevice(void); USBDevice(void);
USBDevice(struct usb_device *); USBDevice(struct usb_device *);
virtual ~USBDevice(void); virtual ~USBDevice(void);
}; };
#endif // USBDEVICE_H #endif // USBDEVICE_H
 End of changes. 4 change blocks. 
23 lines changed or deleted 27 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/