| baseclient.h | | baseclient.h | |
| #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 34 | | skipping to change at line 35 | |
| | | | |
| \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. | |
| \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; | |
| | | | |
| BaseClient(); | | BaseClient(); | |
|
| virtual ~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); | |
| | | | |
| /** \brief Add a device to the watch list. | | /** \brief Add a device to the watch list. | |
| | | | |
| A client may select to receive notifications of only a specific dev
ice or a set of devices. | | A client may select to receive notifications of only a specific dev
ice or a set of devices. | |
| | | | |
| skipping to change at line 63 | | skipping to change at line 65 | |
| /** \brief Connect to INDI server. | | /** \brief Connect to INDI server. | |
| | | | |
| \returns True if the connection is successful, false otherwise. | | \returns True if the connection is successful, false otherwise. | |
| \note This function blocks until connection is either successull or
unsuccessful. | | \note This function blocks until connection is either successull or
unsuccessful. | |
| */ | | */ | |
| bool connectServer(); | | bool connectServer(); | |
| | | | |
| /** \brief Disconnect from INDI server. | | /** \brief Disconnect from INDI server. | |
| | | | |
| Disconnects from INDI servers. Any devices previously created will
be deleted and memory cleared. | | Disconnects from INDI servers. Any devices previously created will
be deleted and memory cleared. | |
|
| | | \return True if disconnection is successful, false otherwise. | |
| */ | | */ | |
|
| void disconnectServer(); | | bool disconnectServer(); | |
| | | | |
| /** \brief Connect/Disconnect to INDI driver | | /** \brief Connect/Disconnect to INDI driver | |
| \param status If true, the client will attempt to turn on CONNECTIO
N property within the driver (i.e. turn on the device). | | \param status If true, the client will attempt to turn on CONNECTIO
N property within the driver (i.e. turn on the device). | |
| Otherwise, CONNECTION will be turned off. | | Otherwise, CONNECTION will be turned off. | |
| \param deviceName Name of the device to connect to. | | \param deviceName Name of the device to connect to. | |
| */ | | */ | |
| 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<INDI::BaseDriver *> & getDrivers() const { return cDevices
; } | | const vector<devicePtr> & 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> | |
| | | | |
| If \e dev and \e prop are supplied, then the BLOB handling policy is
set for this particular device and property. | | If \e dev and \e prop are supplied, then the BLOB handling policy is
set for this particular device and property. | |
| if \e prop is NULL, then the BLOB policy applies to the whole device. | | if \e prop is NULL, then the BLOB policy applies to the whole device. | |
|
| if \e dev is NULL, then the BLOB policy applies to all devices owned
by INDI server. | | | |
| | | | |
| \param blobH BLOB handling policy | | \param blobH BLOB handling policy | |
|
| \param dev name of device | | \param dev name of device, required. | |
| \param prop name of property | | \param prop name of property, optional. | |
| */ | | */ | |
|
| void setBLOBMode(BLOBHandling blobH, const char *dev = NULL, const char
*prop = NULL); | | void setBLOBMode(BLOBHandling blobH, const char *dev, const char *prop
= NULL); | |
| | | | |
| // Update | | // Update | |
| static void * listenHelper(void *context); | | static void * listenHelper(void *context); | |
| | | | |
| protected: | | protected: | |
| | | | |
| /** \brief Dispatch command received from INDI server to respective dev
ices handled by the client */ | | /** \brief Dispatch command received from INDI server to respective dev
ices handled by the client */ | |
| int dispatchCommand(XMLEle *root, char* errmsg); | | int dispatchCommand(XMLEle *root, char* errmsg); | |
| | | | |
| /** \brief Remove device */ | | /** \brief Remove device */ | |
| | | | |
| skipping to change at line 150 | | skipping to change at line 152 | |
| 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<INDI::BaseDriver *> cDevices; | | vector<devicePtr> cDevices; | |
| vector<string> cDeviceNames; | | vector<string> cDeviceNames; | |
| | | | |
| string cServer; | | string cServer; | |
| unsigned int cPort; | | unsigned int cPort; | |
|
| | | 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 */ | |
|
| FILE *svrrfp; /* FILE * to read from server */ | | | |
| | | | |
| }; | | }; | |
| | | | |
| #endif // INDIBASECLIENT_H | | #endif // INDIBASECLIENT_H | |
| | | | |
End of changes. 12 change blocks. |
| 9 lines changed or deleted | | 11 lines changed or added | |
|
| basedriver.h | | basedriver.h | |
| #ifndef INDIBASEDRIVER_H | | #ifndef INDIBASEDRIVER_H | |
| #define INDIBASEDRIVER_H | | #define INDIBASEDRIVER_H | |
| | | | |
|
| #include <vector> | | #include <boost/shared_ptr.hpp> | |
| #include <map> | | #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 | |
| | | | |
| /** | | /** | |
| | | | |
| skipping to change at line 28 | | skipping to change at line 28 | |
| 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 | |
| */ | | */ | |
| class INDI::BaseDriver | | class INDI::BaseDriver | |
| { | | { | |
| public: | | public: | |
| BaseDriver(); | | BaseDriver(); | |
|
| virtual ~BaseDriver(); | | ~BaseDriver(); | |
| | | | |
| /*! 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 */ | | /*! INDI property type */ | |
|
| enum INDI_TYPE | | typedef enum | |
| { | | { | |
| INDI_NUMBER, /*!< INumberVectorProperty. */ | | INDI_NUMBER, /*!< INumberVectorProperty. */ | |
| INDI_SWITCH, /*!< ISwitchVectorProperty. */ | | INDI_SWITCH, /*!< ISwitchVectorProperty. */ | |
| INDI_TEXT, /*!< ITextVectorProperty. */ | | INDI_TEXT, /*!< ITextVectorProperty. */ | |
| INDI_LIGHT, /*!< ILightVectorProperty. */ | | INDI_LIGHT, /*!< ILightVectorProperty. */ | |
|
| INDI_BLOB /*!< IBLOBVectorProperty. */ | | 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); | |
| | | | |
| /** \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); | | void * getProperty(const char *name, INDI_TYPE type = 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 | |
| | | | |
| */ | | */ | |
| void buildSkeleton(const char *filename); | | void buildSkeleton(const char *filename); | |
| | | | |
| /** \return True if the device is connected (CONNECT=ON), False otherwi
se */ | | /** \return True if the device is connected (CONNECT=ON), False otherwi
se */ | |
| bool isConnected(); | | bool isConnected(); | |
| | | | |
| /** \brief Set the device name | | /** \brief Set the device name | |
| \param dev new device name | | \param dev new device name | |
| */ | | */ | |
| void setDeviceName(const char *dev); | | void setDeviceName(const char *dev); | |
|
| | | | |
| /** \return Returns the device name */ | | /** \return Returns the device name */ | |
| const char *deviceName(); | | const char *deviceName(); | |
| | | | |
| /** \brief Add message to the driver's message queue. | | /** \brief Add message to the driver's message queue. | |
| \param msg Message to add. | | \param msg Message to add. | |
| */ | | */ | |
| void addMessage(const char *msg); | | void addMessage(const char *msg); | |
|
| //** \returns Returns the contents of the driver's message queue. *; | | | |
| | | /** \return Returns the contents of the driver's message queue. */ | |
| const char *message() { return messageQueue.c_str(); } | | const char *message() { return messageQueue.c_str(); } | |
| | | | |
| /** \brief Set the driver's mediator to receive notification of news de
vices and updated property values. */ | | /** \brief Set the driver's mediator to receive notification of news de
vices and updated property values. */ | |
| void setMediator(INDI::BaseMediator *med) { mediator = med; } | | void setMediator(INDI::BaseMediator *med) { mediator = med; } | |
|
| | | | |
| /** \returns Get the meditator assigned to this driver */ | | /** \returns Get the meditator assigned to this driver */ | |
| INDI::BaseMediator * getMediator() { return mediator; } | | INDI::BaseMediator * getMediator() { return mediator; } | |
| | | | |
| protected: | | protected: | |
| | | | |
| /** \brief Build a property given the supplied XML element (defXXX) | | /** \brief Build a property given the supplied XML element (defXXX) | |
| \param root XML element to parse and build. | | \param root XML element to parse and build. | |
| \param errmsg buffer to store error message in parsing fails. | | \param errmsg buffer to store error message in parsing fails. | |
|
| | | | |
| \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]; | | 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: | |
| | | | |
|
| typedef struct | | std::map< boost::shared_ptr<void>, INDI_TYPE> pAll; | |
| { | | | |
| INDI_TYPE type; | | | |
| void *p; | | | |
| } pOrder; | | | |
| | | | |
| std::vector<INumberVectorProperty *> pNumbers; | | | |
| std::vector<ITextVectorProperty *> pTexts; | | | |
| std::vector<ISwitchVectorProperty *> pSwitches; | | | |
| std::vector<ILightVectorProperty *> pLights; | | | |
| std::vector<IBLOBVectorProperty *> pBlobs; | | | |
| | | | |
| LilXML *lp; | | LilXML *lp; | |
| | | | |
|
| std::vector<pOrder> pAll; | | | |
| | | | |
| 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; | |
| | | | |
| }; | | }; | |
| | | | |
| #endif // INDIBASEDRIVER_H | | #endif // INDIBASEDRIVER_H | |
| | | | |
End of changes. 13 change blocks. |
| 21 lines changed or deleted | | 20 lines changed or added | |
|
| defaultdriver.h | | defaultdriver.h | |
| | | | |
| skipping to change at line 40 | | skipping to change at line 40 | |
| | | | |
| /** \brief Add Simulation control to the driver */ | | /** \brief Add Simulation control to the driver */ | |
| void addSimulationControl(); | | void addSimulationControl(); | |
| | | | |
| /** \brief Add Configuration control to the driver */ | | /** \brief Add Configuration control to the driver */ | |
| void addConfigurationControl(); | | void addConfigurationControl(); | |
| | | | |
| /** \brief Set all properties to IDLE state */ | | /** \brief Set all properties to IDLE state */ | |
| void resetProperties(); | | void resetProperties(); | |
| | | | |
|
| | | /** \brief 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 confi | |
| | | guration files. | |
| | | \param nvp The number vector property to be defined | |
| | | */ | |
| | | void defineNumber(INumberVectorProperty *nvp); | |
| | | | |
| | | /** \brief Define text vector to client & register it. Alternatively, I | |
| | | DDefText can be used but the property will not | |
| | | get registered and the driver will not be able to save confi | |
| | | guration files. | |
| | | \param tvp The text vector property to be defined | |
| | | */ | |
| | | void defineText(ITextVectorProperty *tvp); | |
| | | | |
| | | /** \brief 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 confi | |
| | | guration files. | |
| | | \param svp The switch vector property to be defined | |
| | | */ | |
| | | void defineSwitch(ISwitchVectorProperty *svp); | |
| | | | |
| | | /** \brief 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 confi | |
| | | guration files. | |
| | | \param lvp The light vector property to be defined | |
| | | */ | |
| | | void defineLight(ILightVectorProperty *lvp); | |
| | | | |
| | | /** \brief Define BLOB vector to client & register it. Alternatively, I | |
| | | DDefBLOB can be used but the property will not | |
| | | get registered and the driver will not be able to save confi | |
| | | guration files. | |
| | | \param bvp The BLOB vector property to be defined | |
| | | */ | |
| | | void defineBLOB(IBLOBVectorProperty *bvp); | |
| | | | |
| | | /** \brief Delete a property and unregister it. It will also be deleted | |
| | | from all clients. | |
| | | \param propertyName name of property to be deleted. | |
| | | */ | |
| | | virtual bool deleteProperty(const char *propertyName); | |
| | | | |
| /** \brief Connect or Disconnect a device. | | /** \brief Connect or Disconnect a device. | |
| \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 msg A message to be sent along with connect/disconnect command
. | |
| */ | | */ | |
|
| virtual void setConnected(bool status, const char *msg = NULL); | | virtual void setConnected(bool status, IPState state=IPS_OK, const char | |
| | | *msg = NULL); | |
| | | | |
| | | int SetTimer(int); | |
| | | void RemoveTimer(int); | |
| | | 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); | |
| | | | |
| /** \brief Process the client newSwitch command | | /** \brief Process the client newSwitch command | |
| | | | |
| skipping to change at line 114 | | skipping to change at line 153 | |
| \param enable If true, the Simulation option is set to ON. | | \param enable If true, the Simulation option is set to ON. | |
| */ | | */ | |
| void setSimulation(bool enable); | | void setSimulation(bool enable); | |
| | | | |
| /** \return True if Debug is on, False otherwise. */ | | /** \return True if Debug is on, False otherwise. */ | |
| bool isDebug(); | | bool isDebug(); | |
| | | | |
| /** \return True if Simulation is on, False otherwise. */ | | /** \return True if Simulation is on, False otherwise. */ | |
| bool isSimulation(); | | bool isSimulation(); | |
| | | | |
|
| | | // These are the properties we define, that are generic to pretty much | |
| | | all devices | |
| | | // They are public to make them available to all dervied classes and t | |
| | | hier children | |
| | | ISwitchVectorProperty *ConnectionSP; | |
| | | ISwitch ConnectionS[2]; | |
| | | | |
| | | /** \brief Initilize properties initial state and value. The child clas | |
| | | s must implement this function. | |
| | | \return True if initilization is successful, false otherwise. | |
| | | */ | |
| | | virtual bool initProperties(); | |
| | | | |
| | | /** \brief updateProperties is called whenever there is a change in the | |
| | | CONNECTION status of the driver. | |
| | | This will enable the driver to react to changes of switching ON/OFF | |
| | | a device. For example, a driver | |
| | | may only define a set of properties after a device is connected, bu | |
| | | t not before. | |
| | | \return True if update is successful, false otherwise. | |
| | | */ | |
| | | virtual bool updateProperties(); | |
| | | | |
| | | /** \brief Connect to a device. Child classes must implement this funct | |
| | | ion and perform the connection | |
| | | routine in the function. | |
| | | \return True if connection to device is successful, false otherwise | |
| | | . | |
| | | */ | |
| | | virtual bool Connect()=0; | |
| | | | |
| | | /** \brief Disconnect from a device. Child classes must implement this | |
| | | function and perform the disconnection | |
| | | routine in the function. | |
| | | \return True if disconnection from a device is successful, false ot | |
| | | herwise. | |
| | | */ | |
| | | virtual bool Disconnect()=0; | |
| | | | |
| | | /** \return Default name of the device. */ | |
| | | virtual const char *getDefaultName()=0; | |
| | | | |
| private: | | private: | |
| | | | |
| bool pDebug; | | bool pDebug; | |
| bool pSimulation; | | bool pSimulation; | |
| | | | |
| ISwitch DebugS[2]; | | ISwitch DebugS[2]; | |
| ISwitch SimulationS[2]; | | ISwitch SimulationS[2]; | |
| ISwitch ConfigProcessS[3]; | | ISwitch ConfigProcessS[3]; | |
| | | | |
| ISwitchVectorProperty *DebugSP; | | ISwitchVectorProperty *DebugSP; | |
| | | | |
End of changes. 3 change blocks. |
| 1 lines changed or deleted | | 94 lines changed or added | |
|